libroot: Undefine constants for unsupported POSIX features

Haiku does not yet support certain features related to POSIX threads.
Constants used to test for the presence of these features should
therefore be left undefined, according to the POSIX spec, but are
currently set to -1. This can cause software built on Haiku to
incorrectly detect the presence of these features.

* unistd.h: Undefine _POSIX_THREAD_ATTR_STACKADDR,
  _POSIX_THREAD_PRIORITY_SCHEDULING feature constants.
* conf.cpp: __sysconf: Return -1 for unsupported features.

Signed-off-by: Augustin Cavalier <[email protected]>
This commit is contained in:
Simon South
2015-12-21 11:09:34 -05:00
committed by Augustin Cavalier
parent 349ef416e4
commit 7aebec8db1
2 changed files with 6 additions and 4 deletions
+2 -2
View File
@@ -43,9 +43,9 @@
#define _POSIX_THREADS (200112L)
#define _POSIX_MAPPED_FILES (200809L)
#define _POSIX_THREAD_PROCESS_SHARED (200809L)
#define _POSIX_THREAD_ATTR_STACKADDR (-1) /* currently unsupported */
#undef _POSIX_THREAD_ATTR_STACKADDR /* currently unsupported */
#define _POSIX_THREAD_ATTR_STACKSIZE (200809L)
#define _POSIX_THREAD_PRIORITY_SCHEDULING (-1) /* currently unsupported */
#undef _POSIX_THREAD_PRIORITY_SCHEDULING /* currently unsupported */
#define _POSIX_REALTIME_SIGNALS (200809L)
#define _POSIX_MEMORY_PROTECTION (200809L)
#define _POSIX_MONOTONIC_CLOCK (200809L)
+4 -2
View File
@@ -156,11 +156,13 @@ __sysconf(int name)
case _SC_THREAD_STACK_MIN:
return MIN_USER_STACK_SIZE;
case _SC_THREAD_ATTR_STACKADDR:
return _POSIX_THREAD_ATTR_STACKADDR;
return -1;
// currently unsupported
case _SC_THREAD_ATTR_STACKSIZE:
return _POSIX_THREAD_ATTR_STACKSIZE;
case _SC_THREAD_PRIORITY_SCHEDULING:
return _POSIX_THREAD_PRIORITY_SCHEDULING;
return -1;
// currently unsupported
case _SC_REALTIME_SIGNALS:
return _POSIX_REALTIME_SIGNALS;
case _SC_MEMORY_PROTECTION: