[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Job control fix
Here's a patch to fix job control handling. Don't be surprised if
you get some offsets while applying the patch,
tty.c: ++entropy@terminator.rs.itd.umich.edu
Fix SIGTTIN/SIGTTOU job control.
--- 1.10.1.3 1994/02/27 04:03:08
+++ tty.c 1994/02/27 04:14:34
@@ -658,8 +658,16 @@
}
/* job control check */
-
- if (tty->pgrp && tty->pgrp != curproc->pgrp) {
+/*
+entropy: only do the job control if SIGTTIN is neither blocked nor ignored,
+and only for the controlling tty (IEEE 1003.1-1990 7.1.1.4 70-78).
+BUG: if the process group is orphaned or SIGTTIN *is* blocked or ignored,
+we should return EIO instead of signalling.
+*/
+
+ if ((tty->pgrp && tty->pgrp != curproc->pgrp) &&
+ (f->fc.dev == curproc->control->fc.dev) &&
+ (f->fc.index == curproc->control->fc.index)) {
TRACE(("job control: tty pgrp is %d proc pgrp is %d",
tty->pgrp, curproc->pgrp));
killgroup(curproc->pgrp, SIGTTIN);
@@ -787,8 +795,18 @@
}
/* job control checks */
/* AKP: added T_TOSTOP; don't stop BG output if T_TOSTOP is clear */
+/*
+entropy: only do the job control if SIGTTOU is neither blocked nor ignored,
+and only for the controlling tty (IEEE 1003.1-1990 7.1.1.4 79-87).
+BUG: if the process group is orphaned and SIGTTOU *is not* blocked
+or ignored, we should return EIO instead of signalling.
+*/
if (tty->pgrp && tty->pgrp != curproc->pgrp &&
- (tty->sg.sg_flags & T_TOSTOP)) {
+ (tty->sg.sg_flags & T_TOSTOP) &&
+ (curproc->sighandle[SIGTTOU] != SIG_IGN) &&
+ ((curproc->sigmask & (1L << SIGTTOU)) == 0L) &&
+ (f->fc.dev == curproc->control->fc.dev) &&
+ (f->fc.index == curproc->control->fc.index)) {
TRACE(("job control: tty pgrp is %d proc pgrp is %d",
tty->pgrp, curproc->pgrp));
killgroup(curproc->pgrp, SIGTTOU);
--
entropy -- it's not just a good idea, it's the second law.
Personal mail: entropy@gnu.ai.mit.edu
MiNT library mail: entropy@terminator.rs.itd.umich.edu
"what do you have against octal?" -jrb