From 654ab66c5fc0d21172d6c6093ccbbc48557e922e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vlad-Andrei=20B=C4=82DOIU?= Date: Tue, 31 Mar 2020 18:07:19 +0300 Subject: [PATCH] Implement pthread_condattr_{getclock, setclock} MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit We adapt the implementation from musl. Signed-off-by: Vlad-Andrei BĂDOIU Reviewed-by: Felipe Huici --- pthread_condattr.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/pthread_condattr.c b/pthread_condattr.c index 53dcc64..0861a53 100644 --- a/pthread_condattr.c +++ b/pthread_condattr.c @@ -23,19 +23,20 @@ #include #include #include - +#include int pthread_condattr_getclock(const pthread_condattr_t *__restrict attr, clockid_t *__restrict clock_id) { - WARN_STUBBED(); - errno = ENOTSUP; - return -1; + *clock_id = (*attr)->clock & 0x7fffffff; + return 0; } int pthread_condattr_setclock(pthread_condattr_t *attr, clockid_t clock_id) { - WARN_STUBBED(); - errno = ENOTSUP; - return -1; + if (clock_id < 0 || clock_id-2U < 2) + return EINVAL; + (*attr)->clock &= 0x80000000; + (*attr)->clock |= clock_id; + return 0; } -- 2.39.5