Skip to content

gh-154271: Define _XOPEN_SOURCE=600 on Solaris to enable socket ancillary data and forkserver#154273

Open
serhiy-storchaka wants to merge 3 commits into
python:mainfrom
serhiy-storchaka:solaris-xopen-source
Open

gh-154271: Define _XOPEN_SOURCE=600 on Solaris to enable socket ancillary data and forkserver#154273
serhiy-storchaka wants to merge 3 commits into
python:mainfrom
serhiy-storchaka:solaris-xopen-source

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Jul 20, 2026

Copy link
Copy Markdown
Member

On Solaris/illumos the X/Open socket ancillary-data API (CMSG_*, sendmsg(), recvmsg()) is declared only under _XOPEN_SOURCE>=600, but configure.ac left it undefined there (historically because it hides other features — gh-57208, bpo-1759169). So the socket module built without sendmsg/recvmsg, making multiprocessing.reduction.HAVE_SEND_HANDLE False and the forkserver start method unavailable.

Define _XOPEN_SOURCE=600 on Solaris; __EXTENSIONS__ (from AC_USE_SYSTEM_EXTENSIONS) re-enables the platform features it would otherwise hide — the same combination the OpenIndiana system Python builds with. Verified on OpenIndiana (illumos): sendmsg/recvmsg/CMSG_* are built, forkserver becomes available, full build clean, and test_socket / test_multiprocessing_forkserver / test_concurrent_futures pass.

Related: GH-154272 (test-robustness fix for platforms that genuinely lack forkserver).

🤖 Generated with Claude Code

… ancillary data and forkserver

Solaris declares the socket ancillary-data API (CMSG_*, sendmsg(),
recvmsg()) only under _XOPEN_SOURCE >= 600.  __EXTENSIONS__ keeps the
other platform features.  This enables the forkserver start method.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@serhiy-storchaka

Copy link
Copy Markdown
Member Author

@kulikjak, could you please look at this and verify if it is a correct change for real Solaris?

@kulikjak

kulikjak commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Thanks for the ping, Serhiy.

Interestingly, on Oracle Solaris, sendmsg and forkserver are available even without your change:

$> LD_LIBRARY_PATH=./build/sparcv9/ ./build/sparcv9/python
Python 3.16.0a0 (main, Jul 22 2026, 10:34:32) [GCC 15.2.0] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket; hasattr(socket.socket, 'sendmsg')
True
>>> import multiprocessing; multiprocessing.get_all_start_methods()
['forkserver', 'fork', 'spawn']

The header files are likely slightly different now compared to Illumos. That said, I built and tested it with your change and everything seems to work as before.

One minor thing I noticed is that the configure now says:

checking whether it is safe to define __EXTENSIONS__... yes
checking whether _XOPEN_SOURCE should be defined... no

and then it's defined, which might be a little confusing.

serhiy-storchaka and others added 2 commits July 22, 2026 13:30
Move the Solaris definition into the same conditional as the general one,
so that all _XOPEN_SOURCE decisions are together.  The socket ancillary
data API is gated on _XOPEN_SOURCE only on illumos; Solaris declares it
anyway.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@serhiy-storchaka

Copy link
Copy Markdown
Member Author

Thanks for testing it!

Then the gap is illumos-specific -- I reworded the comment and the NEWS entry.

The confusing check is Autoconf's own, from AC_USE_SYSTEM_EXTENSIONS, and asks a different question -- whether to define _XOPEN_SOURCE to 500 for mbstate_t. It answers "no" on unpatched main too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting core review build The build process and cross-build extension-modules C modules in the Modules dir topic-multiprocessing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants