syscall_darwin_arm.go 1.8 KB

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