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 // *int32
123	parent_tid *int32
124	flags      int32
125	rtp        *rtprio
126	spare      [3]uintptr
127}
128
129type thread int32 // long
130
131type sigset struct {
132	__bits [4]uint32
133}
134
135type stackt struct {
136	ss_sp    uintptr
137	ss_size  uintptr
138	ss_flags int32
139}
140
141type siginfo struct {
142	si_signo  int32
143	si_errno  int32
144	si_code   int32
145	si_pid    int32
146	si_uid    uint32
147	si_status int32
148	si_addr   uintptr
149	si_value  [4]byte
150	_reason   [32]byte
151}
152
153type mcontext struct {
154	__gregs [17]uint32
155	__fpu   [140]byte
156}
157
158type ucontext struct {
159	uc_sigmask  sigset
160	uc_mcontext mcontext
161	uc_link     *ucontext
162	uc_stack    stackt
163	uc_flags    int32
164	__spare__   [4]int32
165}
166
167type timespec struct {
168	tv_sec    int64
169	tv_nsec   int32
170	pad_cgo_0 [4]byte
171}
172
173//go:nosplit
174func (ts *timespec) setNsec(ns int64) {
175	ts.tv_sec = int64(timediv(ns, 1e9, &ts.tv_nsec))
176}
177
178type timeval struct {
179	tv_sec    int64
180	tv_usec   int32
181	pad_cgo_0 [4]byte
182}
183
184func (tv *timeval) set_usec(x int32) {
185	tv.tv_usec = x
186}
187
188type itimerval struct {
189	it_interval timeval
190	it_value    timeval
191}
192
193type umtx_time struct {
194	_timeout timespec
195	_flags   uint32
196	_clockid uint32
197}
198
199type keventt struct {
200	ident  uint32
201	filter int16
202	flags  uint16
203	fflags uint32
204	data   int32
205	udata  *byte
206}
207
208type bintime struct {
209	sec  int64
210	frac uint64
211}
212
213type vdsoTimehands struct {
214	algo         uint32
215	gen          uint32
216	scale        uint64
217	offset_count uint32
218	counter_mask uint32
219	offset       bintime
220	boottime     bintime
221	physical     uint32
222	res          [7]uint32
223}
224
225type vdsoTimekeep struct {
226	ver       uint32
227	enabled   uint32
228	current   uint32
229	pad_cgo_0 [4]byte
230}
231
232const (
233	_VDSO_TK_VER_CURR = 0x1
234
235	vdsoTimehandsSize = 0x58
236	vdsoTimekeepSize  = 0x10
237)
238