Repository navigation
Conversation
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.
|
Hi @lzcunt! Thank you for your pull request and welcome to our community. Action RequiredIn 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. ProcessIn 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 If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
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.