home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
GEMini Atari
/
GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso
/
zip
/
mint
/
mntlib16.lzh
/
MNTLIB16
/
WAIT.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-08-03
|
681b
|
38 lines
/*
* wait.c: a version of wait() for MiNT
*/
#include <errno.h>
#include <osbind.h>
#include "mintbind.h"
/* under TOS, vfork() puts its result in __waitval */
extern long __waitval; /* in thread.c */
int wait(status)
int *status;
{
long r;
int exit_status, sig_term, pid;
extern int __mint;
if (__mint == 0) { /* wait is faked by vfork() */
r = __waitval;
__waitval = -ENOENT;
}
else
r = Pwait3(0, 0L);
if (r < 0) {
errno = -r;
return -1;
}
pid = (r & 0xffff0000L) >> 16;
exit_status = r & 0x000000ffL;
sig_term = (r & 0x00007f00L) >> 8;
if (status) {
*status = (exit_status << 8) | sig_term;
}
return pid;
}