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_ENABLE    = 0x4
89	_EV_DISABLE   = 0x8
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	_EVFILT_USER  = -0xa
97
98	_NOTE_TRIGGER = 0x1000000
99
100	_PTHREAD_CREATE_DETACHED = 0x2
101
102	_F_GETFL = 0x3
103	_F_SETFL = 0x4
104
105	_O_WRONLY   = 0x1
106	_O_NONBLOCK = 0x4
107	_O_CREAT    = 0x200
108	_O_TRUNC    = 0x400
109
110	_VM_REGION_BASIC_INFO_COUNT_64 = 0x9
111	_VM_REGION_BASIC_INFO_64       = 0x9
112)
113
114type stackt struct {
115	ss_sp     *byte
116	ss_size   uintptr
117	ss_flags  int32
118	pad_cgo_0 [4]byte
119}
120
121type sigactiont struct {
122	__sigaction_u [8]byte
123	sa_tramp      unsafe.Pointer
124	sa_mask       uint32
125	sa_flags      int32
126}
127
128type usigactiont struct {
129	__sigaction_u [8]byte
130	sa_mask       uint32
131	sa_flags      int32
132}
133
134type siginfo struct {
135	si_signo  int32
136	si_errno  int32
137	si_code   int32
138	si_pid    int32
139	si_uid    uint32
140	si_status int32
141	si_addr   uint64
142	si_value  [8]byte
143	si_band   int64
144	__pad     [7]uint64
145}
146
147type timeval struct {
148	tv_sec    int64
149	tv_usec   int32
150	pad_cgo_0 [4]byte
151}
152
153func (tv *timeval) set_usec(x int32) {
154	tv.tv_usec = x
155}
156
157type itimerval struct {
158	it_interval timeval
159	it_value    timeval
160}
161
162type timespec struct {
163	tv_sec  int64
164	tv_nsec int64
165}
166
167//go:nosplit
168func (ts *timespec) setNsec(ns int64) {
169	ts.tv_sec = ns / 1e9
170	ts.tv_nsec = ns % 1e9
171}
172
173type fpcontrol struct {
174	pad_cgo_0 [2]byte
175}
176
177type fpstatus struct {
178	pad_cgo_0 [2]byte
179}
180
181type regmmst struct {
182	mmst_reg  [10]int8
183	mmst_rsrv [6]int8
184}
185
186type regxmm struct {
187	xmm_reg [16]int8
188}
189
190type regs64 struct {
191	rax    uint64
192	rbx    uint64
193	rcx    uint64
194	rdx    uint64
195	rdi    uint64
196	rsi    uint64
197	rbp    uint64
198	rsp    uint64
199	r8     uint64
200	r9     uint64
201	r10    uint64
202	r11    uint64
203	r12    uint64
204	r13    uint64
205	r14    uint64
206	r15    uint64
207	rip    uint64
208	rflags uint64
209	cs     uint64
210	fs     uint64
211	gs     uint64
212}
213
214type floatstate64 struct {
215	fpu_reserved  [2]int32
216	fpu_fcw       fpcontrol
217	fpu_fsw       fpstatus
218	fpu_ftw       uint8
219	fpu_rsrv1     uint8
220	fpu_fop       uint16
221	fpu_ip        uint32
222	fpu_cs        uint16
223	fpu_rsrv2     uint16
224	fpu_dp        uint32
225	fpu_ds        uint16
226	fpu_rsrv3     uint16
227	fpu_mxcsr     uint32
228	fpu_mxcsrmask uint32
229	fpu_stmm0     regmmst
230	fpu_stmm1     regmmst
231	fpu_stmm2     regmmst
232	fpu_stmm3     regmmst
233	fpu_stmm4     regmmst
234	fpu_stmm5     regmmst
235	fpu_stmm6     regmmst
236	fpu_stmm7     regmmst
237	fpu_xmm0      regxmm
238	fpu_xmm1      regxmm
239	fpu_xmm2      regxmm
240	fpu_xmm3      regxmm
241	fpu_xmm4      regxmm
242	fpu_xmm5      regxmm
243	fpu_xmm6      regxmm
244	fpu_xmm7      regxmm
245	fpu_xmm8      regxmm
246	fpu_xmm9      regxmm
247	fpu_xmm10     regxmm
248	fpu_xmm11     regxmm
249	fpu_xmm12     regxmm
250	fpu_xmm13     regxmm
251	fpu_xmm14     regxmm
252	fpu_xmm15     regxmm
253	fpu_rsrv4     [96]int8
254	fpu_reserved1 int32
255}
256
257type exceptionstate64 struct {
258	trapno     uint16
259	cpu        uint16
260	err        uint32
261	faultvaddr uint64
262}
263
264type mcontext64 struct {
265	es        exceptionstate64
266	ss        regs64
267	fs        floatstate64
268	pad_cgo_0 [4]byte
269}
270
271type regs32 struct {
272	eax    uint32
273	ebx    uint32
274	ecx    uint32
275	edx    uint32
276	edi    uint32
277	esi    uint32
278	ebp    uint32
279	esp    uint32
280	ss     uint32
281	eflags uint32
282	eip    uint32
283	cs     uint32
284	ds     uint32
285	es     uint32
286	fs     uint32
287	gs     uint32
288}
289
290type floatstate32 struct {
291	fpu_reserved  [2]int32
292	fpu_fcw       fpcontrol
293	fpu_fsw       fpstatus
294	fpu_ftw       uint8
295	fpu_rsrv1     uint8
296	fpu_fop       uint16
297	fpu_ip        uint32
298	fpu_cs        uint16
299	fpu_rsrv2     uint16
300	fpu_dp        uint32
301	fpu_ds        uint16
302	fpu_rsrv3     uint16
303	fpu_mxcsr     uint32
304	fpu_mxcsrmask uint32
305	fpu_stmm0     regmmst
306	fpu_stmm1     regmmst
307	fpu_stmm2     regmmst
308	fpu_stmm3     regmmst
309	fpu_stmm4     regmmst
310	fpu_stmm5     regmmst
311	fpu_stmm6     regmmst
312	fpu_stmm7     regmmst
313	fpu_xmm0      regxmm
314	fpu_xmm1      regxmm
315	fpu_xmm2      regxmm
316	fpu_xmm3      regxmm
317	fpu_xmm4      regxmm
318	fpu_xmm5      regxmm
319	fpu_xmm6      regxmm
320	fpu_xmm7      regxmm
321	fpu_rsrv4     [224]int8
322	fpu_reserved1 int32
323}
324
325type exceptionstate32 struct {
326	trapno     uint16
327	cpu        uint16
328	err        uint32
329	faultvaddr uint32
330}
331
332type mcontext32 struct {
333	es exceptionstate32
334	ss regs32
335	fs floatstate32
336}
337
338type ucontext struct {
339	uc_onstack  int32
340	uc_sigmask  uint32
341	uc_stack    stackt
342	uc_link     *ucontext
343	uc_mcsize   uint64
344	uc_mcontext *mcontext64
345}
346
347type keventt struct {
348	ident  uint64
349	filter int16
350	flags  uint16
351	fflags uint32
352	data   int64
353	udata  *byte
354}
355
356type pthread uintptr
357type pthreadattr struct {
358	X__sig    int64
359	X__opaque [56]int8
360}
361type pthreadmutex struct {
362	X__sig    int64
363	X__opaque [56]int8
364}
365type pthreadmutexattr struct {
366	X__sig    int64
367	X__opaque [8]int8
368}
369type pthreadcond struct {
370	X__sig    int64
371	X__opaque [40]int8
372}
373type pthreadcondattr struct {
374	X__sig    int64
375	X__opaque [8]int8
376}
377
378type machTimebaseInfo struct {
379	numer uint32
380	denom uint32
381}
382
383type machPort uint32
384type machVMMapRead uint32
385type machVMAddress uint64
386type machVMSize uint64
387type machVMRegionFlavour int32
388type machVMRegionInfo *int32
389type machMsgTypeNumber uint32
390