Ticket #12542: 0001-libroot-Undefine-constants-for-unsupported-POSIX-fea.patch

File 0001-libroot-Undefine-constants-for-unsupported-POSIX-fea.patch, 2.3 KB (added by simonsouth, 8 years ago)

libroot: Undefine constants for unsupported POSIX features

  • headers/posix/unistd.h

    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  
    4343#define _POSIX_THREADS                      (200112L)
    4444#define _POSIX_MAPPED_FILES                 (200809L)
    4545#define _POSIX_THREAD_PROCESS_SHARED        (200809L)
    46 #define _POSIX_THREAD_ATTR_STACKADDR        (-1)    /* currently unsupported */
     46#undef  _POSIX_THREAD_ATTR_STACKADDR        /* currently unsupported */
    4747#define _POSIX_THREAD_ATTR_STACKSIZE        (200809L)
    48 #define _POSIX_THREAD_PRIORITY_SCHEDULING   (-1)    /* currently unsupported */
     48#undef  _POSIX_THREAD_PRIORITY_SCHEDULING   /* currently unsupported */
    4949#define _POSIX_REALTIME_SIGNALS             (200809L)
    5050#define _POSIX_MEMORY_PROTECTION            (200809L)
    5151#define _POSIX_MONOTONIC_CLOCK              (200809L)
  • src/system/libroot/posix/unistd/conf.cpp

    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)  
    156156        case _SC_THREAD_STACK_MIN:
    157157            return MIN_USER_STACK_SIZE;
    158158        case _SC_THREAD_ATTR_STACKADDR:
    159             return _POSIX_THREAD_ATTR_STACKADDR;
     159            return -1;
     160                // currently unsupported
    160161        case _SC_THREAD_ATTR_STACKSIZE:
    161162            return _POSIX_THREAD_ATTR_STACKSIZE;
    162163        case _SC_THREAD_PRIORITY_SCHEDULING:
    163             return _POSIX_THREAD_PRIORITY_SCHEDULING;
     164            return -1;
     165                // currently unsupported
    164166        case _SC_REALTIME_SIGNALS:
    165167            return _POSIX_REALTIME_SIGNALS;
    166168        case _SC_MEMORY_PROTECTION: