From: Kenn H. <ke...@us...> - 2003-02-17 01:15:08
|
Update of /cvsroot/linux-vax/kernel-2.5/drivers/char In directory sc8-pr-cvs1:/tmp/cvs-serv6356/drivers/char Modified Files: tty_io.c Log Message: Merge with 2.5.37 Index: tty_io.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/drivers/char/tty_io.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- tty_io.c 16 Feb 2003 01:05:23 -0000 1.6 +++ tty_io.c 17 Feb 2003 01:15:01 -0000 1.7 @@ -432,6 +432,7 @@ struct file * cons_filp = NULL; struct task_struct *p; struct list_head *l; + struct pid *pid; int closecount = 0, n; if (!tty) @@ -496,17 +497,17 @@ } read_lock(&tasklist_lock); - for_each_process(p) { - if ((tty->session > 0) && (p->session == tty->session) && - p->leader) { - send_sig(SIGHUP,p,1); - send_sig(SIGCONT,p,1); + if (tty->session > 0) + for_each_task_pid(tty->session, PIDTYPE_SID, p, l, pid) { + if (p->tty == tty) + p->tty = NULL; + if (!p->leader) + continue; + send_sig(SIGHUP, p, 1); + send_sig(SIGCONT, p, 1); if (tty->pgrp > 0) p->tty_old_pgrp = tty->pgrp; } - if (p->tty == tty) - p->tty = NULL; - } read_unlock(&tasklist_lock); tty->flags = 0; @@ -571,6 +572,8 @@ { struct tty_struct *tty = current->tty; struct task_struct *p; + struct list_head *l; + struct pid *pid; int tty_pgrp = -1; lock_kernel(); @@ -598,9 +601,8 @@ tty->pgrp = -1; read_lock(&tasklist_lock); - for_each_process(p) - if (p->session == current->session) - p->tty = NULL; + for_each_task_pid(current->session, PIDTYPE_SID, p, l, pid) + p->tty = NULL; read_unlock(&tasklist_lock); unlock_kernel(); } @@ -1221,12 +1223,15 @@ */ if (tty_closing || o_tty_closing) { struct task_struct *p; + struct list_head *l; + struct pid *pid; read_lock(&tasklist_lock); - for_each_process(p) { - if (p->tty == tty || (o_tty && p->tty == o_tty)) + for_each_task_pid(tty->session, PIDTYPE_SID, p, l, pid) + p->tty = NULL; + if (o_tty) + for_each_task_pid(o_tty->session, PIDTYPE_SID, p,l, pid) p->tty = NULL; - } read_unlock(&tasklist_lock); if (redirect == tty || (o_tty && redirect == o_tty)) @@ -1540,6 +1545,10 @@ static int tiocsctty(struct tty_struct *tty, int arg) { + struct list_head *l; + struct pid *pid; + task_t *p; + if (current->leader && (current->session == tty->session)) return 0; @@ -1558,12 +1567,10 @@ /* * Steal it away */ - struct task_struct *p; read_lock(&tasklist_lock); - for_each_process(p) - if (p->tty == tty) - p->tty = NULL; + for_each_task_pid(tty->session, PIDTYPE_SID, p, l, pid) + p->tty = NULL; read_unlock(&tasklist_lock); } else return -EPERM; |