diff --git a/nptl/pthread_barrierattr_setpshared.c b/nptl/pthread_barrierattr_setpshared.c index ae58a2b4fa..74b025818b 100644 --- a/nptl/pthread_barrierattr_setpshared.c +++ b/nptl/pthread_barrierattr_setpshared.c @@ -17,15 +17,13 @@ #include #include "pthreadP.h" -#include #include int __pthread_barrierattr_setpshared (pthread_barrierattr_t *attr, int pshared) { - int err = futex_supports_pshared (pshared); - if (err != 0) - return err; + if (pshared != PTHREAD_PROCESS_PRIVATE && pshared != PTHREAD_PROCESS_SHARED) + return EINVAL; ((struct pthread_barrierattr *) attr)->pshared = pshared; diff --git a/nptl/pthread_condattr_setpshared.c b/nptl/pthread_condattr_setpshared.c index 13e6f78d18..2ab3e9f9e9 100644 --- a/nptl/pthread_condattr_setpshared.c +++ b/nptl/pthread_condattr_setpshared.c @@ -17,15 +17,13 @@ #include #include -#include #include int __pthread_condattr_setpshared (pthread_condattr_t *attr, int pshared) { - int err = futex_supports_pshared (pshared); - if (err != 0) - return err; + if (pshared != PTHREAD_PROCESS_PRIVATE && pshared != PTHREAD_PROCESS_SHARED) + return EINVAL; int *valuep = &((struct pthread_condattr *) attr)->value; diff --git a/nptl/pthread_mutexattr_setpshared.c b/nptl/pthread_mutexattr_setpshared.c index fea8ee6d70..d7ef3430c3 100644 --- a/nptl/pthread_mutexattr_setpshared.c +++ b/nptl/pthread_mutexattr_setpshared.c @@ -17,7 +17,6 @@ #include #include -#include #include int @@ -25,9 +24,8 @@ __pthread_mutexattr_setpshared (pthread_mutexattr_t *attr, int pshared) { struct pthread_mutexattr *iattr; - int err = futex_supports_pshared (pshared); - if (err != 0) - return err; + if (pshared != PTHREAD_PROCESS_PRIVATE && pshared != PTHREAD_PROCESS_SHARED) + return EINVAL; iattr = (struct pthread_mutexattr *) attr; diff --git a/nptl/pthread_rwlockattr_setpshared.c b/nptl/pthread_rwlockattr_setpshared.c index c32d99515a..655bcef726 100644 --- a/nptl/pthread_rwlockattr_setpshared.c +++ b/nptl/pthread_rwlockattr_setpshared.c @@ -17,7 +17,6 @@ #include #include "pthreadP.h" -#include #include int @@ -25,9 +24,8 @@ __pthread_rwlockattr_setpshared (pthread_rwlockattr_t *attr, int pshared) { struct pthread_rwlockattr *iattr; - int err = futex_supports_pshared (pshared); - if (err != 0) - return err; + if (pshared != PTHREAD_PROCESS_PRIVATE && pshared != PTHREAD_PROCESS_SHARED) + return EINVAL; iattr = (struct pthread_rwlockattr *) attr; diff --git a/nptl/sem_init.c b/nptl/sem_init.c index cf17411270..76e1aceb70 100644 --- a/nptl/sem_init.c +++ b/nptl/sem_init.c @@ -20,7 +20,6 @@ #include #include "semaphoreP.h" #include -#include int @@ -34,13 +33,6 @@ __new_sem_init (sem_t *sem, int pshared, unsigned int value) __set_errno (EINVAL); return -1; } - pshared = pshared != 0 ? PTHREAD_PROCESS_SHARED : PTHREAD_PROCESS_PRIVATE; - int err = futex_supports_pshared (pshared); - if (err != 0) - { - __set_errno (err); - return -1; - } /* Map to the internal type. */ struct new_sem *isem = (struct new_sem *) sem; @@ -55,8 +47,7 @@ __new_sem_init (sem_t *sem, int pshared, unsigned int value) isem->nwaiters = 0; #endif - isem->private = (pshared == PTHREAD_PROCESS_PRIVATE - ? FUTEX_PRIVATE : FUTEX_SHARED); + isem->private = (pshared == 0 ? FUTEX_PRIVATE : FUTEX_SHARED); return 0; } diff --git a/sysdeps/htl/futex-internal.h b/sysdeps/htl/futex-internal.h index 4976fa07c2..7380290183 100644 --- a/sysdeps/htl/futex-internal.h +++ b/sysdeps/htl/futex-internal.h @@ -22,18 +22,4 @@ #include -/* Returns EINVAL if PSHARED is neither PTHREAD_PROCESS_PRIVATE nor - PTHREAD_PROCESS_SHARED; otherwise, returns 0 if PSHARED is supported, and - ENOTSUP if not. */ -static __always_inline int -futex_supports_pshared (int pshared) -{ - if (__glibc_likely (pshared == PTHREAD_PROCESS_PRIVATE)) - return 0; - else if (pshared == PTHREAD_PROCESS_SHARED) - return 0; - else - return EINVAL; -} - #endif /* futex-internal.h */ diff --git a/sysdeps/nptl/futex-internal.h b/sysdeps/nptl/futex-internal.h index 301daccbb1..2533c91dd3 100644 --- a/sysdeps/nptl/futex-internal.h +++ b/sysdeps/nptl/futex-internal.h @@ -38,12 +38,6 @@ return values that callers need to handle. The private flag must be either FUTEX_PRIVATE or FUTEX_SHARED. - FUTEX_PRIVATE is always supported, and the implementation can internally - use FUTEX_SHARED when FUTEX_PRIVATE is requested. FUTEX_SHARED is not - necessarily supported (use futex_supports_pshared to detect this). - - We expect callers to only use these operations if futexes and the - specific futex operations being used are supported (e.g., FUTEX_SHARED). Given that waking other threads waiting on a futex involves concurrent accesses to the futex word, you must use atomic operations to access the @@ -95,20 +89,6 @@ futex_fatal_error (void) We expect a Linux kernel version of 2.6.22 or more recent (since this version, EINTR is not returned on spurious wake-ups anymore). */ -/* Returns EINVAL if PSHARED is neither PTHREAD_PROCESS_PRIVATE nor - PTHREAD_PROCESS_SHARED; otherwise, returns 0 if PSHARED is supported, and - ENOTSUP if not. */ -static __always_inline int -futex_supports_pshared (int pshared) -{ - if (__glibc_likely (pshared == PTHREAD_PROCESS_PRIVATE)) - return 0; - else if (pshared == PTHREAD_PROCESS_SHARED) - return 0; - else - return EINVAL; -} - /* Atomically wrt other futex operations on the same futex, this blocks iff the value *FUTEX_WORD matches the expected value. This is semantically equivalent to: diff --git a/sysdeps/pthread/sem_open.c b/sysdeps/pthread/sem_open.c index 992786e01b..143b60a0d0 100644 --- a/sysdeps/pthread/sem_open.c +++ b/sysdeps/pthread/sem_open.c @@ -23,7 +23,6 @@ #include "semaphoreP.h" #include #include -#include #include #include #include @@ -36,14 +35,6 @@ __sem_open (const char *name, int oflag, ...) int fd; sem_t *result; - /* Check that shared futexes are supported. */ - int err = futex_supports_pshared (PTHREAD_PROCESS_SHARED); - if (err != 0) - { - __set_errno (err); - return SEM_FAILED; - } - struct shmdir_name dirname; int ret = __shm_get_name (&dirname, name, true); if (ret != 0)