Source file src/cmd/vendor/golang.org/x/sys/unix/syscall_darwin.go
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 // Darwin 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 "fmt" 17 "runtime" 18 "syscall" 19 "unsafe" 20 ) 21 22 // SockaddrDatalink implements the Sockaddr interface for AF_LINK type sockets. 23 type SockaddrDatalink struct { 24 Len uint8 25 Family uint8 26 Index uint16 27 Type uint8 28 Nlen uint8 29 Alen uint8 30 Slen uint8 31 Data [12]int8 32 raw RawSockaddrDatalink 33 } 34 35 // SockaddrCtl implements the Sockaddr interface for AF_SYSTEM type sockets. 36 type SockaddrCtl struct { 37 ID uint32 38 Unit uint32 39 raw RawSockaddrCtl 40 } 41 42 func (sa *SockaddrCtl) sockaddr() (unsafe.Pointer, _Socklen, error) { 43 sa.raw.Sc_len = SizeofSockaddrCtl 44 sa.raw.Sc_family = AF_SYSTEM 45 sa.raw.Ss_sysaddr = AF_SYS_CONTROL 46 sa.raw.Sc_id = sa.ID 47 sa.raw.Sc_unit = sa.Unit 48 return unsafe.Pointer(&sa.raw), SizeofSockaddrCtl, nil 49 } 50 51 // SockaddrVM implements the Sockaddr interface for AF_VSOCK type sockets. 52 // SockaddrVM provides access to Darwin VM sockets: a mechanism that enables 53 // bidirectional communication between a hypervisor and its guest virtual 54 // machines. 55 type SockaddrVM struct { 56 // CID and Port specify a context ID and port address for a VM socket. 57 // Guests have a unique CID, and hosts may have a well-known CID of: 58 // - VMADDR_CID_HYPERVISOR: refers to the hypervisor process. 59 // - VMADDR_CID_LOCAL: refers to local communication (loopback). 60 // - VMADDR_CID_HOST: refers to other processes on the host. 61 CID uint32 62 Port uint32 63 raw RawSockaddrVM 64 } 65 66 func (sa *SockaddrVM) sockaddr() (unsafe.Pointer, _Socklen, error) { 67 sa.raw.Len = SizeofSockaddrVM 68 sa.raw.Family = AF_VSOCK 69 sa.raw.Port = sa.Port 70 sa.raw.Cid = sa.CID 71 72 return unsafe.Pointer(&sa.raw), SizeofSockaddrVM, nil 73 } 74 75 func anyToSockaddrGOOS(fd int, rsa *RawSockaddrAny) (Sockaddr, error) { 76 switch rsa.Addr.Family { 77 case AF_SYSTEM: 78 pp := (*RawSockaddrCtl)(unsafe.Pointer(rsa)) 79 if pp.Ss_sysaddr == AF_SYS_CONTROL { 80 sa := new(SockaddrCtl) 81 sa.ID = pp.Sc_id 82 sa.Unit = pp.Sc_unit 83 return sa, nil 84 } 85 case AF_VSOCK: 86 pp := (*RawSockaddrVM)(unsafe.Pointer(rsa)) 87 sa := &SockaddrVM{ 88 CID: pp.Cid, 89 Port: pp.Port, 90 } 91 return sa, nil 92 } 93 return nil, EAFNOSUPPORT 94 } 95 96 // Some external packages rely on SYS___SYSCTL being defined to implement their 97 // own sysctl wrappers. Provide it here, even though direct syscalls are no 98 // longer supported on darwin. 99 const SYS___SYSCTL = SYS_SYSCTL 100 101 // Translate "kern.hostname" to []_C_int{0,1,2,3}. 102 func nametomib(name string) (mib []_C_int, err error) { 103 const siz = unsafe.Sizeof(mib[0]) 104 105 // NOTE(rsc): It seems strange to set the buffer to have 106 // size CTL_MAXNAME+2 but use only CTL_MAXNAME 107 // as the size. I don't know why the +2 is here, but the 108 // kernel uses +2 for its own implementation of this function. 109 // I am scared that if we don't include the +2 here, the kernel 110 // will silently write 2 words farther than we specify 111 // and we'll get memory corruption. 112 var buf [CTL_MAXNAME + 2]_C_int 113 n := uintptr(CTL_MAXNAME) * siz 114 115 p := (*byte)(unsafe.Pointer(&buf[0])) 116 bytes, err := ByteSliceFromString(name) 117 if err != nil { 118 return nil, err 119 } 120 121 // Magic sysctl: "setting" 0.3 to a string name 122 // lets you read back the array of integers form. 123 if err = sysctl([]_C_int{0, 3}, p, &n, &bytes[0], uintptr(len(name))); err != nil { 124 return nil, err 125 } 126 return buf[0 : n/siz], nil 127 } 128 129 func direntIno(buf []byte) (uint64, bool) { 130 return readInt(buf, unsafe.Offsetof(Dirent{}.Ino), unsafe.Sizeof(Dirent{}.Ino)) 131 } 132 133 func direntReclen(buf []byte) (uint64, bool) { 134 return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen)) 135 } 136 137 func direntNamlen(buf []byte) (uint64, bool) { 138 return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen)) 139 } 140 141 func PtraceAttach(pid int) (err error) { return ptrace(PT_ATTACH, pid, 0, 0) } 142 func PtraceDetach(pid int) (err error) { return ptrace(PT_DETACH, pid, 0, 0) } 143 144 type attrList struct { 145 bitmapCount uint16 146 _ uint16 147 CommonAttr uint32 148 VolAttr uint32 149 DirAttr uint32 150 FileAttr uint32 151 Forkattr uint32 152 } 153 154 //sysnb pipe(p *[2]int32) (err error) 155 156 func Pipe(p []int) (err error) { 157 if len(p) != 2 { 158 return EINVAL 159 } 160 var x [2]int32 161 err = pipe(&x) 162 p[0] = int(x[0]) 163 p[1] = int(x[1]) 164 return 165 } 166 167 func Getfsstat(buf []Statfs_t, flags int) (n int, err error) { 168 var _p0 unsafe.Pointer 169 var bufsize uintptr 170 if len(buf) > 0 { 171 _p0 = unsafe.Pointer(&buf[0]) 172 bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf)) 173 } 174 return getfsstat(_p0, bufsize, flags) 175 } 176 177 func xattrPointer(dest []byte) *byte { 178 // It's only when dest is set to NULL that the OS X implementations of 179 // getxattr() and listxattr() return the current sizes of the named attributes. 180 // An empty byte array is not sufficient. To maintain the same behaviour as the 181 // linux implementation, we wrap around the system calls and pass in NULL when 182 // dest is empty. 183 var destp *byte 184 if len(dest) > 0 { 185 destp = &dest[0] 186 } 187 return destp 188 } 189 190 //sys getxattr(path string, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) 191 192 func Getxattr(path string, attr string, dest []byte) (sz int, err error) { 193 return getxattr(path, attr, xattrPointer(dest), len(dest), 0, 0) 194 } 195 196 func Lgetxattr(link string, attr string, dest []byte) (sz int, err error) { 197 return getxattr(link, attr, xattrPointer(dest), len(dest), 0, XATTR_NOFOLLOW) 198 } 199 200 //sys fgetxattr(fd int, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) 201 202 func Fgetxattr(fd int, attr string, dest []byte) (sz int, err error) { 203 return fgetxattr(fd, attr, xattrPointer(dest), len(dest), 0, 0) 204 } 205 206 //sys setxattr(path string, attr string, data *byte, size int, position uint32, options int) (err error) 207 208 func Setxattr(path string, attr string, data []byte, flags int) (err error) { 209 // The parameters for the OS X implementation vary slightly compared to the 210 // linux system call, specifically the position parameter: 211 // 212 // linux: 213 // int setxattr( 214 // const char *path, 215 // const char *name, 216 // const void *value, 217 // size_t size, 218 // int flags 219 // ); 220 // 221 // darwin: 222 // int setxattr( 223 // const char *path, 224 // const char *name, 225 // void *value, 226 // size_t size, 227 // u_int32_t position, 228 // int options 229 // ); 230 // 231 // position specifies the offset within the extended attribute. In the 232 // current implementation, only the resource fork extended attribute makes 233 // use of this argument. For all others, position is reserved. We simply 234 // default to setting it to zero. 235 return setxattr(path, attr, xattrPointer(data), len(data), 0, flags) 236 } 237 238 func Lsetxattr(link string, attr string, data []byte, flags int) (err error) { 239 return setxattr(link, attr, xattrPointer(data), len(data), 0, flags|XATTR_NOFOLLOW) 240 } 241 242 //sys fsetxattr(fd int, attr string, data *byte, size int, position uint32, options int) (err error) 243 244 func Fsetxattr(fd int, attr string, data []byte, flags int) (err error) { 245 return fsetxattr(fd, attr, xattrPointer(data), len(data), 0, 0) 246 } 247 248 //sys removexattr(path string, attr string, options int) (err error) 249 250 func Removexattr(path string, attr string) (err error) { 251 // We wrap around and explicitly zero out the options provided to the OS X 252 // implementation of removexattr, we do so for interoperability with the 253 // linux variant. 254 return removexattr(path, attr, 0) 255 } 256 257 func Lremovexattr(link string, attr string) (err error) { 258 return removexattr(link, attr, XATTR_NOFOLLOW) 259 } 260 261 //sys fremovexattr(fd int, attr string, options int) (err error) 262 263 func Fremovexattr(fd int, attr string) (err error) { 264 return fremovexattr(fd, attr, 0) 265 } 266 267 //sys listxattr(path string, dest *byte, size int, options int) (sz int, err error) 268 269 func Listxattr(path string, dest []byte) (sz int, err error) { 270 return listxattr(path, xattrPointer(dest), len(dest), 0) 271 } 272 273 func Llistxattr(link string, dest []byte) (sz int, err error) { 274 return listxattr(link, xattrPointer(dest), len(dest), XATTR_NOFOLLOW) 275 } 276 277 //sys flistxattr(fd int, dest *byte, size int, options int) (sz int, err error) 278 279 func Flistxattr(fd int, dest []byte) (sz int, err error) { 280 return flistxattr(fd, xattrPointer(dest), len(dest), 0) 281 } 282 283 func setattrlistTimes(path string, times []Timespec, flags int) error { 284 _p0, err := BytePtrFromString(path) 285 if err != nil { 286 return err 287 } 288 289 var attrList attrList 290 attrList.bitmapCount = ATTR_BIT_MAP_COUNT 291 attrList.CommonAttr = ATTR_CMN_MODTIME | ATTR_CMN_ACCTIME 292 293 // order is mtime, atime: the opposite of Chtimes 294 attributes := [2]Timespec{times[1], times[0]} 295 options := 0 296 if flags&AT_SYMLINK_NOFOLLOW != 0 { 297 options |= FSOPT_NOFOLLOW 298 } 299 return setattrlist( 300 _p0, 301 unsafe.Pointer(&attrList), 302 unsafe.Pointer(&attributes), 303 unsafe.Sizeof(attributes), 304 options) 305 } 306 307 //sys setattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) 308 309 func utimensat(dirfd int, path string, times *[2]Timespec, flags int) error { 310 // Darwin doesn't support SYS_UTIMENSAT 311 return ENOSYS 312 } 313 314 /* 315 * Wrapped 316 */ 317 318 //sys fcntl(fd int, cmd int, arg int) (val int, err error) 319 320 //sys kill(pid int, signum int, posix int) (err error) 321 322 func Kill(pid int, signum syscall.Signal) (err error) { return kill(pid, int(signum), 1) } 323 324 //sys ioctl(fd int, req uint, arg uintptr) (err error) 325 326 func IoctlCtlInfo(fd int, ctlInfo *CtlInfo) error { 327 err := ioctl(fd, CTLIOCGINFO, uintptr(unsafe.Pointer(ctlInfo))) 328 runtime.KeepAlive(ctlInfo) 329 return err 330 } 331 332 // IfreqMTU is struct ifreq used to get or set a network device's MTU. 333 type IfreqMTU struct { 334 Name [IFNAMSIZ]byte 335 MTU int32 336 } 337 338 // IoctlGetIfreqMTU performs the SIOCGIFMTU ioctl operation on fd to get the MTU 339 // of the network device specified by ifname. 340 func IoctlGetIfreqMTU(fd int, ifname string) (*IfreqMTU, error) { 341 var ifreq IfreqMTU 342 copy(ifreq.Name[:], ifname) 343 err := ioctl(fd, SIOCGIFMTU, uintptr(unsafe.Pointer(&ifreq))) 344 return &ifreq, err 345 } 346 347 // IoctlSetIfreqMTU performs the SIOCSIFMTU ioctl operation on fd to set the MTU 348 // of the network device specified by ifreq.Name. 349 func IoctlSetIfreqMTU(fd int, ifreq *IfreqMTU) error { 350 err := ioctl(fd, SIOCSIFMTU, uintptr(unsafe.Pointer(ifreq))) 351 runtime.KeepAlive(ifreq) 352 return err 353 } 354 355 //sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS_SYSCTL 356 357 func Uname(uname *Utsname) error { 358 mib := []_C_int{CTL_KERN, KERN_OSTYPE} 359 n := unsafe.Sizeof(uname.Sysname) 360 if err := sysctl(mib, &uname.Sysname[0], &n, nil, 0); err != nil { 361 return err 362 } 363 364 mib = []_C_int{CTL_KERN, KERN_HOSTNAME} 365 n = unsafe.Sizeof(uname.Nodename) 366 if err := sysctl(mib, &uname.Nodename[0], &n, nil, 0); err != nil { 367 return err 368 } 369 370 mib = []_C_int{CTL_KERN, KERN_OSRELEASE} 371 n = unsafe.Sizeof(uname.Release) 372 if err := sysctl(mib, &uname.Release[0], &n, nil, 0); err != nil { 373 return err 374 } 375 376 mib = []_C_int{CTL_KERN, KERN_VERSION} 377 n = unsafe.Sizeof(uname.Version) 378 if err := sysctl(mib, &uname.Version[0], &n, nil, 0); err != nil { 379 return err 380 } 381 382 // The version might have newlines or tabs in it, convert them to 383 // spaces. 384 for i, b := range uname.Version { 385 if b == '\n' || b == '\t' { 386 if i == len(uname.Version)-1 { 387 uname.Version[i] = 0 388 } else { 389 uname.Version[i] = ' ' 390 } 391 } 392 } 393 394 mib = []_C_int{CTL_HW, HW_MACHINE} 395 n = unsafe.Sizeof(uname.Machine) 396 if err := sysctl(mib, &uname.Machine[0], &n, nil, 0); err != nil { 397 return err 398 } 399 400 return nil 401 } 402 403 func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 404 if raceenabled { 405 raceReleaseMerge(unsafe.Pointer(&ioSync)) 406 } 407 var length = int64(count) 408 err = sendfile(infd, outfd, *offset, &length, nil, 0) 409 written = int(length) 410 return 411 } 412 413 func GetsockoptIPMreqn(fd, level, opt int) (*IPMreqn, error) { 414 var value IPMreqn 415 vallen := _Socklen(SizeofIPMreqn) 416 errno := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen) 417 return &value, errno 418 } 419 420 func SetsockoptIPMreqn(fd, level, opt int, mreq *IPMreqn) (err error) { 421 return setsockopt(fd, level, opt, unsafe.Pointer(mreq), unsafe.Sizeof(*mreq)) 422 } 423 424 // GetsockoptXucred is a getsockopt wrapper that returns an Xucred struct. 425 // The usual level and opt are SOL_LOCAL and LOCAL_PEERCRED, respectively. 426 func GetsockoptXucred(fd, level, opt int) (*Xucred, error) { 427 x := new(Xucred) 428 vallen := _Socklen(SizeofXucred) 429 err := getsockopt(fd, level, opt, unsafe.Pointer(x), &vallen) 430 return x, err 431 } 432 433 func SysctlKinfoProc(name string, args ...int) (*KinfoProc, error) { 434 mib, err := sysctlmib(name, args...) 435 if err != nil { 436 return nil, err 437 } 438 439 var kinfo KinfoProc 440 n := uintptr(SizeofKinfoProc) 441 if err := sysctl(mib, (*byte)(unsafe.Pointer(&kinfo)), &n, nil, 0); err != nil { 442 return nil, err 443 } 444 if n != SizeofKinfoProc { 445 return nil, EIO 446 } 447 return &kinfo, nil 448 } 449 450 func SysctlKinfoProcSlice(name string, args ...int) ([]KinfoProc, error) { 451 mib, err := sysctlmib(name, args...) 452 if err != nil { 453 return nil, err 454 } 455 456 // Find size. 457 n := uintptr(0) 458 if err := sysctl(mib, nil, &n, nil, 0); err != nil { 459 return nil, err 460 } 461 if n == 0 { 462 return nil, nil 463 } 464 if n%SizeofKinfoProc != 0 { 465 return nil, fmt.Errorf("sysctl() returned a size of %d, which is not a multiple of %d", n, SizeofKinfoProc) 466 } 467 468 // Read into buffer of that size. 469 buf := make([]KinfoProc, n/SizeofKinfoProc) 470 if err := sysctl(mib, (*byte)(unsafe.Pointer(&buf[0])), &n, nil, 0); err != nil { 471 return nil, err 472 } 473 if n%SizeofKinfoProc != 0 { 474 return nil, fmt.Errorf("sysctl() returned a size of %d, which is not a multiple of %d", n, SizeofKinfoProc) 475 } 476 477 // The actual call may return less than the original reported required 478 // size so ensure we deal with that. 479 return buf[:n/SizeofKinfoProc], nil 480 } 481 482 //sys sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) 483 484 //sys shmat(id int, addr uintptr, flag int) (ret uintptr, err error) 485 //sys shmctl(id int, cmd int, buf *SysvShmDesc) (result int, err error) 486 //sys shmdt(addr uintptr) (err error) 487 //sys shmget(key int, size int, flag int) (id int, err error) 488 489 /* 490 * Exposed directly 491 */ 492 //sys Access(path string, mode uint32) (err error) 493 //sys Adjtime(delta *Timeval, olddelta *Timeval) (err error) 494 //sys Chdir(path string) (err error) 495 //sys Chflags(path string, flags int) (err error) 496 //sys Chmod(path string, mode uint32) (err error) 497 //sys Chown(path string, uid int, gid int) (err error) 498 //sys Chroot(path string) (err error) 499 //sys ClockGettime(clockid int32, time *Timespec) (err error) 500 //sys Close(fd int) (err error) 501 //sys Clonefile(src string, dst string, flags int) (err error) 502 //sys Clonefileat(srcDirfd int, src string, dstDirfd int, dst string, flags int) (err error) 503 //sys Dup(fd int) (nfd int, err error) 504 //sys Dup2(from int, to int) (err error) 505 //sys Exchangedata(path1 string, path2 string, options int) (err error) 506 //sys Exit(code int) 507 //sys Faccessat(dirfd int, path string, mode uint32, flags int) (err error) 508 //sys Fchdir(fd int) (err error) 509 //sys Fchflags(fd int, flags int) (err error) 510 //sys Fchmod(fd int, mode uint32) (err error) 511 //sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) 512 //sys Fchown(fd int, uid int, gid int) (err error) 513 //sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) 514 //sys Fclonefileat(srcDirfd int, dstDirfd int, dst string, flags int) (err error) 515 //sys Flock(fd int, how int) (err error) 516 //sys Fpathconf(fd int, name int) (val int, err error) 517 //sys Fsync(fd int) (err error) 518 //sys Ftruncate(fd int, length int64) (err error) 519 //sys Getcwd(buf []byte) (n int, err error) 520 //sys Getdtablesize() (size int) 521 //sysnb Getegid() (egid int) 522 //sysnb Geteuid() (uid int) 523 //sysnb Getgid() (gid int) 524 //sysnb Getpgid(pid int) (pgid int, err error) 525 //sysnb Getpgrp() (pgrp int) 526 //sysnb Getpid() (pid int) 527 //sysnb Getppid() (ppid int) 528 //sys Getpriority(which int, who int) (prio int, err error) 529 //sysnb Getrlimit(which int, lim *Rlimit) (err error) 530 //sysnb Getrusage(who int, rusage *Rusage) (err error) 531 //sysnb Getsid(pid int) (sid int, err error) 532 //sysnb Gettimeofday(tp *Timeval) (err error) 533 //sysnb Getuid() (uid int) 534 //sysnb Issetugid() (tainted bool) 535 //sys Kqueue() (fd int, err error) 536 //sys Lchown(path string, uid int, gid int) (err error) 537 //sys Link(path string, link string) (err error) 538 //sys Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) 539 //sys Listen(s int, backlog int) (err error) 540 //sys Mkdir(path string, mode uint32) (err error) 541 //sys Mkdirat(dirfd int, path string, mode uint32) (err error) 542 //sys Mkfifo(path string, mode uint32) (err error) 543 //sys Mknod(path string, mode uint32, dev int) (err error) 544 //sys Open(path string, mode int, perm uint32) (fd int, err error) 545 //sys Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) 546 //sys Pathconf(path string, name int) (val int, err error) 547 //sys Pread(fd int, p []byte, offset int64) (n int, err error) 548 //sys Pwrite(fd int, p []byte, offset int64) (n int, err error) 549 //sys read(fd int, p []byte) (n int, err error) 550 //sys Readlink(path string, buf []byte) (n int, err error) 551 //sys Readlinkat(dirfd int, path string, buf []byte) (n int, err error) 552 //sys Rename(from string, to string) (err error) 553 //sys Renameat(fromfd int, from string, tofd int, to string) (err error) 554 //sys Revoke(path string) (err error) 555 //sys Rmdir(path string) (err error) 556 //sys Seek(fd int, offset int64, whence int) (newoffset int64, err error) = SYS_LSEEK 557 //sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) 558 //sys Setegid(egid int) (err error) 559 //sysnb Seteuid(euid int) (err error) 560 //sysnb Setgid(gid int) (err error) 561 //sys Setlogin(name string) (err error) 562 //sysnb Setpgid(pid int, pgid int) (err error) 563 //sys Setpriority(which int, who int, prio int) (err error) 564 //sys Setprivexec(flag int) (err error) 565 //sysnb Setregid(rgid int, egid int) (err error) 566 //sysnb Setreuid(ruid int, euid int) (err error) 567 //sysnb Setrlimit(which int, lim *Rlimit) (err error) 568 //sysnb Setsid() (pid int, err error) 569 //sysnb Settimeofday(tp *Timeval) (err error) 570 //sysnb Setuid(uid int) (err error) 571 //sys Symlink(path string, link string) (err error) 572 //sys Symlinkat(oldpath string, newdirfd int, newpath string) (err error) 573 //sys Sync() (err error) 574 //sys Truncate(path string, length int64) (err error) 575 //sys Umask(newmask int) (oldmask int) 576 //sys Undelete(path string) (err error) 577 //sys Unlink(path string) (err error) 578 //sys Unlinkat(dirfd int, path string, flags int) (err error) 579 //sys Unmount(path string, flags int) (err error) 580 //sys write(fd int, p []byte) (n int, err error) 581 //sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) 582 //sys munmap(addr uintptr, length uintptr) (err error) 583 //sys readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ 584 //sys writelen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_WRITE 585 586 /* 587 * Unimplemented 588 */ 589 // Profil 590 // Sigaction 591 // Sigprocmask 592 // Getlogin 593 // Sigpending 594 // Sigaltstack 595 // Ioctl 596 // Reboot 597 // Execve 598 // Vfork 599 // Sbrk 600 // Sstk 601 // Ovadvise 602 // Mincore 603 // Setitimer 604 // Swapon 605 // Select 606 // Sigsuspend 607 // Readv 608 // Writev 609 // Nfssvc 610 // Getfh 611 // Quotactl 612 // Mount 613 // Csops 614 // Waitid 615 // Add_profil 616 // Kdebug_trace 617 // Sigreturn 618 // Atsocket 619 // Kqueue_from_portset_np 620 // Kqueue_portset 621 // Getattrlist 622 // Setattrlist 623 // Getdirentriesattr 624 // Searchfs 625 // Delete 626 // Copyfile 627 // Watchevent 628 // Waitevent 629 // Modwatch 630 // Fsctl 631 // Initgroups 632 // Posix_spawn 633 // Nfsclnt 634 // Fhopen 635 // Minherit 636 // Semsys 637 // Msgsys 638 // Shmsys 639 // Semctl 640 // Semget 641 // Semop 642 // Msgctl 643 // Msgget 644 // Msgsnd 645 // Msgrcv 646 // Shm_open 647 // Shm_unlink 648 // Sem_open 649 // Sem_close 650 // Sem_unlink 651 // Sem_wait 652 // Sem_trywait 653 // Sem_post 654 // Sem_getvalue 655 // Sem_init 656 // Sem_destroy 657 // Open_extended 658 // Umask_extended 659 // Stat_extended 660 // Lstat_extended 661 // Fstat_extended 662 // Chmod_extended 663 // Fchmod_extended 664 // Access_extended 665 // Settid 666 // Gettid 667 // Setsgroups 668 // Getsgroups 669 // Setwgroups 670 // Getwgroups 671 // Mkfifo_extended 672 // Mkdir_extended 673 // Identitysvc 674 // Shared_region_check_np 675 // Shared_region_map_np 676 // __pthread_mutex_destroy 677 // __pthread_mutex_init 678 // __pthread_mutex_lock 679 // __pthread_mutex_trylock 680 // __pthread_mutex_unlock 681 // __pthread_cond_init 682 // __pthread_cond_destroy 683 // __pthread_cond_broadcast 684 // __pthread_cond_signal 685 // Setsid_with_pid 686 // __pthread_cond_timedwait 687 // Aio_fsync 688 // Aio_return 689 // Aio_suspend 690 // Aio_cancel 691 // Aio_error 692 // Aio_read 693 // Aio_write 694 // Lio_listio 695 // __pthread_cond_wait 696 // Iopolicysys 697 // __pthread_kill 698 // __pthread_sigmask 699 // __sigwait 700 // __disable_threadsignal 701 // __pthread_markcancel 702 // __pthread_canceled 703 // __semwait_signal 704 // Proc_info 705 // sendfile 706 // Stat64_extended 707 // Lstat64_extended 708 // Fstat64_extended 709 // __pthread_chdir 710 // __pthread_fchdir 711 // Audit 712 // Auditon 713 // Getauid 714 // Setauid 715 // Getaudit 716 // Setaudit 717 // Getaudit_addr 718 // Setaudit_addr 719 // Auditctl 720 // Bsdthread_create 721 // Bsdthread_terminate 722 // Stack_snapshot 723 // Bsdthread_register 724 // Workq_open 725 // Workq_ops 726 // __mac_execve 727 // __mac_syscall 728 // __mac_get_file 729 // __mac_set_file 730 // __mac_get_link 731 // __mac_set_link 732 // __mac_get_proc 733 // __mac_set_proc 734 // __mac_get_fd 735 // __mac_set_fd 736 // __mac_get_pid 737 // __mac_get_lcid 738 // __mac_get_lctx 739 // __mac_set_lctx 740 // Setlcid 741 // Read_nocancel 742 // Write_nocancel 743 // Open_nocancel 744 // Close_nocancel 745 // Wait4_nocancel 746 // Recvmsg_nocancel 747 // Sendmsg_nocancel 748 // Recvfrom_nocancel 749 // Accept_nocancel 750 // Fcntl_nocancel 751 // Select_nocancel 752 // Fsync_nocancel 753 // Connect_nocancel 754 // Sigsuspend_nocancel 755 // Readv_nocancel 756 // Writev_nocancel 757 // Sendto_nocancel 758 // Pread_nocancel 759 // Pwrite_nocancel 760 // Waitid_nocancel 761 // Poll_nocancel 762 // Msgsnd_nocancel 763 // Msgrcv_nocancel 764 // Sem_wait_nocancel 765 // Aio_suspend_nocancel 766 // __sigwait_nocancel 767 // __semwait_signal_nocancel 768 // __mac_mount 769 // __mac_get_mount 770 // __mac_getfsstat 771