aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/tty.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/tty.h')
-rw-r--r--include/linux/tty.h25
1 files changed, 24 insertions, 1 deletions
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 7d66ae508e5c..358a337af598 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -14,6 +14,29 @@
14#include <linux/llist.h> 14#include <linux/llist.h>
15 15
16 16
17/*
18 * Lock subclasses for tty locks
19 *
20 * TTY_LOCK_NORMAL is for normal ttys and master ptys.
21 * TTY_LOCK_SLAVE is for slave ptys only.
22 *
23 * Lock subclasses are necessary for handling nested locking with pty pairs.
24 * tty locks which use nested locking:
25 *
26 * legacy_mutex - Nested tty locks are necessary for releasing pty pairs.
27 * The stable lock order is master pty first, then slave pty.
28 * termios_rwsem - The stable lock order is tty_buffer lock->termios_rwsem.
29 * Subclassing this lock enables the slave pty to hold its
30 * termios_rwsem when claiming the master tty_buffer lock.
31 * tty_buffer lock - slave ptys can claim nested buffer lock when handling
32 * signal chars. The stable lock order is slave pty, then
33 * master.
34 */
35
36enum {
37 TTY_LOCK_NORMAL = 0,
38 TTY_LOCK_SLAVE,
39};
17 40
18/* 41/*
19 * (Note: the *_driver.minor_start values 1, 64, 128, 192 are 42 * (Note: the *_driver.minor_start values 1, 64, 128, 192 are
@@ -443,6 +466,7 @@ extern void tty_flush_to_ldisc(struct tty_struct *tty);
443extern void tty_buffer_free_all(struct tty_port *port); 466extern void tty_buffer_free_all(struct tty_port *port);
444extern void tty_buffer_flush(struct tty_struct *tty, struct tty_ldisc *ld); 467extern void tty_buffer_flush(struct tty_struct *tty, struct tty_ldisc *ld);
445extern void tty_buffer_init(struct tty_port *port); 468extern void tty_buffer_init(struct tty_port *port);
469extern void tty_buffer_set_lock_subclass(struct tty_port *port);
446extern speed_t tty_termios_baud_rate(struct ktermios *termios); 470extern speed_t tty_termios_baud_rate(struct ktermios *termios);
447extern speed_t tty_termios_input_baud_rate(struct ktermios *termios); 471extern speed_t tty_termios_input_baud_rate(struct ktermios *termios);
448extern void tty_termios_encode_baud_rate(struct ktermios *termios, 472extern void tty_termios_encode_baud_rate(struct ktermios *termios,
@@ -467,7 +491,6 @@ static inline speed_t tty_get_baud_rate(struct tty_struct *tty)
467 491
468extern void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old); 492extern void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old);
469extern int tty_termios_hw_change(struct ktermios *a, struct ktermios *b); 493extern int tty_termios_hw_change(struct ktermios *a, struct ktermios *b);
470extern int tty_set_termios(struct tty_struct *tty, struct ktermios *kt);
471 494
472extern struct tty_ldisc *tty_ldisc_ref(struct tty_struct *); 495extern struct tty_ldisc *tty_ldisc_ref(struct tty_struct *);
473extern void tty_ldisc_deref(struct tty_ldisc *); 496extern void tty_ldisc_deref(struct tty_ldisc *);