This patch set aims to add and use the wait4 system call. wait4(2) differs from waitpid(2) in that it optionally returns resource usage for the terminated child - the same resource usage information also returned by getrusage(2). However, as it turned out, our implementation for getrusage(2) was not exactly returning the right information. Since it is better to return no information than wrong information, the first few patches actually strip down its implementation to a bare minimum. On top of that, an ABI change allows getrusage and wait4 to use the same information gathering infrastructure in the future.
The wait4 system call itself now returns the absolute minimum information for it to be useful: the user and system times consumed by the terminated child's process tree. All other "rusage" fields will have to be populated later, although this is tricky: at the time that PM completes a wait4 call, the process no longer exists as far as services other than PM is concerned. PM could gather all resource usage information from other services upon process exit, but this may be expensive in the common case (ie when no resource usage is requested). Solving this is part of future work.
As users of the wait4 system call, we import csh and time - the former mainly to support the import of the latter. Since I am not a csh user myself, the csh port may have several rough edges. Please report any issues (aside from missing job control support).
- PM: make child time accumulation POSIX complianthttp://gerrit.minix3.org/#/c/3200/
- getrusage(2): zero out ru_i[xds]rss fieldshttp://gerrit.minix3.org/#/c/3201/
- getrusage(2): zero out ru_nsignals fieldhttp://gerrit.minix3.org/#/c/3202/
- Rework getrusage(2) infrastructurehttp://gerrit.minix3.org/#/c/3203/
- PM: add support for wait4(2)http://gerrit.minix3.org/#/c/3204/
- Import NetBSD csh(1)http://gerrit.minix3.org/#/c/3205/
- Import NetBSD time(1)