patch-1.3.39 linux/drivers/char/tty_io.c
Next file: linux/drivers/net/3c501.c
Previous file: linux/drivers/char/stallion.c
Back to the patch index
Back to the overall index
- Lines: 58
- Date:
Wed Nov 8 07:06:25 1995
- Orig file:
v1.3.38/linux/drivers/char/tty_io.c
- Orig date:
Tue Oct 10 18:46:34 1995
diff -u --recursive --new-file v1.3.38/linux/drivers/char/tty_io.c linux/drivers/char/tty_io.c
@@ -443,22 +443,28 @@
* (2) Clears the tty from being controlling the session
* (3) Clears the controlling tty for all processes in the
* session group.
+ *
+ * The argument on_exit is set to 1 if called when a process is
+ * exiting; it is 0 if called by the ioctl TIOCNOTTY.
*/
-void disassociate_ctty(int priv)
+void disassociate_ctty(int on_exit)
{
struct tty_struct *tty = current->tty;
struct task_struct *p;
- if (!tty) {
+ if (tty) {
+ if (on_exit)
+ tty_vhangup(tty);
+ } else {
if (current->tty_old_pgrp) {
- kill_pg(current->tty_old_pgrp, SIGHUP, priv);
- kill_pg(current->tty_old_pgrp, SIGCONT, priv);
+ kill_pg(current->tty_old_pgrp, SIGHUP, on_exit);
+ kill_pg(current->tty_old_pgrp, SIGCONT, on_exit);
}
return;
}
if (tty->pgrp > 0) {
- kill_pg(tty->pgrp, SIGHUP, priv);
- kill_pg(tty->pgrp, SIGCONT, priv);
+ kill_pg(tty->pgrp, SIGHUP, on_exit);
+ kill_pg(tty->pgrp, SIGCONT, on_exit);
}
current->tty_old_pgrp = 0;
@@ -1781,11 +1787,6 @@
{
if (sizeof(struct tty_struct) > PAGE_SIZE)
panic("size of tty structure > PAGE_SIZE!");
- if (register_chrdev(TTY_MAJOR,"tty",&tty_fops))
- panic("unable to get major %d for tty device", TTY_MAJOR);
- if (register_chrdev(TTYAUX_MAJOR,"cua",&tty_fops))
- panic("unable to get major %d for tty device", TTYAUX_MAJOR);
-
kbd_init();
rs_init();
#ifdef CONFIG_SCC
@@ -1802,5 +1803,10 @@
#endif
pty_init();
vcs_init();
+ if (register_chrdev(TTY_MAJOR,"tty",&tty_fops))
+ panic("unable to get major %d for tty device", TTY_MAJOR);
+ if (register_chrdev(TTYAUX_MAJOR,"cua",&tty_fops))
+ panic("unable to get major %d for tty device", TTYAUX_MAJOR);
+
return 0;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov
with Sam's (original) version of this