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