Skip to content

std.os.linux: Implement clone3 #22616

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

Closed
wants to merge 1 commit into from
Closed

Conversation

NicoElbers
Copy link
Contributor

Implements clone3 based on the clone(2) man page.

I did my best to follow the convention that std.os.linux contains the straight syscall, and std.posix contains the syscall with error handling. If I broke some convention please let me know.

I did not add the ERESTARTNOINTR error case because I am unsure where exactly to add the errno code (only to linux, everywhere and if so where all is everywhere). If that's a prerequisite for merging please point me to where to add the errno code.

Finally in line with the other structs I found in std.os.linux I added minimal documentation to the fields and none to the flags. If I were to add the man page documentation it'd explode to a couple hundred lines which seems overkill.

Closes #18508

Verified

This commit was signed with the committer’s verified signature.
NicoElbers Nico Elbers
Implement clone3 based on the clone(2) man page
@alexrp
Copy link
Member

alexrp commented Jan 26, 2025

Mm, there's overlap with #22368 here. I think it'd be ok to take the addition of the clone3 syscall wrapper separately from the main change in #22368, but you should probably coordinate with @ruihe774 then.

@NicoElbers
Copy link
Contributor Author

This is an incorrect implementation, see #22368 (comment)

@NicoElbers NicoElbers closed this Jan 26, 2025
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.

std.linux: expose clone3 to get CLONE_PIDFD for race-free signaling via pidfd
3 participants