Skip to content

Add CLOEXEC and NONBLOCK to pipe2#99

Merged
Arshia001 merged 2 commits intomainfrom
fix-cloexec-for-pipe2
Feb 13, 2026
Merged

Add CLOEXEC and NONBLOCK to pipe2#99
Arshia001 merged 2 commits intomainfrom
fix-cloexec-for-pipe2

Conversation

@zebreus
Copy link
Member

@zebreus zebreus commented Feb 12, 2026

Currently, our pipe2 implementation just swallows all flags, even though they work. This PR applies CLOEXEC and NONBLOCK as they are easy. CLOEXEC is 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 CLOFORK flag, but we don't support it.

Copilot AI review requested due to automatic review settings February 12, 2026 11:26
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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_CLOEXEC via fcntl(..., F_SETFD, FD_CLOEXEC) on both ends of the pipe.
  • Apply O_NONBLOCK via fcntl(..., 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.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

@Arshia001 Arshia001 merged commit 4048aab into main Feb 13, 2026
9 checks passed
@Arshia001 Arshia001 deleted the fix-cloexec-for-pipe2 branch February 13, 2026 12:27
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.

3 participants