From 5b7b6755fa38b5c8d6b950670f2d93aa95d3085d Mon Sep 17 00:00:00 2001
From: Simon South <simon@simonsouth.com>
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.
---
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 9c8fc77..4de488a 100644
a
|
b
|
|
43 | 43 | #define _POSIX_THREADS (200112L) |
44 | 44 | #define _POSIX_MAPPED_FILES (200809L) |
45 | 45 | #define _POSIX_THREAD_PROCESS_SHARED (200809L) |
46 | | #define _POSIX_THREAD_ATTR_STACKADDR (-1) /* currently unsupported */ |
| 46 | #undef _POSIX_THREAD_ATTR_STACKADDR /* currently unsupported */ |
47 | 47 | #define _POSIX_THREAD_ATTR_STACKSIZE (200809L) |
48 | | #define _POSIX_THREAD_PRIORITY_SCHEDULING (-1) /* currently unsupported */ |
| 48 | #undef _POSIX_THREAD_PRIORITY_SCHEDULING /* currently unsupported */ |
49 | 49 | #define _POSIX_REALTIME_SIGNALS (200809L) |
50 | 50 | #define _POSIX_MEMORY_PROTECTION (200809L) |
51 | 51 | #define _POSIX_MONOTONIC_CLOCK (200809L) |
diff --git a/src/system/libroot/posix/unistd/conf.cpp b/src/system/libroot/posix/unistd/conf.cpp
index 5ae51e9..a572892 100644
a
|
b
|
__sysconf(int name)
|
156 | 156 | case _SC_THREAD_STACK_MIN: |
157 | 157 | return MIN_USER_STACK_SIZE; |
158 | 158 | case _SC_THREAD_ATTR_STACKADDR: |
159 | | return _POSIX_THREAD_ATTR_STACKADDR; |
| 159 | return -1; |
| 160 | // currently unsupported |
160 | 161 | case _SC_THREAD_ATTR_STACKSIZE: |
161 | 162 | return _POSIX_THREAD_ATTR_STACKSIZE; |
162 | 163 | case _SC_THREAD_PRIORITY_SCHEDULING: |
163 | | return _POSIX_THREAD_PRIORITY_SCHEDULING; |
| 164 | return -1; |
| 165 | // currently unsupported |
164 | 166 | case _SC_REALTIME_SIGNALS: |
165 | 167 | return _POSIX_REALTIME_SIGNALS; |
166 | 168 | case _SC_MEMORY_PROTECTION: |