diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/tty.h | 165 |
1 files changed, 85 insertions, 80 deletions
diff --git a/include/linux/tty.h b/include/linux/tty.h index d7c695b65c0e..46008e86b191 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h | |||
@@ -71,7 +71,8 @@ struct tty_bufhead { | |||
71 | struct tty_buffer *head; /* Queue head */ | 71 | struct tty_buffer *head; /* Queue head */ |
72 | struct tty_buffer *tail; /* Active buffer */ | 72 | struct tty_buffer *tail; /* Active buffer */ |
73 | struct tty_buffer *free; /* Free queue head */ | 73 | struct tty_buffer *free; /* Free queue head */ |
74 | int memory_used; /* Buffer space used excluding free queue */ | 74 | int memory_used; /* Buffer space used excluding |
75 | free queue */ | ||
75 | }; | 76 | }; |
76 | /* | 77 | /* |
77 | * When a break, frame error, or parity error happens, these codes are | 78 | * When a break, frame error, or parity error happens, these codes are |
@@ -101,68 +102,68 @@ struct tty_bufhead { | |||
101 | #define LNEXT_CHAR(tty) ((tty)->termios->c_cc[VLNEXT]) | 102 | #define LNEXT_CHAR(tty) ((tty)->termios->c_cc[VLNEXT]) |
102 | #define EOL2_CHAR(tty) ((tty)->termios->c_cc[VEOL2]) | 103 | #define EOL2_CHAR(tty) ((tty)->termios->c_cc[VEOL2]) |
103 | 104 | ||
104 | #define _I_FLAG(tty,f) ((tty)->termios->c_iflag & (f)) | 105 | #define _I_FLAG(tty, f) ((tty)->termios->c_iflag & (f)) |
105 | #define _O_FLAG(tty,f) ((tty)->termios->c_oflag & (f)) | 106 | #define _O_FLAG(tty, f) ((tty)->termios->c_oflag & (f)) |
106 | #define _C_FLAG(tty,f) ((tty)->termios->c_cflag & (f)) | 107 | #define _C_FLAG(tty, f) ((tty)->termios->c_cflag & (f)) |
107 | #define _L_FLAG(tty,f) ((tty)->termios->c_lflag & (f)) | 108 | #define _L_FLAG(tty, f) ((tty)->termios->c_lflag & (f)) |
108 | 109 | ||
109 | #define I_IGNBRK(tty) _I_FLAG((tty),IGNBRK) | 110 | #define I_IGNBRK(tty) _I_FLAG((tty), IGNBRK) |
110 | #define I_BRKINT(tty) _I_FLAG((tty),BRKINT) | 111 | #define I_BRKINT(tty) _I_FLAG((tty), BRKINT) |
111 | #define I_IGNPAR(tty) _I_FLAG((tty),IGNPAR) | 112 | #define I_IGNPAR(tty) _I_FLAG((tty), IGNPAR) |
112 | #define I_PARMRK(tty) _I_FLAG((tty),PARMRK) | 113 | #define I_PARMRK(tty) _I_FLAG((tty), PARMRK) |
113 | #define I_INPCK(tty) _I_FLAG((tty),INPCK) | 114 | #define I_INPCK(tty) _I_FLAG((tty), INPCK) |
114 | #define I_ISTRIP(tty) _I_FLAG((tty),ISTRIP) | 115 | #define I_ISTRIP(tty) _I_FLAG((tty), ISTRIP) |
115 | #define I_INLCR(tty) _I_FLAG((tty),INLCR) | 116 | #define I_INLCR(tty) _I_FLAG((tty), INLCR) |
116 | #define I_IGNCR(tty) _I_FLAG((tty),IGNCR) | 117 | #define I_IGNCR(tty) _I_FLAG((tty), IGNCR) |
117 | #define I_ICRNL(tty) _I_FLAG((tty),ICRNL) | 118 | #define I_ICRNL(tty) _I_FLAG((tty), ICRNL) |
118 | #define I_IUCLC(tty) _I_FLAG((tty),IUCLC) | 119 | #define I_IUCLC(tty) _I_FLAG((tty), IUCLC) |
119 | #define I_IXON(tty) _I_FLAG((tty),IXON) | 120 | #define I_IXON(tty) _I_FLAG((tty), IXON) |
120 | #define I_IXANY(tty) _I_FLAG((tty),IXANY) | 121 | #define I_IXANY(tty) _I_FLAG((tty), IXANY) |
121 | #define I_IXOFF(tty) _I_FLAG((tty),IXOFF) | 122 | #define I_IXOFF(tty) _I_FLAG((tty), IXOFF) |
122 | #define I_IMAXBEL(tty) _I_FLAG((tty),IMAXBEL) | 123 | #define I_IMAXBEL(tty) _I_FLAG((tty), IMAXBEL) |
123 | #define I_IUTF8(tty) _I_FLAG((tty),IUTF8) | 124 | #define I_IUTF8(tty) _I_FLAG((tty), IUTF8) |
124 | 125 | ||
125 | #define O_OPOST(tty) _O_FLAG((tty),OPOST) | 126 | #define O_OPOST(tty) _O_FLAG((tty), OPOST) |
126 | #define O_OLCUC(tty) _O_FLAG((tty),OLCUC) | 127 | #define O_OLCUC(tty) _O_FLAG((tty), OLCUC) |
127 | #define O_ONLCR(tty) _O_FLAG((tty),ONLCR) | 128 | #define O_ONLCR(tty) _O_FLAG((tty), ONLCR) |
128 | #define O_OCRNL(tty) _O_FLAG((tty),OCRNL) | 129 | #define O_OCRNL(tty) _O_FLAG((tty), OCRNL) |
129 | #define O_ONOCR(tty) _O_FLAG((tty),ONOCR) | 130 | #define O_ONOCR(tty) _O_FLAG((tty), ONOCR) |
130 | #define O_ONLRET(tty) _O_FLAG((tty),ONLRET) | 131 | #define O_ONLRET(tty) _O_FLAG((tty), ONLRET) |
131 | #define O_OFILL(tty) _O_FLAG((tty),OFILL) | 132 | #define O_OFILL(tty) _O_FLAG((tty), OFILL) |
132 | #define O_OFDEL(tty) _O_FLAG((tty),OFDEL) | 133 | #define O_OFDEL(tty) _O_FLAG((tty), OFDEL) |
133 | #define O_NLDLY(tty) _O_FLAG((tty),NLDLY) | 134 | #define O_NLDLY(tty) _O_FLAG((tty), NLDLY) |
134 | #define O_CRDLY(tty) _O_FLAG((tty),CRDLY) | 135 | #define O_CRDLY(tty) _O_FLAG((tty), CRDLY) |
135 | #define O_TABDLY(tty) _O_FLAG((tty),TABDLY) | 136 | #define O_TABDLY(tty) _O_FLAG((tty), TABDLY) |
136 | #define O_BSDLY(tty) _O_FLAG((tty),BSDLY) | 137 | #define O_BSDLY(tty) _O_FLAG((tty), BSDLY) |
137 | #define O_VTDLY(tty) _O_FLAG((tty),VTDLY) | 138 | #define O_VTDLY(tty) _O_FLAG((tty), VTDLY) |
138 | #define O_FFDLY(tty) _O_FLAG((tty),FFDLY) | 139 | #define O_FFDLY(tty) _O_FLAG((tty), FFDLY) |
139 | 140 | ||
140 | #define C_BAUD(tty) _C_FLAG((tty),CBAUD) | 141 | #define C_BAUD(tty) _C_FLAG((tty), CBAUD) |
141 | #define C_CSIZE(tty) _C_FLAG((tty),CSIZE) | 142 | #define C_CSIZE(tty) _C_FLAG((tty), CSIZE) |
142 | #define C_CSTOPB(tty) _C_FLAG((tty),CSTOPB) | 143 | #define C_CSTOPB(tty) _C_FLAG((tty), CSTOPB) |
143 | #define C_CREAD(tty) _C_FLAG((tty),CREAD) | 144 | #define C_CREAD(tty) _C_FLAG((tty), CREAD) |
144 | #define C_PARENB(tty) _C_FLAG((tty),PARENB) | 145 | #define C_PARENB(tty) _C_FLAG((tty), PARENB) |
145 | #define C_PARODD(tty) _C_FLAG((tty),PARODD) | 146 | #define C_PARODD(tty) _C_FLAG((tty), PARODD) |
146 | #define C_HUPCL(tty) _C_FLAG((tty),HUPCL) | 147 | #define C_HUPCL(tty) _C_FLAG((tty), HUPCL) |
147 | #define C_CLOCAL(tty) _C_FLAG((tty),CLOCAL) | 148 | #define C_CLOCAL(tty) _C_FLAG((tty), CLOCAL) |
148 | #define C_CIBAUD(tty) _C_FLAG((tty),CIBAUD) | 149 | #define C_CIBAUD(tty) _C_FLAG((tty), CIBAUD) |
149 | #define C_CRTSCTS(tty) _C_FLAG((tty),CRTSCTS) | 150 | #define C_CRTSCTS(tty) _C_FLAG((tty), CRTSCTS) |
150 | 151 | ||
151 | #define L_ISIG(tty) _L_FLAG((tty),ISIG) | 152 | #define L_ISIG(tty) _L_FLAG((tty), ISIG) |
152 | #define L_ICANON(tty) _L_FLAG((tty),ICANON) | 153 | #define L_ICANON(tty) _L_FLAG((tty), ICANON) |
153 | #define L_XCASE(tty) _L_FLAG((tty),XCASE) | 154 | #define L_XCASE(tty) _L_FLAG((tty), XCASE) |
154 | #define L_ECHO(tty) _L_FLAG((tty),ECHO) | 155 | #define L_ECHO(tty) _L_FLAG((tty), ECHO) |
155 | #define L_ECHOE(tty) _L_FLAG((tty),ECHOE) | 156 | #define L_ECHOE(tty) _L_FLAG((tty), ECHOE) |
156 | #define L_ECHOK(tty) _L_FLAG((tty),ECHOK) | 157 | #define L_ECHOK(tty) _L_FLAG((tty), ECHOK) |
157 | #define L_ECHONL(tty) _L_FLAG((tty),ECHONL) | 158 | #define L_ECHONL(tty) _L_FLAG((tty), ECHONL) |
158 | #define L_NOFLSH(tty) _L_FLAG((tty),NOFLSH) | 159 | #define L_NOFLSH(tty) _L_FLAG((tty), NOFLSH) |
159 | #define L_TOSTOP(tty) _L_FLAG((tty),TOSTOP) | 160 | #define L_TOSTOP(tty) _L_FLAG((tty), TOSTOP) |
160 | #define L_ECHOCTL(tty) _L_FLAG((tty),ECHOCTL) | 161 | #define L_ECHOCTL(tty) _L_FLAG((tty), ECHOCTL) |
161 | #define L_ECHOPRT(tty) _L_FLAG((tty),ECHOPRT) | 162 | #define L_ECHOPRT(tty) _L_FLAG((tty), ECHOPRT) |
162 | #define L_ECHOKE(tty) _L_FLAG((tty),ECHOKE) | 163 | #define L_ECHOKE(tty) _L_FLAG((tty), ECHOKE) |
163 | #define L_FLUSHO(tty) _L_FLAG((tty),FLUSHO) | 164 | #define L_FLUSHO(tty) _L_FLAG((tty), FLUSHO) |
164 | #define L_PENDIN(tty) _L_FLAG((tty),PENDIN) | 165 | #define L_PENDIN(tty) _L_FLAG((tty), PENDIN) |
165 | #define L_IEXTEN(tty) _L_FLAG((tty),IEXTEN) | 166 | #define L_IEXTEN(tty) _L_FLAG((tty), IEXTEN) |
166 | 167 | ||
167 | struct device; | 168 | struct device; |
168 | struct signal_struct; | 169 | struct signal_struct; |
@@ -177,7 +178,7 @@ struct signal_struct; | |||
177 | * of the tty object but in many cases port -> tty mappings are valid only | 178 | * of the tty object but in many cases port -> tty mappings are valid only |
178 | * until a hangup so don't use the wrong path. | 179 | * until a hangup so don't use the wrong path. |
179 | */ | 180 | */ |
180 | 181 | ||
181 | struct tty_port { | 182 | struct tty_port { |
182 | struct tty_struct *tty; /* Back pointer */ | 183 | struct tty_struct *tty; /* Back pointer */ |
183 | int blocked_open; /* Waiting to open */ | 184 | int blocked_open; /* Waiting to open */ |
@@ -273,14 +274,14 @@ struct tty_struct { | |||
273 | 274 | ||
274 | /* | 275 | /* |
275 | * These bits are used in the flags field of the tty structure. | 276 | * These bits are used in the flags field of the tty structure. |
276 | * | 277 | * |
277 | * So that interrupts won't be able to mess up the queues, | 278 | * So that interrupts won't be able to mess up the queues, |
278 | * copy_to_cooked must be atomic with respect to itself, as must | 279 | * copy_to_cooked must be atomic with respect to itself, as must |
279 | * tty->write. Thus, you must use the inline functions set_bit() and | 280 | * tty->write. Thus, you must use the inline functions set_bit() and |
280 | * clear_bit() to make things atomic. | 281 | * clear_bit() to make things atomic. |
281 | */ | 282 | */ |
282 | #define TTY_THROTTLED 0 /* Call unthrottle() at threshold min */ | 283 | #define TTY_THROTTLED 0 /* Call unthrottle() at threshold min */ |
283 | #define TTY_IO_ERROR 1 /* Canse an I/O error (may be no ldisc too) */ | 284 | #define TTY_IO_ERROR 1 /* Cause an I/O error (may be no ldisc too) */ |
284 | #define TTY_OTHER_CLOSED 2 /* Other side (if any) has closed */ | 285 | #define TTY_OTHER_CLOSED 2 /* Other side (if any) has closed */ |
285 | #define TTY_EXCLUSIVE 3 /* Exclusive open mode */ | 286 | #define TTY_EXCLUSIVE 3 /* Exclusive open mode */ |
286 | #define TTY_DEBUG 4 /* Debugging */ | 287 | #define TTY_DEBUG 4 /* Debugging */ |
@@ -310,10 +311,10 @@ extern int vcs_init(void); | |||
310 | extern int tty_paranoia_check(struct tty_struct *tty, struct inode *inode, | 311 | extern int tty_paranoia_check(struct tty_struct *tty, struct inode *inode, |
311 | const char *routine); | 312 | const char *routine); |
312 | extern char *tty_name(struct tty_struct *tty, char *buf); | 313 | extern char *tty_name(struct tty_struct *tty, char *buf); |
313 | extern void tty_wait_until_sent(struct tty_struct * tty, long timeout); | 314 | extern void tty_wait_until_sent(struct tty_struct *tty, long timeout); |
314 | extern int tty_check_change(struct tty_struct * tty); | 315 | extern int tty_check_change(struct tty_struct *tty); |
315 | extern void stop_tty(struct tty_struct * tty); | 316 | extern void stop_tty(struct tty_struct *tty); |
316 | extern void start_tty(struct tty_struct * tty); | 317 | extern void start_tty(struct tty_struct *tty); |
317 | extern int tty_register_ldisc(int disc, struct tty_ldisc_ops *new_ldisc); | 318 | extern int tty_register_ldisc(int disc, struct tty_ldisc_ops *new_ldisc); |
318 | extern int tty_unregister_ldisc(int disc); | 319 | extern int tty_unregister_ldisc(int disc); |
319 | extern int tty_register_driver(struct tty_driver *driver); | 320 | extern int tty_register_driver(struct tty_driver *driver); |
@@ -335,10 +336,10 @@ extern int is_current_pgrp_orphaned(void); | |||
335 | extern struct pid *tty_get_pgrp(struct tty_struct *tty); | 336 | extern struct pid *tty_get_pgrp(struct tty_struct *tty); |
336 | extern int is_ignored(int sig); | 337 | extern int is_ignored(int sig); |
337 | extern int tty_signal(int sig, struct tty_struct *tty); | 338 | extern int tty_signal(int sig, struct tty_struct *tty); |
338 | extern void tty_hangup(struct tty_struct * tty); | 339 | extern void tty_hangup(struct tty_struct *tty); |
339 | extern void tty_vhangup(struct tty_struct * tty); | 340 | extern void tty_vhangup(struct tty_struct *tty); |
340 | extern void tty_unhangup(struct file *filp); | 341 | extern void tty_unhangup(struct file *filp); |
341 | extern int tty_hung_up_p(struct file * filp); | 342 | extern int tty_hung_up_p(struct file *filp); |
342 | extern void do_SAK(struct tty_struct *tty); | 343 | extern void do_SAK(struct tty_struct *tty); |
343 | extern void __do_SAK(struct tty_struct *tty); | 344 | extern void __do_SAK(struct tty_struct *tty); |
344 | extern void disassociate_ctty(int priv); | 345 | extern void disassociate_ctty(int priv); |
@@ -347,8 +348,10 @@ extern void tty_flip_buffer_push(struct tty_struct *tty); | |||
347 | extern speed_t tty_get_baud_rate(struct tty_struct *tty); | 348 | extern speed_t tty_get_baud_rate(struct tty_struct *tty); |
348 | extern speed_t tty_termios_baud_rate(struct ktermios *termios); | 349 | extern speed_t tty_termios_baud_rate(struct ktermios *termios); |
349 | extern speed_t tty_termios_input_baud_rate(struct ktermios *termios); | 350 | extern speed_t tty_termios_input_baud_rate(struct ktermios *termios); |
350 | extern void tty_termios_encode_baud_rate(struct ktermios *termios, speed_t ibaud, speed_t obaud); | 351 | extern void tty_termios_encode_baud_rate(struct ktermios *termios, |
351 | extern void tty_encode_baud_rate(struct tty_struct *tty, speed_t ibaud, speed_t obaud); | 352 | speed_t ibaud, speed_t obaud); |
353 | extern void tty_encode_baud_rate(struct tty_struct *tty, | ||
354 | speed_t ibaud, speed_t obaud); | ||
352 | extern void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old); | 355 | extern void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old); |
353 | extern int tty_termios_hw_change(struct ktermios *a, struct ktermios *b); | 356 | extern int tty_termios_hw_change(struct ktermios *a, struct ktermios *b); |
354 | 357 | ||
@@ -390,7 +393,8 @@ extern void tty_audit_add_data(struct tty_struct *tty, unsigned char *data, | |||
390 | extern void tty_audit_exit(void); | 393 | extern void tty_audit_exit(void); |
391 | extern void tty_audit_fork(struct signal_struct *sig); | 394 | extern void tty_audit_fork(struct signal_struct *sig); |
392 | extern void tty_audit_push(struct tty_struct *tty); | 395 | extern void tty_audit_push(struct tty_struct *tty); |
393 | extern void tty_audit_push_task(struct task_struct *tsk, uid_t loginuid, u32 sessionid); | 396 | extern void tty_audit_push_task(struct task_struct *tsk, |
397 | uid_t loginuid, u32 sessionid); | ||
394 | #else | 398 | #else |
395 | static inline void tty_audit_add_data(struct tty_struct *tty, | 399 | static inline void tty_audit_add_data(struct tty_struct *tty, |
396 | unsigned char *data, size_t size) | 400 | unsigned char *data, size_t size) |
@@ -405,19 +409,20 @@ static inline void tty_audit_fork(struct signal_struct *sig) | |||
405 | static inline void tty_audit_push(struct tty_struct *tty) | 409 | static inline void tty_audit_push(struct tty_struct *tty) |
406 | { | 410 | { |
407 | } | 411 | } |
408 | static inline void tty_audit_push_task(struct task_struct *tsk, uid_t loginuid, u32 sessionid) | 412 | static inline void tty_audit_push_task(struct task_struct *tsk, |
413 | uid_t loginuid, u32 sessionid) | ||
409 | { | 414 | { |
410 | } | 415 | } |
411 | #endif | 416 | #endif |
412 | 417 | ||
413 | /* tty_ioctl.c */ | 418 | /* tty_ioctl.c */ |
414 | extern int n_tty_ioctl(struct tty_struct * tty, struct file * file, | 419 | extern int n_tty_ioctl(struct tty_struct *tty, struct file *file, |
415 | unsigned int cmd, unsigned long arg); | 420 | unsigned int cmd, unsigned long arg); |
416 | 421 | ||
417 | /* serial.c */ | 422 | /* serial.c */ |
418 | 423 | ||
419 | extern void serial_console_init(void); | 424 | extern void serial_console_init(void); |
420 | 425 | ||
421 | /* pcxx.c */ | 426 | /* pcxx.c */ |
422 | 427 | ||
423 | extern int pcxe_open(struct tty_struct *tty, struct file *filp); | 428 | extern int pcxe_open(struct tty_struct *tty, struct file *filp); |
@@ -428,7 +433,7 @@ extern void console_print(const char *); | |||
428 | 433 | ||
429 | /* vt.c */ | 434 | /* vt.c */ |
430 | 435 | ||
431 | extern int vt_ioctl(struct tty_struct *tty, struct file * file, | 436 | extern int vt_ioctl(struct tty_struct *tty, struct file *file, |
432 | unsigned int cmd, unsigned long arg); | 437 | unsigned int cmd, unsigned long arg); |
433 | 438 | ||
434 | #endif /* __KERNEL__ */ | 439 | #endif /* __KERNEL__ */ |