|
@@ -154,6 +154,7 @@ int tty_ioctl(struct inode * inode, struct file * file,
|
|
static int tty_fasync(int fd, struct file * filp, int on);
|
|
static int tty_fasync(int fd, struct file * filp, int on);
|
|
static void release_tty(struct tty_struct *tty, int idx);
|
|
static void release_tty(struct tty_struct *tty, int idx);
|
|
static void __proc_set_tty(struct task_struct *tsk, struct tty_struct *tty);
|
|
static void __proc_set_tty(struct task_struct *tsk, struct tty_struct *tty);
|
|
|
|
+static void proc_set_tty(struct task_struct *tsk, struct tty_struct *tty);
|
|
|
|
|
|
/**
|
|
/**
|
|
* alloc_tty_struct - allocate a tty object
|
|
* alloc_tty_struct - allocate a tty object
|
|
@@ -1558,6 +1559,18 @@ void disassociate_ctty(int on_exit)
|
|
unlock_kernel();
|
|
unlock_kernel();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+/**
|
|
|
|
+ *
|
|
|
|
+ * no_tty - Ensure the current process does not have a controlling tty
|
|
|
|
+ */
|
|
|
|
+void no_tty(void)
|
|
|
|
+{
|
|
|
|
+ struct task_struct *tsk = current;
|
|
|
|
+ if (tsk->signal->leader)
|
|
|
|
+ disassociate_ctty(0);
|
|
|
|
+ proc_clear_tty(tsk);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
|
|
/**
|
|
/**
|
|
* stop_tty - propogate flow control
|
|
* stop_tty - propogate flow control
|
|
@@ -3280,9 +3293,7 @@ int tty_ioctl(struct inode * inode, struct file * file,
|
|
case TIOCNOTTY:
|
|
case TIOCNOTTY:
|
|
if (current->signal->tty != tty)
|
|
if (current->signal->tty != tty)
|
|
return -ENOTTY;
|
|
return -ENOTTY;
|
|
- if (current->signal->leader)
|
|
|
|
- disassociate_ctty(0);
|
|
|
|
- proc_clear_tty(current);
|
|
|
|
|
|
+ no_tty();
|
|
return 0;
|
|
return 0;
|
|
case TIOCSCTTY:
|
|
case TIOCSCTTY:
|
|
return tiocsctty(tty, arg);
|
|
return tiocsctty(tty, arg);
|
|
@@ -3844,7 +3855,7 @@ static void __proc_set_tty(struct task_struct *tsk, struct tty_struct *tty)
|
|
tsk->signal->tty_old_pgrp = NULL;
|
|
tsk->signal->tty_old_pgrp = NULL;
|
|
}
|
|
}
|
|
|
|
|
|
-void proc_set_tty(struct task_struct *tsk, struct tty_struct *tty)
|
|
|
|
|
|
+static void proc_set_tty(struct task_struct *tsk, struct tty_struct *tty)
|
|
{
|
|
{
|
|
spin_lock_irq(&tsk->sighand->siglock);
|
|
spin_lock_irq(&tsk->sighand->siglock);
|
|
__proc_set_tty(tsk, tty);
|
|
__proc_set_tty(tsk, tty);
|