blob: ab90723f754858bb2ac64636e85fbd8022f3d04d [file] [log] [blame]
Michael Mundaye6f36f02016-03-18 19:09:39 -04001// Copyright 2016 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5package runtime
6
7const (
8 _EINTR = 0x4
9 _EAGAIN = 0xb
10 _ENOMEM = 0xc
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_HUGEPAGE = 0xe
23 _MADV_NOHUGEPAGE = 0xf
24
25 _SA_RESTART = 0x10000000
26 _SA_ONSTACK = 0x8000000
27 _SA_SIGINFO = 0x4
28
29 _SIGHUP = 0x1
30 _SIGINT = 0x2
31 _SIGQUIT = 0x3
32 _SIGILL = 0x4
33 _SIGTRAP = 0x5
34 _SIGABRT = 0x6
35 _SIGBUS = 0x7
36 _SIGFPE = 0x8
37 _SIGKILL = 0x9
38 _SIGUSR1 = 0xa
39 _SIGSEGV = 0xb
40 _SIGUSR2 = 0xc
41 _SIGPIPE = 0xd
42 _SIGALRM = 0xe
43 _SIGSTKFLT = 0x10
44 _SIGCHLD = 0x11
45 _SIGCONT = 0x12
46 _SIGSTOP = 0x13
47 _SIGTSTP = 0x14
48 _SIGTTIN = 0x15
49 _SIGTTOU = 0x16
50 _SIGURG = 0x17
51 _SIGXCPU = 0x18
52 _SIGXFSZ = 0x19
53 _SIGVTALRM = 0x1a
54 _SIGPROF = 0x1b
55 _SIGWINCH = 0x1c
56 _SIGIO = 0x1d
57 _SIGPWR = 0x1e
58 _SIGSYS = 0x1f
59
60 _FPE_INTDIV = 0x1
61 _FPE_INTOVF = 0x2
62 _FPE_FLTDIV = 0x3
63 _FPE_FLTOVF = 0x4
64 _FPE_FLTUND = 0x5
65 _FPE_FLTRES = 0x6
66 _FPE_FLTINV = 0x7
67 _FPE_FLTSUB = 0x8
68
69 _BUS_ADRALN = 0x1
70 _BUS_ADRERR = 0x2
71 _BUS_OBJERR = 0x3
72
73 _SEGV_MAPERR = 0x1
74 _SEGV_ACCERR = 0x2
75
76 _ITIMER_REAL = 0x0
77 _ITIMER_VIRTUAL = 0x1
78 _ITIMER_PROF = 0x2
79
80 _EPOLLIN = 0x1
81 _EPOLLOUT = 0x4
82 _EPOLLERR = 0x8
83 _EPOLLHUP = 0x10
84 _EPOLLRDHUP = 0x2000
85 _EPOLLET = 0x80000000
86 _EPOLL_CLOEXEC = 0x80000
87 _EPOLL_CTL_ADD = 0x1
88 _EPOLL_CTL_DEL = 0x2
89 _EPOLL_CTL_MOD = 0x3
90)
91
92type timespec struct {
93 tv_sec int64
94 tv_nsec int64
95}
96
97func (ts *timespec) set_sec(x int64) {
98 ts.tv_sec = x
99}
100
101func (ts *timespec) set_nsec(x int32) {
102 ts.tv_nsec = int64(x)
103}
104
105type timeval struct {
106 tv_sec int64
107 tv_usec int64
108}
109
110func (tv *timeval) set_usec(x int32) {
111 tv.tv_usec = int64(x)
112}
113
114type sigactiont struct {
115 sa_handler uintptr
116 sa_flags uint64
117 sa_restorer uintptr
118 sa_mask uint64
119}
120
121type siginfo struct {
122 si_signo int32
123 si_errno int32
124 si_code int32
125 // below here is a union; si_addr is the only field we use
126 si_addr uint64
127}
128
129type itimerval struct {
130 it_interval timeval
131 it_value timeval
132}
133
134type epollevent struct {
135 events uint32
136 pad_cgo_0 [4]byte
137 data [8]byte // unaligned uintptr
138}
139
140const (
141 _O_RDONLY = 0x0
142 _O_CLOEXEC = 0x80000
143 _SA_RESTORER = 0
144)
145
Ian Lance Taylord15295c2016-09-25 13:38:54 -0700146type stackt struct {
Michael Mundaye6f36f02016-03-18 19:09:39 -0400147 ss_sp *byte
148 ss_flags int32
149 ss_size uintptr
150}
151
152type sigcontext struct {
153 psw_mask uint64
154 psw_addr uint64
155 gregs [16]uint64
156 aregs [16]uint32
157 fpc uint32
158 fpregs [16]uint64
159}
160
161type ucontext struct {
162 uc_flags uint64
163 uc_link *ucontext
Ian Lance Taylord15295c2016-09-25 13:38:54 -0700164 uc_stack stackt
Michael Mundaye6f36f02016-03-18 19:09:39 -0400165 uc_mcontext sigcontext
166 uc_sigmask uint64
167}