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

Side by Side Diff: fusl/src/internal/pthread_impl.h

Issue 1714623002: [fusl] clang-format fusl (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: headers too Created 4 years, 10 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
OLDNEW
1 #ifndef _PTHREAD_IMPL_H 1 #ifndef _PTHREAD_IMPL_H
2 #define _PTHREAD_IMPL_H 2 #define _PTHREAD_IMPL_H
3 3
4 #include <pthread.h> 4 #include <pthread.h>
5 #include <signal.h> 5 #include <signal.h>
6 #include <errno.h> 6 #include <errno.h>
7 #include <limits.h> 7 #include <limits.h>
8 #include "libc.h" 8 #include "libc.h"
9 #include "syscall.h" 9 #include "syscall.h"
10 #include "atomic.h" 10 #include "atomic.h"
11 #include "futex.h" 11 #include "futex.h"
12 12
13 #define pthread __pthread 13 #define pthread __pthread
14 14
15 struct pthread { 15 struct pthread {
16 » struct pthread *self; 16 struct pthread* self;
17 » void **dtv, *unused1, *unused2; 17 void **dtv, *unused1, *unused2;
18 » uintptr_t sysinfo; 18 uintptr_t sysinfo;
19 » uintptr_t canary, canary2; 19 uintptr_t canary, canary2;
20 » pid_t tid, pid; 20 pid_t tid, pid;
21 » int tsd_used, errno_val; 21 int tsd_used, errno_val;
22 » volatile int cancel, canceldisable, cancelasync; 22 volatile int cancel, canceldisable, cancelasync;
23 » int detached; 23 int detached;
24 » unsigned char *map_base; 24 unsigned char* map_base;
25 » size_t map_size; 25 size_t map_size;
26 » void *stack; 26 void* stack;
27 » size_t stack_size; 27 size_t stack_size;
28 » void *start_arg; 28 void* start_arg;
29 » void *(*start)(void *); 29 void* (*start)(void*);
30 » void *result; 30 void* result;
31 » struct __ptcb *cancelbuf; 31 struct __ptcb* cancelbuf;
32 » void **tsd; 32 void** tsd;
33 » pthread_attr_t attr; 33 pthread_attr_t attr;
34 » volatile int dead; 34 volatile int dead;
35 » struct { 35 struct {
36 » » volatile void *volatile head; 36 volatile void* volatile head;
37 » » long off; 37 long off;
38 » » volatile void *volatile pending; 38 volatile void* volatile pending;
39 » } robust_list; 39 } robust_list;
40 » int unblock_cancel; 40 int unblock_cancel;
41 » volatile int timer_id; 41 volatile int timer_id;
42 » locale_t locale; 42 locale_t locale;
43 » volatile int killlock[2]; 43 volatile int killlock[2];
44 » volatile int exitlock[2]; 44 volatile int exitlock[2];
45 » volatile int startlock[2]; 45 volatile int startlock[2];
46 » unsigned long sigmask[_NSIG/8/sizeof(long)]; 46 unsigned long sigmask[_NSIG / 8 / sizeof(long)];
47 » char *dlerror_buf; 47 char* dlerror_buf;
48 » int dlerror_flag; 48 int dlerror_flag;
49 » void *stdio_locks; 49 void* stdio_locks;
50 » uintptr_t canary_at_end; 50 uintptr_t canary_at_end;
51 » void **dtv_copy; 51 void** dtv_copy;
52 }; 52 };
53 53
54 struct __timer { 54 struct __timer {
55 » int timerid; 55 int timerid;
56 » pthread_t thread; 56 pthread_t thread;
57 }; 57 };
58 58
59 #define __SU (sizeof(size_t)/sizeof(int)) 59 #define __SU (sizeof(size_t) / sizeof(int))
60 60
61 #define _a_stacksize __u.__s[0] 61 #define _a_stacksize __u.__s[0]
62 #define _a_guardsize __u.__s[1] 62 #define _a_guardsize __u.__s[1]
63 #define _a_stackaddr __u.__s[2] 63 #define _a_stackaddr __u.__s[2]
64 #define _a_detach __u.__i[3*__SU+0] 64 #define _a_detach __u.__i[3 * __SU + 0]
65 #define _a_sched __u.__i[3*__SU+1] 65 #define _a_sched __u.__i[3 * __SU + 1]
66 #define _a_policy __u.__i[3*__SU+2] 66 #define _a_policy __u.__i[3 * __SU + 2]
67 #define _a_prio __u.__i[3*__SU+3] 67 #define _a_prio __u.__i[3 * __SU + 3]
68 #define _m_type __u.__i[0] 68 #define _m_type __u.__i[0]
69 #define _m_lock __u.__vi[1] 69 #define _m_lock __u.__vi[1]
70 #define _m_waiters __u.__vi[2] 70 #define _m_waiters __u.__vi[2]
71 #define _m_prev __u.__p[3] 71 #define _m_prev __u.__p[3]
72 #define _m_next __u.__p[4] 72 #define _m_next __u.__p[4]
73 #define _m_count __u.__i[5] 73 #define _m_count __u.__i[5]
74 #define _c_shared __u.__p[0] 74 #define _c_shared __u.__p[0]
75 #define _c_seq __u.__vi[2] 75 #define _c_seq __u.__vi[2]
76 #define _c_waiters __u.__vi[3] 76 #define _c_waiters __u.__vi[3]
77 #define _c_clock __u.__i[4] 77 #define _c_clock __u.__i[4]
(...skipping 17 matching lines...) Expand all
95 #endif 95 #endif
96 96
97 #ifndef DTP_OFFSET 97 #ifndef DTP_OFFSET
98 #define DTP_OFFSET 0 98 #define DTP_OFFSET 0
99 #endif 99 #endif
100 100
101 #define SIGTIMER 32 101 #define SIGTIMER 32
102 #define SIGCANCEL 33 102 #define SIGCANCEL 33
103 #define SIGSYNCCALL 34 103 #define SIGSYNCCALL 34
104 104
105 #define SIGALL_SET ((sigset_t *)(const unsigned long long [2]){ -1,-1 }) 105 #define SIGALL_SET ((sigset_t*)(const unsigned long long[2]){-1, -1})
106 #define SIGPT_SET \ 106 #define SIGPT_SET \
107 » ((sigset_t *)(const unsigned long [_NSIG/8/sizeof(long)]){ \ 107 ((sigset_t*)(const unsigned long[_NSIG / 8 / \
108 » [sizeof(long)==4] = 3UL<<(32*(sizeof(long)>4)) }) 108 sizeof(long)]){[sizeof(long) == 4] = \
109 3UL \
110 << (32 * (sizeof(long) > \
111 4))})
109 #define SIGTIMER_SET \ 112 #define SIGTIMER_SET \
110 » ((sigset_t *)(const unsigned long [_NSIG/8/sizeof(long)]){ \ 113 ((sigset_t*)(const unsigned long[_NSIG / 8 / sizeof(long)]){0x80000000})
111 » 0x80000000 })
112 114
113 pthread_t __pthread_self_init(void); 115 pthread_t __pthread_self_init(void);
114 116
115 int __clone(int (*)(void *), void *, int, void *, ...); 117 int __clone(int (*)(void*), void*, int, void*, ...);
116 int __set_thread_area(void *); 118 int __set_thread_area(void*);
117 int __libc_sigaction(int, const struct sigaction *, struct sigaction *); 119 int __libc_sigaction(int, const struct sigaction*, struct sigaction*);
118 int __libc_sigprocmask(int, const sigset_t *, sigset_t *); 120 int __libc_sigprocmask(int, const sigset_t*, sigset_t*);
119 void __lock(volatile int *); 121 void __lock(volatile int*);
120 void __unmapself(void *, size_t); 122 void __unmapself(void*, size_t);
121 123
122 void __vm_wait(void); 124 void __vm_wait(void);
123 void __vm_lock(void); 125 void __vm_lock(void);
124 void __vm_unlock(void); 126 void __vm_unlock(void);
125 127
126 int __timedwait(volatile int *, int, clockid_t, const struct timespec *, int); 128 int __timedwait(volatile int*, int, clockid_t, const struct timespec*, int);
127 int __timedwait_cp(volatile int *, int, clockid_t, const struct timespec *, int) ; 129 int __timedwait_cp(volatile int*, int, clockid_t, const struct timespec*, int);
128 void __wait(volatile int *, volatile int *, int, int); 130 void __wait(volatile int*, volatile int*, int, int);
129 static inline void __wake(volatile void *addr, int cnt, int priv) 131 static inline void __wake(volatile void* addr, int cnt, int priv) {
130 { 132 if (priv)
131 » if (priv) priv = 128; 133 priv = 128;
132 » if (cnt<0) cnt = INT_MAX; 134 if (cnt < 0)
133 » __syscall(SYS_futex, addr, FUTEX_WAKE|priv, cnt) != -ENOSYS || 135 cnt = INT_MAX;
134 » __syscall(SYS_futex, addr, FUTEX_WAKE, cnt); 136 __syscall(SYS_futex, addr, FUTEX_WAKE | priv, cnt) != -ENOSYS ||
137 __syscall(SYS_futex, addr, FUTEX_WAKE, cnt);
135 } 138 }
136 139
137 void __acquire_ptc(void); 140 void __acquire_ptc(void);
138 void __release_ptc(void); 141 void __release_ptc(void);
139 void __inhibit_ptc(void); 142 void __inhibit_ptc(void);
140 143
141 void __block_all_sigs(void *); 144 void __block_all_sigs(void*);
142 void __block_app_sigs(void *); 145 void __block_app_sigs(void*);
143 void __restore_sigs(void *); 146 void __restore_sigs(void*);
144 147
145 #define DEFAULT_STACK_SIZE 81920 148 #define DEFAULT_STACK_SIZE 81920
146 #define DEFAULT_GUARD_SIZE PAGE_SIZE 149 #define DEFAULT_GUARD_SIZE PAGE_SIZE
147 150
148 #define __ATTRP_C11_THREAD ((void*)(uintptr_t)-1) 151 #define __ATTRP_C11_THREAD ((void*)(uintptr_t)-1)
149 152
150 #endif 153 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698