1 #include <u.h> 2 #include <libc.h> 3 #include <fcall.h> 4 5 int waitpid(void)6waitpid(void) 7 { 8 int n; 9 char buf[512], *fld[5]; 10 11 n = await(buf, sizeof buf-1); 12 if(n <= 0) 13 return -1; 14 buf[n] = '\0'; 15 if(tokenize(buf, fld, nelem(fld)) != nelem(fld)){ 16 werrstr("couldn't parse wait message"); 17 return -1; 18 } 19 return atoi(fld[0]); 20 } 21 22