Skip to content

std.os.linux: Implement clone3#22616

Closed
NicoElbers wants to merge 1 commit intoziglang:masterfrom
NicoElbers:clone3
Closed

std.os.linux: Implement clone3#22616
NicoElbers wants to merge 1 commit intoziglang:masterfrom
NicoElbers:clone3

Conversation

@NicoElbers
Copy link
Copy Markdown
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

Comment thread lib/std/os/linux.zig Outdated
Implement clone3 based on the clone(2) man page
@alexrp
Copy link
Copy Markdown
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
Copy Markdown
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