7 #include <sys/resource.h>
18 SIGILL, "sys: trap: illegal instruction",
19 SIGTRAP, "sys: trace trap",
20 SIGABRT, "sys: abort",
21 SIGEMT, "sys: emulate instruction executed",
22 SIGFPE, "sys: fp: trap",
24 SIGBUS, "sys: bus error",
25 SIGSEGV, "sys: segmentation violation",
28 SIGURG, "sys: urgent condition on socket",
32 SIGCHLD, "sys: child",
35 SIGIO, "sys: i/o possible on fd",
36 SIGXCPU, "sys: cpu time limit exceeded",
37 SIGXFSZ, "sys: file size limit exceeded",
38 SIGVTALRM, "sys: virtual time alarm",
39 SIGPROF, "sys: profiling timer alarm",
40 SIGWINCH, "sys: window size change",
41 SIGINFO, "sys: status request",
47 _p9sigstr(int sig, char *tmp)
51 for(i=0; i<nelem(tab); i++)
54 sprint(tmp, "sys: signal %d", sig);
63 for(i=0; i<nelem(tab); i++)
64 if(strcmp(s, tab[i].str) == 0)
70 await(char *str, int n)
74 char buf[128], tmp[64];
78 pid = wait3(&status, 0, &ru);
81 u = ru.ru_utime.tv_sec*1000+((ru.ru_utime.tv_usec+500)/1000);
82 s = ru.ru_stime.tv_sec*1000+((ru.ru_stime.tv_usec+500)/1000);
83 if(WIFEXITED(status)){
84 status = WEXITSTATUS(status);
86 snprint(buf, sizeof buf, "%d %lud %lud %lud %d", pid, u, s, u+s, status);
88 snprint(buf, sizeof buf, "%d %lud %lud %lud ''", pid, u, s, u+s, status);
89 strecpy(str, str+n, buf);
92 if(WIFSIGNALED(status)){
93 cd = WCOREDUMP(status);
95 snprint(buf, sizeof buf, "%d %lud %lud %lud '%s'", pid, u, s, u+s, _p9sigstr(WTERMSIG(status), tmp));
96 strecpy(str, str+n, buf);