blob: 2c50ca9015404625392d18a2ce6da54f4e512475 [file] [log] [blame]
Don Newton98fd8812019-09-23 15:15:02 -04001// 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
7package unix
8
9import (
10 "syscall"
11)
12
Don Newton7577f072020-01-06 12:41:11 -050013func ptrace(request int, pid int, addr uintptr, data uintptr) error {
14 return ENOTSUP
15}
16
17func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) error {
18 return ENOTSUP
19}
20
Don Newton98fd8812019-09-23 15:15:02 -040021func setTimespec(sec, nsec int64) Timespec {
22 return Timespec{Sec: sec, Nsec: nsec}
23}
24
25func 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)
30func 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
40func 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
46func (iov *Iovec) SetLen(length int) {
47 iov.Len = uint64(length)
48}
49
50func (msghdr *Msghdr) SetControllen(length int) {
51 msghdr.Controllen = uint32(length)
52}
53
Don Newton7577f072020-01-06 12:41:11 -050054func (msghdr *Msghdr) SetIovlen(length int) {
55 msghdr.Iovlen = int32(length)
56}
57
Don Newton98fd8812019-09-23 15:15:02 -040058func (cmsg *Cmsghdr) SetLen(length int) {
59 cmsg.Len = uint32(length)
60}
61
62func 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.
66const 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
76func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
77 return 0, ENOSYS
78}