X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fthread%2Fpthread_mutexattr_setrobust.c;h=04db92a626dbd0b05eac4bcd88363a6e31e54207;hb=1ef37aa00ea830dfda76e04e3d941cafa74d8b76;hp=dcfa4cf1c771c5347240c3bd826448b69f094f06;hpb=0109d950e685f1c5f6cef245a8b1bc47c9b6d94c;p=musl diff --git a/src/thread/pthread_mutexattr_setrobust.c b/src/thread/pthread_mutexattr_setrobust.c index dcfa4cf1..04db92a6 100644 --- a/src/thread/pthread_mutexattr_setrobust.c +++ b/src/thread/pthread_mutexattr_setrobust.c @@ -1,9 +1,25 @@ #include "pthread_impl.h" +#include "syscall.h" + +static pthread_once_t check_robust_once; +static int check_robust_result; + +static void check_robust() +{ + void *p; + size_t l; + check_robust_result = -__syscall(SYS_get_robust_list, 0, &p, &l); +} int pthread_mutexattr_setrobust(pthread_mutexattr_t *a, int robust) { if (robust > 1U) return EINVAL; + if (robust) { + pthread_once(&check_robust_once, check_robust); + if (check_robust_result) return check_robust_result; + a->__attr |= 4; + return 0; + } a->__attr &= ~4; - a->__attr |= robust*4; return 0; }