Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please support using wait4 for Child and Command #61992

Open
joshtriplett opened this issue Jun 20, 2019 · 2 comments
Open

Please support using wait4 for Child and Command #61992

joshtriplett opened this issue Jun 20, 2019 · 2 comments
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. O-linux Operating system: Linux T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@joshtriplett
Copy link
Member

On Linux, the wait4 system call provides all the same information as waitpid, but additionally returns a struct rusage containing the resource usage of the child process. I'd love to have Child and Command provide a platform-specific extension trait that uses wait4, and then returns the struct rusage in addition to the exit status.

@jonas-schievink jonas-schievink added C-feature-request Category: A feature request, i.e: not implemented / a PR. O-linux Operating system: Linux T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Jun 20, 2019
@cuviper
Copy link
Member

cuviper commented Jun 25, 2019

It would be nice to just add methods to ExitStatusExt for ExitStatus, as this is where we use waitpid today, but currently that type is just a c_int wrapper, so adding struct rusage would be a lot.

So I guess you're suggesting to provide alternatives for Command::status and Child::{wait, try_wait}, and maybe some alternatives for the methods returning Output too?

@joshtriplett
Copy link
Member Author

Replacements for the whole range of functions seem like overkill; it'd suffice to have some way to call wait4 on a child (returning an rusage and a status) and then separately obtain the output if desired and captured.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. O-linux Operating system: Linux T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants