Lines Matching refs:tty

14 #include <uapi/linux/tty.h>
34 #define INTR_CHAR(tty) ((tty)->termios.c_cc[VINTR])
35 #define QUIT_CHAR(tty) ((tty)->termios.c_cc[VQUIT])
36 #define ERASE_CHAR(tty) ((tty)->termios.c_cc[VERASE])
37 #define KILL_CHAR(tty) ((tty)->termios.c_cc[VKILL])
38 #define EOF_CHAR(tty) ((tty)->termios.c_cc[VEOF])
39 #define TIME_CHAR(tty) ((tty)->termios.c_cc[VTIME])
40 #define MIN_CHAR(tty) ((tty)->termios.c_cc[VMIN])
41 #define SWTC_CHAR(tty) ((tty)->termios.c_cc[VSWTC])
42 #define START_CHAR(tty) ((tty)->termios.c_cc[VSTART])
43 #define STOP_CHAR(tty) ((tty)->termios.c_cc[VSTOP])
44 #define SUSP_CHAR(tty) ((tty)->termios.c_cc[VSUSP])
45 #define EOL_CHAR(tty) ((tty)->termios.c_cc[VEOL])
46 #define REPRINT_CHAR(tty) ((tty)->termios.c_cc[VREPRINT])
47 #define DISCARD_CHAR(tty) ((tty)->termios.c_cc[VDISCARD])
48 #define WERASE_CHAR(tty) ((tty)->termios.c_cc[VWERASE])
49 #define LNEXT_CHAR(tty) ((tty)->termios.c_cc[VLNEXT])
50 #define EOL2_CHAR(tty) ((tty)->termios.c_cc[VEOL2])
52 #define _I_FLAG(tty, f) ((tty)->termios.c_iflag & (f))
53 #define _O_FLAG(tty, f) ((tty)->termios.c_oflag & (f))
54 #define _C_FLAG(tty, f) ((tty)->termios.c_cflag & (f))
55 #define _L_FLAG(tty, f) ((tty)->termios.c_lflag & (f))
57 #define I_IGNBRK(tty) _I_FLAG((tty), IGNBRK)
58 #define I_BRKINT(tty) _I_FLAG((tty), BRKINT)
59 #define I_IGNPAR(tty) _I_FLAG((tty), IGNPAR)
60 #define I_PARMRK(tty) _I_FLAG((tty), PARMRK)
61 #define I_INPCK(tty) _I_FLAG((tty), INPCK)
62 #define I_ISTRIP(tty) _I_FLAG((tty), ISTRIP)
63 #define I_INLCR(tty) _I_FLAG((tty), INLCR)
64 #define I_IGNCR(tty) _I_FLAG((tty), IGNCR)
65 #define I_ICRNL(tty) _I_FLAG((tty), ICRNL)
66 #define I_IUCLC(tty) _I_FLAG((tty), IUCLC)
67 #define I_IXON(tty) _I_FLAG((tty), IXON)
68 #define I_IXANY(tty) _I_FLAG((tty), IXANY)
69 #define I_IXOFF(tty) _I_FLAG((tty), IXOFF)
70 #define I_IMAXBEL(tty) _I_FLAG((tty), IMAXBEL)
71 #define I_IUTF8(tty) _I_FLAG((tty), IUTF8)
73 #define O_OPOST(tty) _O_FLAG((tty), OPOST)
74 #define O_OLCUC(tty) _O_FLAG((tty), OLCUC)
75 #define O_ONLCR(tty) _O_FLAG((tty), ONLCR)
76 #define O_OCRNL(tty) _O_FLAG((tty), OCRNL)
77 #define O_ONOCR(tty) _O_FLAG((tty), ONOCR)
78 #define O_ONLRET(tty) _O_FLAG((tty), ONLRET)
79 #define O_OFILL(tty) _O_FLAG((tty), OFILL)
80 #define O_OFDEL(tty) _O_FLAG((tty), OFDEL)
81 #define O_NLDLY(tty) _O_FLAG((tty), NLDLY)
82 #define O_CRDLY(tty) _O_FLAG((tty), CRDLY)
83 #define O_TABDLY(tty) _O_FLAG((tty), TABDLY)
84 #define O_BSDLY(tty) _O_FLAG((tty), BSDLY)
85 #define O_VTDLY(tty) _O_FLAG((tty), VTDLY)
86 #define O_FFDLY(tty) _O_FLAG((tty), FFDLY)
88 #define C_BAUD(tty) _C_FLAG((tty), CBAUD)
89 #define C_CSIZE(tty) _C_FLAG((tty), CSIZE)
90 #define C_CSTOPB(tty) _C_FLAG((tty), CSTOPB)
91 #define C_CREAD(tty) _C_FLAG((tty), CREAD)
92 #define C_PARENB(tty) _C_FLAG((tty), PARENB)
93 #define C_PARODD(tty) _C_FLAG((tty), PARODD)
94 #define C_HUPCL(tty) _C_FLAG((tty), HUPCL)
95 #define C_CLOCAL(tty) _C_FLAG((tty), CLOCAL)
96 #define C_CIBAUD(tty) _C_FLAG((tty), CIBAUD)
97 #define C_CRTSCTS(tty) _C_FLAG((tty), CRTSCTS)
98 #define C_CMSPAR(tty) _C_FLAG((tty), CMSPAR)
100 #define L_ISIG(tty) _L_FLAG((tty), ISIG)
101 #define L_ICANON(tty) _L_FLAG((tty), ICANON)
102 #define L_XCASE(tty) _L_FLAG((tty), XCASE)
103 #define L_ECHO(tty) _L_FLAG((tty), ECHO)
104 #define L_ECHOE(tty) _L_FLAG((tty), ECHOE)
105 #define L_ECHOK(tty) _L_FLAG((tty), ECHOK)
106 #define L_ECHONL(tty) _L_FLAG((tty), ECHONL)
107 #define L_NOFLSH(tty) _L_FLAG((tty), NOFLSH)
108 #define L_TOSTOP(tty) _L_FLAG((tty), TOSTOP)
109 #define L_ECHOCTL(tty) _L_FLAG((tty), ECHOCTL)
110 #define L_ECHOPRT(tty) _L_FLAG((tty), ECHOPRT)
111 #define L_ECHOKE(tty) _L_FLAG((tty), ECHOKE)
112 #define L_FLUSHO(tty) _L_FLAG((tty), FLUSHO)
113 #define L_PENDIN(tty) _L_FLAG((tty), PENDIN)
114 #define L_IEXTEN(tty) _L_FLAG((tty), IEXTEN)
115 #define L_EXTPROC(tty) _L_FLAG((tty), EXTPROC)
122 * struct tty_struct - state associated with a tty while open
127 * @driver: &struct tty_driver operating this tty
128 * @ops: &struct tty_operations of @driver for this tty (open, close, etc.)
129 * @index: index of this tty (e.g. to construct @name like tty12)
130 * @ldisc_sem: protects line discipline changes (@ldisc) -- lock tty not pty
131 * @ldisc: the current line discipline for this tty (n_tty by default)
135 * protecting several operations on this tty
140 * @termios: termios for the current tty, copied from/to @driver.termios
143 * @name: name of the tty constructed by tty_line_name() (e.g. ttyS3)
146 * this tty and drops a @kref too (but does not free this tty)
150 * @flow.stopped: tty stopped/started by stop_tty()/start_tty()
151 * @flow.tco_stopped: tty stopped/started by %TCOOFF/%TCOON ioctls (it has
158 * @ctrl.pgrp: process group of this tty (setpgrp(2))
159 * @ctrl.session: session of this tty (setsid(2)). Writes are protected by both
165 * @hw_stopped: not controlled by the tty layer, under @driver's control for CTS
176 * freeing the tty, (re)used to release_one_tty()
180 * @tty_files: list of (re)openers of this tty (i.e. linked &struct
185 * @SAK_work: if the tty has a pending do_SAK, it is queued here
188 * All of the state associated with a tty while the tty is open. Persistent
189 * storage for tty devices is referenced here as @port and is documented in
252 /* Each of a tty's open files has private_data pointing to tty_file_private */
254 struct tty_struct *tty;
266 * tty->write. Thus, you must use the inline functions set_bit() and
275 * If set, causes all subsequent userspace read/write calls on the tty to
326 static inline bool tty_io_nonblock(struct tty_struct *tty, struct file *file)
329 test_bit(TTY_LDISC_CHANGING, &tty->flags);
332 static inline bool tty_io_error(struct tty_struct *tty)
334 return test_bit(TTY_IO_ERROR, &tty->flags);
337 static inline bool tty_throttled(struct tty_struct *tty)
339 return test_bit(TTY_THROTTLED, &tty->flags);
343 void tty_kref_put(struct tty_struct *tty);
344 struct pid *tty_get_pgrp(struct tty_struct *tty);
347 dev_t tty_devnum(struct tty_struct *tty);
352 const char *tty_name(const struct tty_struct *tty);
355 void tty_kclose(struct tty_struct *tty);
358 static inline void tty_kref_put(struct tty_struct *tty)
360 static inline struct pid *tty_get_pgrp(struct tty_struct *tty)
366 static inline dev_t tty_devnum(struct tty_struct *tty)
375 static inline const char *tty_name(const struct tty_struct *tty)
379 static inline void tty_kclose(struct tty_struct *tty)
392 * tty_kref_get - get a tty reference
393 * @tty: tty device
395 * Returns: a new reference to a tty object
400 static inline struct tty_struct *tty_kref_get(struct tty_struct *tty)
402 if (tty)
403 kref_get(&tty->kref);
404 return tty;
407 const char *tty_driver_name(const struct tty_struct *tty);
408 void tty_wait_until_sent(struct tty_struct *tty, long timeout);
409 void stop_tty(struct tty_struct *tty);
410 void start_tty(struct tty_struct *tty);
411 void tty_write_message(struct tty_struct *tty, char *msg);
412 int tty_send_xchar(struct tty_struct *tty, u8 ch);
413 int tty_put_char(struct tty_struct *tty, u8 c);
414 unsigned int tty_chars_in_buffer(struct tty_struct *tty);
415 unsigned int tty_write_room(struct tty_struct *tty);
416 void tty_driver_flush_buffer(struct tty_struct *tty);
417 void tty_unthrottle(struct tty_struct *tty);
418 bool tty_throttle_safe(struct tty_struct *tty);
419 bool tty_unthrottle_safe(struct tty_struct *tty);
420 int tty_do_resize(struct tty_struct *tty, struct winsize *ws);
421 int tty_get_icount(struct tty_struct *tty,
423 int tty_get_tiocm(struct tty_struct *tty);
425 void tty_hangup(struct tty_struct *tty);
426 void tty_vhangup(struct tty_struct *tty);
428 void do_SAK(struct tty_struct *tty);
429 void __do_SAK(struct tty_struct *tty);
434 void tty_encode_baud_rate(struct tty_struct *tty, speed_t ibaud,
438 * tty_get_baud_rate - get tty bit rates
439 * @tty: tty to query
445 static inline speed_t tty_get_baud_rate(const struct tty_struct *tty)
447 return tty_termios_baud_rate(&tty->termios);
455 int tty_set_termios(struct tty_struct *tty, struct ktermios *kt);
457 void tty_wakeup(struct tty_struct *tty);
459 int tty_mode_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg);
460 int tty_perform_flush(struct tty_struct *tty, unsigned long arg);
462 void tty_release_struct(struct tty_struct *tty, int idx);
463 void tty_init_termios(struct tty_struct *tty);
464 void tty_save_termios(struct tty_struct *tty);
466 struct tty_struct *tty);
497 int n_tty_ioctl_helper(struct tty_struct *tty, unsigned int cmd,
502 int vt_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg);
504 long vt_compat_ioctl(struct tty_struct *tty, unsigned int cmd,
509 void tty_lock(struct tty_struct *tty);
510 int tty_lock_interruptible(struct tty_struct *tty);
511 void tty_unlock(struct tty_struct *tty);
512 void tty_lock_slave(struct tty_struct *tty);
513 void tty_unlock_slave(struct tty_struct *tty);
514 void tty_set_lock_subclass(struct tty_struct *tty);