Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: fusl/src/thread/pthread_attr_get.c

Issue 1573973002: Add a "fork" of musl as //fusl. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fusl/src/thread/pthread_attr_destroy.c ('k') | fusl/src/thread/pthread_attr_init.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #include "pthread_impl.h"
2
3 int pthread_attr_getdetachstate(const pthread_attr_t *a, int *state)
4 {
5 *state = a->_a_detach;
6 return 0;
7 }
8 int pthread_attr_getguardsize(const pthread_attr_t *restrict a, size_t *restrict size)
9 {
10 *size = a->_a_guardsize + DEFAULT_GUARD_SIZE;
11 return 0;
12 }
13
14 int pthread_attr_getinheritsched(const pthread_attr_t *restrict a, int *restrict inherit)
15 {
16 *inherit = a->_a_sched;
17 return 0;
18 }
19
20 int pthread_attr_getschedparam(const pthread_attr_t *restrict a, struct sched_pa ram *restrict param)
21 {
22 param->sched_priority = a->_a_prio;
23 return 0;
24 }
25
26 int pthread_attr_getschedpolicy(const pthread_attr_t *restrict a, int *restrict policy)
27 {
28 *policy = a->_a_policy;
29 return 0;
30 }
31
32 int pthread_attr_getscope(const pthread_attr_t *restrict a, int *restrict scope)
33 {
34 *scope = PTHREAD_SCOPE_SYSTEM;
35 return 0;
36 }
37
38 int pthread_attr_getstack(const pthread_attr_t *restrict a, void **restrict addr , size_t *restrict size)
39 {
40 if (!a->_a_stackaddr)
41 return EINVAL;
42 *size = a->_a_stacksize + DEFAULT_STACK_SIZE;
43 *addr = (void *)(a->_a_stackaddr - *size);
44 return 0;
45 }
46
47 int pthread_attr_getstacksize(const pthread_attr_t *restrict a, size_t *restrict size)
48 {
49 *size = a->_a_stacksize + DEFAULT_STACK_SIZE;
50 return 0;
51 }
52
53 int pthread_barrierattr_getpshared(const pthread_barrierattr_t *restrict a, int *restrict pshared)
54 {
55 *pshared = !!a->__attr;
56 return 0;
57 }
58
59 int pthread_condattr_getclock(const pthread_condattr_t *restrict a, clockid_t *r estrict clk)
60 {
61 *clk = a->__attr & 0x7fffffff;
62 return 0;
63 }
64
65 int pthread_condattr_getpshared(const pthread_condattr_t *restrict a, int *restr ict pshared)
66 {
67 *pshared = a->__attr>>31;
68 return 0;
69 }
70
71 int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *restrict a, int *re strict protocol)
72 {
73 *protocol = PTHREAD_PRIO_NONE;
74 return 0;
75 }
76 int pthread_mutexattr_getpshared(const pthread_mutexattr_t *restrict a, int *res trict pshared)
77 {
78 *pshared = a->__attr / 128U % 2;
79 return 0;
80 }
81
82 int pthread_mutexattr_getrobust(const pthread_mutexattr_t *restrict a, int *rest rict robust)
83 {
84 *robust = a->__attr / 4U % 2;
85 return 0;
86 }
87
88 int pthread_mutexattr_gettype(const pthread_mutexattr_t *restrict a, int *restri ct type)
89 {
90 *type = a->__attr & 3;
91 return 0;
92 }
93
94 int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *restrict a, int *r estrict pshared)
95 {
96 *pshared = a->__attr[0];
97 return 0;
98 }
OLDNEW
« no previous file with comments | « fusl/src/thread/pthread_attr_destroy.c ('k') | fusl/src/thread/pthread_attr_init.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698