tty: Combine SIGTTOU/SIGTTIN handling
[linux-2.6-block.git] / drivers / tty / n_tty.c
index b09023b071696c2a5d25e003dcff798b42235602..fb8ccbfdbb30bfa41ef67dfd70e4d61e78d31241 100644 (file)
@@ -1179,8 +1179,6 @@ static void n_tty_receive_break(struct tty_struct *tty)
                put_tty_queue('\0', ldata);
        }
        put_tty_queue('\0', ldata);
-       if (waitqueue_active(&tty->read_wait))
-               wake_up_interruptible_poll(&tty->read_wait, POLLIN);
 }
 
 /**
@@ -1237,8 +1235,6 @@ static void n_tty_receive_parity_error(struct tty_struct *tty, unsigned char c)
                        put_tty_queue('\0', ldata);
        } else
                put_tty_queue(c, ldata);
-       if (waitqueue_active(&tty->read_wait))
-               wake_up_interruptible_poll(&tty->read_wait, POLLIN);
 }
 
 static void
@@ -2142,37 +2138,15 @@ extern ssize_t redirected_tty_write(struct file *, const char __user *,
 
 static int job_control(struct tty_struct *tty, struct file *file)
 {
-       struct pid *pgrp;
-
        /* Job control check -- must be done at start and after
           every sleep (POSIX.1 7.1.1.4). */
        /* NOTE: not yet done after every sleep pending a thorough
           check of the logic of this change. -- jlc */
        /* don't stop on /dev/console */
-       if (file->f_op->write == redirected_tty_write ||
-           current->signal->tty != tty)
+       if (file->f_op->write == redirected_tty_write)
                return 0;
 
-       rcu_read_lock();
-       pgrp = task_pgrp(current);
-
-       spin_lock_irq(&tty->ctrl_lock);
-       if (!tty->pgrp)
-               printk(KERN_ERR "n_tty_read: no tty->pgrp!\n");
-       else if (pgrp != tty->pgrp) {
-               spin_unlock_irq(&tty->ctrl_lock);
-               if (is_ignored(SIGTTIN) || is_current_pgrp_orphaned()) {
-                       rcu_read_unlock();
-                       return -EIO;
-               }
-               kill_pgrp(pgrp, SIGTTIN, 1);
-               rcu_read_unlock();
-               set_thread_flag(TIF_SIGPENDING);
-               return -ERESTARTSYS;
-       }
-       spin_unlock_irq(&tty->ctrl_lock);
-       rcu_read_unlock();
-       return 0;
+       return __tty_check_change(tty, SIGTTIN);
 }