twaitpid.c - plan9port - [fork] Plan 9 from user space
HTML git clone git://src.adamsgaard.dk/plan9port
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
twaitpid.c (293B)
---
1 #include <u.h>
2 #include <libc.h>
3
4 int
5 waitpid(void)
6 {
7 int n;
8 char buf[512], *fld[5];
9
10 n = await(buf, sizeof buf-1);
11 if(n <= 0)
12 return -1;
13 buf[n] = '\0';
14 if(tokenize(buf, fld, nelem(fld)) != nelem(fld)){
15 werrstr("couldn't parse wait message");
16 return -1;
17 }
18 return atoi(fld[0]);
19 }