• Home
  • Raw
  • Download

Lines Matching refs:tty

31 int __tty_check_change(struct tty_struct *tty, int sig)  in __tty_check_change()  argument
37 if (current->signal->tty != tty) in __tty_check_change()
43 spin_lock_irqsave(&tty->ctrl_lock, flags); in __tty_check_change()
44 tty_pgrp = tty->pgrp; in __tty_check_change()
45 spin_unlock_irqrestore(&tty->ctrl_lock, flags); in __tty_check_change()
62 tty_warn(tty, "sig=%d, tty->pgrp == NULL!\n", sig); in __tty_check_change()
67 int tty_check_change(struct tty_struct *tty) in tty_check_change() argument
69 return __tty_check_change(tty, SIGTTOU); in tty_check_change()
76 struct tty_struct *tty; in proc_clear_tty() local
78 tty = p->signal->tty; in proc_clear_tty()
79 p->signal->tty = NULL; in proc_clear_tty()
81 tty_kref_put(tty); in proc_clear_tty()
94 static void __proc_set_tty(struct tty_struct *tty) in __proc_set_tty() argument
98 spin_lock_irqsave(&tty->ctrl_lock, flags); in __proc_set_tty()
103 put_pid(tty->session); in __proc_set_tty()
104 put_pid(tty->pgrp); in __proc_set_tty()
105 tty->pgrp = get_pid(task_pgrp(current)); in __proc_set_tty()
106 tty->session = get_pid(task_session(current)); in __proc_set_tty()
107 spin_unlock_irqrestore(&tty->ctrl_lock, flags); in __proc_set_tty()
108 if (current->signal->tty) { in __proc_set_tty()
109 tty_debug(tty, "current tty %s not NULL!!\n", in __proc_set_tty()
110 current->signal->tty->name); in __proc_set_tty()
111 tty_kref_put(current->signal->tty); in __proc_set_tty()
114 current->signal->tty = tty_kref_get(tty); in __proc_set_tty()
118 static void proc_set_tty(struct tty_struct *tty) in proc_set_tty() argument
121 __proc_set_tty(tty); in proc_set_tty()
128 void tty_open_proc_set_tty(struct file *filp, struct tty_struct *tty) in tty_open_proc_set_tty() argument
133 !current->signal->tty && in tty_open_proc_set_tty()
134 tty->session == NULL) { in tty_open_proc_set_tty()
150 __proc_set_tty(tty); in tty_open_proc_set_tty()
158 struct tty_struct *tty; in get_current_tty() local
162 tty = tty_kref_get(current->signal->tty); in get_current_tty()
164 return tty; in get_current_tty()
191 int tty_signal_session_leader(struct tty_struct *tty, int exit_session) in tty_signal_session_leader() argument
198 if (tty->session) { in tty_signal_session_leader()
199 do_each_pid_task(tty->session, PIDTYPE_SID, p) { in tty_signal_session_leader()
201 if (p->signal->tty == tty) { in tty_signal_session_leader()
202 p->signal->tty = NULL; in tty_signal_session_leader()
214 spin_lock(&tty->ctrl_lock); in tty_signal_session_leader()
215 tty_pgrp = get_pid(tty->pgrp); in tty_signal_session_leader()
216 if (tty->pgrp) in tty_signal_session_leader()
217 p->signal->tty_old_pgrp = get_pid(tty->pgrp); in tty_signal_session_leader()
218 spin_unlock(&tty->ctrl_lock); in tty_signal_session_leader()
220 } while_each_pid_task(tty->session, PIDTYPE_SID, p); in tty_signal_session_leader()
259 struct tty_struct *tty; in disassociate_ctty() local
264 tty = get_current_tty(); in disassociate_ctty()
265 if (tty) { in disassociate_ctty()
266 if (on_exit && tty->driver->type != TTY_DRIVER_TYPE_PTY) { in disassociate_ctty()
267 tty_vhangup_session(tty); in disassociate_ctty()
269 struct pid *tty_pgrp = tty_get_pgrp(tty); in disassociate_ctty()
277 tty_kref_put(tty); in disassociate_ctty()
296 tty = tty_kref_get(current->signal->tty); in disassociate_ctty()
299 if (tty) { in disassociate_ctty()
302 tty_lock(tty); in disassociate_ctty()
303 spin_lock_irqsave(&tty->ctrl_lock, flags); in disassociate_ctty()
304 put_pid(tty->session); in disassociate_ctty()
305 put_pid(tty->pgrp); in disassociate_ctty()
306 tty->session = NULL; in disassociate_ctty()
307 tty->pgrp = NULL; in disassociate_ctty()
308 spin_unlock_irqrestore(&tty->ctrl_lock, flags); in disassociate_ctty()
309 tty_unlock(tty); in disassociate_ctty()
310 tty_kref_put(tty); in disassociate_ctty()
346 static int tiocsctty(struct tty_struct *tty, struct file *file, int arg) in tiocsctty() argument
350 tty_lock(tty); in tiocsctty()
353 if (current->signal->leader && (task_session(current) == tty->session)) in tiocsctty()
360 if (!current->signal->leader || current->signal->tty) { in tiocsctty()
365 if (tty->session) { in tiocsctty()
374 session_clear_tty(tty->session); in tiocsctty()
387 proc_set_tty(tty); in tiocsctty()
390 tty_unlock(tty); in tiocsctty()
401 struct pid *tty_get_pgrp(struct tty_struct *tty) in tty_get_pgrp() argument
406 spin_lock_irqsave(&tty->ctrl_lock, flags); in tty_get_pgrp()
407 pgrp = get_pid(tty->pgrp); in tty_get_pgrp()
408 spin_unlock_irqrestore(&tty->ctrl_lock, flags); in tty_get_pgrp()
446 static int tiocgpgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t __user *p) in tiocgpgrp() argument
454 if (tty == real_tty && current->signal->tty != real_tty) in tiocgpgrp()
473 static int tiocspgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t __user *p) in tiocspgrp() argument
490 if (!current->signal->tty || in tiocspgrp()
491 (current->signal->tty != real_tty) || in tiocspgrp()
523 static int tiocgsid(struct tty_struct *tty, struct tty_struct *real_tty, pid_t __user *p) in tiocgsid() argument
532 if (tty == real_tty && current->signal->tty != real_tty) in tiocgsid()
552 long tty_jobctrl_ioctl(struct tty_struct *tty, struct tty_struct *real_tty, in tty_jobctrl_ioctl() argument
559 if (current->signal->tty != tty) in tty_jobctrl_ioctl()
566 return tiocgpgrp(tty, real_tty, p); in tty_jobctrl_ioctl()
568 return tiocspgrp(tty, real_tty, p); in tty_jobctrl_ioctl()
570 return tiocgsid(tty, real_tty, p); in tty_jobctrl_ioctl()