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