github.com/xingly-cn/shorturl-go@v0.0.0-20220110130535-e21de4659f74/pkg/mod/golang.org/x/sys@v0.0.0-20200323222414-85ca7c5b95cd/unix/syscall_darwin_arm64.go (about)

     1  // Copyright 2015 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  // +build arm64,darwin
     6  
     7  package unix
     8  
     9  import (
    10  	"syscall"
    11  )
    12  
    13  func ptrace(request int, pid int, addr uintptr, data uintptr) error {
    14  	return ENOTSUP
    15  }
    16  
    17  func setTimespec(sec, nsec int64) Timespec {
    18  	return Timespec{Sec: sec, Nsec: nsec}
    19  }
    20  
    21  func setTimeval(sec, usec int64) Timeval {
    22  	return Timeval{Sec: sec, Usec: int32(usec)}
    23  }
    24  
    25  //sysnb	gettimeofday(tp *Timeval) (sec int64, usec int32, err error)
    26  func Gettimeofday(tv *Timeval) (err error) {
    27  	// The tv passed to gettimeofday must be non-nil
    28  	// but is otherwise unused. The answers come back
    29  	// in the two registers.
    30  	sec, usec, err := gettimeofday(tv)
    31  	tv.Sec = sec
    32  	tv.Usec = usec
    33  	return err
    34  }
    35  
    36  func SetKevent(k *Kevent_t, fd, mode, flags int) {
    37  	k.Ident = uint64(fd)
    38  	k.Filter = int16(mode)
    39  	k.Flags = uint16(flags)
    40  }
    41  
    42  func (iov *Iovec) SetLen(length int) {
    43  	iov.Len = uint64(length)
    44  }
    45  
    46  func (msghdr *Msghdr) SetControllen(length int) {
    47  	msghdr.Controllen = uint32(length)
    48  }
    49  
    50  func (msghdr *Msghdr) SetIovlen(length int) {
    51  	msghdr.Iovlen = int32(length)
    52  }
    53  
    54  func (cmsg *Cmsghdr) SetLen(length int) {
    55  	cmsg.Len = uint32(length)
    56  }
    57  
    58  func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic
    59  
    60  // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
    61  // of darwin/arm64 the syscall is called sysctl instead of __sysctl.
    62  const SYS___SYSCTL = SYS_SYSCTL
    63  
    64  //sys	Fstat(fd int, stat *Stat_t) (err error)
    65  //sys	Fstatat(fd int, path string, stat *Stat_t, flags int) (err error)
    66  //sys	Fstatfs(fd int, stat *Statfs_t) (err error)
    67  //sys	getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT
    68  //sys	Lstat(path string, stat *Stat_t) (err error)
    69  //sys	Stat(path string, stat *Stat_t) (err error)
    70  //sys	Statfs(path string, stat *Statfs_t) (err error)