master
 1#include "pthread_impl.h"
 2#include "syscall.h"
 3
 4static volatile int check_robust_result = -1;
 5
 6int pthread_mutexattr_setrobust(pthread_mutexattr_t *a, int robust)
 7{
 8	if (robust > 1U) return EINVAL;
 9	if (robust) {
10		int r = check_robust_result;
11		if (r < 0) {
12			void *p;
13			size_t l;
14			r = -__syscall(SYS_get_robust_list, 0, &p, &l);
15			a_store(&check_robust_result, r);
16		}
17		if (r) return r;
18		a->__attr |= 4;
19		return 0;
20	}
21	a->__attr &= ~4;
22	return 0;
23}