I recently needed to write some code that directly invokes libc::wait4
, so that it can retrieve the rusage
of the child process in addition to the exit status. libc::wait4
expects a libc::pid_t
, a type alias for i32
. However, Child::id()
returns a u32
. As a result, I end up having to use an as
cast.
This seems like it ought to be fixable through type improvements. What change would it take to call libc::wait4
without a cast? Should Child
have a method that returns a type compatible with OS PIDs? (Could we make that method portable, if possible?)
(Obviously we can’t change the type of the existing Child::id()
method, but we could potentially add a new method that returns the correct type.)