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