github.com/Andyfoo/golang/x/sys@v0.0.0-20190901054642-57c1bf301704/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 (cmsg *Cmsghdr) SetLen(length int) { 51 cmsg.Len = uint32(length) 52 } 53 54 func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic 55 56 // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 57 // of darwin/arm64 the syscall is called sysctl instead of __sysctl. 58 const SYS___SYSCTL = SYS_SYSCTL 59 60 //sys Fstat(fd int, stat *Stat_t) (err error) 61 //sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) 62 //sys Fstatfs(fd int, stat *Statfs_t) (err error) 63 //sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT 64 //sys Lstat(path string, stat *Stat_t) (err error) 65 //sys Stat(path string, stat *Stat_t) (err error) 66 //sys Statfs(path string, stat *Statfs_t) (err error) 67 68 func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { 69 return 0, ENOSYS 70 }