aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/golang.org/x/sys/unix/syscall_darwin.go
diff options
context:
space:
mode:
authorLibravatar Rutger Broekhoff2023-12-29 21:31:53 +0100
committerLibravatar Rutger Broekhoff2023-12-29 21:31:53 +0100
commit404aeae4545d2426c089a5f8d5e82dae56f5212b (patch)
tree2d84e00af272b39fc04f3795ae06bc48970e57b5 /vendor/golang.org/x/sys/unix/syscall_darwin.go
parent209d8b0187ed025dec9ac149ebcced3462877bff (diff)
downloadgitolfs3-404aeae4545d2426c089a5f8d5e82dae56f5212b.tar.gz
gitolfs3-404aeae4545d2426c089a5f8d5e82dae56f5212b.zip
Make Nix builds work
Diffstat (limited to 'vendor/golang.org/x/sys/unix/syscall_darwin.go')
-rw-r--r--vendor/golang.org/x/sys/unix/syscall_darwin.go646
1 files changed, 646 insertions, 0 deletions
diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin.go b/vendor/golang.org/x/sys/unix/syscall_darwin.go
new file mode 100644
index 0000000..59542a8
--- /dev/null
+++ b/vendor/golang.org/x/sys/unix/syscall_darwin.go
@@ -0,0 +1,646 @@
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
13package unix
14
15import (
16 "fmt"
17 "syscall"
18 "unsafe"
19)
20
21//sys closedir(dir uintptr) (err error)
22//sys readdir_r(dir uintptr, entry *Dirent, result **Dirent) (res Errno)
23
24func fdopendir(fd int) (dir uintptr, err error) {
25 r0, _, e1 := syscall_syscallPtr(libc_fdopendir_trampoline_addr, uintptr(fd), 0, 0)
26 dir = uintptr(r0)
27 if e1 != 0 {
28 err = errnoErr(e1)
29 }
30 return
31}
32
33var libc_fdopendir_trampoline_addr uintptr
34
35//go:cgo_import_dynamic libc_fdopendir fdopendir "/usr/lib/libSystem.B.dylib"
36
37func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
38 // Simulate Getdirentries using fdopendir/readdir_r/closedir.
39 // We store the number of entries to skip in the seek
40 // offset of fd. See issue #31368.
41 // It's not the full required semantics, but should handle the case
42 // of calling Getdirentries or ReadDirent repeatedly.
43 // It won't handle assigning the results of lseek to *basep, or handle
44 // the directory being edited underfoot.
45 skip, err := Seek(fd, 0, 1 /* SEEK_CUR */)
46 if err != nil {
47 return 0, err
48 }
49
50 // We need to duplicate the incoming file descriptor
51 // because the caller expects to retain control of it, but
52 // fdopendir expects to take control of its argument.
53 // Just Dup'ing the file descriptor is not enough, as the
54 // result shares underlying state. Use Openat to make a really
55 // new file descriptor referring to the same directory.
56 fd2, err := Openat(fd, ".", O_RDONLY, 0)
57 if err != nil {
58 return 0, err
59 }
60 d, err := fdopendir(fd2)
61 if err != nil {
62 Close(fd2)
63 return 0, err
64 }
65 defer closedir(d)
66
67 var cnt int64
68 for {
69 var entry Dirent
70 var entryp *Dirent
71 e := readdir_r(d, &entry, &entryp)
72 if e != 0 {
73 return n, errnoErr(e)
74 }
75 if entryp == nil {
76 break
77 }
78 if skip > 0 {
79 skip--
80 cnt++
81 continue
82 }
83
84 reclen := int(entry.Reclen)
85 if reclen > len(buf) {
86 // Not enough room. Return for now.
87 // The counter will let us know where we should start up again.
88 // Note: this strategy for suspending in the middle and
89 // restarting is O(n^2) in the length of the directory. Oh well.
90 break
91 }
92
93 // Copy entry into return buffer.
94 s := unsafe.Slice((*byte)(unsafe.Pointer(&entry)), reclen)
95 copy(buf, s)
96
97 buf = buf[reclen:]
98 n += reclen
99 cnt++
100 }
101 // Set the seek offset of the input fd to record
102 // how many files we've already returned.
103 _, err = Seek(fd, cnt, 0 /* SEEK_SET */)
104 if err != nil {
105 return n, err
106 }
107
108 return n, nil
109}
110
111// SockaddrDatalink implements the Sockaddr interface for AF_LINK type sockets.
112type SockaddrDatalink struct {
113 Len uint8
114 Family uint8
115 Index uint16
116 Type uint8
117 Nlen uint8
118 Alen uint8
119 Slen uint8
120 Data [12]int8
121 raw RawSockaddrDatalink
122}
123
124// SockaddrCtl implements the Sockaddr interface for AF_SYSTEM type sockets.
125type SockaddrCtl struct {
126 ID uint32
127 Unit uint32
128 raw RawSockaddrCtl
129}
130
131func (sa *SockaddrCtl) sockaddr() (unsafe.Pointer, _Socklen, error) {
132 sa.raw.Sc_len = SizeofSockaddrCtl
133 sa.raw.Sc_family = AF_SYSTEM
134 sa.raw.Ss_sysaddr = AF_SYS_CONTROL
135 sa.raw.Sc_id = sa.ID
136 sa.raw.Sc_unit = sa.Unit
137 return unsafe.Pointer(&sa.raw), SizeofSockaddrCtl, nil
138}
139
140// SockaddrVM implements the Sockaddr interface for AF_VSOCK type sockets.
141// SockaddrVM provides access to Darwin VM sockets: a mechanism that enables
142// bidirectional communication between a hypervisor and its guest virtual
143// machines.
144type SockaddrVM struct {
145 // CID and Port specify a context ID and port address for a VM socket.
146 // Guests have a unique CID, and hosts may have a well-known CID of:
147 // - VMADDR_CID_HYPERVISOR: refers to the hypervisor process.
148 // - VMADDR_CID_LOCAL: refers to local communication (loopback).
149 // - VMADDR_CID_HOST: refers to other processes on the host.
150 CID uint32
151 Port uint32
152 raw RawSockaddrVM
153}
154
155func (sa *SockaddrVM) sockaddr() (unsafe.Pointer, _Socklen, error) {
156 sa.raw.Len = SizeofSockaddrVM
157 sa.raw.Family = AF_VSOCK
158 sa.raw.Port = sa.Port
159 sa.raw.Cid = sa.CID
160
161 return unsafe.Pointer(&sa.raw), SizeofSockaddrVM, nil
162}
163
164func anyToSockaddrGOOS(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
165 switch rsa.Addr.Family {
166 case AF_SYSTEM:
167 pp := (*RawSockaddrCtl)(unsafe.Pointer(rsa))
168 if pp.Ss_sysaddr == AF_SYS_CONTROL {
169 sa := new(SockaddrCtl)
170 sa.ID = pp.Sc_id
171 sa.Unit = pp.Sc_unit
172 return sa, nil
173 }
174 case AF_VSOCK:
175 pp := (*RawSockaddrVM)(unsafe.Pointer(rsa))
176 sa := &SockaddrVM{
177 CID: pp.Cid,
178 Port: pp.Port,
179 }
180 return sa, nil
181 }
182 return nil, EAFNOSUPPORT
183}
184
185// Some external packages rely on SYS___SYSCTL being defined to implement their
186// own sysctl wrappers. Provide it here, even though direct syscalls are no
187// longer supported on darwin.
188const SYS___SYSCTL = SYS_SYSCTL
189
190// Translate "kern.hostname" to []_C_int{0,1,2,3}.
191func nametomib(name string) (mib []_C_int, err error) {
192 const siz = unsafe.Sizeof(mib[0])
193
194 // NOTE(rsc): It seems strange to set the buffer to have
195 // size CTL_MAXNAME+2 but use only CTL_MAXNAME
196 // as the size. I don't know why the +2 is here, but the
197 // kernel uses +2 for its own implementation of this function.
198 // I am scared that if we don't include the +2 here, the kernel
199 // will silently write 2 words farther than we specify
200 // and we'll get memory corruption.
201 var buf [CTL_MAXNAME + 2]_C_int
202 n := uintptr(CTL_MAXNAME) * siz
203
204 p := (*byte)(unsafe.Pointer(&buf[0]))
205 bytes, err := ByteSliceFromString(name)
206 if err != nil {
207 return nil, err
208 }
209
210 // Magic sysctl: "setting" 0.3 to a string name
211 // lets you read back the array of integers form.
212 if err = sysctl([]_C_int{0, 3}, p, &n, &bytes[0], uintptr(len(name))); err != nil {
213 return nil, err
214 }
215 return buf[0 : n/siz], nil
216}
217
218func direntIno(buf []byte) (uint64, bool) {
219 return readInt(buf, unsafe.Offsetof(Dirent{}.Ino), unsafe.Sizeof(Dirent{}.Ino))
220}
221
222func direntReclen(buf []byte) (uint64, bool) {
223 return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen))
224}
225
226func direntNamlen(buf []byte) (uint64, bool) {
227 return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen))
228}
229
230func PtraceAttach(pid int) (err error) { return ptrace(PT_ATTACH, pid, 0, 0) }
231func PtraceDetach(pid int) (err error) { return ptrace(PT_DETACH, pid, 0, 0) }
232func PtraceDenyAttach() (err error) { return ptrace(PT_DENY_ATTACH, 0, 0, 0) }
233
234//sysnb pipe(p *[2]int32) (err error)
235
236func Pipe(p []int) (err error) {
237 if len(p) != 2 {
238 return EINVAL
239 }
240 var x [2]int32
241 err = pipe(&x)
242 if err == nil {
243 p[0] = int(x[0])
244 p[1] = int(x[1])
245 }
246 return
247}
248
249func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
250 var _p0 unsafe.Pointer
251 var bufsize uintptr
252 if len(buf) > 0 {
253 _p0 = unsafe.Pointer(&buf[0])
254 bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf))
255 }
256 return getfsstat(_p0, bufsize, flags)
257}
258
259func xattrPointer(dest []byte) *byte {
260 // It's only when dest is set to NULL that the OS X implementations of
261 // getxattr() and listxattr() return the current sizes of the named attributes.
262 // An empty byte array is not sufficient. To maintain the same behaviour as the
263 // linux implementation, we wrap around the system calls and pass in NULL when
264 // dest is empty.
265 var destp *byte
266 if len(dest) > 0 {
267 destp = &dest[0]
268 }
269 return destp
270}
271
272//sys getxattr(path string, attr string, dest *byte, size int, position uint32, options int) (sz int, err error)
273
274func Getxattr(path string, attr string, dest []byte) (sz int, err error) {
275 return getxattr(path, attr, xattrPointer(dest), len(dest), 0, 0)
276}
277
278func Lgetxattr(link string, attr string, dest []byte) (sz int, err error) {
279 return getxattr(link, attr, xattrPointer(dest), len(dest), 0, XATTR_NOFOLLOW)
280}
281
282//sys fgetxattr(fd int, attr string, dest *byte, size int, position uint32, options int) (sz int, err error)
283
284func Fgetxattr(fd int, attr string, dest []byte) (sz int, err error) {
285 return fgetxattr(fd, attr, xattrPointer(dest), len(dest), 0, 0)
286}
287
288//sys setxattr(path string, attr string, data *byte, size int, position uint32, options int) (err error)
289
290func Setxattr(path string, attr string, data []byte, flags int) (err error) {
291 // The parameters for the OS X implementation vary slightly compared to the
292 // linux system call, specifically the position parameter:
293 //
294 // linux:
295 // int setxattr(
296 // const char *path,
297 // const char *name,
298 // const void *value,
299 // size_t size,
300 // int flags
301 // );
302 //
303 // darwin:
304 // int setxattr(
305 // const char *path,
306 // const char *name,
307 // void *value,
308 // size_t size,
309 // u_int32_t position,
310 // int options
311 // );
312 //
313 // position specifies the offset within the extended attribute. In the
314 // current implementation, only the resource fork extended attribute makes
315 // use of this argument. For all others, position is reserved. We simply
316 // default to setting it to zero.
317 return setxattr(path, attr, xattrPointer(data), len(data), 0, flags)
318}
319
320func Lsetxattr(link string, attr string, data []byte, flags int) (err error) {
321 return setxattr(link, attr, xattrPointer(data), len(data), 0, flags|XATTR_NOFOLLOW)
322}
323
324//sys fsetxattr(fd int, attr string, data *byte, size int, position uint32, options int) (err error)
325
326func Fsetxattr(fd int, attr string, data []byte, flags int) (err error) {
327 return fsetxattr(fd, attr, xattrPointer(data), len(data), 0, 0)
328}
329
330//sys removexattr(path string, attr string, options int) (err error)
331
332func Removexattr(path string, attr string) (err error) {
333 // We wrap around and explicitly zero out the options provided to the OS X
334 // implementation of removexattr, we do so for interoperability with the
335 // linux variant.
336 return removexattr(path, attr, 0)
337}
338
339func Lremovexattr(link string, attr string) (err error) {
340 return removexattr(link, attr, XATTR_NOFOLLOW)
341}
342
343//sys fremovexattr(fd int, attr string, options int) (err error)
344
345func Fremovexattr(fd int, attr string) (err error) {
346 return fremovexattr(fd, attr, 0)
347}
348
349//sys listxattr(path string, dest *byte, size int, options int) (sz int, err error)
350
351func Listxattr(path string, dest []byte) (sz int, err error) {
352 return listxattr(path, xattrPointer(dest), len(dest), 0)
353}
354
355func Llistxattr(link string, dest []byte) (sz int, err error) {
356 return listxattr(link, xattrPointer(dest), len(dest), XATTR_NOFOLLOW)
357}
358
359//sys flistxattr(fd int, dest *byte, size int, options int) (sz int, err error)
360
361func Flistxattr(fd int, dest []byte) (sz int, err error) {
362 return flistxattr(fd, xattrPointer(dest), len(dest), 0)
363}
364
365//sys utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error)
366
367/*
368 * Wrapped
369 */
370
371//sys fcntl(fd int, cmd int, arg int) (val int, err error)
372
373//sys kill(pid int, signum int, posix int) (err error)
374
375func Kill(pid int, signum syscall.Signal) (err error) { return kill(pid, int(signum), 1) }
376
377//sys ioctl(fd int, req uint, arg uintptr) (err error)
378//sys ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) = SYS_IOCTL
379
380func IoctlCtlInfo(fd int, ctlInfo *CtlInfo) error {
381 return ioctlPtr(fd, CTLIOCGINFO, unsafe.Pointer(ctlInfo))
382}
383
384// IfreqMTU is struct ifreq used to get or set a network device's MTU.
385type IfreqMTU struct {
386 Name [IFNAMSIZ]byte
387 MTU int32
388}
389
390// IoctlGetIfreqMTU performs the SIOCGIFMTU ioctl operation on fd to get the MTU
391// of the network device specified by ifname.
392func IoctlGetIfreqMTU(fd int, ifname string) (*IfreqMTU, error) {
393 var ifreq IfreqMTU
394 copy(ifreq.Name[:], ifname)
395 err := ioctlPtr(fd, SIOCGIFMTU, unsafe.Pointer(&ifreq))
396 return &ifreq, err
397}
398
399// IoctlSetIfreqMTU performs the SIOCSIFMTU ioctl operation on fd to set the MTU
400// of the network device specified by ifreq.Name.
401func IoctlSetIfreqMTU(fd int, ifreq *IfreqMTU) error {
402 return ioctlPtr(fd, SIOCSIFMTU, unsafe.Pointer(ifreq))
403}
404
405//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS_SYSCTL
406
407func Uname(uname *Utsname) error {
408 mib := []_C_int{CTL_KERN, KERN_OSTYPE}
409 n := unsafe.Sizeof(uname.Sysname)
410 if err := sysctl(mib, &uname.Sysname[0], &n, nil, 0); err != nil {
411 return err
412 }
413
414 mib = []_C_int{CTL_KERN, KERN_HOSTNAME}
415 n = unsafe.Sizeof(uname.Nodename)
416 if err := sysctl(mib, &uname.Nodename[0], &n, nil, 0); err != nil {
417 return err
418 }
419
420 mib = []_C_int{CTL_KERN, KERN_OSRELEASE}
421 n = unsafe.Sizeof(uname.Release)
422 if err := sysctl(mib, &uname.Release[0], &n, nil, 0); err != nil {
423 return err
424 }
425
426 mib = []_C_int{CTL_KERN, KERN_VERSION}
427 n = unsafe.Sizeof(uname.Version)
428 if err := sysctl(mib, &uname.Version[0], &n, nil, 0); err != nil {
429 return err
430 }
431
432 // The version might have newlines or tabs in it, convert them to
433 // spaces.
434 for i, b := range uname.Version {
435 if b == '\n' || b == '\t' {
436 if i == len(uname.Version)-1 {
437 uname.Version[i] = 0
438 } else {
439 uname.Version[i] = ' '
440 }
441 }
442 }
443
444 mib = []_C_int{CTL_HW, HW_MACHINE}
445 n = unsafe.Sizeof(uname.Machine)
446 if err := sysctl(mib, &uname.Machine[0], &n, nil, 0); err != nil {
447 return err
448 }
449
450 return nil
451}
452
453func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
454 if raceenabled {
455 raceReleaseMerge(unsafe.Pointer(&ioSync))
456 }
457 var length = int64(count)
458 err = sendfile(infd, outfd, *offset, &length, nil, 0)
459 written = int(length)
460 return
461}
462
463func GetsockoptIPMreqn(fd, level, opt int) (*IPMreqn, error) {
464 var value IPMreqn
465 vallen := _Socklen(SizeofIPMreqn)
466 errno := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen)
467 return &value, errno
468}
469
470func SetsockoptIPMreqn(fd, level, opt int, mreq *IPMreqn) (err error) {
471 return setsockopt(fd, level, opt, unsafe.Pointer(mreq), unsafe.Sizeof(*mreq))
472}
473
474// GetsockoptXucred is a getsockopt wrapper that returns an Xucred struct.
475// The usual level and opt are SOL_LOCAL and LOCAL_PEERCRED, respectively.
476func GetsockoptXucred(fd, level, opt int) (*Xucred, error) {
477 x := new(Xucred)
478 vallen := _Socklen(SizeofXucred)
479 err := getsockopt(fd, level, opt, unsafe.Pointer(x), &vallen)
480 return x, err
481}
482
483func GetsockoptTCPConnectionInfo(fd, level, opt int) (*TCPConnectionInfo, error) {
484 var value TCPConnectionInfo
485 vallen := _Socklen(SizeofTCPConnectionInfo)
486 err := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen)
487 return &value, err
488}
489
490func SysctlKinfoProc(name string, args ...int) (*KinfoProc, error) {
491 mib, err := sysctlmib(name, args...)
492 if err != nil {
493 return nil, err
494 }
495
496 var kinfo KinfoProc
497 n := uintptr(SizeofKinfoProc)
498 if err := sysctl(mib, (*byte)(unsafe.Pointer(&kinfo)), &n, nil, 0); err != nil {
499 return nil, err
500 }
501 if n != SizeofKinfoProc {
502 return nil, EIO
503 }
504 return &kinfo, nil
505}
506
507func SysctlKinfoProcSlice(name string, args ...int) ([]KinfoProc, error) {
508 mib, err := sysctlmib(name, args...)
509 if err != nil {
510 return nil, err
511 }
512
513 for {
514 // Find size.
515 n := uintptr(0)
516 if err := sysctl(mib, nil, &n, nil, 0); err != nil {
517 return nil, err
518 }
519 if n == 0 {
520 return nil, nil
521 }
522 if n%SizeofKinfoProc != 0 {
523 return nil, fmt.Errorf("sysctl() returned a size of %d, which is not a multiple of %d", n, SizeofKinfoProc)
524 }
525
526 // Read into buffer of that size.
527 buf := make([]KinfoProc, n/SizeofKinfoProc)
528 if err := sysctl(mib, (*byte)(unsafe.Pointer(&buf[0])), &n, nil, 0); err != nil {
529 if err == ENOMEM {
530 // Process table grew. Try again.
531 continue
532 }
533 return nil, err
534 }
535 if n%SizeofKinfoProc != 0 {
536 return nil, fmt.Errorf("sysctl() returned a size of %d, which is not a multiple of %d", n, SizeofKinfoProc)
537 }
538
539 // The actual call may return less than the original reported required
540 // size so ensure we deal with that.
541 return buf[:n/SizeofKinfoProc], nil
542 }
543}
544
545//sys sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error)
546
547//sys shmat(id int, addr uintptr, flag int) (ret uintptr, err error)
548//sys shmctl(id int, cmd int, buf *SysvShmDesc) (result int, err error)
549//sys shmdt(addr uintptr) (err error)
550//sys shmget(key int, size int, flag int) (id int, err error)
551
552/*
553 * Exposed directly
554 */
555//sys Access(path string, mode uint32) (err error)
556//sys Adjtime(delta *Timeval, olddelta *Timeval) (err error)
557//sys Chdir(path string) (err error)
558//sys Chflags(path string, flags int) (err error)
559//sys Chmod(path string, mode uint32) (err error)
560//sys Chown(path string, uid int, gid int) (err error)
561//sys Chroot(path string) (err error)
562//sys ClockGettime(clockid int32, time *Timespec) (err error)
563//sys Close(fd int) (err error)
564//sys Clonefile(src string, dst string, flags int) (err error)
565//sys Clonefileat(srcDirfd int, src string, dstDirfd int, dst string, flags int) (err error)
566//sys Dup(fd int) (nfd int, err error)
567//sys Dup2(from int, to int) (err error)
568//sys Exchangedata(path1 string, path2 string, options int) (err error)
569//sys Exit(code int)
570//sys Faccessat(dirfd int, path string, mode uint32, flags int) (err error)
571//sys Fchdir(fd int) (err error)
572//sys Fchflags(fd int, flags int) (err error)
573//sys Fchmod(fd int, mode uint32) (err error)
574//sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error)
575//sys Fchown(fd int, uid int, gid int) (err error)
576//sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error)
577//sys Fclonefileat(srcDirfd int, dstDirfd int, dst string, flags int) (err error)
578//sys Flock(fd int, how int) (err error)
579//sys Fpathconf(fd int, name int) (val int, err error)
580//sys Fsync(fd int) (err error)
581//sys Ftruncate(fd int, length int64) (err error)
582//sys Getcwd(buf []byte) (n int, err error)
583//sys Getdtablesize() (size int)
584//sysnb Getegid() (egid int)
585//sysnb Geteuid() (uid int)
586//sysnb Getgid() (gid int)
587//sysnb Getpgid(pid int) (pgid int, err error)
588//sysnb Getpgrp() (pgrp int)
589//sysnb Getpid() (pid int)
590//sysnb Getppid() (ppid int)
591//sys Getpriority(which int, who int) (prio int, err error)
592//sysnb Getrlimit(which int, lim *Rlimit) (err error)
593//sysnb Getrusage(who int, rusage *Rusage) (err error)
594//sysnb Getsid(pid int) (sid int, err error)
595//sysnb Gettimeofday(tp *Timeval) (err error)
596//sysnb Getuid() (uid int)
597//sysnb Issetugid() (tainted bool)
598//sys Kqueue() (fd int, err error)
599//sys Lchown(path string, uid int, gid int) (err error)
600//sys Link(path string, link string) (err error)
601//sys Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error)
602//sys Listen(s int, backlog int) (err error)
603//sys Mkdir(path string, mode uint32) (err error)
604//sys Mkdirat(dirfd int, path string, mode uint32) (err error)
605//sys Mkfifo(path string, mode uint32) (err error)
606//sys Mknod(path string, mode uint32, dev int) (err error)
607//sys Mount(fsType string, dir string, flags int, data unsafe.Pointer) (err error)
608//sys Open(path string, mode int, perm uint32) (fd int, err error)
609//sys Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error)
610//sys Pathconf(path string, name int) (val int, err error)
611//sys pread(fd int, p []byte, offset int64) (n int, err error)
612//sys pwrite(fd int, p []byte, offset int64) (n int, err error)
613//sys read(fd int, p []byte) (n int, err error)
614//sys Readlink(path string, buf []byte) (n int, err error)
615//sys Readlinkat(dirfd int, path string, buf []byte) (n int, err error)
616//sys Rename(from string, to string) (err error)
617//sys Renameat(fromfd int, from string, tofd int, to string) (err error)
618//sys Revoke(path string) (err error)
619//sys Rmdir(path string) (err error)
620//sys Seek(fd int, offset int64, whence int) (newoffset int64, err error) = SYS_LSEEK
621//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error)
622//sys Setattrlist(path string, attrlist *Attrlist, attrBuf []byte, options int) (err error)
623//sys Setegid(egid int) (err error)
624//sysnb Seteuid(euid int) (err error)
625//sysnb Setgid(gid int) (err error)
626//sys Setlogin(name string) (err error)
627//sysnb Setpgid(pid int, pgid int) (err error)
628//sys Setpriority(which int, who int, prio int) (err error)
629//sys Setprivexec(flag int) (err error)
630//sysnb Setregid(rgid int, egid int) (err error)
631//sysnb Setreuid(ruid int, euid int) (err error)
632//sysnb Setsid() (pid int, err error)
633//sysnb Settimeofday(tp *Timeval) (err error)
634//sysnb Setuid(uid int) (err error)
635//sys Symlink(path string, link string) (err error)
636//sys Symlinkat(oldpath string, newdirfd int, newpath string) (err error)
637//sys Sync() (err error)
638//sys Truncate(path string, length int64) (err error)
639//sys Umask(newmask int) (oldmask int)
640//sys Undelete(path string) (err error)
641//sys Unlink(path string) (err error)
642//sys Unlinkat(dirfd int, path string, flags int) (err error)
643//sys Unmount(path string, flags int) (err error)
644//sys write(fd int, p []byte) (n int, err error)
645//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error)
646//sys munmap(addr uintptr, length uintptr) (err error)