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.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 931078b73226..1437da3ddc62 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -13,6 +13,7 @@
13#include <linux/tty_driver.h> 13#include <linux/tty_driver.h>
14#include <linux/tty_ldisc.h> 14#include <linux/tty_ldisc.h>
15#include <linux/mutex.h> 15#include <linux/mutex.h>
16#include <linux/smp_lock.h>
16 17
17#include <asm/system.h> 18#include <asm/system.h>
18 19
@@ -179,6 +180,7 @@ struct tty_bufhead {
179#define L_FLUSHO(tty) _L_FLAG((tty), FLUSHO) 180#define L_FLUSHO(tty) _L_FLAG((tty), FLUSHO)
180#define L_PENDIN(tty) _L_FLAG((tty), PENDIN) 181#define L_PENDIN(tty) _L_FLAG((tty), PENDIN)
181#define L_IEXTEN(tty) _L_FLAG((tty), IEXTEN) 182#define L_IEXTEN(tty) _L_FLAG((tty), IEXTEN)
183#define L_EXTPROC(tty) _L_FLAG((tty), EXTPROC)
182 184
183struct device; 185struct device;
184struct signal_struct; 186struct signal_struct;
@@ -415,6 +417,7 @@ extern int is_ignored(int sig);
415extern int tty_signal(int sig, struct tty_struct *tty); 417extern int tty_signal(int sig, struct tty_struct *tty);
416extern void tty_hangup(struct tty_struct *tty); 418extern void tty_hangup(struct tty_struct *tty);
417extern void tty_vhangup(struct tty_struct *tty); 419extern void tty_vhangup(struct tty_struct *tty);
420extern void tty_vhangup_locked(struct tty_struct *tty);
418extern void tty_vhangup_self(void); 421extern void tty_vhangup_self(void);
419extern void tty_unhangup(struct file *filp); 422extern void tty_unhangup(struct file *filp);
420extern int tty_hung_up_p(struct file *filp); 423extern int tty_hung_up_p(struct file *filp);
@@ -552,6 +555,9 @@ static inline void tty_audit_push_task(struct task_struct *tsk,
552} 555}
553#endif 556#endif
554 557
558/* tty_io.c */
559extern int __init tty_init(void);
560
555/* tty_ioctl.c */ 561/* tty_ioctl.c */
556extern int n_tty_ioctl_helper(struct tty_struct *tty, struct file *file, 562extern int n_tty_ioctl_helper(struct tty_struct *tty, struct file *file,
557 unsigned int cmd, unsigned long arg); 563 unsigned int cmd, unsigned long arg);
@@ -572,5 +578,54 @@ extern int vt_ioctl(struct tty_struct *tty, struct file *file,
572extern long vt_compat_ioctl(struct tty_struct *tty, struct file * file, 578extern long vt_compat_ioctl(struct tty_struct *tty, struct file * file,
573 unsigned int cmd, unsigned long arg); 579 unsigned int cmd, unsigned long arg);
574 580
581/* tty_mutex.c */
582/* functions for preparation of BKL removal */
583extern void __lockfunc tty_lock(void) __acquires(tty_lock);
584extern void __lockfunc tty_unlock(void) __releases(tty_lock);
585extern struct task_struct *__big_tty_mutex_owner;
586#define tty_locked() (current == __big_tty_mutex_owner)
587
588/*
589 * wait_event_interruptible_tty -- wait for a condition with the tty lock held
590 *
591 * The condition we are waiting for might take a long time to
592 * become true, or might depend on another thread taking the
593 * BTM. In either case, we need to drop the BTM to guarantee
594 * forward progress. This is a leftover from the conversion
595 * from the BKL and should eventually get removed as the BTM
596 * falls out of use.
597 *
598 * Do not use in new code.
599 */
600#define wait_event_interruptible_tty(wq, condition) \
601({ \
602 int __ret = 0; \
603 if (!(condition)) { \
604 __wait_event_interruptible_tty(wq, condition, __ret); \
605 } \
606 __ret; \
607})
608
609#define __wait_event_interruptible_tty(wq, condition, ret) \
610do { \
611 DEFINE_WAIT(__wait); \
612 \
613 for (;;) { \
614 prepare_to_wait(&wq, &__wait, TASK_INTERRUPTIBLE); \
615 if (condition) \
616 break; \
617 if (!signal_pending(current)) { \
618 tty_unlock(); \
619 schedule(); \
620 tty_lock(); \
621 continue; \
622 } \
623 ret = -ERESTARTSYS; \
624 break; \
625 } \
626 finish_wait(&wq, &__wait); \
627} while (0)
628
629
575#endif /* __KERNEL__ */ 630#endif /* __KERNEL__ */
576#endif 631#endif