github.com/binkynet/BinkyNet@v1.12.1-0.20240421190447-da4e34c20be0/proto_vendor/golang.org/x/sys/unix/syscall_freebsd.go (about) 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 const ( 21 SYS_FSTAT_FREEBSD12 = 551 // { int fstat(int fd, _Out_ struct stat *sb); } 22 SYS_FSTATAT_FREEBSD12 = 552 // { int fstatat(int fd, _In_z_ char *path, \ 23 SYS_GETDIRENTRIES_FREEBSD12 = 554 // { ssize_t getdirentries(int fd, \ 24 SYS_STATFS_FREEBSD12 = 555 // { int statfs(_In_z_ char *path, \ 25 SYS_FSTATFS_FREEBSD12 = 556 // { int fstatfs(int fd, \ 26 SYS_GETFSSTAT_FREEBSD12 = 557 // { int getfsstat( \ 27 SYS_MKNODAT_FREEBSD12 = 559 // { int mknodat(int fd, _In_z_ char *path, \ 28 ) 29 30 // See https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/versions.html. 31 var ( 32 osreldateOnce sync.Once 33 osreldate uint32 34 ) 35 36 // INO64_FIRST from /usr/src/lib/libc/sys/compat-ino64.h 37 const _ino64First = 1200031 38 39 //sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL 40 41 func supportsABI(ver uint32) bool { 42 osreldateOnce.Do(func() { osreldate, _ = SysctlUint32("kern.osreldate") }) 43 return osreldate >= ver 44 } 45 46 // SockaddrDatalink implements the Sockaddr interface for AF_LINK type sockets. 47 type SockaddrDatalink struct { 48 Len uint8 49 Family uint8 50 Index uint16 51 Type uint8 52 Nlen uint8 53 Alen uint8 54 Slen uint8 55 Data [46]int8 56 raw RawSockaddrDatalink 57 } 58 59 // Translate "kern.hostname" to []_C_int{0,1,2,3}. 60 func nametomib(name string) (mib []_C_int, err error) { 61 const siz = unsafe.Sizeof(mib[0]) 62 63 // NOTE(rsc): It seems strange to set the buffer to have 64 // size CTL_MAXNAME+2 but use only CTL_MAXNAME 65 // as the size. I don't know why the +2 is here, but the 66 // kernel uses +2 for its own implementation of this function. 67 // I am scared that if we don't include the +2 here, the kernel 68 // will silently write 2 words farther than we specify 69 // and we'll get memory corruption. 70 var buf [CTL_MAXNAME + 2]_C_int 71 n := uintptr(CTL_MAXNAME) * siz 72 73 p := (*byte)(unsafe.Pointer(&buf[0])) 74 bytes, err := ByteSliceFromString(name) 75 if err != nil { 76 return nil, err 77 } 78 79 // Magic sysctl: "setting" 0.3 to a string name 80 // lets you read back the array of integers form. 81 if err = sysctl([]_C_int{0, 3}, p, &n, &bytes[0], uintptr(len(name))); err != nil { 82 return nil, err 83 } 84 return buf[0 : n/siz], nil 85 } 86 87 func direntIno(buf []byte) (uint64, bool) { 88 return readInt(buf, unsafe.Offsetof(Dirent{}.Fileno), unsafe.Sizeof(Dirent{}.Fileno)) 89 } 90 91 func direntReclen(buf []byte) (uint64, bool) { 92 return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen)) 93 } 94 95 func direntNamlen(buf []byte) (uint64, bool) { 96 return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen)) 97 } 98 99 func Pipe(p []int) (err error) { 100 return Pipe2(p, 0) 101 } 102 103 //sysnb pipe2(p *[2]_C_int, flags int) (err error) 104 105 func Pipe2(p []int, flags int) error { 106 if len(p) != 2 { 107 return EINVAL 108 } 109 var pp [2]_C_int 110 err := pipe2(&pp, flags) 111 p[0] = int(pp[0]) 112 p[1] = int(pp[1]) 113 return err 114 } 115 116 func GetsockoptIPMreqn(fd, level, opt int) (*IPMreqn, error) { 117 var value IPMreqn 118 vallen := _Socklen(SizeofIPMreqn) 119 errno := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen) 120 return &value, errno 121 } 122 123 func SetsockoptIPMreqn(fd, level, opt int, mreq *IPMreqn) (err error) { 124 return setsockopt(fd, level, opt, unsafe.Pointer(mreq), unsafe.Sizeof(*mreq)) 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 const ImplementsGetwd = true 146 147 //sys Getcwd(buf []byte) (n int, err error) = SYS___GETCWD 148 149 func Getwd() (string, error) { 150 var buf [PathMax]byte 151 _, err := Getcwd(buf[0:]) 152 if err != nil { 153 return "", err 154 } 155 n := clen(buf[:]) 156 if n < 1 { 157 return "", EINVAL 158 } 159 return string(buf[:n]), nil 160 } 161 162 func Getfsstat(buf []Statfs_t, flags int) (n int, err error) { 163 var ( 164 _p0 unsafe.Pointer 165 bufsize uintptr 166 oldBuf []statfs_freebsd11_t 167 needsConvert bool 168 ) 169 170 if len(buf) > 0 { 171 if supportsABI(_ino64First) { 172 _p0 = unsafe.Pointer(&buf[0]) 173 bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf)) 174 } else { 175 n := len(buf) 176 oldBuf = make([]statfs_freebsd11_t, n) 177 _p0 = unsafe.Pointer(&oldBuf[0]) 178 bufsize = unsafe.Sizeof(statfs_freebsd11_t{}) * uintptr(n) 179 needsConvert = true 180 } 181 } 182 var sysno uintptr = SYS_GETFSSTAT 183 if supportsABI(_ino64First) { 184 sysno = SYS_GETFSSTAT_FREEBSD12 185 } 186 r0, _, e1 := Syscall(sysno, uintptr(_p0), bufsize, uintptr(flags)) 187 n = int(r0) 188 if e1 != 0 { 189 err = e1 190 } 191 if e1 == 0 && needsConvert { 192 for i := range oldBuf { 193 buf[i].convertFrom(&oldBuf[i]) 194 } 195 } 196 return 197 } 198 199 func setattrlistTimes(path string, times []Timespec, flags int) error { 200 // used on Darwin for UtimesNano 201 return ENOSYS 202 } 203 204 //sys ioctl(fd int, req uint, arg uintptr) (err error) 205 206 func Uname(uname *Utsname) error { 207 mib := []_C_int{CTL_KERN, KERN_OSTYPE} 208 n := unsafe.Sizeof(uname.Sysname) 209 if err := sysctl(mib, &uname.Sysname[0], &n, nil, 0); err != nil { 210 return err 211 } 212 213 mib = []_C_int{CTL_KERN, KERN_HOSTNAME} 214 n = unsafe.Sizeof(uname.Nodename) 215 if err := sysctl(mib, &uname.Nodename[0], &n, nil, 0); err != nil { 216 return err 217 } 218 219 mib = []_C_int{CTL_KERN, KERN_OSRELEASE} 220 n = unsafe.Sizeof(uname.Release) 221 if err := sysctl(mib, &uname.Release[0], &n, nil, 0); err != nil { 222 return err 223 } 224 225 mib = []_C_int{CTL_KERN, KERN_VERSION} 226 n = unsafe.Sizeof(uname.Version) 227 if err := sysctl(mib, &uname.Version[0], &n, nil, 0); err != nil { 228 return err 229 } 230 231 // The version might have newlines or tabs in it, convert them to 232 // spaces. 233 for i, b := range uname.Version { 234 if b == '\n' || b == '\t' { 235 if i == len(uname.Version)-1 { 236 uname.Version[i] = 0 237 } else { 238 uname.Version[i] = ' ' 239 } 240 } 241 } 242 243 mib = []_C_int{CTL_HW, HW_MACHINE} 244 n = unsafe.Sizeof(uname.Machine) 245 if err := sysctl(mib, &uname.Machine[0], &n, nil, 0); err != nil { 246 return err 247 } 248 249 return nil 250 } 251 252 func Stat(path string, st *Stat_t) (err error) { 253 var oldStat stat_freebsd11_t 254 if supportsABI(_ino64First) { 255 return fstatat_freebsd12(AT_FDCWD, path, st, 0) 256 } 257 err = stat(path, &oldStat) 258 if err != nil { 259 return err 260 } 261 262 st.convertFrom(&oldStat) 263 return nil 264 } 265 266 func Lstat(path string, st *Stat_t) (err error) { 267 var oldStat stat_freebsd11_t 268 if supportsABI(_ino64First) { 269 return fstatat_freebsd12(AT_FDCWD, path, st, AT_SYMLINK_NOFOLLOW) 270 } 271 err = lstat(path, &oldStat) 272 if err != nil { 273 return err 274 } 275 276 st.convertFrom(&oldStat) 277 return nil 278 } 279 280 func Fstat(fd int, st *Stat_t) (err error) { 281 var oldStat stat_freebsd11_t 282 if supportsABI(_ino64First) { 283 return fstat_freebsd12(fd, st) 284 } 285 err = fstat(fd, &oldStat) 286 if err != nil { 287 return err 288 } 289 290 st.convertFrom(&oldStat) 291 return nil 292 } 293 294 func Fstatat(fd int, path string, st *Stat_t, flags int) (err error) { 295 var oldStat stat_freebsd11_t 296 if supportsABI(_ino64First) { 297 return fstatat_freebsd12(fd, path, st, flags) 298 } 299 err = fstatat(fd, path, &oldStat, flags) 300 if err != nil { 301 return err 302 } 303 304 st.convertFrom(&oldStat) 305 return nil 306 } 307 308 func Statfs(path string, st *Statfs_t) (err error) { 309 var oldStatfs statfs_freebsd11_t 310 if supportsABI(_ino64First) { 311 return statfs_freebsd12(path, st) 312 } 313 err = statfs(path, &oldStatfs) 314 if err != nil { 315 return err 316 } 317 318 st.convertFrom(&oldStatfs) 319 return nil 320 } 321 322 func Fstatfs(fd int, st *Statfs_t) (err error) { 323 var oldStatfs statfs_freebsd11_t 324 if supportsABI(_ino64First) { 325 return fstatfs_freebsd12(fd, st) 326 } 327 err = fstatfs(fd, &oldStatfs) 328 if err != nil { 329 return err 330 } 331 332 st.convertFrom(&oldStatfs) 333 return nil 334 } 335 336 func Getdents(fd int, buf []byte) (n int, err error) { 337 return Getdirentries(fd, buf, nil) 338 } 339 340 func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { 341 if supportsABI(_ino64First) { 342 if basep == nil || unsafe.Sizeof(*basep) == 8 { 343 return getdirentries_freebsd12(fd, buf, (*uint64)(unsafe.Pointer(basep))) 344 } 345 // The freebsd12 syscall needs a 64-bit base. On 32-bit machines 346 // we can't just use the basep passed in. See #32498. 347 var base uint64 = uint64(*basep) 348 n, err = getdirentries_freebsd12(fd, buf, &base) 349 *basep = uintptr(base) 350 if base>>32 != 0 { 351 // We can't stuff the base back into a uintptr, so any 352 // future calls would be suspect. Generate an error. 353 // EIO is allowed by getdirentries. 354 err = EIO 355 } 356 return 357 } 358 359 // The old syscall entries are smaller than the new. Use 1/4 of the original 360 // buffer size rounded up to DIRBLKSIZ (see /usr/src/lib/libc/sys/getdirentries.c). 361 oldBufLen := roundup(len(buf)/4, _dirblksiz) 362 oldBuf := make([]byte, oldBufLen) 363 n, err = getdirentries(fd, oldBuf, basep) 364 if err == nil && n > 0 { 365 n = convertFromDirents11(buf, oldBuf[:n]) 366 } 367 return 368 } 369 370 func Mknod(path string, mode uint32, dev uint64) (err error) { 371 var oldDev int 372 if supportsABI(_ino64First) { 373 return mknodat_freebsd12(AT_FDCWD, path, mode, dev) 374 } 375 oldDev = int(dev) 376 return mknod(path, mode, oldDev) 377 } 378 379 func Mknodat(fd int, path string, mode uint32, dev uint64) (err error) { 380 var oldDev int 381 if supportsABI(_ino64First) { 382 return mknodat_freebsd12(fd, path, mode, dev) 383 } 384 oldDev = int(dev) 385 return mknodat(fd, path, mode, oldDev) 386 } 387 388 // round x to the nearest multiple of y, larger or equal to x. 389 // 390 // from /usr/include/sys/param.h Macros for counting and rounding. 391 // #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) 392 func roundup(x, y int) int { 393 return ((x + y - 1) / y) * y 394 } 395 396 func (s *Stat_t) convertFrom(old *stat_freebsd11_t) { 397 *s = Stat_t{ 398 Dev: uint64(old.Dev), 399 Ino: uint64(old.Ino), 400 Nlink: uint64(old.Nlink), 401 Mode: old.Mode, 402 Uid: old.Uid, 403 Gid: old.Gid, 404 Rdev: uint64(old.Rdev), 405 Atim: old.Atim, 406 Mtim: old.Mtim, 407 Ctim: old.Ctim, 408 Btim: old.Btim, 409 Size: old.Size, 410 Blocks: old.Blocks, 411 Blksize: old.Blksize, 412 Flags: old.Flags, 413 Gen: uint64(old.Gen), 414 } 415 } 416 417 func (s *Statfs_t) convertFrom(old *statfs_freebsd11_t) { 418 *s = Statfs_t{ 419 Version: _statfsVersion, 420 Type: old.Type, 421 Flags: old.Flags, 422 Bsize: old.Bsize, 423 Iosize: old.Iosize, 424 Blocks: old.Blocks, 425 Bfree: old.Bfree, 426 Bavail: old.Bavail, 427 Files: old.Files, 428 Ffree: old.Ffree, 429 Syncwrites: old.Syncwrites, 430 Asyncwrites: old.Asyncwrites, 431 Syncreads: old.Syncreads, 432 Asyncreads: old.Asyncreads, 433 // Spare 434 Namemax: old.Namemax, 435 Owner: old.Owner, 436 Fsid: old.Fsid, 437 // Charspare 438 // Fstypename 439 // Mntfromname 440 // Mntonname 441 } 442 443 sl := old.Fstypename[:] 444 n := clen(*(*[]byte)(unsafe.Pointer(&sl))) 445 copy(s.Fstypename[:], old.Fstypename[:n]) 446 447 sl = old.Mntfromname[:] 448 n = clen(*(*[]byte)(unsafe.Pointer(&sl))) 449 copy(s.Mntfromname[:], old.Mntfromname[:n]) 450 451 sl = old.Mntonname[:] 452 n = clen(*(*[]byte)(unsafe.Pointer(&sl))) 453 copy(s.Mntonname[:], old.Mntonname[:n]) 454 } 455 456 func convertFromDirents11(buf []byte, old []byte) int { 457 const ( 458 fixedSize = int(unsafe.Offsetof(Dirent{}.Name)) 459 oldFixedSize = int(unsafe.Offsetof(dirent_freebsd11{}.Name)) 460 ) 461 462 dstPos := 0 463 srcPos := 0 464 for dstPos+fixedSize < len(buf) && srcPos+oldFixedSize < len(old) { 465 dstDirent := (*Dirent)(unsafe.Pointer(&buf[dstPos])) 466 srcDirent := (*dirent_freebsd11)(unsafe.Pointer(&old[srcPos])) 467 468 reclen := roundup(fixedSize+int(srcDirent.Namlen)+1, 8) 469 if dstPos+reclen > len(buf) { 470 break 471 } 472 473 dstDirent.Fileno = uint64(srcDirent.Fileno) 474 dstDirent.Off = 0 475 dstDirent.Reclen = uint16(reclen) 476 dstDirent.Type = srcDirent.Type 477 dstDirent.Pad0 = 0 478 dstDirent.Namlen = uint16(srcDirent.Namlen) 479 dstDirent.Pad1 = 0 480 481 copy(dstDirent.Name[:], srcDirent.Name[:srcDirent.Namlen]) 482 padding := buf[dstPos+fixedSize+int(dstDirent.Namlen) : dstPos+reclen] 483 for i := range padding { 484 padding[i] = 0 485 } 486 487 dstPos += int(dstDirent.Reclen) 488 srcPos += int(srcDirent.Reclen) 489 } 490 491 return dstPos 492 } 493 494 func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 495 if raceenabled { 496 raceReleaseMerge(unsafe.Pointer(&ioSync)) 497 } 498 return sendfile(outfd, infd, offset, count) 499 } 500 501 //sys ptrace(request int, pid int, addr uintptr, data int) (err error) 502 503 func PtraceAttach(pid int) (err error) { 504 return ptrace(PTRACE_ATTACH, pid, 0, 0) 505 } 506 507 func PtraceCont(pid int, signal int) (err error) { 508 return ptrace(PTRACE_CONT, pid, 1, signal) 509 } 510 511 func PtraceDetach(pid int) (err error) { 512 return ptrace(PTRACE_DETACH, pid, 1, 0) 513 } 514 515 func PtraceGetFpRegs(pid int, fpregsout *FpReg) (err error) { 516 return ptrace(PTRACE_GETFPREGS, pid, uintptr(unsafe.Pointer(fpregsout)), 0) 517 } 518 519 func PtraceGetFsBase(pid int, fsbase *int64) (err error) { 520 return ptrace(PTRACE_GETFSBASE, pid, uintptr(unsafe.Pointer(fsbase)), 0) 521 } 522 523 func PtraceGetRegs(pid int, regsout *Reg) (err error) { 524 return ptrace(PTRACE_GETREGS, pid, uintptr(unsafe.Pointer(regsout)), 0) 525 } 526 527 func PtraceIO(req int, pid int, addr uintptr, out []byte, countin int) (count int, err error) { 528 ioDesc := PtraceIoDesc{Op: int32(req), Offs: (*byte)(unsafe.Pointer(addr)), Addr: (*byte)(unsafe.Pointer(&out[0])), Len: uint(countin)} 529 err = ptrace(PTRACE_IO, pid, uintptr(unsafe.Pointer(&ioDesc)), 0) 530 return int(ioDesc.Len), err 531 } 532 533 func PtraceLwpEvents(pid int, enable int) (err error) { 534 return ptrace(PTRACE_LWPEVENTS, pid, 0, enable) 535 } 536 537 func PtraceLwpInfo(pid int, info uintptr) (err error) { 538 return ptrace(PTRACE_LWPINFO, pid, info, int(unsafe.Sizeof(PtraceLwpInfoStruct{}))) 539 } 540 541 func PtracePeekData(pid int, addr uintptr, out []byte) (count int, err error) { 542 return PtraceIO(PIOD_READ_D, pid, addr, out, SizeofLong) 543 } 544 545 func PtracePeekText(pid int, addr uintptr, out []byte) (count int, err error) { 546 return PtraceIO(PIOD_READ_I, pid, addr, out, SizeofLong) 547 } 548 549 func PtracePokeData(pid int, addr uintptr, data []byte) (count int, err error) { 550 return PtraceIO(PIOD_WRITE_D, pid, addr, data, SizeofLong) 551 } 552 553 func PtracePokeText(pid int, addr uintptr, data []byte) (count int, err error) { 554 return PtraceIO(PIOD_WRITE_I, pid, addr, data, SizeofLong) 555 } 556 557 func PtraceSetRegs(pid int, regs *Reg) (err error) { 558 return ptrace(PTRACE_SETREGS, pid, uintptr(unsafe.Pointer(regs)), 0) 559 } 560 561 func PtraceSingleStep(pid int) (err error) { 562 return ptrace(PTRACE_SINGLESTEP, pid, 1, 0) 563 } 564 565 /* 566 * Exposed directly 567 */ 568 //sys Access(path string, mode uint32) (err error) 569 //sys Adjtime(delta *Timeval, olddelta *Timeval) (err error) 570 //sys CapEnter() (err error) 571 //sys capRightsGet(version int, fd int, rightsp *CapRights) (err error) = SYS___CAP_RIGHTS_GET 572 //sys capRightsLimit(fd int, rightsp *CapRights) (err error) 573 //sys Chdir(path string) (err error) 574 //sys Chflags(path string, flags int) (err error) 575 //sys Chmod(path string, mode uint32) (err error) 576 //sys Chown(path string, uid int, gid int) (err error) 577 //sys Chroot(path string) (err error) 578 //sys Close(fd int) (err error) 579 //sys Dup(fd int) (nfd int, err error) 580 //sys Dup2(from int, to int) (err error) 581 //sys Exit(code int) 582 //sys ExtattrGetFd(fd int, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) 583 //sys ExtattrSetFd(fd int, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) 584 //sys ExtattrDeleteFd(fd int, attrnamespace int, attrname string) (err error) 585 //sys ExtattrListFd(fd int, attrnamespace int, data uintptr, nbytes int) (ret int, err error) 586 //sys ExtattrGetFile(file string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) 587 //sys ExtattrSetFile(file string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) 588 //sys ExtattrDeleteFile(file string, attrnamespace int, attrname string) (err error) 589 //sys ExtattrListFile(file string, attrnamespace int, data uintptr, nbytes int) (ret int, err error) 590 //sys ExtattrGetLink(link string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) 591 //sys ExtattrSetLink(link string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) 592 //sys ExtattrDeleteLink(link string, attrnamespace int, attrname string) (err error) 593 //sys ExtattrListLink(link string, attrnamespace int, data uintptr, nbytes int) (ret int, err error) 594 //sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_POSIX_FADVISE 595 //sys Faccessat(dirfd int, path string, mode uint32, flags int) (err error) 596 //sys Fchdir(fd int) (err error) 597 //sys Fchflags(fd int, flags int) (err error) 598 //sys Fchmod(fd int, mode uint32) (err error) 599 //sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) 600 //sys Fchown(fd int, uid int, gid int) (err error) 601 //sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) 602 //sys Flock(fd int, how int) (err error) 603 //sys Fpathconf(fd int, name int) (val int, err error) 604 //sys fstat(fd int, stat *stat_freebsd11_t) (err error) 605 //sys fstat_freebsd12(fd int, stat *Stat_t) (err error) 606 //sys fstatat(fd int, path string, stat *stat_freebsd11_t, flags int) (err error) 607 //sys fstatat_freebsd12(fd int, path string, stat *Stat_t, flags int) (err error) 608 //sys fstatfs(fd int, stat *statfs_freebsd11_t) (err error) 609 //sys fstatfs_freebsd12(fd int, stat *Statfs_t) (err error) 610 //sys Fsync(fd int) (err error) 611 //sys Ftruncate(fd int, length int64) (err error) 612 //sys getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) 613 //sys getdirentries_freebsd12(fd int, buf []byte, basep *uint64) (n int, err error) 614 //sys Getdtablesize() (size int) 615 //sysnb Getegid() (egid int) 616 //sysnb Geteuid() (uid int) 617 //sysnb Getgid() (gid int) 618 //sysnb Getpgid(pid int) (pgid int, err error) 619 //sysnb Getpgrp() (pgrp int) 620 //sysnb Getpid() (pid int) 621 //sysnb Getppid() (ppid int) 622 //sys Getpriority(which int, who int) (prio int, err error) 623 //sysnb Getrlimit(which int, lim *Rlimit) (err error) 624 //sysnb Getrusage(who int, rusage *Rusage) (err error) 625 //sysnb Getsid(pid int) (sid int, err error) 626 //sysnb Gettimeofday(tv *Timeval) (err error) 627 //sysnb Getuid() (uid int) 628 //sys Issetugid() (tainted bool) 629 //sys Kill(pid int, signum syscall.Signal) (err error) 630 //sys Kqueue() (fd int, err error) 631 //sys Lchown(path string, uid int, gid int) (err error) 632 //sys Link(path string, link string) (err error) 633 //sys Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) 634 //sys Listen(s int, backlog int) (err error) 635 //sys lstat(path string, stat *stat_freebsd11_t) (err error) 636 //sys Mkdir(path string, mode uint32) (err error) 637 //sys Mkdirat(dirfd int, path string, mode uint32) (err error) 638 //sys Mkfifo(path string, mode uint32) (err error) 639 //sys mknod(path string, mode uint32, dev int) (err error) 640 //sys mknodat(fd int, path string, mode uint32, dev int) (err error) 641 //sys mknodat_freebsd12(fd int, path string, mode uint32, dev uint64) (err error) 642 //sys Nanosleep(time *Timespec, leftover *Timespec) (err error) 643 //sys Open(path string, mode int, perm uint32) (fd int, err error) 644 //sys Openat(fdat int, path string, mode int, perm uint32) (fd int, err error) 645 //sys Pathconf(path string, name int) (val int, err error) 646 //sys Pread(fd int, p []byte, offset int64) (n int, err error) 647 //sys Pwrite(fd int, p []byte, offset int64) (n int, err error) 648 //sys read(fd int, p []byte) (n int, err error) 649 //sys Readlink(path string, buf []byte) (n int, err error) 650 //sys Readlinkat(dirfd int, path string, buf []byte) (n int, err error) 651 //sys Rename(from string, to string) (err error) 652 //sys Renameat(fromfd int, from string, tofd int, to string) (err error) 653 //sys Revoke(path string) (err error) 654 //sys Rmdir(path string) (err error) 655 //sys Seek(fd int, offset int64, whence int) (newoffset int64, err error) = SYS_LSEEK 656 //sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) 657 //sysnb Setegid(egid int) (err error) 658 //sysnb Seteuid(euid int) (err error) 659 //sysnb Setgid(gid int) (err error) 660 //sys Setlogin(name string) (err error) 661 //sysnb Setpgid(pid int, pgid int) (err error) 662 //sys Setpriority(which int, who int, prio int) (err error) 663 //sysnb Setregid(rgid int, egid int) (err error) 664 //sysnb Setreuid(ruid int, euid int) (err error) 665 //sysnb Setresgid(rgid int, egid int, sgid int) (err error) 666 //sysnb Setresuid(ruid int, euid int, suid int) (err error) 667 //sysnb Setrlimit(which int, lim *Rlimit) (err error) 668 //sysnb Setsid() (pid int, err error) 669 //sysnb Settimeofday(tp *Timeval) (err error) 670 //sysnb Setuid(uid int) (err error) 671 //sys stat(path string, stat *stat_freebsd11_t) (err error) 672 //sys statfs(path string, stat *statfs_freebsd11_t) (err error) 673 //sys statfs_freebsd12(path string, stat *Statfs_t) (err error) 674 //sys Symlink(path string, link string) (err error) 675 //sys Symlinkat(oldpath string, newdirfd int, newpath string) (err error) 676 //sys Sync() (err error) 677 //sys Truncate(path string, length int64) (err error) 678 //sys Umask(newmask int) (oldmask int) 679 //sys Undelete(path string) (err error) 680 //sys Unlink(path string) (err error) 681 //sys Unlinkat(dirfd int, path string, flags int) (err error) 682 //sys Unmount(path string, flags int) (err error) 683 //sys write(fd int, p []byte) (n int, err error) 684 //sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) 685 //sys munmap(addr uintptr, length uintptr) (err error) 686 //sys readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ 687 //sys writelen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_WRITE 688 //sys accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int, err error) 689 //sys utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) 690 691 /* 692 * Unimplemented 693 */ 694 // Profil 695 // Sigaction 696 // Sigprocmask 697 // Getlogin 698 // Sigpending 699 // Sigaltstack 700 // Ioctl 701 // Reboot 702 // Execve 703 // Vfork 704 // Sbrk 705 // Sstk 706 // Ovadvise 707 // Mincore 708 // Setitimer 709 // Swapon 710 // Select 711 // Sigsuspend 712 // Readv 713 // Writev 714 // Nfssvc 715 // Getfh 716 // Quotactl 717 // Mount 718 // Csops 719 // Waitid 720 // Add_profil 721 // Kdebug_trace 722 // Sigreturn 723 // Atsocket 724 // Kqueue_from_portset_np 725 // Kqueue_portset 726 // Getattrlist 727 // Setattrlist 728 // Getdents 729 // Getdirentriesattr 730 // Searchfs 731 // Delete 732 // Copyfile 733 // Watchevent 734 // Waitevent 735 // Modwatch 736 // Fsctl 737 // Initgroups 738 // Posix_spawn 739 // Nfsclnt 740 // Fhopen 741 // Minherit 742 // Semsys 743 // Msgsys 744 // Shmsys 745 // Semctl 746 // Semget 747 // Semop 748 // Msgctl 749 // Msgget 750 // Msgsnd 751 // Msgrcv 752 // Shmat 753 // Shmctl 754 // Shmdt 755 // Shmget 756 // Shm_open 757 // Shm_unlink 758 // Sem_open 759 // Sem_close 760 // Sem_unlink 761 // Sem_wait 762 // Sem_trywait 763 // Sem_post 764 // Sem_getvalue 765 // Sem_init 766 // Sem_destroy 767 // Open_extended 768 // Umask_extended 769 // Stat_extended 770 // Lstat_extended 771 // Fstat_extended 772 // Chmod_extended 773 // Fchmod_extended 774 // Access_extended 775 // Settid 776 // Gettid 777 // Setsgroups 778 // Getsgroups 779 // Setwgroups 780 // Getwgroups 781 // Mkfifo_extended 782 // Mkdir_extended 783 // Identitysvc 784 // Shared_region_check_np 785 // Shared_region_map_np 786 // __pthread_mutex_destroy 787 // __pthread_mutex_init 788 // __pthread_mutex_lock 789 // __pthread_mutex_trylock 790 // __pthread_mutex_unlock 791 // __pthread_cond_init 792 // __pthread_cond_destroy 793 // __pthread_cond_broadcast 794 // __pthread_cond_signal 795 // Setsid_with_pid 796 // __pthread_cond_timedwait 797 // Aio_fsync 798 // Aio_return 799 // Aio_suspend 800 // Aio_cancel 801 // Aio_error 802 // Aio_read 803 // Aio_write 804 // Lio_listio 805 // __pthread_cond_wait 806 // Iopolicysys 807 // __pthread_kill 808 // __pthread_sigmask 809 // __sigwait 810 // __disable_threadsignal 811 // __pthread_markcancel 812 // __pthread_canceled 813 // __semwait_signal 814 // Proc_info 815 // Stat64_extended 816 // Lstat64_extended 817 // Fstat64_extended 818 // __pthread_chdir 819 // __pthread_fchdir 820 // Audit 821 // Auditon 822 // Getauid 823 // Setauid 824 // Getaudit 825 // Setaudit 826 // Getaudit_addr 827 // Setaudit_addr 828 // Auditctl 829 // Bsdthread_create 830 // Bsdthread_terminate 831 // Stack_snapshot 832 // Bsdthread_register 833 // Workq_open 834 // Workq_ops 835 // __mac_execve 836 // __mac_syscall 837 // __mac_get_file 838 // __mac_set_file 839 // __mac_get_link 840 // __mac_set_link 841 // __mac_get_proc 842 // __mac_set_proc 843 // __mac_get_fd 844 // __mac_set_fd 845 // __mac_get_pid 846 // __mac_get_lcid 847 // __mac_get_lctx 848 // __mac_set_lctx 849 // Setlcid 850 // Read_nocancel 851 // Write_nocancel 852 // Open_nocancel 853 // Close_nocancel 854 // Wait4_nocancel 855 // Recvmsg_nocancel 856 // Sendmsg_nocancel 857 // Recvfrom_nocancel 858 // Accept_nocancel 859 // Fcntl_nocancel 860 // Select_nocancel 861 // Fsync_nocancel 862 // Connect_nocancel 863 // Sigsuspend_nocancel 864 // Readv_nocancel 865 // Writev_nocancel 866 // Sendto_nocancel 867 // Pread_nocancel 868 // Pwrite_nocancel 869 // Waitid_nocancel 870 // Poll_nocancel 871 // Msgsnd_nocancel 872 // Msgrcv_nocancel 873 // Sem_wait_nocancel 874 // Aio_suspend_nocancel 875 // __sigwait_nocancel 876 // __semwait_signal_nocancel 877 // __mac_mount 878 // __mac_get_mount 879 // __mac_getfsstat