mercer@npdiss1.StPaul.NCR.COM (Dan Mercer) (08/22/90)
More porting help needed - what is an equivalent SYSV r3.2 call for a BSD wait3(). Specifically, a wait3 (&status, WNOHANG, ...) TIA -- Dan Mercer Reply-To: mercer@npdiss1.StPaul.NCR.COM (Dan Mercer) "MAN - the only one word oxymoron in the English Language"
pim@cti-software.nl (Pim Zandbergen) (08/22/90)
mercer@npdiss1.StPaul.NCR.COM (Dan Mercer) writes: >More porting help needed - what is an equivalent SYSV r3.2 call for >a BSD wait3(). Specifically, a wait3 (&status, WNOHANG, ...) There is no real equivalent, but sometimes there is a workaround. This depends on the code. Usually wait3() is used to release dead child processes from their zombie-state. This can be accomplished in SysV by ignoring SIGCLD : signal(SIGCLD, SIG_IGN); This will prevent the need for waiting for dead child processes. Just remove all the wait3 stuff. I used this workaround for porting tinyMUD (the game) and OLWM (the X11 window manager). -- Pim Zandbergen domain : pim@cti-software.nl CTI Software BV uucp : uunet!mcsun!hp4nl!ctisbv!pim Laan Copes van Cattenburch 70 phone : +31 70 3542302 2585 GD The Hague, The Netherlands fax : +31 70 3512837
jbev@iscden.UUCP ( J B Systems) (08/23/90)
In article <114@npdiss1.StPaul.NCR.COM> mercer@npdiss1.StPaul.NCR.COM (Dan Mercer) writes: >More porting help needed - what is an equivalent SYSV r3.2 call for >a BSD wait3(). Specifically, a wait3 (&status, WNOHANG, ...) > >TIA >-- > >Dan Mercer >Reply-To: mercer@npdiss1.StPaul.NCR.COM (Dan Mercer) >"MAN - the only one word oxymoron in the English Language" Here is the code I used to emulate the wait3 BSD function on SCO UNIX. Hope it will fix you right up. -------------------code fragments follow--------------- register int childPid; #if defined(SYSV_UNIX) while ((childPid = waitpid(NULL, &w, WUNTRACED | WNOHANG)) > 0) { #else while ((childPid = wait3(&w, WUNTRACED | WNOHANG, (struct rusage *)NULL)) > 0) { #endif if (WIFSTOPPED(w)) { fprintf(stderr,"%s: Child %d Stopped.\r\n", ProgramName, childPid); } else if (WIFEXITED(w)) { fprintf(stderr,"%s: Child %d Exited.\r\n", ProgramName, childPid); } else if (WIFSIGNALED(w)) { fprintf(stderr,"%s: Child %d Killed.\r\n", ProgramName, childPid); } --------------------end of code-------------------- Jim Bevier --- +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ +=+ From the mountains of Colorado: +=+ +=+ when it's not snowing, the sun is shining +=+ +=+ Jim Bevier - J B Systems (303)-697-1038 +=+ +=+ 10136 Horizon View, Morrison, CO 80465 +=+ +=+ jbev@iscden.UUCP or ...{ico,boulder}!iscden!jbev +=+ +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
guy@auspex.auspex.com (Guy Harris) (08/24/90)
>Here is the code I used to emulate the wait3 BSD function on SCO UNIX. >Hope it will fix you right up. Probably not, unless his S5R3.2 system is POSIX-compliant; "waitpid()" is a POSIXism, and not in S5R3.1 or earlier versions from AT&T. It may not be in S5R3.2, either....