Phantom CPU gobbler?!
Richard Kuhns
rjk at sawmill.sawmill.uucp
Tue Jul 10 07:28:17 AEST 1990
In article <1277 at tuewsd.win.tue.nl> wsinpdb at lso.win.tue.nl (Paul de Bra) writes:
Sender: wsinpdb at win.tue.nl (Paul de Bra)
Organization: Eindhoven University of Technology, The Netherlands
Lines: 15
In article <960004 at teecs.UUCP> belkin at teecs.UUCP (Hershel Belkin) writes:
>...
>Every so often I fins a shell process (sh or ksh) which has somehow
>become dis-associated with its logon session. By this I mean that
>the shell's PPID is "1", and the user is no longer logged on.
>...
This is the infamous trap/signal/eof bug, which I don't know exactly,
but some combination of trapping and sending signals and having
end-of-file on standard input causes an infinite loop in the Bourne
and Korn shell, at least in some Unix versions which haven't fixed the bug.
Anyone know the full scoop?
Paul.
I don't know if this is the *full* scoop or not, but some versions of Korn
shell and Bourne shell have problems if a program leaves the terminal
(stdin) in non-blocking mode when you've set `ignoreeof'. The following
little program will exercise this bug, if that's what it is.
Rich Kuhns
newton.physics.purdue.edu!sawmill!rjk
==============================cut here==============================
/* killksh.c */
#include <stdio.h>
#include <fcntl.h>
extern int errno;
main(argc, argv)
int argc;
char *argv[];
{
char *progname;
int flags;
progname = *argv;
if ((flags = fcntl(0, F_GETFL, 0)) < 0) {
fprintf(stderr, "%s:can't get flags (errno=%d)\n", progname);
exit(1);
}
if (fcntl(0, F_SETFL, flags|O_NDELAY) < 0) {
fprintf(stderr, "%s:can't set flags (errno=%d)\n", progname, errno);
exit(1);
}
fprintf(stderr, "shell should crash in 3 seconds\n");
sleep(3);
exit(0);
}
More information about the Comp.unix.wizards
mailing list