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	_PTHREAD_KEYS_MAX = 512
103
104	_F_GETFL = 0x3
105	_F_SETFL = 0x4
106
107	_O_WRONLY   = 0x1
108	_O_NONBLOCK = 0x4
109	_O_CREAT    = 0x200
110	_O_TRUNC    = 0x400
111
112	_VM_REGION_BASIC_INFO_COUNT_64 = 0x9
113	_VM_REGION_BASIC_INFO_64       = 0x9
114)
115
116type stackt struct {
117	ss_sp     *byte
118	ss_size   uintptr
119	ss_flags  int32
120	pad_cgo_0 [4]byte
121}
122
123type sigactiont struct {
124	__sigaction_u [8]byte
125	sa_tramp      unsafe.Pointer
126	sa_mask       uint32
127	sa_flags      int32
128}
129
130type usigactiont struct {
131	__sigaction_u [8]byte
132	sa_mask       uint32
133	sa_flags      int32
134}
135
136type siginfo struct {
137	si_signo  int32
138	si_errno  int32
139	si_code   int32
140	si_pid    int32
141	si_uid    uint32
142	si_status int32
143	si_addr   *byte
144	si_value  [8]byte
145	si_band   int64
146	__pad     [7]uint64
147}
148
149type timeval struct {
150	tv_sec    int64
151	tv_usec   int32
152	pad_cgo_0 [4]byte
153}
154
155func (tv *timeval) set_usec(x int32) {
156	tv.tv_usec = x
157}
158
159type itimerval struct {
160	it_interval timeval
161	it_value    timeval
162}
163
164type timespec struct {
165	tv_sec  int64
166	tv_nsec int64
167}
168
169//go:nosplit
170func (ts *timespec) setNsec(ns int64) {
171	ts.tv_sec = ns / 1e9
172	ts.tv_nsec = ns % 1e9
173}
174
175type exceptionstate64 struct {
176	far uint64 // virtual fault addr
177	esr uint32 // exception syndrome
178	exc uint32 // number of arm exception taken
179}
180
181type regs64 struct {
182	x     [29]uint64 // registers x0 to x28
183	fp    uint64     // frame register, x29
184	lr    uint64     // link register, x30
185	sp    uint64     // stack pointer, x31
186	pc    uint64     // program counter
187	cpsr  uint32     // current program status register
188	__pad uint32
189}
190
191type neonstate64 struct {
192	v    [64]uint64 // actually [32]uint128
193	fpsr uint32
194	fpcr uint32
195}
196
197type mcontext64 struct {
198	es exceptionstate64
199	ss regs64
200	ns neonstate64
201}
202
203type ucontext struct {
204	uc_onstack  int32
205	uc_sigmask  uint32
206	uc_stack    stackt
207	uc_link     *ucontext
208	uc_mcsize   uint64
209	uc_mcontext *mcontext64
210}
211
212type keventt struct {
213	ident  uint64
214	filter int16
215	flags  uint16
216	fflags uint32
217	data   int64
218	udata  *byte
219}
220
221type pthread uintptr
222type pthreadattr struct {
223	X__sig    int64
224	X__opaque [56]int8
225}
226type pthreadmutex struct {
227	X__sig    int64
228	X__opaque [56]int8
229}
230type pthreadmutexattr struct {
231	X__sig    int64
232	X__opaque [8]int8
233}
234type pthreadcond struct {
235	X__sig    int64
236	X__opaque [40]int8
237}
238type pthreadcondattr struct {
239	X__sig    int64
240	X__opaque [8]int8
241}
242
243type machTimebaseInfo struct {
244	numer uint32
245	denom uint32
246}
247
248type pthreadkey uint64
249
250type machPort uint32
251type machVMMapRead uint32
252type machVMAddress uint64
253type machVMSize uint64
254type machVMRegionFlavour int32
255type machVMRegionInfo *int32
256type machMsgTypeNumber uint32
257