X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fthread%2Fpthread_mutexattr_setrobust.c;h=30a9ac3bea559bb54b762c7df04e0fa035d3ec1e;hb=f897461d4fe72bb71854a6d0662de83008caccb7;hp=dcfa4cf1c771c5347240c3bd826448b69f094f06;hpb=12e1e324683a1d381b7f15dd36c99b37dd44d940;p=musl diff --git a/src/thread/pthread_mutexattr_setrobust.c b/src/thread/pthread_mutexattr_setrobust.c index dcfa4cf1..30a9ac3b 100644 --- a/src/thread/pthread_mutexattr_setrobust.c +++ b/src/thread/pthread_mutexattr_setrobust.c @@ -1,9 +1,23 @@ #include "pthread_impl.h" +#include "syscall.h" + +static volatile int check_robust_result = -1; int pthread_mutexattr_setrobust(pthread_mutexattr_t *a, int robust) { if (robust > 1U) return EINVAL; + if (robust) { + int r = check_robust_result; + if (r < 0) { + void *p; + size_t l; + r = -__syscall(SYS_get_robust_list, 0, &p, &l); + a_store(&check_robust_result, r); + } + if (r) return r; + a->__attr |= 4; + return 0; + } a->__attr &= ~4; - a->__attr |= robust*4; return 0; }