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.h54
1 files changed, 6 insertions, 48 deletions
diff --git a/include/linux/tty.h b/include/linux/tty.h
index d072ded41678..5e31f1b99037 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -227,7 +227,6 @@ struct tty_port {
227 int blocked_open; /* Waiting to open */ 227 int blocked_open; /* Waiting to open */
228 int count; /* Usage count */ 228 int count; /* Usage count */
229 wait_queue_head_t open_wait; /* Open waiters */ 229 wait_queue_head_t open_wait; /* Open waiters */
230 wait_queue_head_t close_wait; /* Close waiters */
231 wait_queue_head_t delta_msr_wait; /* Modem status change */ 230 wait_queue_head_t delta_msr_wait; /* Modem status change */
232 unsigned long flags; /* TTY flags ASY_*/ 231 unsigned long flags; /* TTY flags ASY_*/
233 unsigned char console:1, /* port is a console */ 232 unsigned char console:1, /* port is a console */
@@ -424,6 +423,7 @@ extern int tty_paranoia_check(struct tty_struct *tty, struct inode *inode,
424 const char *routine); 423 const char *routine);
425extern const char *tty_name(const struct tty_struct *tty); 424extern const char *tty_name(const struct tty_struct *tty);
426extern void tty_wait_until_sent(struct tty_struct *tty, long timeout); 425extern void tty_wait_until_sent(struct tty_struct *tty, long timeout);
426extern int __tty_check_change(struct tty_struct *tty, int sig);
427extern int tty_check_change(struct tty_struct *tty); 427extern int tty_check_change(struct tty_struct *tty);
428extern void __stop_tty(struct tty_struct *tty); 428extern void __stop_tty(struct tty_struct *tty);
429extern void stop_tty(struct tty_struct *tty); 429extern void stop_tty(struct tty_struct *tty);
@@ -467,6 +467,8 @@ extern void tty_buffer_free_all(struct tty_port *port);
467extern 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);
468extern 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); 469extern void tty_buffer_set_lock_subclass(struct tty_port *port);
470extern bool tty_buffer_restart_work(struct tty_port *port);
471extern bool tty_buffer_cancel_work(struct tty_port *port);
470extern speed_t tty_termios_baud_rate(struct ktermios *termios); 472extern speed_t tty_termios_baud_rate(struct ktermios *termios);
471extern speed_t tty_termios_input_baud_rate(struct ktermios *termios); 473extern speed_t tty_termios_input_baud_rate(struct ktermios *termios);
472extern void tty_termios_encode_baud_rate(struct ktermios *termios, 474extern void tty_termios_encode_baud_rate(struct ktermios *termios,
@@ -605,7 +607,7 @@ extern void n_tty_inherit_ops(struct tty_ldisc_ops *ops);
605 607
606/* tty_audit.c */ 608/* tty_audit.c */
607#ifdef CONFIG_AUDIT 609#ifdef CONFIG_AUDIT
608extern void tty_audit_add_data(struct tty_struct *tty, unsigned char *data, 610extern void tty_audit_add_data(struct tty_struct *tty, const void *data,
609 size_t size, unsigned icanon); 611 size_t size, unsigned icanon);
610extern void tty_audit_exit(void); 612extern void tty_audit_exit(void);
611extern void tty_audit_fork(struct signal_struct *sig); 613extern void tty_audit_fork(struct signal_struct *sig);
@@ -613,8 +615,8 @@ extern void tty_audit_tiocsti(struct tty_struct *tty, char ch);
613extern void tty_audit_push(struct tty_struct *tty); 615extern void tty_audit_push(struct tty_struct *tty);
614extern int tty_audit_push_current(void); 616extern int tty_audit_push_current(void);
615#else 617#else
616static inline void tty_audit_add_data(struct tty_struct *tty, 618static inline void tty_audit_add_data(struct tty_struct *tty, const void *data,
617 unsigned char *data, size_t size, unsigned icanon) 619 size_t size, unsigned icanon)
618{ 620{
619} 621}
620static inline void tty_audit_tiocsti(struct tty_struct *tty, char ch) 622static inline void tty_audit_tiocsti(struct tty_struct *tty, char ch)
@@ -656,50 +658,6 @@ extern void __lockfunc tty_unlock(struct tty_struct *tty);
656extern void __lockfunc tty_lock_slave(struct tty_struct *tty); 658extern void __lockfunc tty_lock_slave(struct tty_struct *tty);
657extern void __lockfunc tty_unlock_slave(struct tty_struct *tty); 659extern void __lockfunc tty_unlock_slave(struct tty_struct *tty);
658extern void tty_set_lock_subclass(struct tty_struct *tty); 660extern void tty_set_lock_subclass(struct tty_struct *tty);
659/*
660 * this shall be called only from where BTM is held (like close)
661 *
662 * We need this to ensure nobody waits for us to finish while we are waiting.
663 * Without this we were encountering system stalls.
664 *
665 * This should be indeed removed with BTM removal later.
666 *
667 * Locking: BTM required. Nobody is allowed to hold port->mutex.
668 */
669static inline void tty_wait_until_sent_from_close(struct tty_struct *tty,
670 long timeout)
671{
672 tty_unlock(tty); /* tty->ops->close holds the BTM, drop it while waiting */
673 tty_wait_until_sent(tty, timeout);
674 tty_lock(tty);
675}
676
677/*
678 * wait_event_interruptible_tty -- wait for a condition with the tty lock held
679 *
680 * The condition we are waiting for might take a long time to
681 * become true, or might depend on another thread taking the
682 * BTM. In either case, we need to drop the BTM to guarantee
683 * forward progress. This is a leftover from the conversion
684 * from the BKL and should eventually get removed as the BTM
685 * falls out of use.
686 *
687 * Do not use in new code.
688 */
689#define wait_event_interruptible_tty(tty, wq, condition) \
690({ \
691 int __ret = 0; \
692 if (!(condition)) \
693 __ret = __wait_event_interruptible_tty(tty, wq, \
694 condition); \
695 __ret; \
696})
697
698#define __wait_event_interruptible_tty(tty, wq, condition) \
699 ___wait_event(wq, condition, TASK_INTERRUPTIBLE, 0, 0, \
700 tty_unlock(tty); \
701 schedule(); \
702 tty_lock(tty))
703 661
704#ifdef CONFIG_PROC_FS 662#ifdef CONFIG_PROC_FS
705extern void proc_tty_register_driver(struct tty_driver *); 663extern void proc_tty_register_driver(struct tty_driver *);