[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: another 1.10 job control bug?



Nicholas S Castellano writes:

> > After having been on holiday last week I've digged myself through the pile
> >of patches that arose in my mailbox yesterday, namely those of SRU, NOX and
> >AS. I sort of remember there were also some fixes dealing with job control.
> >Something seems to have gone wrong with them, cause now I'm only able to log
> >in once at the console, every following getty gets stopped after some:
> >
> >pid  91 (getty): Fcntl(0, cmd=0x5401)
> >pid  91 (getty): Fcntl mode 5401: calling ioctl
> >pid  91 (getty): job control: tty pgrp is 16 proc pgrp is 91
> >pid  91 (getty): killgroup 91 22
> >
> > This did not happen in the "clean" version of 1.10, and it does not happen
> >on any vconsole (2 Juergen: looks like they're really good 4 something... :-)
> 
> In one of the patches sent out by nox, there was a 'fix' I sent out a
> few weeks ago for a problem someone described in tty.c.  I think the
> 'fix' is actually worse than the problem, and that code should *not*
> be disabled.
> 
> The code in question is to release the controlling tty (by setting
> it's pgrp to 0) when the process group leader attached to that process
> exits.

 i think the problem was when there are several processes in a group the
leader isn't always the one that exits last, and then you could no longer
signal the others from the terminal after that. (^c, ^z, ...)  of course
you could say the parent should always catch SIGCHLD and then TIOCSPGRP
whenever the first process in a pipe (for example) exited but somehow i
doubt thats a real solution...  (although i did put such a hack in ksh
first... :)
> 
> Try undoing that patch and see if it helps.

 or try this one:

Index: dosmem.c
@@ -748,6 +749,7 @@
 		}
 	}
 
+#if 0
 /* release the controlling terminal, if we're a process group leader */
 	fp = curproc->handle[-1];
 	if (fp && is_terminal(fp) && curproc->pgrp == curproc->pid) {
@@ -755,6 +757,26 @@
 		if (curproc->pgrp == tty->pgrp)
 			tty->pgrp = 0;
 	}
+#else
+/* release the controlling terminal, if we're the last member of this pgroup */
+	fp = curproc->handle[-1];
+	if (fp && is_terminal(fp)) {
+		struct tty *tty = (struct tty *)fp->devinfo;
+		int pgrp = curproc->pgrp;
+
+		if (pgrp == tty->pgrp) {
+			PROC *p;
+			int found = 0;
+
+			for (p = proclist; p; p = p->gl_next) {
+				if (p->pgrp == pgrp && p->handle[-1] == fp)
+					found++;
+			}
+			if (!found)
+				tty->pgrp = 0;
+		}
+	}
+#endif
 
 /* close all files */
 	for (i = MIN_HANDLE; i < MAX_OPEN; i++) {

i hope that finalls does it. :)

 cheers
	Juergen
-- 
J"urgen Lock / nox@jelal.north.de / UUCP: ..!uunet!unido!uniol!jelal!nox
								...ohne Gewehr
PGP public key fingerprint =  8A 18 58 54 03 7B FC 12  1F 8B 63 C7 19 27 CF DA