SYSV r3.2 - how to implement wait3 BSD function

J B Systems jbev at iscden.UUCP
Thu Aug 23 04:00:25 AEST 1990


In article <114 at npdiss1.StPaul.NCR.COM> mercer at 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 at 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 at iscden.UUCP  or  ...{ico,boulder}!iscden!jbev      +=+
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+



More information about the Comp.unix.questions mailing list