From: Vlad-Andrei BĂDOIU Date: Tue, 31 Mar 2020 15:07:19 +0000 (+0300) Subject: Implement pthread_condattr_{getclock, setclock} X-Git-Tag: RELEASE-0.5~4 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=654ab66c5fc0d21172d6c6093ccbbc48557e922e;p=unikraft%2Flibs%2Fpthread-embedded.git Implement pthread_condattr_{getclock, setclock} We adapt the implementation from musl. Signed-off-by: Vlad-Andrei BĂDOIU Reviewed-by: Felipe Huici --- 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; }