-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Enable pipe2() on *BSD #14556
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
base: unstable
Are you sure you want to change the base?
Enable pipe2() on *BSD #14556
Conversation
Before this PR, `pipe2()` is only enabled on Linux and FreeBSD while `pipe2()` is available on *BSD. This PR enables `pipe2()` for the rest of *BSD: DragonFlyBSD, NetBSD and OpenBSD. - [pipe2 on DraonFlyBSD](https://man.dragonflybsd.org/?command=pipe§ion=2) - [__DragonFly_version for pipe2](https://github.com/DragonFlyBSD/DragonFlyBSD/blob/7485684fa5c3fadb6c7a1da0d8bb6ea5da4e0f2f/sys/sys/param.h#L121) - [pipe2 on NetBSD](https://man.netbsd.org/pipe.2) - [pipe2 on OpenBSD](https://man.openbsd.org/pipe.2)
skaslev
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OTOH all of those *BSD added pipe2() more than 10 years ago.
The same is true for FreeBSD and we've been using pipe2() unconditionally of OS version so far.
Maybe we use pipe2() version unconditionally on all *BSDs; alternatively we can add FreeBSD version check > 10.0 for completeness.
@sundb wdyt?
i'm not sure which way is correct, let's wait for #14558 (comment) |
shahsb
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
There was a problem hiding this 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 extends pipe2() system call support beyond Linux and FreeBSD to include DragonFlyBSD, NetBSD, and OpenBSD. The changes introduce version-specific detection for these BSD variants and refactor the existing hardcoded platform checks to use a centralized HAVE_PIPE2 macro for better maintainability.
Key Changes:
- Added version-aware detection for
pipe2()availability on OpenBSD (≥5.7), DragonFlyBSD (≥4.0), and NetBSD (≥6.0) - Refactored platform-specific conditional from direct
__linux__/__FreeBSD__checks to a centralizedHAVE_PIPE2macro - Applied consistent feature detection pattern used elsewhere in the codebase
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/config.h | Defines HAVE_PIPE2 macro with version checks for Linux, FreeBSD, OpenBSD, DragonFlyBSD, and NetBSD |
| src/anet.c | Replaces platform-specific conditionals with HAVE_PIPE2 macro check for cleaner code |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Before this PR,
pipe2()is only enabled on Linux and FreeBSD whilepipe2()is available on *BSD.This PR enables
pipe2()for the rest of *BSD: DragonFlyBSD, NetBSD and OpenBSD.