1 #include "threads_impl.h"
2
pthread_attr_getdetachstate(const pthread_attr_t * a,int * state)3 int pthread_attr_getdetachstate(const pthread_attr_t* a, int* state) {
4 *state = a->_a_detach;
5 return 0;
6 }
pthread_attr_getguardsize(const pthread_attr_t * restrict a,size_t * restrict size)7 int pthread_attr_getguardsize(const pthread_attr_t* restrict a, size_t* restrict size) {
8 *size = a->_a_guardsize;
9 return 0;
10 }
11
pthread_attr_getschedparam(const pthread_attr_t * restrict a,struct sched_param * restrict param)12 int pthread_attr_getschedparam(const pthread_attr_t* restrict a,
13 struct sched_param* restrict param) {
14 param->sched_priority = a->_a_prio;
15 return 0;
16 }
17
pthread_attr_getstack(const pthread_attr_t * restrict a,void ** restrict addr,size_t * restrict size)18 int pthread_attr_getstack(const pthread_attr_t* restrict a, void** restrict addr,
19 size_t* restrict size) {
20 if (a->_a_stackaddr == NULL)
21 return EINVAL;
22 *addr = a->_a_stackaddr;
23 *size = a->_a_stacksize;
24 return 0;
25 }
26
pthread_attr_getstacksize(const pthread_attr_t * restrict a,size_t * restrict size)27 int pthread_attr_getstacksize(const pthread_attr_t* restrict a, size_t* restrict size) {
28 *size = a->_a_stacksize;
29 return 0;
30 }
31
pthread_condattr_getclock(const pthread_condattr_t * restrict a,clockid_t * restrict clk)32 int pthread_condattr_getclock(const pthread_condattr_t* restrict a, clockid_t* restrict clk) {
33 *clk = a->__attr & 0x7fffffff;
34 return 0;
35 }
36
pthread_mutexattr_getprotocol(const pthread_mutexattr_t * restrict a,int * restrict protocol)37 int pthread_mutexattr_getprotocol(const pthread_mutexattr_t* restrict a, int* restrict protocol) {
38 *protocol = PTHREAD_PRIO_NONE;
39 return 0;
40 }
pthread_mutexattr_getrobust(const pthread_mutexattr_t * restrict a,int * restrict robust)41 int pthread_mutexattr_getrobust(const pthread_mutexattr_t* restrict a, int* restrict robust) {
42 // We do not support robust pthread_mutex_ts.
43 *robust = 0;
44 return 0;
45 }
46
pthread_mutexattr_gettype(const pthread_mutexattr_t * restrict a,int * restrict type)47 int pthread_mutexattr_gettype(const pthread_mutexattr_t* restrict a, int* restrict type) {
48 *type = a->__attr & PTHREAD_MUTEX_MASK;
49 return 0;
50 }
51