syscall_freebsd.go (18811B)
1 // Copyright 2009,2010 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // FreeBSD system calls. 6 // This file is compiled as ordinary Go code, 7 // but it is also input to mksyscall, 8 // which parses the //sys lines and generates system call stubs. 9 // Note that sometimes we use a lowercase //sys name and wrap 10 // it in our own nicer implementation, either here or in 11 // syscall_bsd.go or syscall_unix.go. 12 13 package unix 14 15 import ( 16 "sync" 17 "unsafe" 18 ) 19 20 // See https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/versions.html. 21 var ( 22 osreldateOnce sync.Once 23 osreldate uint32 24 ) 25 26 func supportsABI(ver uint32) bool { 27 osreldateOnce.Do(func() { osreldate, _ = SysctlUint32("kern.osreldate") }) 28 return osreldate >= ver 29 } 30 31 // SockaddrDatalink implements the Sockaddr interface for AF_LINK type sockets. 32 type SockaddrDatalink struct { 33 Len uint8 34 Family uint8 35 Index uint16 36 Type uint8 37 Nlen uint8 38 Alen uint8 39 Slen uint8 40 Data [46]int8 41 raw RawSockaddrDatalink 42 } 43 44 func anyToSockaddrGOOS(fd int, rsa *RawSockaddrAny) (Sockaddr, error) { 45 return nil, EAFNOSUPPORT 46 } 47 48 // Translate "kern.hostname" to []_C_int{0,1,2,3}. 49 func nametomib(name string) (mib []_C_int, err error) { 50 const siz = unsafe.Sizeof(mib[0]) 51 52 // NOTE(rsc): It seems strange to set the buffer to have 53 // size CTL_MAXNAME+2 but use only CTL_MAXNAME 54 // as the size. I don't know why the +2 is here, but the 55 // kernel uses +2 for its own implementation of this function. 56 // I am scared that if we don't include the +2 here, the kernel 57 // will silently write 2 words farther than we specify 58 // and we'll get memory corruption. 59 var buf [CTL_MAXNAME + 2]_C_int 60 n := uintptr(CTL_MAXNAME) * siz 61 62 p := (*byte)(unsafe.Pointer(&buf[0])) 63 bytes, err := ByteSliceFromString(name) 64 if err != nil { 65 return nil, err 66 } 67 68 // Magic sysctl: "setting" 0.3 to a string name 69 // lets you read back the array of integers form. 70 if err = sysctl([]_C_int{0, 3}, p, &n, &bytes[0], uintptr(len(name))); err != nil { 71 return nil, err 72 } 73 return buf[0 : n/siz], nil 74 } 75 76 func direntIno(buf []byte) (uint64, bool) { 77 return readInt(buf, unsafe.Offsetof(Dirent{}.Fileno), unsafe.Sizeof(Dirent{}.Fileno)) 78 } 79 80 func direntReclen(buf []byte) (uint64, bool) { 81 return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen)) 82 } 83 84 func direntNamlen(buf []byte) (uint64, bool) { 85 return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen)) 86 } 87 88 func Pipe(p []int) (err error) { 89 return Pipe2(p, 0) 90 } 91 92 //sysnb pipe2(p *[2]_C_int, flags int) (err error) 93 94 func Pipe2(p []int, flags int) error { 95 if len(p) != 2 { 96 return EINVAL 97 } 98 var pp [2]_C_int 99 err := pipe2(&pp, flags) 100 if err == nil { 101 p[0] = int(pp[0]) 102 p[1] = int(pp[1]) 103 } 104 return err 105 } 106 107 func GetsockoptIPMreqn(fd, level, opt int) (*IPMreqn, error) { 108 var value IPMreqn 109 vallen := _Socklen(SizeofIPMreqn) 110 errno := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen) 111 return &value, errno 112 } 113 114 func SetsockoptIPMreqn(fd, level, opt int, mreq *IPMreqn) (err error) { 115 return setsockopt(fd, level, opt, unsafe.Pointer(mreq), unsafe.Sizeof(*mreq)) 116 } 117 118 // GetsockoptXucred is a getsockopt wrapper that returns an Xucred struct. 119 // The usual level and opt are SOL_LOCAL and LOCAL_PEERCRED, respectively. 120 func GetsockoptXucred(fd, level, opt int) (*Xucred, error) { 121 x := new(Xucred) 122 vallen := _Socklen(SizeofXucred) 123 err := getsockopt(fd, level, opt, unsafe.Pointer(x), &vallen) 124 return x, err 125 } 126 127 func Accept4(fd, flags int) (nfd int, sa Sockaddr, err error) { 128 var rsa RawSockaddrAny 129 var len _Socklen = SizeofSockaddrAny 130 nfd, err = accept4(fd, &rsa, &len, flags) 131 if err != nil { 132 return 133 } 134 if len > SizeofSockaddrAny { 135 panic("RawSockaddrAny too small") 136 } 137 sa, err = anyToSockaddr(fd, &rsa) 138 if err != nil { 139 Close(nfd) 140 nfd = 0 141 } 142 return 143 } 144 145 //sys Getcwd(buf []byte) (n int, err error) = SYS___GETCWD 146 147 func Getfsstat(buf []Statfs_t, flags int) (n int, err error) { 148 var ( 149 _p0 unsafe.Pointer 150 bufsize uintptr 151 ) 152 if len(buf) > 0 { 153 _p0 = unsafe.Pointer(&buf[0]) 154 bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf)) 155 } 156 r0, _, e1 := Syscall(SYS_GETFSSTAT, uintptr(_p0), bufsize, uintptr(flags)) 157 n = int(r0) 158 if e1 != 0 { 159 err = e1 160 } 161 return 162 } 163 164 //sys ioctl(fd int, req uint, arg uintptr) (err error) = SYS_IOCTL 165 //sys ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) = SYS_IOCTL 166 167 //sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL 168 169 func Uname(uname *Utsname) error { 170 mib := []_C_int{CTL_KERN, KERN_OSTYPE} 171 n := unsafe.Sizeof(uname.Sysname) 172 if err := sysctl(mib, &uname.Sysname[0], &n, nil, 0); err != nil { 173 return err 174 } 175 176 mib = []_C_int{CTL_KERN, KERN_HOSTNAME} 177 n = unsafe.Sizeof(uname.Nodename) 178 if err := sysctl(mib, &uname.Nodename[0], &n, nil, 0); err != nil { 179 return err 180 } 181 182 mib = []_C_int{CTL_KERN, KERN_OSRELEASE} 183 n = unsafe.Sizeof(uname.Release) 184 if err := sysctl(mib, &uname.Release[0], &n, nil, 0); err != nil { 185 return err 186 } 187 188 mib = []_C_int{CTL_KERN, KERN_VERSION} 189 n = unsafe.Sizeof(uname.Version) 190 if err := sysctl(mib, &uname.Version[0], &n, nil, 0); err != nil { 191 return err 192 } 193 194 // The version might have newlines or tabs in it, convert them to 195 // spaces. 196 for i, b := range uname.Version { 197 if b == '\n' || b == '\t' { 198 if i == len(uname.Version)-1 { 199 uname.Version[i] = 0 200 } else { 201 uname.Version[i] = ' ' 202 } 203 } 204 } 205 206 mib = []_C_int{CTL_HW, HW_MACHINE} 207 n = unsafe.Sizeof(uname.Machine) 208 if err := sysctl(mib, &uname.Machine[0], &n, nil, 0); err != nil { 209 return err 210 } 211 212 return nil 213 } 214 215 func Stat(path string, st *Stat_t) (err error) { 216 return Fstatat(AT_FDCWD, path, st, 0) 217 } 218 219 func Lstat(path string, st *Stat_t) (err error) { 220 return Fstatat(AT_FDCWD, path, st, AT_SYMLINK_NOFOLLOW) 221 } 222 223 func Getdents(fd int, buf []byte) (n int, err error) { 224 return Getdirentries(fd, buf, nil) 225 } 226 227 func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { 228 if basep == nil || unsafe.Sizeof(*basep) == 8 { 229 return getdirentries(fd, buf, (*uint64)(unsafe.Pointer(basep))) 230 } 231 // The syscall needs a 64-bit base. On 32-bit machines 232 // we can't just use the basep passed in. See #32498. 233 var base uint64 = uint64(*basep) 234 n, err = getdirentries(fd, buf, &base) 235 *basep = uintptr(base) 236 if base>>32 != 0 { 237 // We can't stuff the base back into a uintptr, so any 238 // future calls would be suspect. Generate an error. 239 // EIO is allowed by getdirentries. 240 err = EIO 241 } 242 return 243 } 244 245 func Mknod(path string, mode uint32, dev uint64) (err error) { 246 return Mknodat(AT_FDCWD, path, mode, dev) 247 } 248 249 func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 250 if raceenabled { 251 raceReleaseMerge(unsafe.Pointer(&ioSync)) 252 } 253 return sendfile(outfd, infd, offset, count) 254 } 255 256 //sys ptrace(request int, pid int, addr uintptr, data int) (err error) 257 //sys ptracePtr(request int, pid int, addr unsafe.Pointer, data int) (err error) = SYS_PTRACE 258 259 func PtraceAttach(pid int) (err error) { 260 return ptrace(PT_ATTACH, pid, 0, 0) 261 } 262 263 func PtraceCont(pid int, signal int) (err error) { 264 return ptrace(PT_CONTINUE, pid, 1, signal) 265 } 266 267 func PtraceDetach(pid int) (err error) { 268 return ptrace(PT_DETACH, pid, 1, 0) 269 } 270 271 func PtraceGetFpRegs(pid int, fpregsout *FpReg) (err error) { 272 return ptracePtr(PT_GETFPREGS, pid, unsafe.Pointer(fpregsout), 0) 273 } 274 275 func PtraceGetRegs(pid int, regsout *Reg) (err error) { 276 return ptracePtr(PT_GETREGS, pid, unsafe.Pointer(regsout), 0) 277 } 278 279 func PtraceIO(req int, pid int, offs uintptr, out []byte, countin int) (count int, err error) { 280 ioDesc := PtraceIoDesc{ 281 Op: int32(req), 282 Offs: offs, 283 } 284 if countin > 0 { 285 _ = out[:countin] // check bounds 286 ioDesc.Addr = &out[0] 287 } else if out != nil { 288 ioDesc.Addr = (*byte)(unsafe.Pointer(&_zero)) 289 } 290 ioDesc.SetLen(countin) 291 292 err = ptracePtr(PT_IO, pid, unsafe.Pointer(&ioDesc), 0) 293 return int(ioDesc.Len), err 294 } 295 296 func PtraceLwpEvents(pid int, enable int) (err error) { 297 return ptrace(PT_LWP_EVENTS, pid, 0, enable) 298 } 299 300 func PtraceLwpInfo(pid int, info *PtraceLwpInfoStruct) (err error) { 301 return ptracePtr(PT_LWPINFO, pid, unsafe.Pointer(info), int(unsafe.Sizeof(*info))) 302 } 303 304 func PtracePeekData(pid int, addr uintptr, out []byte) (count int, err error) { 305 return PtraceIO(PIOD_READ_D, pid, addr, out, SizeofLong) 306 } 307 308 func PtracePeekText(pid int, addr uintptr, out []byte) (count int, err error) { 309 return PtraceIO(PIOD_READ_I, pid, addr, out, SizeofLong) 310 } 311 312 func PtracePokeData(pid int, addr uintptr, data []byte) (count int, err error) { 313 return PtraceIO(PIOD_WRITE_D, pid, addr, data, SizeofLong) 314 } 315 316 func PtracePokeText(pid int, addr uintptr, data []byte) (count int, err error) { 317 return PtraceIO(PIOD_WRITE_I, pid, addr, data, SizeofLong) 318 } 319 320 func PtraceSetRegs(pid int, regs *Reg) (err error) { 321 return ptracePtr(PT_SETREGS, pid, unsafe.Pointer(regs), 0) 322 } 323 324 func PtraceSingleStep(pid int) (err error) { 325 return ptrace(PT_STEP, pid, 1, 0) 326 } 327 328 func Dup3(oldfd, newfd, flags int) error { 329 if oldfd == newfd || flags&^O_CLOEXEC != 0 { 330 return EINVAL 331 } 332 how := F_DUP2FD 333 if flags&O_CLOEXEC != 0 { 334 how = F_DUP2FD_CLOEXEC 335 } 336 _, err := fcntl(oldfd, how, newfd) 337 return err 338 } 339 340 /* 341 * Exposed directly 342 */ 343 //sys Access(path string, mode uint32) (err error) 344 //sys Adjtime(delta *Timeval, olddelta *Timeval) (err error) 345 //sys CapEnter() (err error) 346 //sys capRightsGet(version int, fd int, rightsp *CapRights) (err error) = SYS___CAP_RIGHTS_GET 347 //sys capRightsLimit(fd int, rightsp *CapRights) (err error) 348 //sys Chdir(path string) (err error) 349 //sys Chflags(path string, flags int) (err error) 350 //sys Chmod(path string, mode uint32) (err error) 351 //sys Chown(path string, uid int, gid int) (err error) 352 //sys Chroot(path string) (err error) 353 //sys ClockGettime(clockid int32, time *Timespec) (err error) 354 //sys Close(fd int) (err error) 355 //sys Dup(fd int) (nfd int, err error) 356 //sys Dup2(from int, to int) (err error) 357 //sys Exit(code int) 358 //sys ExtattrGetFd(fd int, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) 359 //sys ExtattrSetFd(fd int, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) 360 //sys ExtattrDeleteFd(fd int, attrnamespace int, attrname string) (err error) 361 //sys ExtattrListFd(fd int, attrnamespace int, data uintptr, nbytes int) (ret int, err error) 362 //sys ExtattrGetFile(file string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) 363 //sys ExtattrSetFile(file string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) 364 //sys ExtattrDeleteFile(file string, attrnamespace int, attrname string) (err error) 365 //sys ExtattrListFile(file string, attrnamespace int, data uintptr, nbytes int) (ret int, err error) 366 //sys ExtattrGetLink(link string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) 367 //sys ExtattrSetLink(link string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) 368 //sys ExtattrDeleteLink(link string, attrnamespace int, attrname string) (err error) 369 //sys ExtattrListLink(link string, attrnamespace int, data uintptr, nbytes int) (ret int, err error) 370 //sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_POSIX_FADVISE 371 //sys Faccessat(dirfd int, path string, mode uint32, flags int) (err error) 372 //sys Fchdir(fd int) (err error) 373 //sys Fchflags(fd int, flags int) (err error) 374 //sys Fchmod(fd int, mode uint32) (err error) 375 //sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) 376 //sys Fchown(fd int, uid int, gid int) (err error) 377 //sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) 378 //sys Flock(fd int, how int) (err error) 379 //sys Fpathconf(fd int, name int) (val int, err error) 380 //sys Fstat(fd int, stat *Stat_t) (err error) 381 //sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) 382 //sys Fstatfs(fd int, stat *Statfs_t) (err error) 383 //sys Fsync(fd int) (err error) 384 //sys Ftruncate(fd int, length int64) (err error) 385 //sys getdirentries(fd int, buf []byte, basep *uint64) (n int, err error) 386 //sys Getdtablesize() (size int) 387 //sysnb Getegid() (egid int) 388 //sysnb Geteuid() (uid int) 389 //sysnb Getgid() (gid int) 390 //sysnb Getpgid(pid int) (pgid int, err error) 391 //sysnb Getpgrp() (pgrp int) 392 //sysnb Getpid() (pid int) 393 //sysnb Getppid() (ppid int) 394 //sys Getpriority(which int, who int) (prio int, err error) 395 //sysnb Getrlimit(which int, lim *Rlimit) (err error) 396 //sysnb Getrusage(who int, rusage *Rusage) (err error) 397 //sysnb Getsid(pid int) (sid int, err error) 398 //sysnb Gettimeofday(tv *Timeval) (err error) 399 //sysnb Getuid() (uid int) 400 //sys Issetugid() (tainted bool) 401 //sys Kill(pid int, signum syscall.Signal) (err error) 402 //sys Kqueue() (fd int, err error) 403 //sys Lchown(path string, uid int, gid int) (err error) 404 //sys Link(path string, link string) (err error) 405 //sys Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) 406 //sys Listen(s int, backlog int) (err error) 407 //sys Mkdir(path string, mode uint32) (err error) 408 //sys Mkdirat(dirfd int, path string, mode uint32) (err error) 409 //sys Mkfifo(path string, mode uint32) (err error) 410 //sys Mknodat(fd int, path string, mode uint32, dev uint64) (err error) 411 //sys Nanosleep(time *Timespec, leftover *Timespec) (err error) 412 //sys Open(path string, mode int, perm uint32) (fd int, err error) 413 //sys Openat(fdat int, path string, mode int, perm uint32) (fd int, err error) 414 //sys Pathconf(path string, name int) (val int, err error) 415 //sys pread(fd int, p []byte, offset int64) (n int, err error) 416 //sys pwrite(fd int, p []byte, offset int64) (n int, err error) 417 //sys read(fd int, p []byte) (n int, err error) 418 //sys Readlink(path string, buf []byte) (n int, err error) 419 //sys Readlinkat(dirfd int, path string, buf []byte) (n int, err error) 420 //sys Rename(from string, to string) (err error) 421 //sys Renameat(fromfd int, from string, tofd int, to string) (err error) 422 //sys Revoke(path string) (err error) 423 //sys Rmdir(path string) (err error) 424 //sys Seek(fd int, offset int64, whence int) (newoffset int64, err error) = SYS_LSEEK 425 //sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) 426 //sysnb Setegid(egid int) (err error) 427 //sysnb Seteuid(euid int) (err error) 428 //sysnb Setgid(gid int) (err error) 429 //sys Setlogin(name string) (err error) 430 //sysnb Setpgid(pid int, pgid int) (err error) 431 //sys Setpriority(which int, who int, prio int) (err error) 432 //sysnb Setregid(rgid int, egid int) (err error) 433 //sysnb Setreuid(ruid int, euid int) (err error) 434 //sysnb Setresgid(rgid int, egid int, sgid int) (err error) 435 //sysnb Setresuid(ruid int, euid int, suid int) (err error) 436 //sysnb Setsid() (pid int, err error) 437 //sysnb Settimeofday(tp *Timeval) (err error) 438 //sysnb Setuid(uid int) (err error) 439 //sys Statfs(path string, stat *Statfs_t) (err error) 440 //sys Symlink(path string, link string) (err error) 441 //sys Symlinkat(oldpath string, newdirfd int, newpath string) (err error) 442 //sys Sync() (err error) 443 //sys Truncate(path string, length int64) (err error) 444 //sys Umask(newmask int) (oldmask int) 445 //sys Undelete(path string) (err error) 446 //sys Unlink(path string) (err error) 447 //sys Unlinkat(dirfd int, path string, flags int) (err error) 448 //sys Unmount(path string, flags int) (err error) 449 //sys write(fd int, p []byte) (n int, err error) 450 //sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) 451 //sys munmap(addr uintptr, length uintptr) (err error) 452 //sys readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ 453 //sys writelen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_WRITE 454 //sys accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int, err error) 455 //sys utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) 456 457 /* 458 * Unimplemented 459 */ 460 // Profil 461 // Sigaction 462 // Sigprocmask 463 // Getlogin 464 // Sigpending 465 // Sigaltstack 466 // Ioctl 467 // Reboot 468 // Execve 469 // Vfork 470 // Sbrk 471 // Sstk 472 // Ovadvise 473 // Mincore 474 // Setitimer 475 // Swapon 476 // Select 477 // Sigsuspend 478 // Readv 479 // Writev 480 // Nfssvc 481 // Getfh 482 // Quotactl 483 // Mount 484 // Csops 485 // Waitid 486 // Add_profil 487 // Kdebug_trace 488 // Sigreturn 489 // Atsocket 490 // Kqueue_from_portset_np 491 // Kqueue_portset 492 // Getattrlist 493 // Setattrlist 494 // Getdents 495 // Getdirentriesattr 496 // Searchfs 497 // Delete 498 // Copyfile 499 // Watchevent 500 // Waitevent 501 // Modwatch 502 // Fsctl 503 // Initgroups 504 // Posix_spawn 505 // Nfsclnt 506 // Fhopen 507 // Minherit 508 // Semsys 509 // Msgsys 510 // Shmsys 511 // Semctl 512 // Semget 513 // Semop 514 // Msgctl 515 // Msgget 516 // Msgsnd 517 // Msgrcv 518 // Shmat 519 // Shmctl 520 // Shmdt 521 // Shmget 522 // Shm_open 523 // Shm_unlink 524 // Sem_open 525 // Sem_close 526 // Sem_unlink 527 // Sem_wait 528 // Sem_trywait 529 // Sem_post 530 // Sem_getvalue 531 // Sem_init 532 // Sem_destroy 533 // Open_extended 534 // Umask_extended 535 // Stat_extended 536 // Lstat_extended 537 // Fstat_extended 538 // Chmod_extended 539 // Fchmod_extended 540 // Access_extended 541 // Settid 542 // Gettid 543 // Setsgroups 544 // Getsgroups 545 // Setwgroups 546 // Getwgroups 547 // Mkfifo_extended 548 // Mkdir_extended 549 // Identitysvc 550 // Shared_region_check_np 551 // Shared_region_map_np 552 // __pthread_mutex_destroy 553 // __pthread_mutex_init 554 // __pthread_mutex_lock 555 // __pthread_mutex_trylock 556 // __pthread_mutex_unlock 557 // __pthread_cond_init 558 // __pthread_cond_destroy 559 // __pthread_cond_broadcast 560 // __pthread_cond_signal 561 // Setsid_with_pid 562 // __pthread_cond_timedwait 563 // Aio_fsync 564 // Aio_return 565 // Aio_suspend 566 // Aio_cancel 567 // Aio_error 568 // Aio_read 569 // Aio_write 570 // Lio_listio 571 // __pthread_cond_wait 572 // Iopolicysys 573 // __pthread_kill 574 // __pthread_sigmask 575 // __sigwait 576 // __disable_threadsignal 577 // __pthread_markcancel 578 // __pthread_canceled 579 // __semwait_signal 580 // Proc_info 581 // Stat64_extended 582 // Lstat64_extended 583 // Fstat64_extended 584 // __pthread_chdir 585 // __pthread_fchdir 586 // Audit 587 // Auditon 588 // Getauid 589 // Setauid 590 // Getaudit 591 // Setaudit 592 // Getaudit_addr 593 // Setaudit_addr 594 // Auditctl 595 // Bsdthread_create 596 // Bsdthread_terminate 597 // Stack_snapshot 598 // Bsdthread_register 599 // Workq_open 600 // Workq_ops 601 // __mac_execve 602 // __mac_syscall 603 // __mac_get_file 604 // __mac_set_file 605 // __mac_get_link 606 // __mac_set_link 607 // __mac_get_proc 608 // __mac_set_proc 609 // __mac_get_fd 610 // __mac_set_fd 611 // __mac_get_pid 612 // __mac_get_lcid 613 // __mac_get_lctx 614 // __mac_set_lctx 615 // Setlcid 616 // Read_nocancel 617 // Write_nocancel 618 // Open_nocancel 619 // Close_nocancel 620 // Wait4_nocancel 621 // Recvmsg_nocancel 622 // Sendmsg_nocancel 623 // Recvfrom_nocancel 624 // Accept_nocancel 625 // Fcntl_nocancel 626 // Select_nocancel 627 // Fsync_nocancel 628 // Connect_nocancel 629 // Sigsuspend_nocancel 630 // Readv_nocancel 631 // Writev_nocancel 632 // Sendto_nocancel 633 // Pread_nocancel 634 // Pwrite_nocancel 635 // Waitid_nocancel 636 // Poll_nocancel 637 // Msgsnd_nocancel 638 // Msgrcv_nocancel 639 // Sem_wait_nocancel 640 // Aio_suspend_nocancel 641 // __sigwait_nocancel 642 // __semwait_signal_nocancel 643 // __mac_mount 644 // __mac_get_mount 645 // __mac_getfsstat