daveb@laidbak.UUCP (Dave Burton) (12/24/87)
The following program produces disconcerting output on a Tandy 6000 with 3.2 Xenix Core, 3.0 Development System: main() { setpgrp(); if (fork() == 0) printf(" child: pid = %d pgrp = %d\n", getpid(), getpgrp()); else printf("parent: pid = %d pgrp = %d\n", getpid(), getpgrp()); } Tandy 6000: [cc ...] parent: pid = 9536 pgrp = 9536 child: pid = 9537 pgrp = 9537 ^^^^----!!! Sun 3/160, 3.4 SunOS: [/usr/5bin/cc ...] parent: pid = 1074 pgrp = 1074 child: pid = 1074 pgrp = 1074 A somewhat more serious bug is illustrated in the following code: /* Bach, pg. 211 */ #include <signal.h> main() { register int i; setpgrp(); for (i = 0; i < 10; i++) { if (fork() == 0) { if (i & 1) setpgrp(); printf("pid = %d pgrp = %d\n", getpid(), getpgrp()); pause(); } } kill(0, SIGINT); } The Tandy produces a newline and no children! [cc ...] The Sun works, sortof. It spits out 7 lines of info (because no exit()) and leaves only 4 orphans. [/usr/5bin/cc ...] A Sequent works properly, giving 10 output lines and 5 orphans. [att cc ...] What gives? How many other inconsistencies are there in the Xenix kernel? Do the 3.1 and earlier versions exhibit the same behaviour? -- --------------------"Well, it looked good when I wrote it"--------------------- Verbal: Dave Burton Net: ...!ihnp4!laidbak!daveb V-MAIL: (312) 505-9100 x325 USSnail: 1901 N. Naper Blvd. #include <disclaimer.h> Naperville, IL 60540