uwait(PCI) 6 January 1993 uwait(PCI) Name uwait - poll for the exit status of a UNIX operating system process Syntax #include <pcilib.h> #include <memmdl.h> pid_t uwait(drvnum, status, blockflag) int drvnum, *status, blockflag; Description uwait is a DOS function call that checks to see if a UNIX operating sys- tem command started with the uexec function has terminated. The UNIX op- erating system program must have been executed with the option to save the exit status. drvnum is the drive number of the host on which to check. Drive letters and numbers correspond in the following way: A: = 1, B: = 2, and so forth. If drvnum is 0, the uwait is performed on the host associated with the current drive. The blockflag controls whether the call is blocking or nonblocking. If blockflag is "true", the call blocks. If blockflag is "false", the call does not block. Only the nonblocking form of this call is now supported. Use sleeph to suspend a DOS program. Return value The return values for this call are: -1 No children for which status is being saved. ~0 No children have exited. >0 Process ID of exited child and status is set. The low byte of status is the exit status supplied by the terminating process or, if it was terminated by a signal, the signal that terminated it. The following values return in the high byte of the status field: 0 Low byte is exit status. 1 Low byte is signal terminating the process. 2 Low byte is signal terminating process and generating a core dump. 3 Process was not started by uexec or status already collected. Example : : int driveNum; int status; int blockFlag; pid_t retVal; : : /* ** Use UWAIT to wait for a child process ** on virtual drive D: (4) to exit. ** ** Since only the nonblocking form of this ** function is supported (blockFlag = 0), we ** use PCILIB's sleep_h() function in our ** busy loop. */ driveNum = 4; blockFlag = 0; /* loop till a child exits */ while ( (retVal = uwait(driveNum, &status, blockFlag)) == 0L ) sleep_h(25); /* sleep for quarter of a second */ if (retVal == -1L) errorHandler(); else checkStatus(); : : See also sleeph(PCI), uexec(PCI), ukill(PCI)