Repository navigation
fix(libkernel): create pipes with pipe and fcntl on macOS, where pipe2 needs macOS 27 - #19903
Merged
oneandonlydean merged 1 commit intoNov 14, 2026
Conversation
Open
Contributor
|
Windows check of head Setup: Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release. The hosted Windows check does not run these tests on pull requests.
AI-assisted: yes. |
This was referenced Nov 14, 2026
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
12 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
pipe2_nid_postfixcalls the host::pipe2on every non-Windows host. In the macOS 27 SDK,sys/unistd.hdeclarespipe2(anddup3) with__API_AVAILABLE(macos(27.0), ...), and the libraries are built with a lower minimum version (LC_BUILD_VERSION minos 26.0here), sopipe2is weakly imported. On macOS 26 it resolves to null, and the first guestpipeorpipe2jumps to address 0:The compiler reports it as
'pipe2' is only available on macOS 27.0 or neweratStdio.cpp:767. With an SDK older than 27,pipe2is not declared and the file does not compile.On macOS the pipe is now made with
pipe, thenFD_CLOEXECandO_NONBLOCKare set withfcntlwhen requested; if eitherfcntlfails, both descriptors are closed and the call fails with thaterrno. This works on every macOS version and SDK. Unlikepipe2, close-on-exec is not set atomically with the creation, so a concurrentfork/execin another thread can inherit the descriptors in that window. Linux and Windows are unchanged.Tested
macOS 26.7.3, Apple M4, Xcode SDK 27.2, Apple clang 21.0.0, CMake 4.4.4, Ninja, full build (
-DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DCMAKE_OSX_ARCHITECTURES=x86_64, tests run under Rosetta) onmainwith #17425, #11049 and #11437 merged locally for the other macOS build breaks.guest_dup,guest_file_timestamps,guest_filesystem,guest_fstatfs,guest_fstatvfs,guest_getrlimit,guest_host_standard_error,guest_host_streams,guest_kernel_fcntl,guest_kernel_fcntl_sync,guest_kernel_fstat,guest_kernel_ioctl_fionread,guest_kernel_pipe2,guest_kernel_sock_names,guest_kernel_socket_shutdown,guest_kernel_sys_aio,guest_kernel_sys_dup,guest_kernel_sys_pselect,guest_kernel_sys_pwrite,guest_kernel_sys_pwrite_patched,guest_kernel_web_forwards,guest_kqueue,guest_pipe_fault,guest_poll,guest_posix_filesystem,guest_posix_scalar_io,guest_select,guest_socket_descriptor_flags,guest_socket_events,guest_socket_on_non_socket,guest_socket_rights,guest_terminal.'pipe2' is only available on macOS 27.0 or newerwarning forStdio.cppis gone.python3 tools/check_conventions.py --base origin/mainpasses.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)