Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the cloudlibc pipe2 implementation to actually apply common flags on the returned pipe file descriptors, instead of ignoring them, improving compatibility with callers (e.g., musl code paths that pass O_CLOEXEC).
Changes:
- Apply
O_CLOEXECviafcntl(..., F_SETFD, FD_CLOEXEC)on both ends of the pipe. - Apply
O_NONBLOCKviafcntl(..., F_SETFL, O_NONBLOCK)on both ends of the pipe. - Add
<fcntl.h>include to support the new flag handling.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
1a88f58 to
8e9187a
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Currently, our
pipe2implementation just swallows all flags, even though they work. This PR appliesCLOEXECandNONBLOCKas they are easy.CLOEXECis tested and works.For
CLOEXEC, this is not fully POSIX-compliant because the standard requires that we set it atomically. This should not really matter for most real-world usecases.The latest POSIX versions also include a
CLOFORKflag, but we don't support it.