| OLD | NEW |
| 1 #include "pthread_impl.h" | 1 #include "pthread_impl.h" |
| 2 | 2 |
| 3 int pthread_attr_getdetachstate(const pthread_attr_t *a, int *state) | 3 int pthread_attr_getdetachstate(const pthread_attr_t* a, int* state) { |
| 4 { | 4 *state = a->_a_detach; |
| 5 » *state = a->_a_detach; | 5 return 0; |
| 6 » return 0; | |
| 7 } | 6 } |
| 8 int pthread_attr_getguardsize(const pthread_attr_t *restrict a, size_t *restrict
size) | 7 int pthread_attr_getguardsize(const pthread_attr_t* restrict a, |
| 9 { | 8 size_t* restrict size) { |
| 10 » *size = a->_a_guardsize + DEFAULT_GUARD_SIZE; | 9 *size = a->_a_guardsize + DEFAULT_GUARD_SIZE; |
| 11 » return 0; | 10 return 0; |
| 12 } | 11 } |
| 13 | 12 |
| 14 int pthread_attr_getinheritsched(const pthread_attr_t *restrict a, int *restrict
inherit) | 13 int pthread_attr_getinheritsched(const pthread_attr_t* restrict a, |
| 15 { | 14 int* restrict inherit) { |
| 16 » *inherit = a->_a_sched; | 15 *inherit = a->_a_sched; |
| 17 » return 0; | 16 return 0; |
| 18 } | 17 } |
| 19 | 18 |
| 20 int pthread_attr_getschedparam(const pthread_attr_t *restrict a, struct sched_pa
ram *restrict param) | 19 int pthread_attr_getschedparam(const pthread_attr_t* restrict a, |
| 21 { | 20 struct sched_param* restrict param) { |
| 22 » param->sched_priority = a->_a_prio; | 21 param->sched_priority = a->_a_prio; |
| 23 » return 0; | 22 return 0; |
| 24 } | 23 } |
| 25 | 24 |
| 26 int pthread_attr_getschedpolicy(const pthread_attr_t *restrict a, int *restrict
policy) | 25 int pthread_attr_getschedpolicy(const pthread_attr_t* restrict a, |
| 27 { | 26 int* restrict policy) { |
| 28 » *policy = a->_a_policy; | 27 *policy = a->_a_policy; |
| 29 » return 0; | 28 return 0; |
| 30 } | 29 } |
| 31 | 30 |
| 32 int pthread_attr_getscope(const pthread_attr_t *restrict a, int *restrict scope) | 31 int pthread_attr_getscope(const pthread_attr_t* restrict a, |
| 33 { | 32 int* restrict scope) { |
| 34 » *scope = PTHREAD_SCOPE_SYSTEM; | 33 *scope = PTHREAD_SCOPE_SYSTEM; |
| 35 » return 0; | 34 return 0; |
| 36 } | 35 } |
| 37 | 36 |
| 38 int pthread_attr_getstack(const pthread_attr_t *restrict a, void **restrict addr
, size_t *restrict size) | 37 int pthread_attr_getstack(const pthread_attr_t* restrict a, |
| 39 { | 38 void** restrict addr, |
| 40 » if (!a->_a_stackaddr) | 39 size_t* restrict size) { |
| 41 » » return EINVAL; | 40 if (!a->_a_stackaddr) |
| 42 » *size = a->_a_stacksize + DEFAULT_STACK_SIZE; | 41 return EINVAL; |
| 43 » *addr = (void *)(a->_a_stackaddr - *size); | 42 *size = a->_a_stacksize + DEFAULT_STACK_SIZE; |
| 44 » return 0; | 43 *addr = (void*)(a->_a_stackaddr - *size); |
| 44 return 0; |
| 45 } | 45 } |
| 46 | 46 |
| 47 int pthread_attr_getstacksize(const pthread_attr_t *restrict a, size_t *restrict
size) | 47 int pthread_attr_getstacksize(const pthread_attr_t* restrict a, |
| 48 { | 48 size_t* restrict size) { |
| 49 » *size = a->_a_stacksize + DEFAULT_STACK_SIZE; | 49 *size = a->_a_stacksize + DEFAULT_STACK_SIZE; |
| 50 » return 0; | 50 return 0; |
| 51 } | 51 } |
| 52 | 52 |
| 53 int pthread_barrierattr_getpshared(const pthread_barrierattr_t *restrict a, int
*restrict pshared) | 53 int pthread_barrierattr_getpshared(const pthread_barrierattr_t* restrict a, |
| 54 { | 54 int* restrict pshared) { |
| 55 » *pshared = !!a->__attr; | 55 *pshared = !!a->__attr; |
| 56 » return 0; | 56 return 0; |
| 57 } | 57 } |
| 58 | 58 |
| 59 int pthread_condattr_getclock(const pthread_condattr_t *restrict a, clockid_t *r
estrict clk) | 59 int pthread_condattr_getclock(const pthread_condattr_t* restrict a, |
| 60 { | 60 clockid_t* restrict clk) { |
| 61 » *clk = a->__attr & 0x7fffffff; | 61 *clk = a->__attr & 0x7fffffff; |
| 62 » return 0; | 62 return 0; |
| 63 } | 63 } |
| 64 | 64 |
| 65 int pthread_condattr_getpshared(const pthread_condattr_t *restrict a, int *restr
ict pshared) | 65 int pthread_condattr_getpshared(const pthread_condattr_t* restrict a, |
| 66 { | 66 int* restrict pshared) { |
| 67 » *pshared = a->__attr>>31; | 67 *pshared = a->__attr >> 31; |
| 68 » return 0; | 68 return 0; |
| 69 } | 69 } |
| 70 | 70 |
| 71 int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *restrict a, int *re
strict protocol) | 71 int pthread_mutexattr_getprotocol(const pthread_mutexattr_t* restrict a, |
| 72 { | 72 int* restrict protocol) { |
| 73 » *protocol = PTHREAD_PRIO_NONE; | 73 *protocol = PTHREAD_PRIO_NONE; |
| 74 » return 0; | 74 return 0; |
| 75 } | 75 } |
| 76 int pthread_mutexattr_getpshared(const pthread_mutexattr_t *restrict a, int *res
trict pshared) | 76 int pthread_mutexattr_getpshared(const pthread_mutexattr_t* restrict a, |
| 77 { | 77 int* restrict pshared) { |
| 78 » *pshared = a->__attr / 128U % 2; | 78 *pshared = a->__attr / 128U % 2; |
| 79 » return 0; | 79 return 0; |
| 80 } | 80 } |
| 81 | 81 |
| 82 int pthread_mutexattr_getrobust(const pthread_mutexattr_t *restrict a, int *rest
rict robust) | 82 int pthread_mutexattr_getrobust(const pthread_mutexattr_t* restrict a, |
| 83 { | 83 int* restrict robust) { |
| 84 » *robust = a->__attr / 4U % 2; | 84 *robust = a->__attr / 4U % 2; |
| 85 » return 0; | 85 return 0; |
| 86 } | 86 } |
| 87 | 87 |
| 88 int pthread_mutexattr_gettype(const pthread_mutexattr_t *restrict a, int *restri
ct type) | 88 int pthread_mutexattr_gettype(const pthread_mutexattr_t* restrict a, |
| 89 { | 89 int* restrict type) { |
| 90 » *type = a->__attr & 3; | 90 *type = a->__attr & 3; |
| 91 » return 0; | 91 return 0; |
| 92 } | 92 } |
| 93 | 93 |
| 94 int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *restrict a, int *r
estrict pshared) | 94 int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t* restrict a, |
| 95 { | 95 int* restrict pshared) { |
| 96 » *pshared = a->__attr[0]; | 96 *pshared = a->__attr[0]; |
| 97 » return 0; | 97 return 0; |
| 98 } | 98 } |
| OLD | NEW |