aboutsummaryrefslogtreecommitdiff
path: root/vendor/golang.org/x/sys/unix/syscall_dragonfly.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/golang.org/x/sys/unix/syscall_dragonfly.go')
-rw-r--r--vendor/golang.org/x/sys/unix/syscall_dragonfly.go146
1 files changed, 127 insertions, 19 deletions
diff --git a/vendor/golang.org/x/sys/unix/syscall_dragonfly.go b/vendor/golang.org/x/sys/unix/syscall_dragonfly.go
index 3a48337..b5072de 100644
--- a/vendor/golang.org/x/sys/unix/syscall_dragonfly.go
+++ b/vendor/golang.org/x/sys/unix/syscall_dragonfly.go
@@ -14,6 +14,7 @@ package unix
import "unsafe"
+// SockaddrDatalink implements the Sockaddr interface for AF_LINK type sockets.
type SockaddrDatalink struct {
Len uint8
Family uint8
@@ -56,22 +57,6 @@ func nametomib(name string) (mib []_C_int, err error) {
return buf[0 : n/siz], nil
}
-func direntIno(buf []byte) (uint64, bool) {
- return readInt(buf, unsafe.Offsetof(Dirent{}.Fileno), unsafe.Sizeof(Dirent{}.Fileno))
-}
-
-func direntReclen(buf []byte) (uint64, bool) {
- namlen, ok := direntNamlen(buf)
- if !ok {
- return 0, false
- }
- return (16 + namlen + 1 + 7) &^ 7, true
-}
-
-func direntNamlen(buf []byte) (uint64, bool) {
- return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen))
-}
-
//sysnb pipe() (r int, w int, err error)
func Pipe(p []int) (err error) {
@@ -110,6 +95,23 @@ func Accept4(fd, flags int) (nfd int, sa Sockaddr, err error) {
return
}
+const ImplementsGetwd = true
+
+//sys Getcwd(buf []byte) (n int, err error) = SYS___GETCWD
+
+func Getwd() (string, error) {
+ var buf [PathMax]byte
+ _, err := Getcwd(buf[0:])
+ if err != nil {
+ return "", err
+ }
+ n := clen(buf[:])
+ if n < 1 {
+ return "", EINVAL
+ }
+ return string(buf[:n]), nil
+}
+
func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
var _p0 unsafe.Pointer
var bufsize uintptr
@@ -125,6 +127,113 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
return
}
+func setattrlistTimes(path string, times []Timespec, flags int) error {
+ // used on Darwin for UtimesNano
+ return ENOSYS
+}
+
+//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
+}
+
+func sysctlUname(mib []_C_int, old *byte, oldlen *uintptr) error {
+ err := sysctl(mib, old, oldlen, nil, 0)
+ if err != nil {
+ // Utsname members on Dragonfly are only 32 bytes and
+ // the syscall returns ENOMEM in case the actual value
+ // is longer.
+ if err == ENOMEM {
+ err = nil
+ }
+ }
+ return err
+}
+
+func Uname(uname *Utsname) error {
+ mib := []_C_int{CTL_KERN, KERN_OSTYPE}
+ n := unsafe.Sizeof(uname.Sysname)
+ if err := sysctlUname(mib, &uname.Sysname[0], &n); err != nil {
+ return err
+ }
+ uname.Sysname[unsafe.Sizeof(uname.Sysname)-1] = 0
+
+ mib = []_C_int{CTL_KERN, KERN_HOSTNAME}
+ n = unsafe.Sizeof(uname.Nodename)
+ if err := sysctlUname(mib, &uname.Nodename[0], &n); err != nil {
+ return err
+ }
+ uname.Nodename[unsafe.Sizeof(uname.Nodename)-1] = 0
+
+ mib = []_C_int{CTL_KERN, KERN_OSRELEASE}
+ n = unsafe.Sizeof(uname.Release)
+ if err := sysctlUname(mib, &uname.Release[0], &n); err != nil {
+ return err
+ }
+ uname.Release[unsafe.Sizeof(uname.Release)-1] = 0
+
+ mib = []_C_int{CTL_KERN, KERN_VERSION}
+ n = unsafe.Sizeof(uname.Version)
+ if err := sysctlUname(mib, &uname.Version[0], &n); err != nil {
+ return err
+ }
+
+ // The version might have newlines or tabs in it, convert them to
+ // spaces.
+ for i, b := range uname.Version {
+ if b == '\n' || b == '\t' {
+ if i == len(uname.Version)-1 {
+ uname.Version[i] = 0
+ } else {
+ uname.Version[i] = ' '
+ }
+ }
+ }
+
+ mib = []_C_int{CTL_HW, HW_MACHINE}
+ n = unsafe.Sizeof(uname.Machine)
+ if err := sysctlUname(mib, &uname.Machine[0], &n); err != nil {
+ return err
+ }
+ uname.Machine[unsafe.Sizeof(uname.Machine)-1] = 0
+
+ return nil
+}
+
/*
* Exposed directly
*/
@@ -142,10 +251,12 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
//sys Fchdir(fd int) (err error)
//sys Fchflags(fd int, flags int) (err error)
//sys Fchmod(fd int, mode uint32) (err error)
+//sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error)
//sys Fchown(fd int, uid int, gid int) (err error)
//sys Flock(fd int, how int) (err error)
//sys Fpathconf(fd int, name int) (val int, err error)
//sys Fstat(fd int, stat *Stat_t) (err error)
+//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error)
//sys Fstatfs(fd int, stat *Statfs_t) (err error)
//sys Fsync(fd int) (err error)
//sys Ftruncate(fd int, length int64) (err error)
@@ -225,7 +336,6 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
// Getlogin
// Sigpending
// Sigaltstack
-// Ioctl
// Reboot
// Execve
// Vfork
@@ -257,7 +367,6 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
// Searchfs
// Delete
// Copyfile
-// Poll
// Watchevent
// Waitevent
// Modwatch
@@ -403,7 +512,6 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
// Pread_nocancel
// Pwrite_nocancel
// Waitid_nocancel
-// Poll_nocancel
// Msgsnd_nocancel
// Msgrcv_nocancel
// Sem_wait_nocancel