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_darwin.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_DONTNEED = 0x4 |
| 22 | _MADV_FREE = 0x5 |
| 23 | |
| 24 | _MACH_MSG_TYPE_MOVE_RECEIVE = 0x10 |
| 25 | _MACH_MSG_TYPE_MOVE_SEND = 0x11 |
| 26 | _MACH_MSG_TYPE_MOVE_SEND_ONCE = 0x12 |
| 27 | _MACH_MSG_TYPE_COPY_SEND = 0x13 |
| 28 | _MACH_MSG_TYPE_MAKE_SEND = 0x14 |
| 29 | _MACH_MSG_TYPE_MAKE_SEND_ONCE = 0x15 |
| 30 | _MACH_MSG_TYPE_COPY_RECEIVE = 0x16 |
| 31 | |
| 32 | _MACH_MSG_PORT_DESCRIPTOR = 0x0 |
| 33 | _MACH_MSG_OOL_DESCRIPTOR = 0x1 |
| 34 | _MACH_MSG_OOL_PORTS_DESCRIPTOR = 0x2 |
| 35 | _MACH_MSG_OOL_VOLATILE_DESCRIPTOR = 0x3 |
| 36 | |
| 37 | _MACH_MSGH_BITS_COMPLEX = 0x80000000 |
| 38 | |
| 39 | _MACH_SEND_MSG = 0x1 |
| 40 | _MACH_RCV_MSG = 0x2 |
| 41 | _MACH_RCV_LARGE = 0x4 |
| 42 | |
| 43 | _MACH_SEND_TIMEOUT = 0x10 |
| 44 | _MACH_SEND_INTERRUPT = 0x40 |
| 45 | _MACH_SEND_ALWAYS = 0x10000 |
| 46 | _MACH_SEND_TRAILER = 0x20000 |
| 47 | _MACH_RCV_TIMEOUT = 0x100 |
| 48 | _MACH_RCV_NOTIFY = 0x200 |
| 49 | _MACH_RCV_INTERRUPT = 0x400 |
| 50 | _MACH_RCV_OVERWRITE = 0x1000 |
| 51 | |
| 52 | _NDR_PROTOCOL_2_0 = 0x0 |
| 53 | _NDR_INT_BIG_ENDIAN = 0x0 |
| 54 | _NDR_INT_LITTLE_ENDIAN = 0x1 |
| 55 | _NDR_FLOAT_IEEE = 0x0 |
| 56 | _NDR_CHAR_ASCII = 0x0 |
| 57 | |
| 58 | _SA_SIGINFO = 0x40 |
| 59 | _SA_RESTART = 0x2 |
| 60 | _SA_ONSTACK = 0x1 |
| 61 | _SA_USERTRAMP = 0x100 |
| 62 | _SA_64REGSET = 0x200 |
| 63 | |
| 64 | _SIGHUP = 0x1 |
| 65 | _SIGINT = 0x2 |
| 66 | _SIGQUIT = 0x3 |
| 67 | _SIGILL = 0x4 |
| 68 | _SIGTRAP = 0x5 |
| 69 | _SIGABRT = 0x6 |
| 70 | _SIGEMT = 0x7 |
| 71 | _SIGFPE = 0x8 |
| 72 | _SIGKILL = 0x9 |
| 73 | _SIGBUS = 0xa |
| 74 | _SIGSEGV = 0xb |
| 75 | _SIGSYS = 0xc |
| 76 | _SIGPIPE = 0xd |
| 77 | _SIGALRM = 0xe |
| 78 | _SIGTERM = 0xf |
| 79 | _SIGURG = 0x10 |
| 80 | _SIGSTOP = 0x11 |
| 81 | _SIGTSTP = 0x12 |
| 82 | _SIGCONT = 0x13 |
| 83 | _SIGCHLD = 0x14 |
| 84 | _SIGTTIN = 0x15 |
| 85 | _SIGTTOU = 0x16 |
| 86 | _SIGIO = 0x17 |
| 87 | _SIGXCPU = 0x18 |
| 88 | _SIGXFSZ = 0x19 |
| 89 | _SIGVTALRM = 0x1a |
| 90 | _SIGPROF = 0x1b |
| 91 | _SIGWINCH = 0x1c |
| 92 | _SIGINFO = 0x1d |
| 93 | _SIGUSR1 = 0x1e |
| 94 | _SIGUSR2 = 0x1f |
| 95 | |
| 96 | _FPE_INTDIV = 0x7 |
| 97 | _FPE_INTOVF = 0x8 |
| 98 | _FPE_FLTDIV = 0x1 |
| 99 | _FPE_FLTOVF = 0x2 |
| 100 | _FPE_FLTUND = 0x3 |
| 101 | _FPE_FLTRES = 0x4 |
| 102 | _FPE_FLTINV = 0x5 |
| 103 | _FPE_FLTSUB = 0x6 |
| 104 | |
| 105 | _BUS_ADRALN = 0x1 |
| 106 | _BUS_ADRERR = 0x2 |
| 107 | _BUS_OBJERR = 0x3 |
| 108 | |
| 109 | _SEGV_MAPERR = 0x1 |
| 110 | _SEGV_ACCERR = 0x2 |
| 111 | |
| 112 | _ITIMER_REAL = 0x0 |
| 113 | _ITIMER_VIRTUAL = 0x1 |
| 114 | _ITIMER_PROF = 0x2 |
| 115 | |
| 116 | _EV_ADD = 0x1 |
| 117 | _EV_DELETE = 0x2 |
| 118 | _EV_CLEAR = 0x20 |
| 119 | _EV_RECEIPT = 0x40 |
| 120 | _EV_ERROR = 0x4000 |
| 121 | _EVFILT_READ = -0x1 |
| 122 | _EVFILT_WRITE = -0x2 |
| 123 | ) |
| 124 | |
| 125 | type machbody struct { |
| 126 | msgh_descriptor_count uint32 |
| 127 | } |
| 128 | |
| 129 | type machheader struct { |
| 130 | msgh_bits uint32 |
| 131 | msgh_size uint32 |
| 132 | msgh_remote_port uint32 |
| 133 | msgh_local_port uint32 |
| 134 | msgh_reserved uint32 |
| 135 | msgh_id int32 |
| 136 | } |
| 137 | |
| 138 | type machndr struct { |
| 139 | mig_vers uint8 |
| 140 | if_vers uint8 |
| 141 | reserved1 uint8 |
| 142 | mig_encoding uint8 |
| 143 | int_rep uint8 |
| 144 | char_rep uint8 |
| 145 | float_rep uint8 |
| 146 | reserved2 uint8 |
| 147 | } |
| 148 | |
| 149 | type machport struct { |
| 150 | name uint32 |
| 151 | pad1 uint32 |
| 152 | pad2 uint16 |
| 153 | disposition uint8 |
| 154 | _type uint8 |
| 155 | } |
| 156 | |
| 157 | type stackt struct { |
| 158 | ss_sp *byte |
| 159 | ss_size uintptr |
| 160 | ss_flags int32 |
| 161 | } |
| 162 | |
| 163 | type sigactiont struct { |
| 164 | __sigaction_u [4]byte |
| 165 | sa_tramp unsafe.Pointer |
| 166 | sa_mask uint32 |
| 167 | sa_flags int32 |
| 168 | } |
| 169 | |
| 170 | type siginfo struct { |
| 171 | si_signo int32 |
| 172 | si_errno int32 |
| 173 | si_code int32 |
| 174 | si_pid int32 |
| 175 | si_uid uint32 |
| 176 | si_status int32 |
Austin Clements | ec2c7e6 | 2015-03-26 12:14:26 -0400 | [diff] [blame] | 177 | si_addr uint32 |
Russ Cox | 580ef3e | 2014-11-11 17:07:37 -0500 | [diff] [blame] | 178 | si_value [4]byte |
| 179 | si_band int32 |
| 180 | __pad [7]uint32 |
| 181 | } |
| 182 | |
| 183 | type timeval struct { |
| 184 | tv_sec int32 |
| 185 | tv_usec int32 |
| 186 | } |
| 187 | |
| 188 | func (tv *timeval) set_usec(x int32) { |
| 189 | tv.tv_usec = x |
| 190 | } |
| 191 | |
| 192 | type itimerval struct { |
| 193 | it_interval timeval |
| 194 | it_value timeval |
| 195 | } |
| 196 | |
| 197 | type timespec struct { |
| 198 | tv_sec int32 |
| 199 | tv_nsec int32 |
| 200 | } |
| 201 | |
| 202 | type fpcontrol struct { |
| 203 | pad_cgo_0 [2]byte |
| 204 | } |
| 205 | |
| 206 | type fpstatus struct { |
| 207 | pad_cgo_0 [2]byte |
| 208 | } |
| 209 | |
| 210 | type regmmst struct { |
| 211 | mmst_reg [10]int8 |
| 212 | mmst_rsrv [6]int8 |
| 213 | } |
| 214 | |
| 215 | type regxmm struct { |
| 216 | xmm_reg [16]int8 |
| 217 | } |
| 218 | |
| 219 | type regs64 struct { |
| 220 | rax uint64 |
| 221 | rbx uint64 |
| 222 | rcx uint64 |
| 223 | rdx uint64 |
| 224 | rdi uint64 |
| 225 | rsi uint64 |
| 226 | rbp uint64 |
| 227 | rsp uint64 |
| 228 | r8 uint64 |
| 229 | r9 uint64 |
| 230 | r10 uint64 |
| 231 | r11 uint64 |
| 232 | r12 uint64 |
| 233 | r13 uint64 |
| 234 | r14 uint64 |
| 235 | r15 uint64 |
| 236 | rip uint64 |
| 237 | rflags uint64 |
| 238 | cs uint64 |
| 239 | fs uint64 |
| 240 | gs uint64 |
| 241 | } |
| 242 | |
| 243 | type floatstate64 struct { |
| 244 | fpu_reserved [2]int32 |
| 245 | fpu_fcw fpcontrol |
| 246 | fpu_fsw fpstatus |
| 247 | fpu_ftw uint8 |
| 248 | fpu_rsrv1 uint8 |
| 249 | fpu_fop uint16 |
| 250 | fpu_ip uint32 |
| 251 | fpu_cs uint16 |
| 252 | fpu_rsrv2 uint16 |
| 253 | fpu_dp uint32 |
| 254 | fpu_ds uint16 |
| 255 | fpu_rsrv3 uint16 |
| 256 | fpu_mxcsr uint32 |
| 257 | fpu_mxcsrmask uint32 |
| 258 | fpu_stmm0 regmmst |
| 259 | fpu_stmm1 regmmst |
| 260 | fpu_stmm2 regmmst |
| 261 | fpu_stmm3 regmmst |
| 262 | fpu_stmm4 regmmst |
| 263 | fpu_stmm5 regmmst |
| 264 | fpu_stmm6 regmmst |
| 265 | fpu_stmm7 regmmst |
| 266 | fpu_xmm0 regxmm |
| 267 | fpu_xmm1 regxmm |
| 268 | fpu_xmm2 regxmm |
| 269 | fpu_xmm3 regxmm |
| 270 | fpu_xmm4 regxmm |
| 271 | fpu_xmm5 regxmm |
| 272 | fpu_xmm6 regxmm |
| 273 | fpu_xmm7 regxmm |
| 274 | fpu_xmm8 regxmm |
| 275 | fpu_xmm9 regxmm |
| 276 | fpu_xmm10 regxmm |
| 277 | fpu_xmm11 regxmm |
| 278 | fpu_xmm12 regxmm |
| 279 | fpu_xmm13 regxmm |
| 280 | fpu_xmm14 regxmm |
| 281 | fpu_xmm15 regxmm |
| 282 | fpu_rsrv4 [96]int8 |
| 283 | fpu_reserved1 int32 |
| 284 | } |
| 285 | |
| 286 | type exceptionstate64 struct { |
| 287 | trapno uint16 |
| 288 | cpu uint16 |
| 289 | err uint32 |
| 290 | faultvaddr uint64 |
| 291 | } |
| 292 | |
| 293 | type mcontext64 struct { |
| 294 | es exceptionstate64 |
| 295 | ss regs64 |
| 296 | fs floatstate64 |
| 297 | } |
| 298 | |
| 299 | type regs32 struct { |
| 300 | eax uint32 |
| 301 | ebx uint32 |
| 302 | ecx uint32 |
| 303 | edx uint32 |
| 304 | edi uint32 |
| 305 | esi uint32 |
| 306 | ebp uint32 |
| 307 | esp uint32 |
| 308 | ss uint32 |
| 309 | eflags uint32 |
| 310 | eip uint32 |
| 311 | cs uint32 |
| 312 | ds uint32 |
| 313 | es uint32 |
| 314 | fs uint32 |
| 315 | gs uint32 |
| 316 | } |
| 317 | |
| 318 | type floatstate32 struct { |
| 319 | fpu_reserved [2]int32 |
| 320 | fpu_fcw fpcontrol |
| 321 | fpu_fsw fpstatus |
| 322 | fpu_ftw uint8 |
| 323 | fpu_rsrv1 uint8 |
| 324 | fpu_fop uint16 |
| 325 | fpu_ip uint32 |
| 326 | fpu_cs uint16 |
| 327 | fpu_rsrv2 uint16 |
| 328 | fpu_dp uint32 |
| 329 | fpu_ds uint16 |
| 330 | fpu_rsrv3 uint16 |
| 331 | fpu_mxcsr uint32 |
| 332 | fpu_mxcsrmask uint32 |
| 333 | fpu_stmm0 regmmst |
| 334 | fpu_stmm1 regmmst |
| 335 | fpu_stmm2 regmmst |
| 336 | fpu_stmm3 regmmst |
| 337 | fpu_stmm4 regmmst |
| 338 | fpu_stmm5 regmmst |
| 339 | fpu_stmm6 regmmst |
| 340 | fpu_stmm7 regmmst |
| 341 | fpu_xmm0 regxmm |
| 342 | fpu_xmm1 regxmm |
| 343 | fpu_xmm2 regxmm |
| 344 | fpu_xmm3 regxmm |
| 345 | fpu_xmm4 regxmm |
| 346 | fpu_xmm5 regxmm |
| 347 | fpu_xmm6 regxmm |
| 348 | fpu_xmm7 regxmm |
| 349 | fpu_rsrv4 [224]int8 |
| 350 | fpu_reserved1 int32 |
| 351 | } |
| 352 | |
| 353 | type exceptionstate32 struct { |
| 354 | trapno uint16 |
| 355 | cpu uint16 |
| 356 | err uint32 |
| 357 | faultvaddr uint32 |
| 358 | } |
| 359 | |
| 360 | type mcontext32 struct { |
| 361 | es exceptionstate32 |
| 362 | ss regs32 |
| 363 | fs floatstate32 |
| 364 | } |
| 365 | |
| 366 | type ucontext struct { |
| 367 | uc_onstack int32 |
| 368 | uc_sigmask uint32 |
| 369 | uc_stack stackt |
| 370 | uc_link *ucontext |
| 371 | uc_mcsize uint32 |
| 372 | uc_mcontext *mcontext32 |
| 373 | } |
| 374 | |
| 375 | type keventt struct { |
| 376 | ident uint32 |
| 377 | filter int16 |
| 378 | flags uint16 |
| 379 | fflags uint32 |
| 380 | data int32 |
| 381 | udata *byte |
| 382 | } |