1// created by cgo -cdefs and then converted to Go
2// cgo -cdefs defs_linux.go defs1_linux.go
3
4package runtime
5
6const (
7	_EINTR  = 0x4
8	_EAGAIN = 0xb
9	_ENOMEM = 0xc
10	_ENOSYS = 0x26
11
12	_PROT_NONE  = 0x0
13	_PROT_READ  = 0x1
14	_PROT_WRITE = 0x2
15	_PROT_EXEC  = 0x4
16
17	_MAP_ANON    = 0x20
18	_MAP_PRIVATE = 0x2
19	_MAP_FIXED   = 0x10
20
21	_MADV_DONTNEED   = 0x4
22	_MADV_FREE       = 0x8
23	_MADV_HUGEPAGE   = 0xe
24	_MADV_NOHUGEPAGE = 0xf
25
26	_SA_RESTART  = 0x10000000
27	_SA_ONSTACK  = 0x8000000
28	_SA_RESTORER = 0x4000000
29	_SA_SIGINFO  = 0x4
30
31	_SIGHUP    = 0x1
32	_SIGINT    = 0x2
33	_SIGQUIT   = 0x3
34	_SIGILL    = 0x4
35	_SIGTRAP   = 0x5
36	_SIGABRT   = 0x6
37	_SIGBUS    = 0x7
38	_SIGFPE    = 0x8
39	_SIGKILL   = 0x9
40	_SIGUSR1   = 0xa
41	_SIGSEGV   = 0xb
42	_SIGUSR2   = 0xc
43	_SIGPIPE   = 0xd
44	_SIGALRM   = 0xe
45	_SIGSTKFLT = 0x10
46	_SIGCHLD   = 0x11
47	_SIGCONT   = 0x12
48	_SIGSTOP   = 0x13
49	_SIGTSTP   = 0x14
50	_SIGTTIN   = 0x15
51	_SIGTTOU   = 0x16
52	_SIGURG    = 0x17
53	_SIGXCPU   = 0x18
54	_SIGXFSZ   = 0x19
55	_SIGVTALRM = 0x1a
56	_SIGPROF   = 0x1b
57	_SIGWINCH  = 0x1c
58	_SIGIO     = 0x1d
59	_SIGPWR    = 0x1e
60	_SIGSYS    = 0x1f
61
62	_FPE_INTDIV = 0x1
63	_FPE_INTOVF = 0x2
64	_FPE_FLTDIV = 0x3
65	_FPE_FLTOVF = 0x4
66	_FPE_FLTUND = 0x5
67	_FPE_FLTRES = 0x6
68	_FPE_FLTINV = 0x7
69	_FPE_FLTSUB = 0x8
70
71	_BUS_ADRALN = 0x1
72	_BUS_ADRERR = 0x2
73	_BUS_OBJERR = 0x3
74
75	_SEGV_MAPERR = 0x1
76	_SEGV_ACCERR = 0x2
77
78	_ITIMER_REAL    = 0x0
79	_ITIMER_VIRTUAL = 0x1
80	_ITIMER_PROF    = 0x2
81
82	_EPOLLIN       = 0x1
83	_EPOLLOUT      = 0x4
84	_EPOLLERR      = 0x8
85	_EPOLLHUP      = 0x10
86	_EPOLLRDHUP    = 0x2000
87	_EPOLLET       = 0x80000000
88	_EPOLL_CLOEXEC = 0x80000
89	_EPOLL_CTL_ADD = 0x1
90	_EPOLL_CTL_DEL = 0x2
91	_EPOLL_CTL_MOD = 0x3
92
93	_AF_UNIX    = 0x1
94	_F_SETFL    = 0x4
95	_SOCK_DGRAM = 0x2
96)
97
98type timespec struct {
99	tv_sec  int64
100	tv_nsec int64
101}
102
103//go:nosplit
104func (ts *timespec) setNsec(ns int64) {
105	ts.tv_sec = ns / 1e9
106	ts.tv_nsec = ns % 1e9
107}
108
109type timeval struct {
110	tv_sec  int64
111	tv_usec int64
112}
113
114func (tv *timeval) set_usec(x int32) {
115	tv.tv_usec = int64(x)
116}
117
118type sigactiont struct {
119	sa_handler  uintptr
120	sa_flags    uint64
121	sa_restorer uintptr
122	sa_mask     uint64
123}
124
125type siginfo struct {
126	si_signo int32
127	si_errno int32
128	si_code  int32
129	// below here is a union; si_addr is the only field we use
130	si_addr uint64
131}
132
133type itimerval struct {
134	it_interval timeval
135	it_value    timeval
136}
137
138type epollevent struct {
139	events uint32
140	data   [8]byte // unaligned uintptr
141}
142
143// created by cgo -cdefs and then converted to Go
144// cgo -cdefs defs_linux.go defs1_linux.go
145
146const (
147	_O_RDONLY   = 0x0
148	_O_NONBLOCK = 0x800
149	_O_CLOEXEC  = 0x80000
150)
151
152type usigset struct {
153	__val [16]uint64
154}
155
156type fpxreg struct {
157	significand [4]uint16
158	exponent    uint16
159	padding     [3]uint16
160}
161
162type xmmreg struct {
163	element [4]uint32
164}
165
166type fpstate struct {
167	cwd       uint16
168	swd       uint16
169	ftw       uint16
170	fop       uint16
171	rip       uint64
172	rdp       uint64
173	mxcsr     uint32
174	mxcr_mask uint32
175	_st       [8]fpxreg
176	_xmm      [16]xmmreg
177	padding   [24]uint32
178}
179
180type fpxreg1 struct {
181	significand [4]uint16
182	exponent    uint16
183	padding     [3]uint16
184}
185
186type xmmreg1 struct {
187	element [4]uint32
188}
189
190type fpstate1 struct {
191	cwd       uint16
192	swd       uint16
193	ftw       uint16
194	fop       uint16
195	rip       uint64
196	rdp       uint64
197	mxcsr     uint32
198	mxcr_mask uint32
199	_st       [8]fpxreg1
200	_xmm      [16]xmmreg1
201	padding   [24]uint32
202}
203
204type fpreg1 struct {
205	significand [4]uint16
206	exponent    uint16
207}
208
209type stackt struct {
210	ss_sp     *byte
211	ss_flags  int32
212	pad_cgo_0 [4]byte
213	ss_size   uintptr
214}
215
216type mcontext struct {
217	gregs       [23]uint64
218	fpregs      *fpstate
219	__reserved1 [8]uint64
220}
221
222type ucontext struct {
223	uc_flags     uint64
224	uc_link      *ucontext
225	uc_stack     stackt
226	uc_mcontext  mcontext
227	uc_sigmask   usigset
228	__fpregs_mem fpstate
229}
230
231type sigcontext struct {
232	r8          uint64
233	r9          uint64
234	r10         uint64
235	r11         uint64
236	r12         uint64
237	r13         uint64
238	r14         uint64
239	r15         uint64
240	rdi         uint64
241	rsi         uint64
242	rbp         uint64
243	rbx         uint64
244	rdx         uint64
245	rax         uint64
246	rcx         uint64
247	rsp         uint64
248	rip         uint64
249	eflags      uint64
250	cs          uint16
251	gs          uint16
252	fs          uint16
253	__pad0      uint16
254	err         uint64
255	trapno      uint64
256	oldmask     uint64
257	cr2         uint64
258	fpstate     *fpstate1
259	__reserved1 [8]uint64
260}
261
262type sockaddr_un struct {
263	family uint16
264	path   [108]byte
265}
266
267const __NEW_UTS_LEN = 64
268
269type new_utsname struct {
270	sysname    [__NEW_UTS_LEN + 1]byte
271	nodename   [__NEW_UTS_LEN + 1]byte
272	release    [__NEW_UTS_LEN + 1]byte
273	version    [__NEW_UTS_LEN + 1]byte
274	machine    [__NEW_UTS_LEN + 1]byte
275	domainname [__NEW_UTS_LEN + 1]byte
276}
277