1// created by cgo -cdefs and then converted to Go
2// cgo -cdefs defs_darwin.go
3
4package runtime
5
6import "unsafe"
7
8const (
9	_EINTR     = 0x4
10	_EFAULT    = 0xe
11	_EAGAIN    = 0x23
12	_ETIMEDOUT = 0x3c
13
14	_PROT_NONE  = 0x0
15	_PROT_READ  = 0x1
16	_PROT_WRITE = 0x2
17	_PROT_EXEC  = 0x4
18
19	_MAP_ANON    = 0x1000
20	_MAP_PRIVATE = 0x2
21	_MAP_FIXED   = 0x10
22
23	_MADV_DONTNEED      = 0x4
24	_MADV_FREE          = 0x5
25	_MADV_FREE_REUSABLE = 0x7
26	_MADV_FREE_REUSE    = 0x8
27
28	_SA_SIGINFO   = 0x40
29	_SA_RESTART   = 0x2
30	_SA_ONSTACK   = 0x1
31	_SA_USERTRAMP = 0x100
32	_SA_64REGSET  = 0x200
33
34	_SIGHUP    = 0x1
35	_SIGINT    = 0x2
36	_SIGQUIT   = 0x3
37	_SIGILL    = 0x4
38	_SIGTRAP   = 0x5
39	_SIGABRT   = 0x6
40	_SIGEMT    = 0x7
41	_SIGFPE    = 0x8
42	_SIGKILL   = 0x9
43	_SIGBUS    = 0xa
44	_SIGSEGV   = 0xb
45	_SIGSYS    = 0xc
46	_SIGPIPE   = 0xd
47	_SIGALRM   = 0xe
48	_SIGTERM   = 0xf
49	_SIGURG    = 0x10
50	_SIGSTOP   = 0x11
51	_SIGTSTP   = 0x12
52	_SIGCONT   = 0x13
53	_SIGCHLD   = 0x14
54	_SIGTTIN   = 0x15
55	_SIGTTOU   = 0x16
56	_SIGIO     = 0x17
57	_SIGXCPU   = 0x18
58	_SIGXFSZ   = 0x19
59	_SIGVTALRM = 0x1a
60	_SIGPROF   = 0x1b
61	_SIGWINCH  = 0x1c
62	_SIGINFO   = 0x1d
63	_SIGUSR1   = 0x1e
64	_SIGUSR2   = 0x1f
65
66	_FPE_INTDIV = 0x7
67	_FPE_INTOVF = 0x8
68	_FPE_FLTDIV = 0x1
69	_FPE_FLTOVF = 0x2
70	_FPE_FLTUND = 0x3
71	_FPE_FLTRES = 0x4
72	_FPE_FLTINV = 0x5
73	_FPE_FLTSUB = 0x6
74
75	_BUS_ADRALN = 0x1
76	_BUS_ADRERR = 0x2
77	_BUS_OBJERR = 0x3
78
79	_SEGV_MAPERR = 0x1
80	_SEGV_ACCERR = 0x2
81
82	_ITIMER_REAL    = 0x0
83	_ITIMER_VIRTUAL = 0x1
84	_ITIMER_PROF    = 0x2
85
86	_EV_ADD       = 0x1
87	_EV_DELETE    = 0x2
88	_EV_CLEAR     = 0x20
89	_EV_RECEIPT   = 0x40
90	_EV_ERROR     = 0x4000
91	_EV_EOF       = 0x8000
92	_EVFILT_READ  = -0x1
93	_EVFILT_WRITE = -0x2
94
95	_PTHREAD_CREATE_DETACHED = 0x2
96
97	_F_SETFD    = 0x2
98	_F_GETFL    = 0x3
99	_F_SETFL    = 0x4
100	_FD_CLOEXEC = 0x1
101
102	_O_NONBLOCK = 4
103)
104
105type stackt struct {
106	ss_sp    *byte
107	ss_size  uintptr
108	ss_flags int32
109}
110
111type sigactiont struct {
112	__sigaction_u [4]byte
113	sa_tramp      unsafe.Pointer
114	sa_mask       uint32
115	sa_flags      int32
116}
117
118type usigactiont struct {
119	__sigaction_u [4]byte
120	sa_mask       uint32
121	sa_flags      int32
122}
123
124type siginfo struct {
125	si_signo  int32
126	si_errno  int32
127	si_code   int32
128	si_pid    int32
129	si_uid    uint32
130	si_status int32
131	si_addr   uint32
132	si_value  [4]byte
133	si_band   int32
134	__pad     [7]uint32
135}
136
137type timeval struct {
138	tv_sec  int32
139	tv_usec int32
140}
141
142func (tv *timeval) set_usec(x int32) {
143	tv.tv_usec = x
144}
145
146type itimerval struct {
147	it_interval timeval
148	it_value    timeval
149}
150
151type timespec struct {
152	tv_sec  int32
153	tv_nsec int32
154}
155
156//go:nosplit
157func (ts *timespec) setNsec(ns int64) {
158	ts.tv_sec = timediv(ns, 1e9, &ts.tv_nsec)
159}
160
161type fpcontrol struct {
162	pad_cgo_0 [2]byte
163}
164
165type fpstatus struct {
166	pad_cgo_0 [2]byte
167}
168
169type regmmst struct {
170	mmst_reg  [10]int8
171	mmst_rsrv [6]int8
172}
173
174type regxmm struct {
175	xmm_reg [16]int8
176}
177
178type regs64 struct {
179	rax    uint64
180	rbx    uint64
181	rcx    uint64
182	rdx    uint64
183	rdi    uint64
184	rsi    uint64
185	rbp    uint64
186	rsp    uint64
187	r8     uint64
188	r9     uint64
189	r10    uint64
190	r11    uint64
191	r12    uint64
192	r13    uint64
193	r14    uint64
194	r15    uint64
195	rip    uint64
196	rflags uint64
197	cs     uint64
198	fs     uint64
199	gs     uint64
200}
201
202type floatstate64 struct {
203	fpu_reserved  [2]int32
204	fpu_fcw       fpcontrol
205	fpu_fsw       fpstatus
206	fpu_ftw       uint8
207	fpu_rsrv1     uint8
208	fpu_fop       uint16
209	fpu_ip        uint32
210	fpu_cs        uint16
211	fpu_rsrv2     uint16
212	fpu_dp        uint32
213	fpu_ds        uint16
214	fpu_rsrv3     uint16
215	fpu_mxcsr     uint32
216	fpu_mxcsrmask uint32
217	fpu_stmm0     regmmst
218	fpu_stmm1     regmmst
219	fpu_stmm2     regmmst
220	fpu_stmm3     regmmst
221	fpu_stmm4     regmmst
222	fpu_stmm5     regmmst
223	fpu_stmm6     regmmst
224	fpu_stmm7     regmmst
225	fpu_xmm0      regxmm
226	fpu_xmm1      regxmm
227	fpu_xmm2      regxmm
228	fpu_xmm3      regxmm
229	fpu_xmm4      regxmm
230	fpu_xmm5      regxmm
231	fpu_xmm6      regxmm
232	fpu_xmm7      regxmm
233	fpu_xmm8      regxmm
234	fpu_xmm9      regxmm
235	fpu_xmm10     regxmm
236	fpu_xmm11     regxmm
237	fpu_xmm12     regxmm
238	fpu_xmm13     regxmm
239	fpu_xmm14     regxmm
240	fpu_xmm15     regxmm
241	fpu_rsrv4     [96]int8
242	fpu_reserved1 int32
243}
244
245type exceptionstate64 struct {
246	trapno     uint16
247	cpu        uint16
248	err        uint32
249	faultvaddr uint64
250}
251
252type mcontext64 struct {
253	es exceptionstate64
254	ss regs64
255	fs floatstate64
256}
257
258type regs32 struct {
259	eax    uint32
260	ebx    uint32
261	ecx    uint32
262	edx    uint32
263	edi    uint32
264	esi    uint32
265	ebp    uint32
266	esp    uint32
267	ss     uint32
268	eflags uint32
269	eip    uint32
270	cs     uint32
271	ds     uint32
272	es     uint32
273	fs     uint32
274	gs     uint32
275}
276
277type floatstate32 struct {
278	fpu_reserved  [2]int32
279	fpu_fcw       fpcontrol
280	fpu_fsw       fpstatus
281	fpu_ftw       uint8
282	fpu_rsrv1     uint8
283	fpu_fop       uint16
284	fpu_ip        uint32
285	fpu_cs        uint16
286	fpu_rsrv2     uint16
287	fpu_dp        uint32
288	fpu_ds        uint16
289	fpu_rsrv3     uint16
290	fpu_mxcsr     uint32
291	fpu_mxcsrmask uint32
292	fpu_stmm0     regmmst
293	fpu_stmm1     regmmst
294	fpu_stmm2     regmmst
295	fpu_stmm3     regmmst
296	fpu_stmm4     regmmst
297	fpu_stmm5     regmmst
298	fpu_stmm6     regmmst
299	fpu_stmm7     regmmst
300	fpu_xmm0      regxmm
301	fpu_xmm1      regxmm
302	fpu_xmm2      regxmm
303	fpu_xmm3      regxmm
304	fpu_xmm4      regxmm
305	fpu_xmm5      regxmm
306	fpu_xmm6      regxmm
307	fpu_xmm7      regxmm
308	fpu_rsrv4     [224]int8
309	fpu_reserved1 int32
310}
311
312type exceptionstate32 struct {
313	trapno     uint16
314	cpu        uint16
315	err        uint32
316	faultvaddr uint32
317}
318
319type mcontext32 struct {
320	es exceptionstate32
321	ss regs32
322	fs floatstate32
323}
324
325type ucontext struct {
326	uc_onstack  int32
327	uc_sigmask  uint32
328	uc_stack    stackt
329	uc_link     *ucontext
330	uc_mcsize   uint32
331	uc_mcontext *mcontext32
332}
333
334type keventt struct {
335	ident  uint32
336	filter int16
337	flags  uint16
338	fflags uint32
339	data   int32
340	udata  *byte
341}
342
343type pthread uintptr
344type pthreadattr struct {
345	X__sig    int32
346	X__opaque [36]int8
347}
348type pthreadmutex struct {
349	X__sig    int32
350	X__opaque [40]int8
351}
352type pthreadmutexattr struct {
353	X__sig    int32
354	X__opaque [8]int8
355}
356type pthreadcond struct {
357	X__sig    int32
358	X__opaque [24]int8
359}
360type pthreadcondattr struct {
361	X__sig    int32
362	X__opaque [4]int8
363}
364type machTimebaseInfo struct {
365	numer uint32
366	denom uint32
367}
368