Source file src/syscall/syscall_freebsd.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  // 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 syscall
    14  
    15  import (
    16  	"sync"
    17  	"unsafe"
    18  )
    19  
    20  func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno)
    21  func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno)
    22  func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno)
    23  func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno)
    24  
    25  const (
    26  	_SYS_FSTAT_FREEBSD12         = 551 // { int fstat(int fd, _Out_ struct stat *sb); }
    27  	_SYS_FSTATAT_FREEBSD12       = 552 // { int fstatat(int fd, _In_z_ char *path, _Out_ struct stat *buf, int flag); }
    28  	_SYS_GETDIRENTRIES_FREEBSD12 = 554 // { ssize_t getdirentries(int fd, _Out_writes_bytes_(count) char *buf, size_t count, _Out_ off_t *basep); }
    29  	_SYS_STATFS_FREEBSD12        = 555 // { int statfs(_In_z_ char *path, _Out_ struct statfs *buf); }
    30  	_SYS_FSTATFS_FREEBSD12       = 556 // { int fstatfs(int fd, _Out_ struct statfs *buf); }
    31  	_SYS_GETFSSTAT_FREEBSD12     = 557 // { int getfsstat(_Out_writes_bytes_opt_(bufsize) struct statfs *buf, long bufsize, int mode); }
    32  	_SYS_MKNODAT_FREEBSD12       = 559 // { int mknodat(int fd, _In_z_ char *path, mode_t mode, dev_t dev); }
    33  )
    34  
    35  // See https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/versions.html.
    36  var (
    37  	osreldateOnce sync.Once
    38  	osreldate     uint32
    39  )
    40  
    41  // INO64_FIRST from /usr/src/lib/libc/sys/compat-ino64.h
    42  const _ino64First = 1200031
    43  
    44  func supportsABI(ver uint32) bool {
    45  	osreldateOnce.Do(func() { osreldate, _ = SysctlUint32("kern.osreldate") })
    46  	return osreldate >= ver
    47  }
    48  
    49  type SockaddrDatalink struct {
    50  	Len    uint8
    51  	Family uint8
    52  	Index  uint16
    53  	Type   uint8
    54  	Nlen   uint8
    55  	Alen   uint8
    56  	Slen   uint8
    57  	Data   [46]int8
    58  	raw    RawSockaddrDatalink
    59  }
    60  
    61  // Translate "kern.hostname" to []_C_int{0,1,2,3}.
    62  func nametomib(name string) (mib []_C_int, err error) {
    63  	const siz = unsafe.Sizeof(mib[0])
    64  
    65  	// NOTE(rsc): It seems strange to set the buffer to have
    66  	// size CTL_MAXNAME+2 but use only CTL_MAXNAME
    67  	// as the size. I don't know why the +2 is here, but the
    68  	// kernel uses +2 for its own implementation of this function.
    69  	// I am scared that if we don't include the +2 here, the kernel
    70  	// will silently write 2 words farther than we specify
    71  	// and we'll get memory corruption.
    72  	var buf [CTL_MAXNAME + 2]_C_int
    73  	n := uintptr(CTL_MAXNAME) * siz
    74  
    75  	p := (*byte)(unsafe.Pointer(&buf[0]))
    76  	bytes, err := ByteSliceFromString(name)
    77  	if err != nil {
    78  		return nil, err
    79  	}
    80  
    81  	// Magic sysctl: "setting" 0.3 to a string name
    82  	// lets you read back the array of integers form.
    83  	if err = sysctl([]_C_int{0, 3}, p, &n, &bytes[0], uintptr(len(name))); err != nil {
    84  		return nil, err
    85  	}
    86  	return buf[0 : n/siz], nil
    87  }
    88  
    89  func direntIno(buf []byte) (uint64, bool) {
    90  	return readInt(buf, unsafe.Offsetof(Dirent{}.Fileno), unsafe.Sizeof(Dirent{}.Fileno))
    91  }
    92  
    93  func direntReclen(buf []byte) (uint64, bool) {
    94  	return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen))
    95  }
    96  
    97  func direntNamlen(buf []byte) (uint64, bool) {
    98  	return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen))
    99  }
   100  
   101  func Pipe(p []int) error {
   102  	return Pipe2(p, 0)
   103  }
   104  
   105  //sysnb pipe2(p *[2]_C_int, flags int) (err error)
   106  
   107  func Pipe2(p []int, flags int) error {
   108  	if len(p) != 2 {
   109  		return EINVAL
   110  	}
   111  	var pp [2]_C_int
   112  	err := pipe2(&pp, flags)
   113  	if err == nil {
   114  		p[0] = int(pp[0])
   115  		p[1] = int(pp[1])
   116  	}
   117  	return err
   118  }
   119  
   120  func GetsockoptIPMreqn(fd, level, opt int) (*IPMreqn, error) {
   121  	var value IPMreqn
   122  	vallen := _Socklen(SizeofIPMreqn)
   123  	errno := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen)
   124  	return &value, errno
   125  }
   126  
   127  func SetsockoptIPMreqn(fd, level, opt int, mreq *IPMreqn) (err error) {
   128  	return setsockopt(fd, level, opt, unsafe.Pointer(mreq), unsafe.Sizeof(*mreq))
   129  }
   130  
   131  func Accept4(fd, flags int) (nfd int, sa Sockaddr, err error) {
   132  	var rsa RawSockaddrAny
   133  	var len _Socklen = SizeofSockaddrAny
   134  	nfd, err = accept4(fd, &rsa, &len, flags)
   135  	if err != nil {
   136  		return
   137  	}
   138  	if len > SizeofSockaddrAny {
   139  		panic("RawSockaddrAny too small")
   140  	}
   141  	sa, err = anyToSockaddr(&rsa)
   142  	if err != nil {
   143  		Close(nfd)
   144  		nfd = 0
   145  	}
   146  	return
   147  }
   148  
   149  func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
   150  	var (
   151  		_p0          unsafe.Pointer
   152  		bufsize      uintptr
   153  		oldBuf       []statfs_freebsd11_t
   154  		needsConvert bool
   155  	)
   156  
   157  	if len(buf) > 0 {
   158  		if supportsABI(_ino64First) {
   159  			_p0 = unsafe.Pointer(&buf[0])
   160  			bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf))
   161  		} else {
   162  			n := len(buf)
   163  			oldBuf = make([]statfs_freebsd11_t, n)
   164  			_p0 = unsafe.Pointer(&oldBuf[0])
   165  			bufsize = unsafe.Sizeof(statfs_freebsd11_t{}) * uintptr(n)
   166  			needsConvert = true
   167  		}
   168  	}
   169  	var sysno uintptr = SYS_GETFSSTAT
   170  	if supportsABI(_ino64First) {
   171  		sysno = _SYS_GETFSSTAT_FREEBSD12
   172  	}
   173  	r0, _, e1 := Syscall(sysno, uintptr(_p0), bufsize, uintptr(flags))
   174  	n = int(r0)
   175  	if e1 != 0 {
   176  		err = e1
   177  	}
   178  	if e1 == 0 && needsConvert {
   179  		for i := range oldBuf {
   180  			buf[i].convertFrom(&oldBuf[i])
   181  		}
   182  	}
   183  	return
   184  }
   185  
   186  func Stat(path string, st *Stat_t) (err error) {
   187  	var oldStat stat_freebsd11_t
   188  	if supportsABI(_ino64First) {
   189  		return fstatat_freebsd12(_AT_FDCWD, path, st, 0)
   190  	}
   191  	err = stat(path, &oldStat)
   192  	if err != nil {
   193  		return err
   194  	}
   195  
   196  	st.convertFrom(&oldStat)
   197  	return nil
   198  }
   199  
   200  func Lstat(path string, st *Stat_t) (err error) {
   201  	var oldStat stat_freebsd11_t
   202  	if supportsABI(_ino64First) {
   203  		return fstatat_freebsd12(_AT_FDCWD, path, st, _AT_SYMLINK_NOFOLLOW)
   204  	}
   205  	err = lstat(path, &oldStat)
   206  	if err != nil {
   207  		return err
   208  	}
   209  
   210  	st.convertFrom(&oldStat)
   211  	return nil
   212  }
   213  
   214  func Fstat(fd int, st *Stat_t) (err error) {
   215  	var oldStat stat_freebsd11_t
   216  	if supportsABI(_ino64First) {
   217  		return fstat_freebsd12(fd, st)
   218  	}
   219  	err = fstat(fd, &oldStat)
   220  	if err != nil {
   221  		return err
   222  	}
   223  
   224  	st.convertFrom(&oldStat)
   225  	return nil
   226  }
   227  
   228  func Fstatat(fd int, path string, st *Stat_t, flags int) (err error) {
   229  	var oldStat stat_freebsd11_t
   230  	if supportsABI(_ino64First) {
   231  		return fstatat_freebsd12(fd, path, st, flags)
   232  	}
   233  	err = fstatat(fd, path, &oldStat, flags)
   234  	if err != nil {
   235  		return err
   236  	}
   237  
   238  	st.convertFrom(&oldStat)
   239  	return nil
   240  }
   241  
   242  func Statfs(path string, st *Statfs_t) (err error) {
   243  	var oldStatfs statfs_freebsd11_t
   244  	if supportsABI(_ino64First) {
   245  		return statfs_freebsd12(path, st)
   246  	}
   247  	err = statfs(path, &oldStatfs)
   248  	if err != nil {
   249  		return err
   250  	}
   251  
   252  	st.convertFrom(&oldStatfs)
   253  	return nil
   254  }
   255  
   256  func Fstatfs(fd int, st *Statfs_t) (err error) {
   257  	var oldStatfs statfs_freebsd11_t
   258  	if supportsABI(_ino64First) {
   259  		return fstatfs_freebsd12(fd, st)
   260  	}
   261  	err = fstatfs(fd, &oldStatfs)
   262  	if err != nil {
   263  		return err
   264  	}
   265  
   266  	st.convertFrom(&oldStatfs)
   267  	return nil
   268  }
   269  
   270  func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
   271  	if supportsABI(_ino64First) {
   272  		if basep == nil || unsafe.Sizeof(*basep) == 8 {
   273  			return getdirentries_freebsd12(fd, buf, (*uint64)(unsafe.Pointer(basep)))
   274  		}
   275  		// The freebsd12 syscall needs a 64-bit base. On 32-bit machines
   276  		// we can't just use the basep passed in. See #32498.
   277  		var base uint64 = uint64(*basep)
   278  		n, err = getdirentries_freebsd12(fd, buf, &base)
   279  		*basep = uintptr(base)
   280  		if base>>32 != 0 {
   281  			// We can't stuff the base back into a uintptr, so any
   282  			// future calls would be suspect. Generate an error.
   283  			// EIO is allowed by getdirentries.
   284  			err = EIO
   285  		}
   286  		return
   287  	}
   288  
   289  	// The old syscall entries are smaller than the new. Use 1/4 of the original
   290  	// buffer size rounded up to DIRBLKSIZ (see /usr/src/lib/libc/sys/getdirentries.c).
   291  	oldBufLen := roundup(len(buf)/4, _dirblksiz)
   292  	oldBuf := make([]byte, oldBufLen)
   293  	n, err = getdirentries(fd, oldBuf, basep)
   294  	if err == nil && n > 0 {
   295  		n = convertFromDirents11(buf, oldBuf[:n])
   296  	}
   297  	return
   298  }
   299  
   300  func Mknod(path string, mode uint32, dev uint64) (err error) {
   301  	var oldDev int
   302  	if supportsABI(_ino64First) {
   303  		return mknodat_freebsd12(_AT_FDCWD, path, mode, dev)
   304  	}
   305  	oldDev = int(dev)
   306  	return mknod(path, mode, oldDev)
   307  }
   308  
   309  // round x to the nearest multiple of y, larger or equal to x.
   310  //
   311  // from /usr/include/sys/param.h Macros for counting and rounding.
   312  // #define roundup(x, y)   ((((x)+((y)-1))/(y))*(y))
   313  func roundup(x, y int) int {
   314  	return ((x + y - 1) / y) * y
   315  }
   316  
   317  func (s *Stat_t) convertFrom(old *stat_freebsd11_t) {
   318  	*s = Stat_t{
   319  		Dev:           uint64(old.Dev),
   320  		Ino:           uint64(old.Ino),
   321  		Nlink:         uint64(old.Nlink),
   322  		Mode:          old.Mode,
   323  		Uid:           old.Uid,
   324  		Gid:           old.Gid,
   325  		Rdev:          uint64(old.Rdev),
   326  		Atimespec:     old.Atimespec,
   327  		Mtimespec:     old.Mtimespec,
   328  		Ctimespec:     old.Ctimespec,
   329  		Birthtimespec: old.Birthtimespec,
   330  		Size:          old.Size,
   331  		Blocks:        old.Blocks,
   332  		Blksize:       old.Blksize,
   333  		Flags:         old.Flags,
   334  		Gen:           uint64(old.Gen),
   335  	}
   336  }
   337  
   338  func (s *Statfs_t) convertFrom(old *statfs_freebsd11_t) {
   339  	*s = Statfs_t{
   340  		Version:     _statfsVersion,
   341  		Type:        old.Type,
   342  		Flags:       old.Flags,
   343  		Bsize:       old.Bsize,
   344  		Iosize:      old.Iosize,
   345  		Blocks:      old.Blocks,
   346  		Bfree:       old.Bfree,
   347  		Bavail:      old.Bavail,
   348  		Files:       old.Files,
   349  		Ffree:       old.Ffree,
   350  		Syncwrites:  old.Syncwrites,
   351  		Asyncwrites: old.Asyncwrites,
   352  		Syncreads:   old.Syncreads,
   353  		Asyncreads:  old.Asyncreads,
   354  		// Spare
   355  		Namemax: old.Namemax,
   356  		Owner:   old.Owner,
   357  		Fsid:    old.Fsid,
   358  		// Charspare
   359  		// Fstypename
   360  		// Mntfromname
   361  		// Mntonname
   362  	}
   363  
   364  	sl := old.Fstypename[:]
   365  	n := clen(*(*[]byte)(unsafe.Pointer(&sl)))
   366  	copy(s.Fstypename[:], old.Fstypename[:n])
   367  
   368  	sl = old.Mntfromname[:]
   369  	n = clen(*(*[]byte)(unsafe.Pointer(&sl)))
   370  	copy(s.Mntfromname[:], old.Mntfromname[:n])
   371  
   372  	sl = old.Mntonname[:]
   373  	n = clen(*(*[]byte)(unsafe.Pointer(&sl)))
   374  	copy(s.Mntonname[:], old.Mntonname[:n])
   375  }
   376  
   377  func convertFromDirents11(buf []byte, old []byte) int {
   378  	const (
   379  		fixedSize    = int(unsafe.Offsetof(Dirent{}.Name))
   380  		oldFixedSize = int(unsafe.Offsetof(dirent_freebsd11{}.Name))
   381  	)
   382  
   383  	dstPos := 0
   384  	srcPos := 0
   385  	for dstPos+fixedSize < len(buf) && srcPos+oldFixedSize < len(old) {
   386  		var dstDirent Dirent
   387  		var srcDirent dirent_freebsd11
   388  
   389  		// If multiple direntries are written, sometimes when we reach the final one,
   390  		// we may have cap of old less than size of dirent_freebsd11.
   391  		copy((*[unsafe.Sizeof(srcDirent)]byte)(unsafe.Pointer(&srcDirent))[:], old[srcPos:])
   392  
   393  		reclen := roundup(fixedSize+int(srcDirent.Namlen)+1, 8)
   394  		if dstPos+reclen > len(buf) {
   395  			break
   396  		}
   397  
   398  		dstDirent.Fileno = uint64(srcDirent.Fileno)
   399  		dstDirent.Off = 0
   400  		dstDirent.Reclen = uint16(reclen)
   401  		dstDirent.Type = srcDirent.Type
   402  		dstDirent.Pad0 = 0
   403  		dstDirent.Namlen = uint16(srcDirent.Namlen)
   404  		dstDirent.Pad1 = 0
   405  
   406  		copy(dstDirent.Name[:], srcDirent.Name[:srcDirent.Namlen])
   407  		copy(buf[dstPos:], (*[unsafe.Sizeof(dstDirent)]byte)(unsafe.Pointer(&dstDirent))[:])
   408  		padding := buf[dstPos+fixedSize+int(dstDirent.Namlen) : dstPos+reclen]
   409  		for i := range padding {
   410  			padding[i] = 0
   411  		}
   412  
   413  		dstPos += int(dstDirent.Reclen)
   414  		srcPos += int(srcDirent.Reclen)
   415  	}
   416  
   417  	return dstPos
   418  }
   419  
   420  /*
   421   * Exposed directly
   422   */
   423  //sys	Access(path string, mode uint32) (err error)
   424  //sys	Adjtime(delta *Timeval, olddelta *Timeval) (err error)
   425  //sys	Chdir(path string) (err error)
   426  //sys	Chflags(path string, flags int) (err error)
   427  //sys	Chmod(path string, mode uint32) (err error)
   428  //sys	Chown(path string, uid int, gid int) (err error)
   429  //sys	Chroot(path string) (err error)
   430  //sys	Close(fd int) (err error)
   431  //sys	Dup(fd int) (nfd int, err error)
   432  //sys	Dup2(from int, to int) (err error)
   433  //sys	Fchdir(fd int) (err error)
   434  //sys	Fchflags(fd int, flags int) (err error)
   435  //sys	Fchmod(fd int, mode uint32) (err error)
   436  //sys	Fchown(fd int, uid int, gid int) (err error)
   437  //sys	Flock(fd int, how int) (err error)
   438  //sys	Fpathconf(fd int, name int) (val int, err error)
   439  //sys	fstat(fd int, stat *stat_freebsd11_t) (err error)
   440  //sys	fstat_freebsd12(fd int, stat *Stat_t) (err error) = _SYS_FSTAT_FREEBSD12
   441  //sys	fstatat(fd int, path string, stat *stat_freebsd11_t, flags int) (err error)
   442  //sys	fstatat_freebsd12(fd int, path string, stat *Stat_t, flags int) (err error) = _SYS_FSTATAT_FREEBSD12
   443  //sys	fstatfs(fd int, stat *statfs_freebsd11_t) (err error)
   444  //sys	fstatfs_freebsd12(fd int, stat *Statfs_t) (err error) = _SYS_FSTATFS_FREEBSD12
   445  //sys	Fsync(fd int) (err error)
   446  //sys	Ftruncate(fd int, length int64) (err error)
   447  //sys	getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error)
   448  //sys	getdirentries_freebsd12(fd int, buf []byte, basep *uint64) (n int, err error) = _SYS_GETDIRENTRIES_FREEBSD12
   449  //sys	Getdtablesize() (size int)
   450  //sysnb	Getegid() (egid int)
   451  //sysnb	Geteuid() (uid int)
   452  //sysnb	Getgid() (gid int)
   453  //sysnb	Getpgid(pid int) (pgid int, err error)
   454  //sysnb	Getpgrp() (pgrp int)
   455  //sysnb	Getpid() (pid int)
   456  //sysnb	Getppid() (ppid int)
   457  //sys	Getpriority(which int, who int) (prio int, err error)
   458  //sysnb	Getrlimit(which int, lim *Rlimit) (err error)
   459  //sysnb	Getrusage(who int, rusage *Rusage) (err error)
   460  //sysnb	Getsid(pid int) (sid int, err error)
   461  //sysnb	Gettimeofday(tv *Timeval) (err error)
   462  //sysnb	Getuid() (uid int)
   463  //sys	Issetugid() (tainted bool)
   464  //sys	Kill(pid int, signum Signal) (err error)
   465  //sys	Kqueue() (fd int, err error)
   466  //sys	Lchown(path string, uid int, gid int) (err error)
   467  //sys	Link(path string, link string) (err error)
   468  //sys	Listen(s int, backlog int) (err error)
   469  //sys	lstat(path string, stat *stat_freebsd11_t) (err error)
   470  //sys	Mkdir(path string, mode uint32) (err error)
   471  //sys	Mkfifo(path string, mode uint32) (err error)
   472  //sys	mknod(path string, mode uint32, dev int) (err error)
   473  //sys	mknodat_freebsd12(fd int, path string, mode uint32, dev uint64) (err error) = _SYS_MKNODAT_FREEBSD12
   474  //sys	Nanosleep(time *Timespec, leftover *Timespec) (err error)
   475  //sys	Open(path string, mode int, perm uint32) (fd int, err error)
   476  //sys	Pathconf(path string, name int) (val int, err error)
   477  //sys	pread(fd int, p []byte, offset int64) (n int, err error)
   478  //sys	pwrite(fd int, p []byte, offset int64) (n int, err error)
   479  //sys	read(fd int, p []byte) (n int, err error)
   480  //sys	Readlink(path string, buf []byte) (n int, err error)
   481  //sys	Rename(from string, to string) (err error)
   482  //sys	Revoke(path string) (err error)
   483  //sys	Rmdir(path string) (err error)
   484  //sys	Seek(fd int, offset int64, whence int) (newoffset int64, err error) = SYS_LSEEK
   485  //sys	Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error)
   486  //sysnb	Setegid(egid int) (err error)
   487  //sysnb	Seteuid(euid int) (err error)
   488  //sysnb	Setgid(gid int) (err error)
   489  //sys	Setlogin(name string) (err error)
   490  //sysnb	Setpgid(pid int, pgid int) (err error)
   491  //sys	Setpriority(which int, who int, prio int) (err error)
   492  //sysnb	Setregid(rgid int, egid int) (err error)
   493  //sysnb	Setreuid(ruid int, euid int) (err error)
   494  //sysnb	Setrlimit(which int, lim *Rlimit) (err error)
   495  //sysnb	Setsid() (pid int, err error)
   496  //sysnb	Settimeofday(tp *Timeval) (err error)
   497  //sysnb	Setuid(uid int) (err error)
   498  //sys	stat(path string, stat *stat_freebsd11_t) (err error)
   499  //sys	statfs(path string, stat *statfs_freebsd11_t) (err error)
   500  //sys	statfs_freebsd12(path string, stat *Statfs_t) (err error) = _SYS_STATFS_FREEBSD12
   501  //sys	Symlink(path string, link string) (err error)
   502  //sys	Sync() (err error)
   503  //sys	Truncate(path string, length int64) (err error)
   504  //sys	Umask(newmask int) (oldmask int)
   505  //sys	Undelete(path string) (err error)
   506  //sys	Unlink(path string) (err error)
   507  //sys	Unmount(path string, flags int) (err error)
   508  //sys	write(fd int, p []byte) (n int, err error)
   509  //sys   mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error)
   510  //sys   munmap(addr uintptr, length uintptr) (err error)
   511  //sys	readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ
   512  //sys	writelen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_WRITE
   513  //sys	accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int, err error)
   514  //sys	utimensat(dirfd int, path string, times *[2]Timespec, flag int) (err error)
   515  //sys	getcwd(buf []byte) (n int, err error) = SYS___GETCWD
   516  //sys	sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL
   517  

View as plain text