Shenghou Ma | 56e8f8e | 2014-12-26 01:07:10 -0500 | [diff] [blame] | 1 | // Note: cgo can't handle some Darwin/ARM structures, so this file can't |
| 2 | // be auto generated by cgo yet. |
| 3 | // Created based on output of `cgo -cdefs defs_darwin.go` and Darwin/ARM |
| 4 | // specific header (mainly mcontext and ucontext related stuff) |
| 5 | |
| 6 | package runtime |
| 7 | |
| 8 | import "unsafe" |
| 9 | |
| 10 | const ( |
| 11 | _EINTR = 0x4 |
| 12 | _EFAULT = 0xe |
| 13 | |
| 14 | _PROT_NONE = 0x0 |
| 15 | _PROT_READ = 0x1 |
| 16 | _PROT_WRITE = 0x2 |
| 17 | _PROT_EXEC = 0x4 |
| 18 | |
| 19 | _MAP_ANON = 0x1000 |
| 20 | _MAP_PRIVATE = 0x2 |
| 21 | _MAP_FIXED = 0x10 |
| 22 | |
| 23 | _MADV_DONTNEED = 0x4 |
| 24 | _MADV_FREE = 0x5 |
| 25 | |
| 26 | _MACH_MSG_TYPE_MOVE_RECEIVE = 0x10 |
| 27 | _MACH_MSG_TYPE_MOVE_SEND = 0x11 |
| 28 | _MACH_MSG_TYPE_MOVE_SEND_ONCE = 0x12 |
| 29 | _MACH_MSG_TYPE_COPY_SEND = 0x13 |
| 30 | _MACH_MSG_TYPE_MAKE_SEND = 0x14 |
| 31 | _MACH_MSG_TYPE_MAKE_SEND_ONCE = 0x15 |
| 32 | _MACH_MSG_TYPE_COPY_RECEIVE = 0x16 |
| 33 | |
| 34 | _MACH_MSG_PORT_DESCRIPTOR = 0x0 |
| 35 | _MACH_MSG_OOL_DESCRIPTOR = 0x1 |
| 36 | _MACH_MSG_OOL_PORTS_DESCRIPTOR = 0x2 |
| 37 | _MACH_MSG_OOL_VOLATILE_DESCRIPTOR = 0x3 |
| 38 | |
| 39 | _MACH_MSGH_BITS_COMPLEX = 0x80000000 |
| 40 | |
| 41 | _MACH_SEND_MSG = 0x1 |
| 42 | _MACH_RCV_MSG = 0x2 |
| 43 | _MACH_RCV_LARGE = 0x4 |
| 44 | |
| 45 | _MACH_SEND_TIMEOUT = 0x10 |
| 46 | _MACH_SEND_INTERRUPT = 0x40 |
| 47 | _MACH_SEND_ALWAYS = 0x10000 |
| 48 | _MACH_SEND_TRAILER = 0x20000 |
| 49 | _MACH_RCV_TIMEOUT = 0x100 |
| 50 | _MACH_RCV_NOTIFY = 0x200 |
| 51 | _MACH_RCV_INTERRUPT = 0x400 |
| 52 | _MACH_RCV_OVERWRITE = 0x1000 |
| 53 | |
| 54 | _NDR_PROTOCOL_2_0 = 0x0 |
| 55 | _NDR_INT_BIG_ENDIAN = 0x0 |
| 56 | _NDR_INT_LITTLE_ENDIAN = 0x1 |
| 57 | _NDR_FLOAT_IEEE = 0x0 |
| 58 | _NDR_CHAR_ASCII = 0x0 |
| 59 | |
| 60 | _SA_SIGINFO = 0x40 |
| 61 | _SA_RESTART = 0x2 |
| 62 | _SA_ONSTACK = 0x1 |
| 63 | _SA_USERTRAMP = 0x100 |
| 64 | _SA_64REGSET = 0x200 |
| 65 | |
| 66 | _SIGHUP = 0x1 |
| 67 | _SIGINT = 0x2 |
| 68 | _SIGQUIT = 0x3 |
| 69 | _SIGILL = 0x4 |
| 70 | _SIGTRAP = 0x5 |
| 71 | _SIGABRT = 0x6 |
| 72 | _SIGEMT = 0x7 |
| 73 | _SIGFPE = 0x8 |
| 74 | _SIGKILL = 0x9 |
| 75 | _SIGBUS = 0xa |
| 76 | _SIGSEGV = 0xb |
| 77 | _SIGSYS = 0xc |
| 78 | _SIGPIPE = 0xd |
| 79 | _SIGALRM = 0xe |
| 80 | _SIGTERM = 0xf |
| 81 | _SIGURG = 0x10 |
| 82 | _SIGSTOP = 0x11 |
| 83 | _SIGTSTP = 0x12 |
| 84 | _SIGCONT = 0x13 |
| 85 | _SIGCHLD = 0x14 |
| 86 | _SIGTTIN = 0x15 |
| 87 | _SIGTTOU = 0x16 |
| 88 | _SIGIO = 0x17 |
| 89 | _SIGXCPU = 0x18 |
| 90 | _SIGXFSZ = 0x19 |
| 91 | _SIGVTALRM = 0x1a |
| 92 | _SIGPROF = 0x1b |
| 93 | _SIGWINCH = 0x1c |
| 94 | _SIGINFO = 0x1d |
| 95 | _SIGUSR1 = 0x1e |
| 96 | _SIGUSR2 = 0x1f |
| 97 | |
| 98 | _FPE_INTDIV = 0x7 |
| 99 | _FPE_INTOVF = 0x8 |
| 100 | _FPE_FLTDIV = 0x1 |
| 101 | _FPE_FLTOVF = 0x2 |
| 102 | _FPE_FLTUND = 0x3 |
| 103 | _FPE_FLTRES = 0x4 |
| 104 | _FPE_FLTINV = 0x5 |
| 105 | _FPE_FLTSUB = 0x6 |
| 106 | |
| 107 | _BUS_ADRALN = 0x1 |
| 108 | _BUS_ADRERR = 0x2 |
| 109 | _BUS_OBJERR = 0x3 |
| 110 | |
| 111 | _SEGV_MAPERR = 0x1 |
| 112 | _SEGV_ACCERR = 0x2 |
| 113 | |
| 114 | _ITIMER_REAL = 0x0 |
| 115 | _ITIMER_VIRTUAL = 0x1 |
| 116 | _ITIMER_PROF = 0x2 |
| 117 | |
| 118 | _EV_ADD = 0x1 |
| 119 | _EV_DELETE = 0x2 |
| 120 | _EV_CLEAR = 0x20 |
| 121 | _EV_RECEIPT = 0x40 |
| 122 | _EV_ERROR = 0x4000 |
| 123 | _EVFILT_READ = -0x1 |
| 124 | _EVFILT_WRITE = -0x2 |
| 125 | ) |
| 126 | |
| 127 | type machbody struct { |
| 128 | msgh_descriptor_count uint32 |
| 129 | } |
| 130 | |
| 131 | type machheader struct { |
| 132 | msgh_bits uint32 |
| 133 | msgh_size uint32 |
| 134 | msgh_remote_port uint32 |
| 135 | msgh_local_port uint32 |
| 136 | msgh_reserved uint32 |
| 137 | msgh_id int32 |
| 138 | } |
| 139 | |
| 140 | type machndr struct { |
| 141 | mig_vers uint8 |
| 142 | if_vers uint8 |
| 143 | reserved1 uint8 |
| 144 | mig_encoding uint8 |
| 145 | int_rep uint8 |
| 146 | char_rep uint8 |
| 147 | float_rep uint8 |
| 148 | reserved2 uint8 |
| 149 | } |
| 150 | |
| 151 | type machport struct { |
| 152 | name uint32 |
| 153 | pad1 uint32 |
| 154 | pad2 uint16 |
| 155 | disposition uint8 |
| 156 | _type uint8 |
| 157 | } |
| 158 | |
| 159 | type stackt struct { |
| 160 | ss_sp *byte |
| 161 | ss_size uintptr |
| 162 | ss_flags int32 |
| 163 | } |
| 164 | |
| 165 | type sigactiont struct { |
| 166 | __sigaction_u [4]byte |
| 167 | sa_tramp unsafe.Pointer |
| 168 | sa_mask uint32 |
| 169 | sa_flags int32 |
| 170 | } |
| 171 | |
| 172 | type siginfo struct { |
| 173 | si_signo int32 |
| 174 | si_errno int32 |
| 175 | si_code int32 |
| 176 | si_pid int32 |
| 177 | si_uid uint32 |
| 178 | si_status int32 |
Austin Clements | ec2c7e6 | 2015-03-26 12:14:26 -0400 | [diff] [blame] | 179 | si_addr uint32 |
Shenghou Ma | 56e8f8e | 2014-12-26 01:07:10 -0500 | [diff] [blame] | 180 | si_value [4]byte |
| 181 | si_band int32 |
| 182 | __pad [7]uint32 |
| 183 | } |
| 184 | |
| 185 | type timeval struct { |
| 186 | tv_sec int32 |
| 187 | tv_usec int32 |
| 188 | } |
| 189 | |
| 190 | func (tv *timeval) set_usec(x int32) { |
| 191 | tv.tv_usec = x |
| 192 | } |
| 193 | |
| 194 | type itimerval struct { |
| 195 | it_interval timeval |
| 196 | it_value timeval |
| 197 | } |
| 198 | |
| 199 | type timespec struct { |
| 200 | tv_sec int32 |
| 201 | tv_nsec int32 |
| 202 | } |
| 203 | |
| 204 | type floatstate32 struct { |
| 205 | r [32]uint32 |
| 206 | fpscr uint32 |
| 207 | } |
| 208 | |
| 209 | type regs32 struct { |
| 210 | r [13]uint32 // r0 to r12 |
| 211 | sp uint32 // r13 |
| 212 | lr uint32 // r14 |
| 213 | pc uint32 // r15 |
| 214 | cpsr uint32 |
| 215 | } |
| 216 | |
| 217 | type exceptionstate32 struct { |
| 218 | trapno uint32 // NOTE: on 386, the trapno field is split into trapno and cpu |
| 219 | err uint32 |
| 220 | faultvaddr uint32 |
| 221 | } |
| 222 | |
| 223 | type mcontext32 struct { |
| 224 | es exceptionstate32 |
| 225 | ss regs32 |
| 226 | fs floatstate32 |
| 227 | } |
| 228 | |
| 229 | type ucontext struct { |
| 230 | uc_onstack int32 |
| 231 | uc_sigmask uint32 |
| 232 | uc_stack stackt |
| 233 | uc_link *ucontext |
| 234 | uc_mcsize uint32 |
| 235 | uc_mcontext *mcontext32 |
| 236 | } |
| 237 | |
| 238 | type keventt struct { |
| 239 | ident uint32 |
| 240 | filter int16 |
| 241 | flags uint16 |
| 242 | fflags uint32 |
| 243 | data int32 |
| 244 | udata *byte |
| 245 | } |