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