github.com/goplusjs/gopherjs@v1.2.6-0.20211206034512-f187917453b8/compiler/natives/src/syscall/syscall_darwin_amd64.go (about) 1 // +build js 2 // +build darwin,amd64 3 4 package syscall 5 6 import ( 7 "github.com/gopherjs/gopherjs/js" 8 ) 9 10 func funcPC(f func()) uintptr { 11 switch js.InternalObject(f) { 12 case js.InternalObject(libc_getgroups_trampoline): 13 return SYS_GETGROUPS 14 case js.InternalObject(libc_setgroups_trampoline): 15 return SYS_SETGROUPS 16 case js.InternalObject(libc_wait4_trampoline): 17 return SYS_WAIT4 18 case js.InternalObject(libc_accept_trampoline): 19 return SYS_ACCEPT 20 case js.InternalObject(libc_bind_trampoline): 21 return SYS_BIND 22 case js.InternalObject(libc_connect_trampoline): 23 return SYS_CONNECT 24 case js.InternalObject(libc_socket_trampoline): 25 return SYS_SOCKET 26 case js.InternalObject(libc_getsockopt_trampoline): 27 return SYS_GETSOCKOPT 28 case js.InternalObject(libc_setsockopt_trampoline): 29 return SYS_SETSOCKOPT 30 case js.InternalObject(libc_getpeername_trampoline): 31 return SYS_GETPEERNAME 32 case js.InternalObject(libc_getsockname_trampoline): 33 return SYS_GETSOCKNAME 34 case js.InternalObject(libc_shutdown_trampoline): 35 return SYS_SHUTDOWN 36 case js.InternalObject(libc_socketpair_trampoline): 37 return SYS_SOCKETPAIR 38 case js.InternalObject(libc_recvfrom_trampoline): 39 return SYS_RECVFROM 40 case js.InternalObject(libc_sendto_trampoline): 41 return SYS_SENDTO 42 case js.InternalObject(libc_recvmsg_trampoline): 43 return SYS_RECVMSG 44 case js.InternalObject(libc_sendmsg_trampoline): 45 return SYS_SENDMSG 46 case js.InternalObject(libc_kevent_trampoline): 47 return SYS_KEVENT 48 case js.InternalObject(libc_utimes_trampoline): 49 return SYS_UTIMES 50 case js.InternalObject(libc_futimes_trampoline): 51 return SYS_FUTIMES 52 case js.InternalObject(libc_fcntl_trampoline): 53 return SYS_FCNTL 54 case js.InternalObject(libc_pipe_trampoline): 55 return SYS_PIPE 56 case js.InternalObject(libc_kill_trampoline): 57 return SYS_KILL 58 case js.InternalObject(libc_access_trampoline): 59 return SYS_ACCESS 60 case js.InternalObject(libc_adjtime_trampoline): 61 return SYS_ADJTIME 62 case js.InternalObject(libc_chdir_trampoline): 63 return SYS_CHDIR 64 case js.InternalObject(libc_chflags_trampoline): 65 return SYS_CHFLAGS 66 case js.InternalObject(libc_chmod_trampoline): 67 return SYS_CHMOD 68 case js.InternalObject(libc_chown_trampoline): 69 return SYS_CHOWN 70 case js.InternalObject(libc_chroot_trampoline): 71 return SYS_CHROOT 72 case js.InternalObject(libc_close_trampoline): 73 return SYS_CLOSE 74 case js.InternalObject(libc_dup_trampoline): 75 return SYS_DUP 76 case js.InternalObject(libc_dup2_trampoline): 77 return SYS_DUP2 78 case js.InternalObject(libc_exchangedata_trampoline): 79 return SYS_EXCHANGEDATA 80 case js.InternalObject(libc_fchdir_trampoline): 81 return SYS_FCHDIR 82 case js.InternalObject(libc_fchflags_trampoline): 83 return SYS_FCHFLAGS 84 case js.InternalObject(libc_fchmod_trampoline): 85 return SYS_FCHMOD 86 case js.InternalObject(libc_fchown_trampoline): 87 return SYS_FCHOWN 88 case js.InternalObject(libc_flock_trampoline): 89 return SYS_FLOCK 90 case js.InternalObject(libc_fpathconf_trampoline): 91 return SYS_FPATHCONF 92 case js.InternalObject(libc_fsync_trampoline): 93 return SYS_FSYNC 94 case js.InternalObject(libc_ftruncate_trampoline): 95 return SYS_FTRUNCATE 96 case js.InternalObject(libc_getdtablesize_trampoline): 97 return SYS_GETDTABLESIZE 98 case js.InternalObject(libc_getegid_trampoline): 99 return SYS_GETEGID 100 case js.InternalObject(libc_geteuid_trampoline): 101 return SYS_GETEUID 102 case js.InternalObject(libc_getgid_trampoline): 103 return SYS_GETGID 104 case js.InternalObject(libc_getpgid_trampoline): 105 return SYS_GETPGID 106 case js.InternalObject(libc_getpgrp_trampoline): 107 return SYS_GETPGRP 108 case js.InternalObject(libc_getpid_trampoline): 109 return SYS_GETPID 110 case js.InternalObject(libc_getppid_trampoline): 111 return SYS_GETPPID 112 case js.InternalObject(libc_getpriority_trampoline): 113 return SYS_GETPRIORITY 114 case js.InternalObject(libc_getrlimit_trampoline): 115 return SYS_GETRLIMIT 116 case js.InternalObject(libc_getrusage_trampoline): 117 return SYS_GETRUSAGE 118 case js.InternalObject(libc_getsid_trampoline): 119 return SYS_GETSID 120 case js.InternalObject(libc_getuid_trampoline): 121 return SYS_GETUID 122 case js.InternalObject(libc_issetugid_trampoline): 123 return SYS_ISSETUGID 124 case js.InternalObject(libc_kqueue_trampoline): 125 return SYS_KQUEUE 126 case js.InternalObject(libc_lchown_trampoline): 127 return SYS_LCHOWN 128 case js.InternalObject(libc_link_trampoline): 129 return SYS_LINK 130 case js.InternalObject(libc_listen_trampoline): 131 return SYS_LISTEN 132 case js.InternalObject(libc_mkdir_trampoline): 133 return SYS_MKDIR 134 case js.InternalObject(libc_mkfifo_trampoline): 135 return SYS_MKFIFO 136 case js.InternalObject(libc_mknod_trampoline): 137 return SYS_MKNOD 138 case js.InternalObject(libc_mlock_trampoline): 139 return SYS_MLOCK 140 case js.InternalObject(libc_mlockall_trampoline): 141 return SYS_MLOCKALL 142 case js.InternalObject(libc_mprotect_trampoline): 143 return SYS_MPROTECT 144 case js.InternalObject(libc_munlock_trampoline): 145 return SYS_MUNLOCK 146 case js.InternalObject(libc_munlockall_trampoline): 147 return SYS_MUNLOCKALL 148 case js.InternalObject(libc_open_trampoline): 149 return SYS_OPEN 150 case js.InternalObject(libc_pathconf_trampoline): 151 return SYS_PATHCONF 152 case js.InternalObject(libc_pread_trampoline): 153 return SYS_PREAD 154 case js.InternalObject(libc_pwrite_trampoline): 155 return SYS_PWRITE 156 case js.InternalObject(libc_read_trampoline): 157 return SYS_READ 158 case js.InternalObject(libc_readlink_trampoline): 159 return SYS_READLINK 160 case js.InternalObject(libc_rename_trampoline): 161 return SYS_RENAME 162 case js.InternalObject(libc_revoke_trampoline): 163 return SYS_REVOKE 164 case js.InternalObject(libc_rmdir_trampoline): 165 return SYS_RMDIR 166 case js.InternalObject(libc_lseek_trampoline): 167 return SYS_LSEEK 168 case js.InternalObject(libc_select_trampoline): 169 return SYS_SELECT 170 case js.InternalObject(libc_setegid_trampoline): 171 return SYS_SETEGID 172 case js.InternalObject(libc_seteuid_trampoline): 173 return SYS_SETEUID 174 case js.InternalObject(libc_setgid_trampoline): 175 return SYS_SETGID 176 case js.InternalObject(libc_setlogin_trampoline): 177 return SYS_SETLOGIN 178 case js.InternalObject(libc_setpgid_trampoline): 179 return SYS_SETPGID 180 case js.InternalObject(libc_setpriority_trampoline): 181 return SYS_SETPRIORITY 182 case js.InternalObject(libc_setprivexec_trampoline): 183 return SYS_SETPRIVEXEC 184 case js.InternalObject(libc_setregid_trampoline): 185 return SYS_SETREGID 186 case js.InternalObject(libc_setreuid_trampoline): 187 return SYS_SETREUID 188 case js.InternalObject(libc_setrlimit_trampoline): 189 return SYS_SETRLIMIT 190 case js.InternalObject(libc_setsid_trampoline): 191 return SYS_SETSID 192 case js.InternalObject(libc_settimeofday_trampoline): 193 return SYS_SETTIMEOFDAY 194 case js.InternalObject(libc_setuid_trampoline): 195 return SYS_SETUID 196 case js.InternalObject(libc_symlink_trampoline): 197 return SYS_SYMLINK 198 case js.InternalObject(libc_sync_trampoline): 199 return SYS_SYNC 200 case js.InternalObject(libc_truncate_trampoline): 201 return SYS_TRUNCATE 202 case js.InternalObject(libc_umask_trampoline): 203 return SYS_UMASK 204 case js.InternalObject(libc_undelete_trampoline): 205 return SYS_UNDELETE 206 case js.InternalObject(libc_unlink_trampoline): 207 return SYS_UNLINK 208 case js.InternalObject(libc_unmount_trampoline): 209 return SYS_UNMOUNT 210 case js.InternalObject(libc_write_trampoline): 211 return SYS_WRITE 212 case js.InternalObject(libc_writev_trampoline): 213 return SYS_WRITEV 214 case js.InternalObject(libc_mmap_trampoline): 215 return SYS_MMAP 216 case js.InternalObject(libc_munmap_trampoline): 217 return SYS_MUNMAP 218 case js.InternalObject(libc_fork_trampoline): 219 return SYS_FORK 220 case js.InternalObject(libc_ioctl_trampoline): 221 return SYS_IOCTL 222 case js.InternalObject(libc_execve_trampoline): 223 return SYS_EXECVE 224 case js.InternalObject(libc_exit_trampoline): 225 return SYS_EXIT 226 case js.InternalObject(libc_fstat64_trampoline): 227 return SYS_FSTAT64 228 case js.InternalObject(libc_fstatfs64_trampoline): 229 return SYS_FSTATFS64 230 case js.InternalObject(libc_gettimeofday_trampoline): 231 return SYS_GETTIMEOFDAY 232 case js.InternalObject(libc_lstat64_trampoline): 233 return SYS_LSTAT64 234 case js.InternalObject(libc_stat64_trampoline): 235 return SYS_STAT64 236 case js.InternalObject(libc_statfs64_trampoline): 237 return SYS_STATFS64 238 case js.InternalObject(libc_ptrace_trampoline): 239 return SYS_PTRACE 240 case js.InternalObject(libc_fstatat64_trampoline): 241 return SYS_FSTATFS64 242 case js.InternalObject(libc_getattrlist_trampoline): 243 return SYS_GETATTRLIST 244 case js.InternalObject(libc_unlinkat_trampoline): 245 return 472 //SYS_UNLINKAT 246 // case js.InternalObject(libc_fdopendir_trampoline): 247 // break 248 default: 249 println("warning syscall:", f) 250 } 251 return uintptr(minusOne) 252 } 253 254 func syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) { 255 return Syscall(trap, a1, a2, a3) 256 } 257 258 func syscallX(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) { 259 return Syscall(trap, a1, a2, a3) 260 } 261 262 func syscallPtr(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) { 263 return Syscall(trap, a1, a2, a3) 264 } 265 266 func syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) { 267 return Syscall6(trap, a1, a2, a3, a4, a5, a6) 268 } 269 270 func syscall6X(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) { 271 return Syscall6(trap, a1, a2, a3, a4, a5, a6) 272 } 273 274 func rawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) { 275 return RawSyscall(trap, a1, a2, a3) 276 } 277 278 func rawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) { 279 return RawSyscall6(trap, a1, a2, a3, a4, a5, a6) 280 }