1// Note: cgo can't handle some Darwin/ARM structures, so this file can't
2// be auto generated by cgo yet.
3// Created based on output of `cgo -cdefs defs_darwin.go` and Darwin/ARM
4// specific header (mainly mcontext and ucontext related stuff)
5
6package runtime
7
8import "unsafe"
9
10const (
11	_EINTR     = 0x4
12	_EFAULT    = 0xe
13	_EAGAIN    = 0x23
14	_ETIMEDOUT = 0x3c
15
16	_PROT_NONE  = 0x0
17	_PROT_READ  = 0x1
18	_PROT_WRITE = 0x2
19	_PROT_EXEC  = 0x4
20
21	_MAP_ANON    = 0x1000
22	_MAP_PRIVATE = 0x2
23	_MAP_FIXED   = 0x10
24
25	_MADV_DONTNEED      = 0x4
26	_MADV_FREE          = 0x5
27	_MADV_FREE_REUSABLE = 0x7
28	_MADV_FREE_REUSE    = 0x8
29
30	_SA_SIGINFO   = 0x40
31	_SA_RESTART   = 0x2
32	_SA_ONSTACK   = 0x1
33	_SA_USERTRAMP = 0x100
34	_SA_64REGSET  = 0x200
35
36	_SIGHUP    = 0x1
37	_SIGINT    = 0x2
38	_SIGQUIT   = 0x3
39	_SIGILL    = 0x4
40	_SIGTRAP   = 0x5
41	_SIGABRT   = 0x6
42	_SIGEMT    = 0x7
43	_SIGFPE    = 0x8
44	_SIGKILL   = 0x9
45	_SIGBUS    = 0xa
46	_SIGSEGV   = 0xb
47	_SIGSYS    = 0xc
48	_SIGPIPE   = 0xd
49	_SIGALRM   = 0xe
50	_SIGTERM   = 0xf
51	_SIGURG    = 0x10
52	_SIGSTOP   = 0x11
53	_SIGTSTP   = 0x12
54	_SIGCONT   = 0x13
55	_SIGCHLD   = 0x14
56	_SIGTTIN   = 0x15
57	_SIGTTOU   = 0x16
58	_SIGIO     = 0x17
59	_SIGXCPU   = 0x18
60	_SIGXFSZ   = 0x19
61	_SIGVTALRM = 0x1a
62	_SIGPROF   = 0x1b
63	_SIGWINCH  = 0x1c
64	_SIGINFO   = 0x1d
65	_SIGUSR1   = 0x1e
66	_SIGUSR2   = 0x1f
67
68	_FPE_INTDIV = 0x7
69	_FPE_INTOVF = 0x8
70	_FPE_FLTDIV = 0x1
71	_FPE_FLTOVF = 0x2
72	_FPE_FLTUND = 0x3
73	_FPE_FLTRES = 0x4
74	_FPE_FLTINV = 0x5
75	_FPE_FLTSUB = 0x6
76
77	_BUS_ADRALN = 0x1
78	_BUS_ADRERR = 0x2
79	_BUS_OBJERR = 0x3
80
81	_SEGV_MAPERR = 0x1
82	_SEGV_ACCERR = 0x2
83
84	_ITIMER_REAL    = 0x0
85	_ITIMER_VIRTUAL = 0x1
86	_ITIMER_PROF    = 0x2
87
88	_EV_ADD       = 0x1
89	_EV_DELETE    = 0x2
90	_EV_CLEAR     = 0x20
91	_EV_RECEIPT   = 0x40
92	_EV_ERROR     = 0x4000
93	_EV_EOF       = 0x8000
94	_EVFILT_READ  = -0x1
95	_EVFILT_WRITE = -0x2
96
97	_PTHREAD_CREATE_DETACHED = 0x2
98
99	_F_SETFD    = 0x2
100	_F_GETFL    = 0x3
101	_F_SETFL    = 0x4
102	_FD_CLOEXEC = 0x1
103
104	_O_NONBLOCK = 4
105)
106
107type stackt struct {
108	ss_sp    *byte
109	ss_size  uintptr
110	ss_flags int32
111}
112
113type sigactiont struct {
114	__sigaction_u [4]byte
115	sa_tramp      unsafe.Pointer
116	sa_mask       uint32
117	sa_flags      int32
118}
119
120type usigactiont struct {
121	__sigaction_u [4]byte
122	sa_mask       uint32
123	sa_flags      int32
124}
125
126type siginfo struct {
127	si_signo  int32
128	si_errno  int32
129	si_code   int32
130	si_pid    int32
131	si_uid    uint32
132	si_status int32
133	si_addr   uint32
134	si_value  [4]byte
135	si_band   int32
136	__pad     [7]uint32
137}
138
139type timeval struct {
140	tv_sec  int32
141	tv_usec int32
142}
143
144func (tv *timeval) set_usec(x int32) {
145	tv.tv_usec = x
146}
147
148type itimerval struct {
149	it_interval timeval
150	it_value    timeval
151}
152
153type timespec struct {
154	tv_sec  int32
155	tv_nsec int32
156}
157
158//go:nosplit
159func (ts *timespec) setNsec(ns int64) {
160	ts.tv_sec = timediv(ns, 1e9, &ts.tv_nsec)
161}
162
163type floatstate32 struct {
164	r     [32]uint32
165	fpscr uint32
166}
167
168type regs32 struct {
169	r    [13]uint32 // r0 to r12
170	sp   uint32     // r13
171	lr   uint32     // r14
172	pc   uint32     // r15
173	cpsr uint32
174}
175
176type exceptionstate32 struct {
177	trapno     uint32 // NOTE: on 386, the trapno field is split into trapno and cpu
178	err        uint32
179	faultvaddr uint32
180}
181
182type mcontext32 struct {
183	es exceptionstate32
184	ss regs32
185	fs floatstate32
186}
187
188type ucontext struct {
189	uc_onstack  int32
190	uc_sigmask  uint32
191	uc_stack    stackt
192	uc_link     *ucontext
193	uc_mcsize   uint32
194	uc_mcontext *mcontext32
195}
196
197type keventt struct {
198	ident  uint32
199	filter int16
200	flags  uint16
201	fflags uint32
202	data   int32
203	udata  *byte
204}
205
206type pthread uintptr
207type pthreadattr struct {
208	X__sig    int32
209	X__opaque [36]int8
210}
211type pthreadmutex struct {
212	X__sig    int32
213	X__opaque [40]int8
214}
215type pthreadmutexattr struct {
216	X__sig    int32
217	X__opaque [8]int8
218}
219type pthreadcond struct {
220	X__sig    int32
221	X__opaque [24]int8
222}
223type pthreadcondattr struct {
224	X__sig    int32
225	X__opaque [4]int8
226}
227
228type machTimebaseInfo struct {
229	numer uint32
230	denom uint32
231}
232