1 package runtime 2 3 // Constants 4 const ( 5 _EINTR = 0x4 6 _ENOMEM = 0xc 7 _EAGAIN = 0xb 8 9 _PROT_NONE = 0 10 _PROT_READ = 0x1 11 _PROT_WRITE = 0x2 12 _PROT_EXEC = 0x4 13 14 _MAP_ANON = 0x20 15 _MAP_PRIVATE = 0x2 16 _MAP_FIXED = 0x10 17 18 _MADV_DONTNEED = 0x4 19 _MADV_HUGEPAGE = 0xe 20 _MADV_NOHUGEPAGE = 0xf 21 22 _SA_RESTART = 0x10000000 23 _SA_ONSTACK = 0x8000000 24 _SA_RESTORER = 0 // unused on ARM 25 _SA_SIGINFO = 0x4 26 _SIGHUP = 0x1 27 _SIGINT = 0x2 28 _SIGQUIT = 0x3 29 _SIGILL = 0x4 30 _SIGTRAP = 0x5 31 _SIGABRT = 0x6 32 _SIGBUS = 0x7 33 _SIGFPE = 0x8 34 _SIGKILL = 0x9 35 _SIGUSR1 = 0xa 36 _SIGSEGV = 0xb 37 _SIGUSR2 = 0xc 38 _SIGPIPE = 0xd 39 _SIGALRM = 0xe 40 _SIGSTKFLT = 0x10 41 _SIGCHLD = 0x11 42 _SIGCONT = 0x12 43 _SIGSTOP = 0x13 44 _SIGTSTP = 0x14 45 _SIGTTIN = 0x15 46 _SIGTTOU = 0x16 47 _SIGURG = 0x17 48 _SIGXCPU = 0x18 49 _SIGXFSZ = 0x19 50 _SIGVTALRM = 0x1a 51 _SIGPROF = 0x1b 52 _SIGWINCH = 0x1c 53 _SIGIO = 0x1d 54 _SIGPWR = 0x1e 55 _SIGSYS = 0x1f 56 _FPE_INTDIV = 0x1 57 _FPE_INTOVF = 0x2 58 _FPE_FLTDIV = 0x3 59 _FPE_FLTOVF = 0x4 60 _FPE_FLTUND = 0x5 61 _FPE_FLTRES = 0x6 62 _FPE_FLTINV = 0x7 63 _FPE_FLTSUB = 0x8 64 _BUS_ADRALN = 0x1 65 _BUS_ADRERR = 0x2 66 _BUS_OBJERR = 0x3 67 _SEGV_MAPERR = 0x1 68 _SEGV_ACCERR = 0x2 69 _ITIMER_REAL = 0 70 _ITIMER_PROF = 0x2 71 _ITIMER_VIRTUAL = 0x1 72 _O_RDONLY = 0 73 _O_CLOEXEC = 0x80000 74 75 _EPOLLIN = 0x1 76 _EPOLLOUT = 0x4 77 _EPOLLERR = 0x8 78 _EPOLLHUP = 0x10 79 _EPOLLRDHUP = 0x2000 80 _EPOLLET = 0x80000000 81 _EPOLL_CLOEXEC = 0x80000 82 _EPOLL_CTL_ADD = 0x1 83 _EPOLL_CTL_DEL = 0x2 84 _EPOLL_CTL_MOD = 0x3 85 86 _AF_UNIX = 0x1 87 _F_SETFL = 0x4 88 _SOCK_DGRAM = 0x2 89 ) 90 91 type timespec struct { 92 tv_sec int32 93 tv_nsec int32 94 } 95 96 func (ts *timespec) set_sec(x int64) { 97 ts.tv_sec = int32(x) 98 } 99 100 func (ts *timespec) set_nsec(x int32) { 101 ts.tv_nsec = x 102 } 103 104 type sigaltstackt struct { 105 ss_sp *byte 106 ss_flags int32 107 ss_size uintptr 108 } 109 110 type sigcontext struct { 111 trap_no uint32 112 error_code uint32 113 oldmask uint32 114 r0 uint32 115 r1 uint32 116 r2 uint32 117 r3 uint32 118 r4 uint32 119 r5 uint32 120 r6 uint32 121 r7 uint32 122 r8 uint32 123 r9 uint32 124 r10 uint32 125 fp uint32 126 ip uint32 127 sp uint32 128 lr uint32 129 pc uint32 130 cpsr uint32 131 fault_address uint32 132 } 133 134 type ucontext struct { 135 uc_flags uint32 136 uc_link *ucontext 137 uc_stack sigaltstackt 138 uc_mcontext sigcontext 139 uc_sigmask uint32 140 __unused [31]int32 141 uc_regspace [128]uint32 142 } 143 144 type timeval struct { 145 tv_sec int32 146 tv_usec int32 147 } 148 149 func (tv *timeval) set_usec(x int32) { 150 tv.tv_usec = x 151 } 152 153 type itimerval struct { 154 it_interval timeval 155 it_value timeval 156 } 157 158 type siginfo struct { 159 si_signo int32 160 si_errno int32 161 si_code int32 162 // below here is a union; si_addr is the only field we use 163 si_addr uint32 164 } 165 166 type sigactiont struct { 167 sa_handler uintptr 168 sa_flags uint32 169 sa_restorer uintptr 170 sa_mask uint64 171 } 172 173 type epollevent struct { 174 events uint32 175 _pad uint32 176 data [8]byte // to match amd64 177 } 178 179 type sockaddr_un struct { 180 family uint16 181 path [108]byte 182 } 183