Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _LINUX_TTY_H
0003 #define _LINUX_TTY_H
0004 
0005 #include <linux/fs.h>
0006 #include <linux/major.h>
0007 #include <linux/termios.h>
0008 #include <linux/workqueue.h>
0009 #include <linux/tty_buffer.h>
0010 #include <linux/tty_driver.h>
0011 #include <linux/tty_ldisc.h>
0012 #include <linux/tty_port.h>
0013 #include <linux/mutex.h>
0014 #include <linux/tty_flags.h>
0015 #include <uapi/linux/tty.h>
0016 #include <linux/rwsem.h>
0017 #include <linux/llist.h>
0018 
0019 
0020 /*
0021  * (Note: the *_driver.minor_start values 1, 64, 128, 192 are
0022  * hardcoded at present.)
0023  */
0024 #define NR_UNIX98_PTY_DEFAULT   4096      /* Default maximum for Unix98 ptys */
0025 #define NR_UNIX98_PTY_RESERVE   1024      /* Default reserve for main devpts */
0026 #define NR_UNIX98_PTY_MAX   (1 << MINORBITS) /* Absolute limit */
0027 
0028 /*
0029  * This character is the same as _POSIX_VDISABLE: it cannot be used as
0030  * a c_cc[] character, but indicates that a particular special character
0031  * isn't in use (eg VINTR has no character etc)
0032  */
0033 #define __DISABLED_CHAR '\0'
0034 
0035 #define INTR_CHAR(tty) ((tty)->termios.c_cc[VINTR])
0036 #define QUIT_CHAR(tty) ((tty)->termios.c_cc[VQUIT])
0037 #define ERASE_CHAR(tty) ((tty)->termios.c_cc[VERASE])
0038 #define KILL_CHAR(tty) ((tty)->termios.c_cc[VKILL])
0039 #define EOF_CHAR(tty) ((tty)->termios.c_cc[VEOF])
0040 #define TIME_CHAR(tty) ((tty)->termios.c_cc[VTIME])
0041 #define MIN_CHAR(tty) ((tty)->termios.c_cc[VMIN])
0042 #define SWTC_CHAR(tty) ((tty)->termios.c_cc[VSWTC])
0043 #define START_CHAR(tty) ((tty)->termios.c_cc[VSTART])
0044 #define STOP_CHAR(tty) ((tty)->termios.c_cc[VSTOP])
0045 #define SUSP_CHAR(tty) ((tty)->termios.c_cc[VSUSP])
0046 #define EOL_CHAR(tty) ((tty)->termios.c_cc[VEOL])
0047 #define REPRINT_CHAR(tty) ((tty)->termios.c_cc[VREPRINT])
0048 #define DISCARD_CHAR(tty) ((tty)->termios.c_cc[VDISCARD])
0049 #define WERASE_CHAR(tty) ((tty)->termios.c_cc[VWERASE])
0050 #define LNEXT_CHAR(tty) ((tty)->termios.c_cc[VLNEXT])
0051 #define EOL2_CHAR(tty) ((tty)->termios.c_cc[VEOL2])
0052 
0053 #define _I_FLAG(tty, f) ((tty)->termios.c_iflag & (f))
0054 #define _O_FLAG(tty, f) ((tty)->termios.c_oflag & (f))
0055 #define _C_FLAG(tty, f) ((tty)->termios.c_cflag & (f))
0056 #define _L_FLAG(tty, f) ((tty)->termios.c_lflag & (f))
0057 
0058 #define I_IGNBRK(tty)   _I_FLAG((tty), IGNBRK)
0059 #define I_BRKINT(tty)   _I_FLAG((tty), BRKINT)
0060 #define I_IGNPAR(tty)   _I_FLAG((tty), IGNPAR)
0061 #define I_PARMRK(tty)   _I_FLAG((tty), PARMRK)
0062 #define I_INPCK(tty)    _I_FLAG((tty), INPCK)
0063 #define I_ISTRIP(tty)   _I_FLAG((tty), ISTRIP)
0064 #define I_INLCR(tty)    _I_FLAG((tty), INLCR)
0065 #define I_IGNCR(tty)    _I_FLAG((tty), IGNCR)
0066 #define I_ICRNL(tty)    _I_FLAG((tty), ICRNL)
0067 #define I_IUCLC(tty)    _I_FLAG((tty), IUCLC)
0068 #define I_IXON(tty) _I_FLAG((tty), IXON)
0069 #define I_IXANY(tty)    _I_FLAG((tty), IXANY)
0070 #define I_IXOFF(tty)    _I_FLAG((tty), IXOFF)
0071 #define I_IMAXBEL(tty)  _I_FLAG((tty), IMAXBEL)
0072 #define I_IUTF8(tty)    _I_FLAG((tty), IUTF8)
0073 
0074 #define O_OPOST(tty)    _O_FLAG((tty), OPOST)
0075 #define O_OLCUC(tty)    _O_FLAG((tty), OLCUC)
0076 #define O_ONLCR(tty)    _O_FLAG((tty), ONLCR)
0077 #define O_OCRNL(tty)    _O_FLAG((tty), OCRNL)
0078 #define O_ONOCR(tty)    _O_FLAG((tty), ONOCR)
0079 #define O_ONLRET(tty)   _O_FLAG((tty), ONLRET)
0080 #define O_OFILL(tty)    _O_FLAG((tty), OFILL)
0081 #define O_OFDEL(tty)    _O_FLAG((tty), OFDEL)
0082 #define O_NLDLY(tty)    _O_FLAG((tty), NLDLY)
0083 #define O_CRDLY(tty)    _O_FLAG((tty), CRDLY)
0084 #define O_TABDLY(tty)   _O_FLAG((tty), TABDLY)
0085 #define O_BSDLY(tty)    _O_FLAG((tty), BSDLY)
0086 #define O_VTDLY(tty)    _O_FLAG((tty), VTDLY)
0087 #define O_FFDLY(tty)    _O_FLAG((tty), FFDLY)
0088 
0089 #define C_BAUD(tty) _C_FLAG((tty), CBAUD)
0090 #define C_CSIZE(tty)    _C_FLAG((tty), CSIZE)
0091 #define C_CSTOPB(tty)   _C_FLAG((tty), CSTOPB)
0092 #define C_CREAD(tty)    _C_FLAG((tty), CREAD)
0093 #define C_PARENB(tty)   _C_FLAG((tty), PARENB)
0094 #define C_PARODD(tty)   _C_FLAG((tty), PARODD)
0095 #define C_HUPCL(tty)    _C_FLAG((tty), HUPCL)
0096 #define C_CLOCAL(tty)   _C_FLAG((tty), CLOCAL)
0097 #define C_CIBAUD(tty)   _C_FLAG((tty), CIBAUD)
0098 #define C_CRTSCTS(tty)  _C_FLAG((tty), CRTSCTS)
0099 #define C_CMSPAR(tty)   _C_FLAG((tty), CMSPAR)
0100 
0101 #define L_ISIG(tty) _L_FLAG((tty), ISIG)
0102 #define L_ICANON(tty)   _L_FLAG((tty), ICANON)
0103 #define L_XCASE(tty)    _L_FLAG((tty), XCASE)
0104 #define L_ECHO(tty) _L_FLAG((tty), ECHO)
0105 #define L_ECHOE(tty)    _L_FLAG((tty), ECHOE)
0106 #define L_ECHOK(tty)    _L_FLAG((tty), ECHOK)
0107 #define L_ECHONL(tty)   _L_FLAG((tty), ECHONL)
0108 #define L_NOFLSH(tty)   _L_FLAG((tty), NOFLSH)
0109 #define L_TOSTOP(tty)   _L_FLAG((tty), TOSTOP)
0110 #define L_ECHOCTL(tty)  _L_FLAG((tty), ECHOCTL)
0111 #define L_ECHOPRT(tty)  _L_FLAG((tty), ECHOPRT)
0112 #define L_ECHOKE(tty)   _L_FLAG((tty), ECHOKE)
0113 #define L_FLUSHO(tty)   _L_FLAG((tty), FLUSHO)
0114 #define L_PENDIN(tty)   _L_FLAG((tty), PENDIN)
0115 #define L_IEXTEN(tty)   _L_FLAG((tty), IEXTEN)
0116 #define L_EXTPROC(tty)  _L_FLAG((tty), EXTPROC)
0117 
0118 struct device;
0119 struct signal_struct;
0120 struct tty_operations;
0121 
0122 /**
0123  * struct tty_struct - state associated with a tty while open
0124  *
0125  * @magic: magic value set early in @alloc_tty_struct to %TTY_MAGIC, for
0126  *     debugging purposes
0127  * @kref: reference counting by tty_kref_get() and tty_kref_put(), reaching zero
0128  *    frees the structure
0129  * @dev: class device or %NULL (e.g. ptys, serdev)
0130  * @driver: &struct tty_driver operating this tty
0131  * @ops: &struct tty_operations of @driver for this tty (open, close, etc.)
0132  * @index: index of this tty (e.g. to construct @name like tty12)
0133  * @ldisc_sem: protects line discipline changes (@ldisc) -- lock tty not pty
0134  * @ldisc: the current line discipline for this tty (n_tty by default)
0135  * @atomic_write_lock: protects against concurrent writers, i.e. locks
0136  *             @write_cnt, @write_buf and similar
0137  * @legacy_mutex: leftover from history (BKL -> BTM -> @legacy_mutex),
0138  *        protecting several operations on this tty
0139  * @throttle_mutex: protects against concurrent tty_throttle_safe() and
0140  *          tty_unthrottle_safe() (but not tty_unthrottle())
0141  * @termios_rwsem: protects @termios and @termios_locked
0142  * @winsize_mutex: protects @winsize
0143  * @termios: termios for the current tty, copied from/to @driver.termios
0144  * @termios_locked: locked termios (by %TIOCGLCKTRMIOS and %TIOCSLCKTRMIOS
0145  *          ioctls)
0146  * @name: name of the tty constructed by tty_line_name() (e.g. ttyS3)
0147  * @flags: bitwise OR of %TTY_THROTTLED, %TTY_IO_ERROR, ...
0148  * @count: count of open processes, reaching zero cancels all the work for
0149  *     this tty and drops a @kref too (but does not free this tty)
0150  * @winsize: size of the terminal "window" (cf. @winsize_mutex)
0151  * @flow: flow settings grouped together, see also @flow.unused
0152  * @flow.lock: lock for @flow members
0153  * @flow.stopped: tty stopped/started by stop_tty()/start_tty()
0154  * @flow.tco_stopped: tty stopped/started by %TCOOFF/%TCOON ioctls (it has
0155  *            precedence over @flow.stopped)
0156  * @flow.unused: alignment for Alpha, so that no members other than @flow.* are
0157  *       modified by the same 64b word store. The @flow's __aligned is
0158  *       there for the very same reason.
0159  * @ctrl: control settings grouped together, see also @ctrl.unused
0160  * @ctrl.lock: lock for @ctrl members
0161  * @ctrl.pgrp: process group of this tty (setpgrp(2))
0162  * @ctrl.session: session of this tty (setsid(2)). Writes are protected by both
0163  *        @ctrl.lock and @legacy_mutex, readers must use at least one of
0164  *        them.
0165  * @ctrl.pktstatus: packet mode status (bitwise OR of %TIOCPKT_ constants)
0166  * @ctrl.packet: packet mode enabled
0167  * @ctrl.unused: alignment for Alpha, see @flow.unused for explanation
0168  * @hw_stopped: not controlled by the tty layer, under @driver's control for CTS
0169  *      handling
0170  * @receive_room: bytes permitted to feed to @ldisc without any being lost
0171  * @flow_change: controls behavior of throttling, see tty_throttle_safe() and
0172  *       tty_unthrottle_safe()
0173  * @link: link to another pty (master -> slave and vice versa)
0174  * @fasync: state for %O_ASYNC (for %SIGIO); managed by fasync_helper()
0175  * @write_wait: concurrent writers are waiting in this queue until they are
0176  *      allowed to write
0177  * @read_wait: readers wait for data in this queue
0178  * @hangup_work: normally a work to perform a hangup (do_tty_hangup()); while
0179  *       freeing the tty, (re)used to release_one_tty()
0180  * @disc_data: pointer to @ldisc's private data (e.g. to &struct n_tty_data)
0181  * @driver_data: pointer to @driver's private data (e.g. &struct uart_state)
0182  * @files_lock: protects @tty_files list
0183  * @tty_files: list of (re)openers of this tty (i.e. linked &struct
0184  *         tty_file_private)
0185  * @closing: when set during close, n_tty processes only START & STOP chars
0186  * @write_buf: temporary buffer used during tty_write() to copy user data to
0187  * @write_cnt: count of bytes written in tty_write() to @write_buf
0188  * @SAK_work: if the tty has a pending do_SAK, it is queued here
0189  * @port: persistent storage for this device (i.e. &struct tty_port)
0190  *
0191  * All of the state associated with a tty while the tty is open. Persistent
0192  * storage for tty devices is referenced here as @port and is documented in
0193  * &struct tty_port.
0194  */
0195 struct tty_struct {
0196     int magic;
0197     struct kref kref;
0198     struct device *dev;
0199     struct tty_driver *driver;
0200     const struct tty_operations *ops;
0201     int index;
0202 
0203     struct ld_semaphore ldisc_sem;
0204     struct tty_ldisc *ldisc;
0205 
0206     struct mutex atomic_write_lock;
0207     struct mutex legacy_mutex;
0208     struct mutex throttle_mutex;
0209     struct rw_semaphore termios_rwsem;
0210     struct mutex winsize_mutex;
0211     struct ktermios termios, termios_locked;
0212     char name[64];
0213     unsigned long flags;
0214     int count;
0215     struct winsize winsize;
0216 
0217     struct {
0218         spinlock_t lock;
0219         bool stopped;
0220         bool tco_stopped;
0221         unsigned long unused[0];
0222     } __aligned(sizeof(unsigned long)) flow;
0223 
0224     struct {
0225         spinlock_t lock;
0226         struct pid *pgrp;
0227         struct pid *session;
0228         unsigned char pktstatus;
0229         bool packet;
0230         unsigned long unused[0];
0231     } __aligned(sizeof(unsigned long)) ctrl;
0232 
0233     int hw_stopped;
0234     unsigned int receive_room;
0235     int flow_change;
0236 
0237     struct tty_struct *link;
0238     struct fasync_struct *fasync;
0239     wait_queue_head_t write_wait;
0240     wait_queue_head_t read_wait;
0241     struct work_struct hangup_work;
0242     void *disc_data;
0243     void *driver_data;
0244     spinlock_t files_lock;
0245     struct list_head tty_files;
0246 
0247 #define N_TTY_BUF_SIZE 4096
0248 
0249     int closing;
0250     unsigned char *write_buf;
0251     int write_cnt;
0252     struct work_struct SAK_work;
0253     struct tty_port *port;
0254 } __randomize_layout;
0255 
0256 /* Each of a tty's open files has private_data pointing to tty_file_private */
0257 struct tty_file_private {
0258     struct tty_struct *tty;
0259     struct file *file;
0260     struct list_head list;
0261 };
0262 
0263 /* tty magic number */
0264 #define TTY_MAGIC       0x5401
0265 
0266 /**
0267  * DOC: TTY Struct Flags
0268  *
0269  * These bits are used in the :c:member:`tty_struct.flags` field.
0270  *
0271  * So that interrupts won't be able to mess up the queues,
0272  * copy_to_cooked must be atomic with respect to itself, as must
0273  * tty->write.  Thus, you must use the inline functions set_bit() and
0274  * clear_bit() to make things atomic.
0275  *
0276  * TTY_THROTTLED
0277  *  Driver input is throttled. The ldisc should call
0278  *  :c:member:`tty_driver.unthrottle()` in order to resume reception when
0279  *  it is ready to process more data (at threshold min).
0280  *
0281  * TTY_IO_ERROR
0282  *  If set, causes all subsequent userspace read/write calls on the tty to
0283  *  fail, returning -%EIO. (May be no ldisc too.)
0284  *
0285  * TTY_OTHER_CLOSED
0286  *  Device is a pty and the other side has closed.
0287  *
0288  * TTY_EXCLUSIVE
0289  *  Exclusive open mode (a single opener).
0290  *
0291  * TTY_DO_WRITE_WAKEUP
0292  *  If set, causes the driver to call the
0293  *  :c:member:`tty_ldisc_ops.write_wakeup()` method in order to resume
0294  *  transmission when it can accept more data to transmit.
0295  *
0296  * TTY_LDISC_OPEN
0297  *  Indicates that a line discipline is open. For debugging purposes only.
0298  *
0299  * TTY_PTY_LOCK
0300  *  A flag private to pty code to implement %TIOCSPTLCK/%TIOCGPTLCK logic.
0301  *
0302  * TTY_NO_WRITE_SPLIT
0303  *  Prevent driver from splitting up writes into smaller chunks (preserve
0304  *  write boundaries to driver).
0305  *
0306  * TTY_HUPPED
0307  *  The TTY was hung up. This is set post :c:member:`tty_driver.hangup()`.
0308  *
0309  * TTY_HUPPING
0310  *  The TTY is in the process of hanging up to abort potential readers.
0311  *
0312  * TTY_LDISC_CHANGING
0313  *  Line discipline for this TTY is being changed. I/O should not block
0314  *  when this is set. Use tty_io_nonblock() to check.
0315  *
0316  * TTY_LDISC_HALTED
0317  *  Line discipline for this TTY was stopped. No work should be queued to
0318  *  this ldisc.
0319  */
0320 #define TTY_THROTTLED       0
0321 #define TTY_IO_ERROR        1
0322 #define TTY_OTHER_CLOSED    2
0323 #define TTY_EXCLUSIVE       3
0324 #define TTY_DO_WRITE_WAKEUP 5
0325 #define TTY_LDISC_OPEN      11
0326 #define TTY_PTY_LOCK        16
0327 #define TTY_NO_WRITE_SPLIT  17
0328 #define TTY_HUPPED      18
0329 #define TTY_HUPPING     19
0330 #define TTY_LDISC_CHANGING  20
0331 #define TTY_LDISC_HALTED    22
0332 
0333 static inline bool tty_io_nonblock(struct tty_struct *tty, struct file *file)
0334 {
0335     return file->f_flags & O_NONBLOCK ||
0336         test_bit(TTY_LDISC_CHANGING, &tty->flags);
0337 }
0338 
0339 static inline bool tty_io_error(struct tty_struct *tty)
0340 {
0341     return test_bit(TTY_IO_ERROR, &tty->flags);
0342 }
0343 
0344 static inline bool tty_throttled(struct tty_struct *tty)
0345 {
0346     return test_bit(TTY_THROTTLED, &tty->flags);
0347 }
0348 
0349 #ifdef CONFIG_TTY
0350 void tty_kref_put(struct tty_struct *tty);
0351 struct pid *tty_get_pgrp(struct tty_struct *tty);
0352 void tty_vhangup_self(void);
0353 void disassociate_ctty(int priv);
0354 dev_t tty_devnum(struct tty_struct *tty);
0355 void proc_clear_tty(struct task_struct *p);
0356 struct tty_struct *get_current_tty(void);
0357 /* tty_io.c */
0358 int __init tty_init(void);
0359 const char *tty_name(const struct tty_struct *tty);
0360 struct tty_struct *tty_kopen_exclusive(dev_t device);
0361 struct tty_struct *tty_kopen_shared(dev_t device);
0362 void tty_kclose(struct tty_struct *tty);
0363 int tty_dev_name_to_number(const char *name, dev_t *number);
0364 #else
0365 static inline void tty_kref_put(struct tty_struct *tty)
0366 { }
0367 static inline struct pid *tty_get_pgrp(struct tty_struct *tty)
0368 { return NULL; }
0369 static inline void tty_vhangup_self(void)
0370 { }
0371 static inline void disassociate_ctty(int priv)
0372 { }
0373 static inline dev_t tty_devnum(struct tty_struct *tty)
0374 { return 0; }
0375 static inline void proc_clear_tty(struct task_struct *p)
0376 { }
0377 static inline struct tty_struct *get_current_tty(void)
0378 { return NULL; }
0379 /* tty_io.c */
0380 static inline int __init tty_init(void)
0381 { return 0; }
0382 static inline const char *tty_name(const struct tty_struct *tty)
0383 { return "(none)"; }
0384 static inline struct tty_struct *tty_kopen_exclusive(dev_t device)
0385 { return ERR_PTR(-ENODEV); }
0386 static inline void tty_kclose(struct tty_struct *tty)
0387 { }
0388 static inline int tty_dev_name_to_number(const char *name, dev_t *number)
0389 { return -ENOTSUPP; }
0390 #endif
0391 
0392 extern struct ktermios tty_std_termios;
0393 
0394 int vcs_init(void);
0395 
0396 extern struct class *tty_class;
0397 
0398 /**
0399  *  tty_kref_get        -   get a tty reference
0400  *  @tty: tty device
0401  *
0402  *  Return a new reference to a tty object. The caller must hold
0403  *  sufficient locks/counts to ensure that their existing reference cannot
0404  *  go away
0405  */
0406 
0407 static inline struct tty_struct *tty_kref_get(struct tty_struct *tty)
0408 {
0409     if (tty)
0410         kref_get(&tty->kref);
0411     return tty;
0412 }
0413 
0414 const char *tty_driver_name(const struct tty_struct *tty);
0415 void tty_wait_until_sent(struct tty_struct *tty, long timeout);
0416 void stop_tty(struct tty_struct *tty);
0417 void start_tty(struct tty_struct *tty);
0418 void tty_write_message(struct tty_struct *tty, char *msg);
0419 int tty_send_xchar(struct tty_struct *tty, char ch);
0420 int tty_put_char(struct tty_struct *tty, unsigned char c);
0421 unsigned int tty_chars_in_buffer(struct tty_struct *tty);
0422 unsigned int tty_write_room(struct tty_struct *tty);
0423 void tty_driver_flush_buffer(struct tty_struct *tty);
0424 void tty_unthrottle(struct tty_struct *tty);
0425 int tty_throttle_safe(struct tty_struct *tty);
0426 int tty_unthrottle_safe(struct tty_struct *tty);
0427 int tty_do_resize(struct tty_struct *tty, struct winsize *ws);
0428 int tty_get_icount(struct tty_struct *tty,
0429         struct serial_icounter_struct *icount);
0430 int is_current_pgrp_orphaned(void);
0431 void tty_hangup(struct tty_struct *tty);
0432 void tty_vhangup(struct tty_struct *tty);
0433 int tty_hung_up_p(struct file *filp);
0434 void do_SAK(struct tty_struct *tty);
0435 void __do_SAK(struct tty_struct *tty);
0436 void no_tty(void);
0437 speed_t tty_termios_baud_rate(struct ktermios *termios);
0438 void tty_termios_encode_baud_rate(struct ktermios *termios, speed_t ibaud,
0439         speed_t obaud);
0440 void tty_encode_baud_rate(struct tty_struct *tty, speed_t ibaud,
0441         speed_t obaud);
0442 
0443 /**
0444  *  tty_get_baud_rate   -   get tty bit rates
0445  *  @tty: tty to query
0446  *
0447  *  Returns the baud rate as an integer for this terminal. The
0448  *  termios lock must be held by the caller and the terminal bit
0449  *  flags may be updated.
0450  *
0451  *  Locking: none
0452  */
0453 static inline speed_t tty_get_baud_rate(struct tty_struct *tty)
0454 {
0455     return tty_termios_baud_rate(&tty->termios);
0456 }
0457 
0458 unsigned char tty_get_char_size(unsigned int cflag);
0459 unsigned char tty_get_frame_size(unsigned int cflag);
0460 
0461 void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old);
0462 int tty_termios_hw_change(const struct ktermios *a, const struct ktermios *b);
0463 int tty_set_termios(struct tty_struct *tty, struct ktermios *kt);
0464 
0465 void tty_wakeup(struct tty_struct *tty);
0466 
0467 int tty_mode_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg);
0468 int tty_perform_flush(struct tty_struct *tty, unsigned long arg);
0469 struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx);
0470 void tty_release_struct(struct tty_struct *tty, int idx);
0471 void tty_init_termios(struct tty_struct *tty);
0472 void tty_save_termios(struct tty_struct *tty);
0473 int tty_standard_install(struct tty_driver *driver,
0474         struct tty_struct *tty);
0475 
0476 extern struct mutex tty_mutex;
0477 
0478 /* n_tty.c */
0479 void n_tty_inherit_ops(struct tty_ldisc_ops *ops);
0480 #ifdef CONFIG_TTY
0481 void __init n_tty_init(void);
0482 #else
0483 static inline void n_tty_init(void) { }
0484 #endif
0485 
0486 /* tty_audit.c */
0487 #ifdef CONFIG_AUDIT
0488 void tty_audit_exit(void);
0489 void tty_audit_fork(struct signal_struct *sig);
0490 int tty_audit_push(void);
0491 #else
0492 static inline void tty_audit_exit(void)
0493 {
0494 }
0495 static inline void tty_audit_fork(struct signal_struct *sig)
0496 {
0497 }
0498 static inline int tty_audit_push(void)
0499 {
0500     return 0;
0501 }
0502 #endif
0503 
0504 /* tty_ioctl.c */
0505 int n_tty_ioctl_helper(struct tty_struct *tty, unsigned int cmd,
0506         unsigned long arg);
0507 
0508 /* vt.c */
0509 
0510 int vt_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg);
0511 
0512 long vt_compat_ioctl(struct tty_struct *tty, unsigned int cmd,
0513         unsigned long arg);
0514 
0515 /* tty_mutex.c */
0516 /* functions for preparation of BKL removal */
0517 void tty_lock(struct tty_struct *tty);
0518 int  tty_lock_interruptible(struct tty_struct *tty);
0519 void tty_unlock(struct tty_struct *tty);
0520 void tty_lock_slave(struct tty_struct *tty);
0521 void tty_unlock_slave(struct tty_struct *tty);
0522 void tty_set_lock_subclass(struct tty_struct *tty);
0523 
0524 #endif