diff options
Diffstat (limited to 'include/linux/tty.h')
| -rw-r--r-- | include/linux/tty.h | 54 |
1 files changed, 46 insertions, 8 deletions
diff --git a/include/linux/tty.h b/include/linux/tty.h index c75d886b0307..8780bd2a272a 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h | |||
| @@ -255,9 +255,9 @@ struct tty_struct { | |||
| 255 | int count; | 255 | int count; |
| 256 | struct winsize winsize; /* termios mutex */ | 256 | struct winsize winsize; /* termios mutex */ |
| 257 | unsigned char stopped:1, hw_stopped:1, flow_stopped:1, packet:1; | 257 | unsigned char stopped:1, hw_stopped:1, flow_stopped:1, packet:1; |
| 258 | unsigned char warned:1; | ||
| 259 | unsigned char ctrl_status; /* ctrl_lock */ | 258 | unsigned char ctrl_status; /* ctrl_lock */ |
| 260 | unsigned int receive_room; /* Bytes free for queue */ | 259 | unsigned int receive_room; /* Bytes free for queue */ |
| 260 | int flow_change; | ||
| 261 | 261 | ||
| 262 | struct tty_struct *link; | 262 | struct tty_struct *link; |
| 263 | struct fasync_struct *fasync; | 263 | struct fasync_struct *fasync; |
| @@ -315,9 +315,25 @@ struct tty_file_private { | |||
| 315 | #define TTY_NO_WRITE_SPLIT 17 /* Preserve write boundaries to driver */ | 315 | #define TTY_NO_WRITE_SPLIT 17 /* Preserve write boundaries to driver */ |
| 316 | #define TTY_HUPPED 18 /* Post driver->hangup() */ | 316 | #define TTY_HUPPED 18 /* Post driver->hangup() */ |
| 317 | #define TTY_HUPPING 21 /* ->hangup() in progress */ | 317 | #define TTY_HUPPING 21 /* ->hangup() in progress */ |
| 318 | #define TTY_LDISC_HALTED 22 /* Line discipline is halted */ | ||
| 318 | 319 | ||
| 319 | #define TTY_WRITE_FLUSH(tty) tty_write_flush((tty)) | 320 | #define TTY_WRITE_FLUSH(tty) tty_write_flush((tty)) |
| 320 | 321 | ||
| 322 | /* Values for tty->flow_change */ | ||
| 323 | #define TTY_THROTTLE_SAFE 1 | ||
| 324 | #define TTY_UNTHROTTLE_SAFE 2 | ||
| 325 | |||
| 326 | static inline void __tty_set_flow_change(struct tty_struct *tty, int val) | ||
| 327 | { | ||
| 328 | tty->flow_change = val; | ||
| 329 | } | ||
| 330 | |||
| 331 | static inline void tty_set_flow_change(struct tty_struct *tty, int val) | ||
| 332 | { | ||
| 333 | tty->flow_change = val; | ||
| 334 | smp_mb(); | ||
| 335 | } | ||
| 336 | |||
| 321 | #ifdef CONFIG_TTY | 337 | #ifdef CONFIG_TTY |
| 322 | extern void console_init(void); | 338 | extern void console_init(void); |
| 323 | extern void tty_kref_put(struct tty_struct *tty); | 339 | extern void tty_kref_put(struct tty_struct *tty); |
| @@ -400,6 +416,8 @@ extern int tty_write_room(struct tty_struct *tty); | |||
| 400 | extern void tty_driver_flush_buffer(struct tty_struct *tty); | 416 | extern void tty_driver_flush_buffer(struct tty_struct *tty); |
| 401 | extern void tty_throttle(struct tty_struct *tty); | 417 | extern void tty_throttle(struct tty_struct *tty); |
| 402 | extern void tty_unthrottle(struct tty_struct *tty); | 418 | extern void tty_unthrottle(struct tty_struct *tty); |
| 419 | extern int tty_throttle_safe(struct tty_struct *tty); | ||
| 420 | extern int tty_unthrottle_safe(struct tty_struct *tty); | ||
| 403 | extern int tty_do_resize(struct tty_struct *tty, struct winsize *ws); | 421 | extern int tty_do_resize(struct tty_struct *tty, struct winsize *ws); |
| 404 | extern void tty_driver_remove_tty(struct tty_driver *driver, | 422 | extern void tty_driver_remove_tty(struct tty_driver *driver, |
| 405 | struct tty_struct *tty); | 423 | struct tty_struct *tty); |
| @@ -419,13 +437,28 @@ extern void tty_flush_to_ldisc(struct tty_struct *tty); | |||
| 419 | extern void tty_buffer_free_all(struct tty_port *port); | 437 | extern void tty_buffer_free_all(struct tty_port *port); |
| 420 | extern void tty_buffer_flush(struct tty_struct *tty); | 438 | extern void tty_buffer_flush(struct tty_struct *tty); |
| 421 | extern void tty_buffer_init(struct tty_port *port); | 439 | extern void tty_buffer_init(struct tty_port *port); |
| 422 | extern speed_t tty_get_baud_rate(struct tty_struct *tty); | ||
| 423 | extern speed_t tty_termios_baud_rate(struct ktermios *termios); | 440 | extern speed_t tty_termios_baud_rate(struct ktermios *termios); |
| 424 | extern speed_t tty_termios_input_baud_rate(struct ktermios *termios); | 441 | extern speed_t tty_termios_input_baud_rate(struct ktermios *termios); |
| 425 | extern void tty_termios_encode_baud_rate(struct ktermios *termios, | 442 | extern void tty_termios_encode_baud_rate(struct ktermios *termios, |
| 426 | speed_t ibaud, speed_t obaud); | 443 | speed_t ibaud, speed_t obaud); |
| 427 | extern void tty_encode_baud_rate(struct tty_struct *tty, | 444 | extern void tty_encode_baud_rate(struct tty_struct *tty, |
| 428 | speed_t ibaud, speed_t obaud); | 445 | speed_t ibaud, speed_t obaud); |
| 446 | |||
| 447 | /** | ||
| 448 | * tty_get_baud_rate - get tty bit rates | ||
| 449 | * @tty: tty to query | ||
| 450 | * | ||
| 451 | * Returns the baud rate as an integer for this terminal. The | ||
| 452 | * termios lock must be held by the caller and the terminal bit | ||
| 453 | * flags may be updated. | ||
| 454 | * | ||
| 455 | * Locking: none | ||
| 456 | */ | ||
| 457 | static inline speed_t tty_get_baud_rate(struct tty_struct *tty) | ||
| 458 | { | ||
| 459 | return tty_termios_baud_rate(&tty->termios); | ||
| 460 | } | ||
| 461 | |||
| 429 | extern void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old); | 462 | extern void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old); |
| 430 | extern int tty_termios_hw_change(struct ktermios *a, struct ktermios *b); | 463 | extern int tty_termios_hw_change(struct ktermios *a, struct ktermios *b); |
| 431 | extern int tty_set_termios(struct tty_struct *tty, struct ktermios *kt); | 464 | extern int tty_set_termios(struct tty_struct *tty, struct ktermios *kt); |
| @@ -502,6 +535,8 @@ extern int tty_port_carrier_raised(struct tty_port *port); | |||
| 502 | extern void tty_port_raise_dtr_rts(struct tty_port *port); | 535 | extern void tty_port_raise_dtr_rts(struct tty_port *port); |
| 503 | extern void tty_port_lower_dtr_rts(struct tty_port *port); | 536 | extern void tty_port_lower_dtr_rts(struct tty_port *port); |
| 504 | extern void tty_port_hangup(struct tty_port *port); | 537 | extern void tty_port_hangup(struct tty_port *port); |
| 538 | extern void tty_port_tty_hangup(struct tty_port *port, bool check_clocal); | ||
| 539 | extern void tty_port_tty_wakeup(struct tty_port *port); | ||
| 505 | extern int tty_port_block_til_ready(struct tty_port *port, | 540 | extern int tty_port_block_til_ready(struct tty_port *port, |
| 506 | struct tty_struct *tty, struct file *filp); | 541 | struct tty_struct *tty, struct file *filp); |
| 507 | extern int tty_port_close_start(struct tty_port *port, | 542 | extern int tty_port_close_start(struct tty_port *port, |
| @@ -526,8 +561,6 @@ extern void tty_ldisc_release(struct tty_struct *tty, struct tty_struct *o_tty); | |||
| 526 | extern void tty_ldisc_init(struct tty_struct *tty); | 561 | extern void tty_ldisc_init(struct tty_struct *tty); |
| 527 | extern void tty_ldisc_deinit(struct tty_struct *tty); | 562 | extern void tty_ldisc_deinit(struct tty_struct *tty); |
| 528 | extern void tty_ldisc_begin(void); | 563 | extern void tty_ldisc_begin(void); |
| 529 | /* This last one is just for the tty layer internals and shouldn't be used elsewhere */ | ||
| 530 | extern void tty_ldisc_enable(struct tty_struct *tty); | ||
| 531 | 564 | ||
| 532 | 565 | ||
| 533 | /* n_tty.c */ | 566 | /* n_tty.c */ |
| @@ -542,8 +575,7 @@ extern void tty_audit_exit(void); | |||
| 542 | extern void tty_audit_fork(struct signal_struct *sig); | 575 | extern void tty_audit_fork(struct signal_struct *sig); |
| 543 | extern void tty_audit_tiocsti(struct tty_struct *tty, char ch); | 576 | extern void tty_audit_tiocsti(struct tty_struct *tty, char ch); |
| 544 | extern void tty_audit_push(struct tty_struct *tty); | 577 | extern void tty_audit_push(struct tty_struct *tty); |
| 545 | extern int tty_audit_push_task(struct task_struct *tsk, | 578 | extern int tty_audit_push_current(void); |
| 546 | kuid_t loginuid, u32 sessionid); | ||
| 547 | #else | 579 | #else |
| 548 | static inline void tty_audit_add_data(struct tty_struct *tty, | 580 | static inline void tty_audit_add_data(struct tty_struct *tty, |
| 549 | unsigned char *data, size_t size, unsigned icanon) | 581 | unsigned char *data, size_t size, unsigned icanon) |
| @@ -561,8 +593,7 @@ static inline void tty_audit_fork(struct signal_struct *sig) | |||
| 561 | static inline void tty_audit_push(struct tty_struct *tty) | 593 | static inline void tty_audit_push(struct tty_struct *tty) |
| 562 | { | 594 | { |
| 563 | } | 595 | } |
| 564 | static inline int tty_audit_push_task(struct task_struct *tsk, | 596 | static inline int tty_audit_push_current(void) |
| 565 | kuid_t loginuid, u32 sessionid) | ||
| 566 | { | 597 | { |
| 567 | return 0; | 598 | return 0; |
| 568 | } | 599 | } |
| @@ -658,5 +689,12 @@ do { \ | |||
| 658 | finish_wait(&wq, &__wait); \ | 689 | finish_wait(&wq, &__wait); \ |
| 659 | } while (0) | 690 | } while (0) |
| 660 | 691 | ||
| 692 | #ifdef CONFIG_PROC_FS | ||
| 693 | extern void proc_tty_register_driver(struct tty_driver *); | ||
| 694 | extern void proc_tty_unregister_driver(struct tty_driver *); | ||
| 695 | #else | ||
| 696 | static inline void proc_tty_register_driver(struct tty_driver *d) {} | ||
| 697 | static inline void proc_tty_unregister_driver(struct tty_driver *d) {} | ||
| 698 | #endif | ||
| 661 | 699 | ||
| 662 | #endif | 700 | #endif |
