Russ Cox | 580ef3e | 2014-11-11 17:07:37 -0500 | [diff] [blame] | 1 | // created by cgo -cdefs and then converted to Go |
| 2 | // cgo -cdefs defs_freebsd.go |
| 3 | |
| 4 | package runtime |
| 5 | |
| 6 | import "unsafe" |
| 7 | |
| 8 | const ( |
| 9 | _EINTR = 0x4 |
| 10 | _EFAULT = 0xe |
| 11 | |
| 12 | _PROT_NONE = 0x0 |
| 13 | _PROT_READ = 0x1 |
| 14 | _PROT_WRITE = 0x2 |
| 15 | _PROT_EXEC = 0x4 |
| 16 | |
| 17 | _MAP_ANON = 0x1000 |
| 18 | _MAP_PRIVATE = 0x2 |
| 19 | _MAP_FIXED = 0x10 |
| 20 | |
| 21 | _MADV_FREE = 0x5 |
| 22 | |
| 23 | _SA_SIGINFO = 0x40 |
| 24 | _SA_RESTART = 0x2 |
| 25 | _SA_ONSTACK = 0x1 |
| 26 | |
| 27 | _UMTX_OP_WAIT_UINT = 0xb |
| 28 | _UMTX_OP_WAIT_UINT_PRIVATE = 0xf |
| 29 | _UMTX_OP_WAKE = 0x3 |
| 30 | _UMTX_OP_WAKE_PRIVATE = 0x10 |
| 31 | |
| 32 | _SIGHUP = 0x1 |
| 33 | _SIGINT = 0x2 |
| 34 | _SIGQUIT = 0x3 |
| 35 | _SIGILL = 0x4 |
| 36 | _SIGTRAP = 0x5 |
| 37 | _SIGABRT = 0x6 |
| 38 | _SIGEMT = 0x7 |
| 39 | _SIGFPE = 0x8 |
| 40 | _SIGKILL = 0x9 |
| 41 | _SIGBUS = 0xa |
| 42 | _SIGSEGV = 0xb |
| 43 | _SIGSYS = 0xc |
| 44 | _SIGPIPE = 0xd |
| 45 | _SIGALRM = 0xe |
| 46 | _SIGTERM = 0xf |
| 47 | _SIGURG = 0x10 |
| 48 | _SIGSTOP = 0x11 |
| 49 | _SIGTSTP = 0x12 |
| 50 | _SIGCONT = 0x13 |
| 51 | _SIGCHLD = 0x14 |
| 52 | _SIGTTIN = 0x15 |
| 53 | _SIGTTOU = 0x16 |
| 54 | _SIGIO = 0x17 |
| 55 | _SIGXCPU = 0x18 |
| 56 | _SIGXFSZ = 0x19 |
| 57 | _SIGVTALRM = 0x1a |
| 58 | _SIGPROF = 0x1b |
| 59 | _SIGWINCH = 0x1c |
| 60 | _SIGINFO = 0x1d |
| 61 | _SIGUSR1 = 0x1e |
| 62 | _SIGUSR2 = 0x1f |
| 63 | |
| 64 | _FPE_INTDIV = 0x2 |
| 65 | _FPE_INTOVF = 0x1 |
| 66 | _FPE_FLTDIV = 0x3 |
| 67 | _FPE_FLTOVF = 0x4 |
| 68 | _FPE_FLTUND = 0x5 |
| 69 | _FPE_FLTRES = 0x6 |
| 70 | _FPE_FLTINV = 0x7 |
| 71 | _FPE_FLTSUB = 0x8 |
| 72 | |
| 73 | _BUS_ADRALN = 0x1 |
| 74 | _BUS_ADRERR = 0x2 |
| 75 | _BUS_OBJERR = 0x3 |
| 76 | |
| 77 | _SEGV_MAPERR = 0x1 |
| 78 | _SEGV_ACCERR = 0x2 |
| 79 | |
| 80 | _ITIMER_REAL = 0x0 |
| 81 | _ITIMER_VIRTUAL = 0x1 |
| 82 | _ITIMER_PROF = 0x2 |
| 83 | |
| 84 | _EV_ADD = 0x1 |
| 85 | _EV_DELETE = 0x2 |
| 86 | _EV_CLEAR = 0x20 |
| 87 | _EV_RECEIPT = 0x40 |
| 88 | _EV_ERROR = 0x4000 |
| 89 | _EVFILT_READ = -0x1 |
| 90 | _EVFILT_WRITE = -0x2 |
| 91 | ) |
| 92 | |
| 93 | type rtprio struct { |
| 94 | _type uint16 |
| 95 | prio uint16 |
| 96 | } |
| 97 | |
| 98 | type thrparam struct { |
Russ Cox | aac17fd | 2014-11-11 23:00:29 -0500 | [diff] [blame] | 99 | start_func uintptr |
| 100 | arg unsafe.Pointer |
| 101 | stack_base uintptr |
| 102 | stack_size uintptr |
| 103 | tls_base unsafe.Pointer |
| 104 | tls_size uintptr |
| 105 | child_tid unsafe.Pointer // *int64 |
Russ Cox | 580ef3e | 2014-11-11 17:07:37 -0500 | [diff] [blame] | 106 | parent_tid *int64 |
| 107 | flags int32 |
| 108 | pad_cgo_0 [4]byte |
| 109 | rtp *rtprio |
| 110 | spare [3]uintptr |
| 111 | } |
| 112 | |
| 113 | type sigaltstackt struct { |
| 114 | ss_sp *int8 |
| 115 | ss_size uint64 |
| 116 | ss_flags int32 |
| 117 | pad_cgo_0 [4]byte |
| 118 | } |
| 119 | |
| 120 | type sigset struct { |
| 121 | __bits [4]uint32 |
| 122 | } |
| 123 | |
| 124 | type stackt struct { |
Russ Cox | aac17fd | 2014-11-11 23:00:29 -0500 | [diff] [blame] | 125 | ss_sp uintptr |
| 126 | ss_size uintptr |
Russ Cox | 580ef3e | 2014-11-11 17:07:37 -0500 | [diff] [blame] | 127 | ss_flags int32 |
| 128 | pad_cgo_0 [4]byte |
| 129 | } |
| 130 | |
| 131 | type siginfo struct { |
| 132 | si_signo int32 |
| 133 | si_errno int32 |
| 134 | si_code int32 |
| 135 | si_pid int32 |
| 136 | si_uid uint32 |
| 137 | si_status int32 |
Russ Cox | aac17fd | 2014-11-11 23:00:29 -0500 | [diff] [blame] | 138 | si_addr uint64 |
Russ Cox | 580ef3e | 2014-11-11 17:07:37 -0500 | [diff] [blame] | 139 | si_value [8]byte |
| 140 | _reason [40]byte |
| 141 | } |
| 142 | |
| 143 | type mcontext struct { |
Russ Cox | aac17fd | 2014-11-11 23:00:29 -0500 | [diff] [blame] | 144 | mc_onstack uint64 |
| 145 | mc_rdi uint64 |
| 146 | mc_rsi uint64 |
| 147 | mc_rdx uint64 |
| 148 | mc_rcx uint64 |
| 149 | mc_r8 uint64 |
| 150 | mc_r9 uint64 |
| 151 | mc_rax uint64 |
| 152 | mc_rbx uint64 |
| 153 | mc_rbp uint64 |
| 154 | mc_r10 uint64 |
| 155 | mc_r11 uint64 |
| 156 | mc_r12 uint64 |
| 157 | mc_r13 uint64 |
| 158 | mc_r14 uint64 |
| 159 | mc_r15 uint64 |
Russ Cox | 580ef3e | 2014-11-11 17:07:37 -0500 | [diff] [blame] | 160 | mc_trapno uint32 |
| 161 | mc_fs uint16 |
| 162 | mc_gs uint16 |
Russ Cox | aac17fd | 2014-11-11 23:00:29 -0500 | [diff] [blame] | 163 | mc_addr uint64 |
Russ Cox | 580ef3e | 2014-11-11 17:07:37 -0500 | [diff] [blame] | 164 | mc_flags uint32 |
| 165 | mc_es uint16 |
| 166 | mc_ds uint16 |
Russ Cox | aac17fd | 2014-11-11 23:00:29 -0500 | [diff] [blame] | 167 | mc_err uint64 |
| 168 | mc_rip uint64 |
| 169 | mc_cs uint64 |
| 170 | mc_rflags uint64 |
| 171 | mc_rsp uint64 |
| 172 | mc_ss uint64 |
| 173 | mc_len uint64 |
| 174 | mc_fpformat uint64 |
| 175 | mc_ownedfp uint64 |
| 176 | mc_fpstate [64]uint64 |
| 177 | mc_fsbase uint64 |
| 178 | mc_gsbase uint64 |
| 179 | mc_xfpustate uint64 |
| 180 | mc_xfpustate_len uint64 |
| 181 | mc_spare [4]uint64 |
Russ Cox | 580ef3e | 2014-11-11 17:07:37 -0500 | [diff] [blame] | 182 | } |
| 183 | |
| 184 | type ucontext struct { |
| 185 | uc_sigmask sigset |
| 186 | uc_mcontext mcontext |
| 187 | uc_link *ucontext |
| 188 | uc_stack stackt |
| 189 | uc_flags int32 |
| 190 | __spare__ [4]int32 |
| 191 | pad_cgo_0 [12]byte |
| 192 | } |
| 193 | |
| 194 | type timespec struct { |
| 195 | tv_sec int64 |
| 196 | tv_nsec int64 |
| 197 | } |
| 198 | |
Russ Cox | 580cba4 | 2014-11-14 14:50:00 -0500 | [diff] [blame] | 199 | func (ts *timespec) set_sec(x int64) { |
| 200 | ts.tv_sec = x |
Russ Cox | aac17fd | 2014-11-11 23:00:29 -0500 | [diff] [blame] | 201 | } |
| 202 | |
Russ Cox | 580ef3e | 2014-11-11 17:07:37 -0500 | [diff] [blame] | 203 | type timeval struct { |
| 204 | tv_sec int64 |
| 205 | tv_usec int64 |
| 206 | } |
| 207 | |
Russ Cox | aac17fd | 2014-11-11 23:00:29 -0500 | [diff] [blame] | 208 | func (tv *timeval) set_usec(x int32) { |
| 209 | tv.tv_usec = int64(x) |
| 210 | } |
| 211 | |
Russ Cox | 580ef3e | 2014-11-11 17:07:37 -0500 | [diff] [blame] | 212 | type itimerval struct { |
| 213 | it_interval timeval |
| 214 | it_value timeval |
| 215 | } |
| 216 | |
| 217 | type keventt struct { |
| 218 | ident uint64 |
| 219 | filter int16 |
| 220 | flags uint16 |
| 221 | fflags uint32 |
| 222 | data int64 |
| 223 | udata *byte |
| 224 | } |