Skip to content

Reap leftover zombie processes #36

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

Merged
merged 1 commit into from
Jun 9, 2023

Conversation

otargowski
Copy link
Contributor

Resolves #33.

We don't have to use the more complex waitid(), as the child is sure to have exited already.

if (waitpid(-1, NULL, WNOHANG) == -1 && errno != ECHILD) {
throw SystemException(
std::string("final waitpid failed: ") + strerror(errno));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this could be simplified DRY-d by using withErrnoCheck(description, ignoredErrnos, func, args...)

Like this:

withErrnoCheck("final waitpid", {ECHILD}, waitpid, -1, NULL, WNOHANG)

That'd be more consistent with other code.

Unless you find withErrnoCheck confusing, then we can merge this as is.

@Wolf480pl Wolf480pl merged commit 676c4c3 into sio2project:master Jun 9, 2023
@otargowski otargowski deleted the zombies-PR branch July 7, 2023 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sio2jail leaves zombie processes
2 participants