aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/golang.org/x/sys/unix/syscall_openbsd.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/golang.org/x/sys/unix/syscall_openbsd.go')
-rw-r--r--vendor/golang.org/x/sys/unix/syscall_openbsd.go98
1 files changed, 59 insertions, 39 deletions
diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd.go b/vendor/golang.org/x/sys/unix/syscall_openbsd.go
index 5a398f8..9a26768 100644
--- a/vendor/golang.org/x/sys/unix/syscall_openbsd.go
+++ b/vendor/golang.org/x/sys/unix/syscall_openbsd.go
@@ -43,6 +43,35 @@ func nametomib(name string) (mib []_C_int, err error) {
return nil, EINVAL
}
+func direntIno(buf []byte) (uint64, bool) {
+ return readInt(buf, unsafe.Offsetof(Dirent{}.Fileno), unsafe.Sizeof(Dirent{}.Fileno))
+}
+
+func direntReclen(buf []byte) (uint64, bool) {
+ return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen))
+}
+
+func direntNamlen(buf []byte) (uint64, bool) {
+ return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen))
+}
+
+func SysctlClockinfo(name string) (*Clockinfo, error) {
+ mib, err := sysctlmib(name)
+ if err != nil {
+ return nil, err
+ }
+
+ n := uintptr(SizeofClockinfo)
+ var ci Clockinfo
+ if err := sysctl(mib, (*byte)(unsafe.Pointer(&ci)), &n, nil, 0); err != nil {
+ return nil, err
+ }
+ if n != SizeofClockinfo {
+ return nil, EIO
+ }
+ return &ci, nil
+}
+
func SysctlUvmexp(name string) (*Uvmexp, error) {
mib, err := sysctlmib(name)
if err != nil {
@@ -72,9 +101,30 @@ func Pipe(p []int) (err error) {
return
}
-//sys getdents(fd int, buf []byte) (n int, err error)
+//sys Getdents(fd int, buf []byte) (n int, err error)
func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
- return getdents(fd, buf)
+ n, err = Getdents(fd, buf)
+ if err != nil || basep == nil {
+ return
+ }
+
+ var off int64
+ off, err = Seek(fd, 0, 1 /* SEEK_CUR */)
+ if err != nil {
+ *basep = ^uintptr(0)
+ return
+ }
+ *basep = uintptr(off)
+ if unsafe.Sizeof(*basep) == 8 {
+ return
+ }
+ if off>>32 != 0 {
+ // We can't stuff the offset back into a uintptr, so any
+ // future calls would be suspect. Generate an error.
+ // EIO was allowed by getdirentries.
+ err = EIO
+ }
+ return
}
const ImplementsGetwd = true
@@ -94,6 +144,13 @@ func Getwd() (string, error) {
return string(buf[:n]), nil
}
+func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
+ if raceenabled {
+ raceReleaseMerge(unsafe.Pointer(&ioSync))
+ }
+ return sendfile(outfd, infd, offset, count)
+}
+
// TODO
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
return -1, ENOSYS
@@ -121,43 +178,6 @@ func setattrlistTimes(path string, times []Timespec, flags int) error {
//sys ioctl(fd int, req uint, arg uintptr) (err error)
-// ioctl itself should not be exposed directly, but additional get/set
-// functions for specific types are permissible.
-
-// IoctlSetInt performs an ioctl operation which sets an integer value
-// on fd, using the specified request number.
-func IoctlSetInt(fd int, req uint, value int) error {
- return ioctl(fd, req, uintptr(value))
-}
-
-func ioctlSetWinsize(fd int, req uint, value *Winsize) error {
- return ioctl(fd, req, uintptr(unsafe.Pointer(value)))
-}
-
-func ioctlSetTermios(fd int, req uint, value *Termios) error {
- return ioctl(fd, req, uintptr(unsafe.Pointer(value)))
-}
-
-// IoctlGetInt performs an ioctl operation which gets an integer value
-// from fd, using the specified request number.
-func IoctlGetInt(fd int, req uint) (int, error) {
- var value int
- err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
- return value, err
-}
-
-func IoctlGetWinsize(fd int, req uint) (*Winsize, error) {
- var value Winsize
- err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
- return &value, err
-}
-
-func IoctlGetTermios(fd int, req uint) (*Termios, error) {
- var value Termios
- err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
- return &value, err
-}
-
//sys ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error)
func Ppoll(fds []PollFd, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {