Skip to content

Request XSI alongside POSIX for setpriority()/getrusage() - #4735

Open
lzcunt wants to merge 1 commit into
meta:devfrom
lzcunt:xsi-feature-macro
Open

lzcunt wants to merge 1 commit into
meta:devfrom
lzcunt:xsi-feature-macro

Conversation

@lzcunt

@lzcunt lzcunt commented Aug 16, 2026

Copy link
Copy Markdown

Fixes building against stricter libcs on Linux, such as mlibc.

On Linux and Cygwin, platform.h defines _POSIX_C_SOURCE 200809L before including <unistd.h>. util.h then uses setpriority() and PRIO_PROCESS when ZSTD_SETPRIORITY_SUPPORT is enabled, and benchzstd.c uses getrusage().

Those are XSI interfaces rather than base POSIX, so _POSIX_C_SOURCE on its own does not oblige a libc to declare them. glibc and musl declare them unconditionally, so this has never shown up there, but on a libc that gates them strictly the build fails.

Note this is specific to defining _POSIX_C_SOURCE: without any feature test macro a libc exposes its default (permissive) namespace, so the same code compiles. The macro is only set on the Linux/Cygwin path, which is exactly where the failure occurs.

Request _XOPEN_SOURCE 700 next to the existing _POSIX_C_SOURCE.

On Linux and Cygwin, platform.h defines _POSIX_C_SOURCE 200809L before
including <unistd.h>. util.h then uses setpriority() and PRIO_PROCESS when
ZSTD_SETPRIORITY_SUPPORT is enabled, and benchzstd.c uses getrusage().

Those are XSI interfaces rather than base POSIX, so _POSIX_C_SOURCE on its
own does not oblige a libc to declare them. glibc and musl declare them
unconditionally, so this has never shown up there, but on a libc that gates
them strictly the build fails.

Note this is specific to defining _POSIX_C_SOURCE: without any feature test
macro a libc exposes its default (permissive) namespace, so the same code
compiles. The macro is only set on the Linux/Cygwin path, which is exactly
where the failure occurs.

Request _XOPEN_SOURCE 700 next to the existing _POSIX_C_SOURCE.
@meta-cla

meta-cla Bot commented Aug 16, 2026

Copy link
Copy Markdown

Hi @lzcunt!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@meta-cla

meta-cla Bot commented Aug 16, 2026

Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@meta-cla meta-cla Bot added the CLA Signed label Aug 16, 2026

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant