From 7aebec8db1a6f231a2a93ec82872afadb8ed3879 Mon Sep 17 00:00:00 2001 From: Simon South Date: Mon, 21 Dec 2015 10:08:28 -0500 Subject: [PATCH] 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 --- headers/posix/unistd.h | 4 ++-- src/system/libroot/posix/unistd/conf.cpp | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/headers/posix/unistd.h b/headers/posix/unistd.h index 9c8fc77099..4de488a158 100644 --- a/headers/posix/unistd.h +++ b/headers/posix/unistd.h @@ -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) diff --git a/src/system/libroot/posix/unistd/conf.cpp b/src/system/libroot/posix/unistd/conf.cpp index 5ae51e9f68..a5728928cb 100644 --- a/src/system/libroot/posix/unistd/conf.cpp +++ b/src/system/libroot/posix/unistd/conf.cpp @@ -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: