1// created by cgo -cdefs and then converted to Go
2// cgo -cdefs defs_freebsd.go
3
4package runtime
5
6import "unsafe"
7
8const (
9	_NBBY            = 0x8
10	_CTL_MAXNAME     = 0x18
11	_CPU_LEVEL_WHICH = 0x3
12	_CPU_WHICH_PID   = 0x2
13)
14
15const (
16	_EINTR  = 0x4
17	_EFAULT = 0xe
18	_EAGAIN = 0x23
19	_ENOSYS = 0x4e
20
21	_O_NONBLOCK = 0x4
22	_O_CLOEXEC  = 0x100000
23
24	_PROT_NONE  = 0x0
25	_PROT_READ  = 0x1
26	_PROT_WRITE = 0x2
27	_PROT_EXEC  = 0x4
28
29	_MAP_ANON    = 0x1000
30	_MAP_SHARED  = 0x1
31	_MAP_PRIVATE = 0x2
32	_MAP_FIXED   = 0x10
33
34	_MADV_FREE = 0x5
35
36	_SA_SIGINFO = 0x40
37	_SA_RESTART = 0x2
38	_SA_ONSTACK = 0x1
39
40	_CLOCK_MONOTONIC = 0x4
41	_CLOCK_REALTIME  = 0x0
42
43	_UMTX_OP_WAIT_UINT         = 0xb
44	_UMTX_OP_WAIT_UINT_PRIVATE = 0xf
45	_UMTX_OP_WAKE              = 0x3
46	_UMTX_OP_WAKE_PRIVATE      = 0x10
47
48	_SIGHUP    = 0x1
49	_SIGINT    = 0x2
50	_SIGQUIT   = 0x3
51	_SIGILL    = 0x4
52	_SIGTRAP   = 0x5
53	_SIGABRT   = 0x6
54	_SIGEMT    = 0x7
55	_SIGFPE    = 0x8
56	_SIGKILL   = 0x9
57	_SIGBUS    = 0xa
58	_SIGSEGV   = 0xb
59	_SIGSYS    = 0xc
60	_SIGPIPE   = 0xd
61	_SIGALRM   = 0xe
62	_SIGTERM   = 0xf
63	_SIGURG    = 0x10
64	_SIGSTOP   = 0x11
65	_SIGTSTP   = 0x12
66	_SIGCONT   = 0x13
67	_SIGCHLD   = 0x14
68	_SIGTTIN   = 0x15
69	_SIGTTOU   = 0x16
70	_SIGIO     = 0x17
71	_SIGXCPU   = 0x18
72	_SIGXFSZ   = 0x19
73	_SIGVTALRM = 0x1a
74	_SIGPROF   = 0x1b
75	_SIGWINCH  = 0x1c
76	_SIGINFO   = 0x1d
77	_SIGUSR1   = 0x1e
78	_SIGUSR2   = 0x1f
79
80	_FPE_INTDIV = 0x2
81	_FPE_INTOVF = 0x1
82	_FPE_FLTDIV = 0x3
83	_FPE_FLTOVF = 0x4
84	_FPE_FLTUND = 0x5
85	_FPE_FLTRES = 0x6
86	_FPE_FLTINV = 0x7
87	_FPE_FLTSUB = 0x8
88
89	_BUS_ADRALN = 0x1
90	_BUS_ADRERR = 0x2
91	_BUS_OBJERR = 0x3
92
93	_SEGV_MAPERR = 0x1
94	_SEGV_ACCERR = 0x2
95
96	_ITIMER_REAL    = 0x0
97	_ITIMER_VIRTUAL = 0x1
98	_ITIMER_PROF    = 0x2
99
100	_EV_ADD       = 0x1
101	_EV_DELETE    = 0x2
102	_EV_CLEAR     = 0x20
103	_EV_RECEIPT   = 0x40
104	_EV_ERROR     = 0x4000
105	_EV_EOF       = 0x8000
106	_EVFILT_READ  = -0x1
107	_EVFILT_WRITE = -0x2
108)
109
110type rtprio struct {
111	_type uint16
112	prio  uint16
113}
114
115type thrparam struct {
116	start_func uintptr
117	arg        unsafe.Pointer
118	stack_base uintptr
119	stack_size uintptr
120	tls_base   unsafe.Pointer
121	tls_size   uintptr
122	child_tid  unsafe.Pointer // *int64
123	parent_tid *int64
124	flags      int32
125	pad_cgo_0  [4]byte
126	rtp        *rtprio
127	spare      [3]uintptr
128}
129
130type thread int64 // long
131
132type sigset struct {
133	__bits [4]uint32
134}
135
136type stackt struct {
137	ss_sp     uintptr
138	ss_size   uintptr
139	ss_flags  int32
140	pad_cgo_0 [4]byte
141}
142
143type siginfo struct {
144	si_signo  int32
145	si_errno  int32
146	si_code   int32
147	si_pid    int32
148	si_uid    uint32
149	si_status int32
150	si_addr   uint64
151	si_value  [8]byte
152	_reason   [40]byte
153}
154
155type gpregs struct {
156	gp_x    [30]uint64
157	gp_lr   uint64
158	gp_sp   uint64
159	gp_elr  uint64
160	gp_spsr uint32
161	gp_pad  int32
162}
163
164type fpregs struct {
165	fp_q     [64]uint64 // actually [32]uint128
166	fp_sr    uint32
167	fp_cr    uint32
168	fp_flags int32
169	fp_pad   int32
170}
171
172type mcontext struct {
173	mc_gpregs gpregs
174	mc_fpregs fpregs
175	mc_flags  int32
176	mc_pad    int32
177	mc_spare  [8]uint64
178}
179
180type ucontext struct {
181	uc_sigmask  sigset
182	uc_mcontext mcontext
183	uc_link     *ucontext
184	uc_stack    stackt
185	uc_flags    int32
186	__spare__   [4]int32
187	pad_cgo_0   [12]byte
188}
189
190type timespec struct {
191	tv_sec  int64
192	tv_nsec int64
193}
194
195//go:nosplit
196func (ts *timespec) setNsec(ns int64) {
197	ts.tv_sec = ns / 1e9
198	ts.tv_nsec = ns % 1e9
199}
200
201type timeval struct {
202	tv_sec  int64
203	tv_usec int64
204}
205
206func (tv *timeval) set_usec(x int32) {
207	tv.tv_usec = int64(x)
208}
209
210type itimerval struct {
211	it_interval timeval
212	it_value    timeval
213}
214
215type umtx_time struct {
216	_timeout timespec
217	_flags   uint32
218	_clockid uint32
219}
220
221type keventt struct {
222	ident  uint64
223	filter int16
224	flags  uint16
225	fflags uint32
226	data   int64
227	udata  *byte
228}
229
230type bintime struct {
231	sec  int64
232	frac uint64
233}
234
235type vdsoTimehands struct {
236	algo         uint32
237	gen          uint32
238	scale        uint64
239	offset_count uint32
240	counter_mask uint32
241	offset       bintime
242	boottime     bintime
243	physical     uint32
244	res          [7]uint32
245}
246
247type vdsoTimekeep struct {
248	ver       uint32
249	enabled   uint32
250	current   uint32
251	pad_cgo_0 [4]byte
252}
253
254const (
255	_VDSO_TK_VER_CURR = 0x1
256
257	vdsoTimehandsSize = 0x58
258	vdsoTimekeepSize  = 0x10
259)
260