From 5c6443ac42ba00ad3a0b4e98db4cc8f45596ca93 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Sat, 17 Nov 2012 18:42:16 -0500 Subject: add stub versions of some missing optional pthread interfaces priority inheritance is not yet supported, and priority protection probably will not be supported ever unless there's serious demand for it (it's a fairly heavy-weight feature). per-thread cpu clocks would be nice to have, but to my knowledge linux is still not capable of supporting them. glibc fakes them by using the _process_ cpu-time clock and subtracting the thread creation time, which gives seriously incorrect semantics (worse than not supporting the feature at all), so until there's a way to do it right, it will remain as a stub that always fails. --- src/thread/pthread_attr_get.c | 5 +++++ src/thread/pthread_getcpuclockid.c | 6 ++++++ src/thread/pthread_mutex_getprioceiling.c | 6 ++++++ src/thread/pthread_mutex_setprioceiling.c | 6 ++++++ src/thread/pthread_mutexattr_setprotocol.c | 7 +++++++ 5 files changed, 30 insertions(+) create mode 100644 src/thread/pthread_getcpuclockid.c create mode 100644 src/thread/pthread_mutex_getprioceiling.c create mode 100644 src/thread/pthread_mutex_setprioceiling.c create mode 100644 src/thread/pthread_mutexattr_setprotocol.c (limited to 'src') diff --git a/src/thread/pthread_attr_get.c b/src/thread/pthread_attr_get.c index f81103d8..e4650e42 100644 --- a/src/thread/pthread_attr_get.c +++ b/src/thread/pthread_attr_get.c @@ -68,6 +68,11 @@ int pthread_condattr_getpshared(const pthread_condattr_t *restrict a, int *restr return 0; } +int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *restrict a, int *restrict protocol) +{ + *protocol = PTHREAD_PRIO_NONE; + return 0; +} int pthread_mutexattr_getpshared(const pthread_mutexattr_t *restrict a, int *restrict pshared) { *pshared = *a>>31; diff --git a/src/thread/pthread_getcpuclockid.c b/src/thread/pthread_getcpuclockid.c new file mode 100644 index 00000000..cf3d2b84 --- /dev/null +++ b/src/thread/pthread_getcpuclockid.c @@ -0,0 +1,6 @@ +#include "pthread_impl.h" + +int pthread_getcpuclockid(pthread_t t, clockid_t *clockid) +{ + return ENOSYS; +} diff --git a/src/thread/pthread_mutex_getprioceiling.c b/src/thread/pthread_mutex_getprioceiling.c new file mode 100644 index 00000000..8c75a661 --- /dev/null +++ b/src/thread/pthread_mutex_getprioceiling.c @@ -0,0 +1,6 @@ +#include "pthread_impl.h" + +int pthread_mutex_getprioceiling(const pthread_mutex_t *restrict m, int *restrict ceiling) +{ + return EINVAL; +} diff --git a/src/thread/pthread_mutex_setprioceiling.c b/src/thread/pthread_mutex_setprioceiling.c new file mode 100644 index 00000000..681f07c8 --- /dev/null +++ b/src/thread/pthread_mutex_setprioceiling.c @@ -0,0 +1,6 @@ +#include "pthread_impl.h" + +int pthread_mutex_setprioceiling(pthread_mutex_t *restrict m, int ceiling, int *restrict old) +{ + return EINVAL; +} diff --git a/src/thread/pthread_mutexattr_setprotocol.c b/src/thread/pthread_mutexattr_setprotocol.c new file mode 100644 index 00000000..c92a31c8 --- /dev/null +++ b/src/thread/pthread_mutexattr_setprotocol.c @@ -0,0 +1,7 @@ +#include "pthread_impl.h" + +int pthread_mutexattr_setprotocol(pthread_mutexattr_t *a, int protocol) +{ + if (protocol) return ENOTSUP; + return 0; +} -- cgit v1.2.1