Opened 9 years ago
Closed 9 years ago
#12542 closed bug (fixed)
libroot: unistd.h defines constants for unsupported POSIX features
Reported by: | simonsouth | Owned by: | waddlesplash |
---|---|---|---|
Priority: | normal | Milestone: | Unscheduled |
Component: | System/POSIX | Version: | R1/Development |
Keywords: | Cc: | ||
Blocked By: | Blocking: | ||
Platform: | All |
Description
Haiku does not yet support certain features related to POSIX threads. For this reason, unistd.h
defines the _POSIX_THREAD_ATTR_STACKADDR
and _POSIX_THREAD_PRIORITY_SCHEDULING
constants to -1, meant to signal the absence of these features.
However, a careful reading of the POSIX spec suggests these constants should actually be left undefined. Referring to _POSIX_THREAD_ATTR_STACKADDR
:
The following symbolic constants are always defined to unspecified values to indicate that this functionality from the POSIX Threads Extension is always present on XSI-conformant systems:
And to _POSIX_THREAD_PRIORITY_SCHEDULING
:
If _XOPEN_REALTIME_THREADS is defined to have a value other than -1, then the following symbolic constants will be defined to an unspecified value to indicate that the features are supported:
Emphasis mine. The implication is that if the features are not available the constants should not be defined to any value; that is, they should be left undefined.
This seems to match how these constants are actually used in the wild.
The attached patch corrects the implementation by modifying
unistd.h
to undefine the two constants (they are left in the file to indicate they have not simply been forgotten) andconf.cpp
sosysconf
returns -1 when the presence of these features is tested (which matches the existing behaviour; POSIX says simply "the results are unspecified" in this case).
These changes are needed to build Apache Thrift on Haiku.
Attachments (1)
Change History (5)
by , 9 years ago
Attachment: | 0001-libroot-Undefine-constants-for-unsupported-POSIX-fea.patch added |
---|
comment:1 by , 9 years ago
patch: | 0 → 1 |
---|
comment:2 by , 9 years ago
Component: | - General → System/POSIX |
---|
comment:3 by , 9 years ago
Owner: | changed from | to
---|---|
Status: | new → in-progress |
comment:4 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | in-progress → closed |
Applied in hrev49935. Thanks!
On a side node, you're welcome to join us in the #haiku channel on Freenode.
libroot: Undefine constants for unsupported POSIX features