aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/golang.org/x/sys/unix/syscall_unix.go
diff options
context:
space:
mode:
authorGravatar Frédéric Guillot <fred@miniflux.net>2019-09-05 21:39:32 -0700
committerGravatar Frédéric Guillot <fred@miniflux.net>2019-09-05 21:53:12 -0700
commitb94160df725a52af53f113bf27de7a7b8723174c (patch)
tree9e86b227d4683f26da9b393410df1bedc2e95074 /vendor/golang.org/x/sys/unix/syscall_unix.go
parent456ebaf423ce2122bf8faa36da464c5d90361204 (diff)
Update dependencies
Diffstat (limited to 'vendor/golang.org/x/sys/unix/syscall_unix.go')
-rw-r--r--vendor/golang.org/x/sys/unix/syscall_unix.go69
1 files changed, 53 insertions, 16 deletions
diff --git a/vendor/golang.org/x/sys/unix/syscall_unix.go b/vendor/golang.org/x/sys/unix/syscall_unix.go
index 64fcda4..3de3756 100644
--- a/vendor/golang.org/x/sys/unix/syscall_unix.go
+++ b/vendor/golang.org/x/sys/unix/syscall_unix.go
@@ -8,7 +8,6 @@ package unix
import (
"bytes"
- "runtime"
"sort"
"sync"
"syscall"
@@ -21,13 +20,6 @@ var (
Stderr = 2
)
-const (
- darwin64Bit = runtime.GOOS == "darwin" && SizeofPtr == 8
- dragonfly64Bit = runtime.GOOS == "dragonfly" && SizeofPtr == 8
- netbsd32Bit = runtime.GOOS == "netbsd" && SizeofPtr == 4
- solaris64Bit = runtime.GOOS == "solaris" && SizeofPtr == 8
-)
-
// Do the interface allocations only once for common
// Errno values.
var (
@@ -36,6 +28,11 @@ var (
errENOENT error = syscall.ENOENT
)
+var (
+ signalNameMapOnce sync.Once
+ signalNameMap map[string]syscall.Signal
+)
+
// errnoErr returns common boxed Errno values, to prevent
// allocations at runtime.
func errnoErr(e syscall.Errno) error {
@@ -74,6 +71,19 @@ func SignalName(s syscall.Signal) string {
return ""
}
+// SignalNum returns the syscall.Signal for signal named s,
+// or 0 if a signal with such name is not found.
+// The signal name should start with "SIG".
+func SignalNum(s string) syscall.Signal {
+ signalNameMapOnce.Do(func() {
+ signalNameMap = make(map[string]syscall.Signal)
+ for _, signal := range signalList {
+ signalNameMap[signal.name] = signal.num
+ }
+ })
+ return signalNameMap[s]
+}
+
// clen returns the index of the first NULL byte in n or len(n) if n contains no NULL byte.
func clen(n []byte) int {
i := bytes.IndexByte(n, 0)
@@ -284,6 +294,13 @@ func GetsockoptTimeval(fd, level, opt int) (*Timeval, error) {
return &tv, err
}
+func GetsockoptUint64(fd, level, opt int) (value uint64, err error) {
+ var n uint64
+ vallen := _Socklen(8)
+ err = getsockopt(fd, level, opt, unsafe.Pointer(&n), &vallen)
+ return n, err
+}
+
func Recvfrom(fd int, p []byte, flags int) (n int, from Sockaddr, err error) {
var rsa RawSockaddrAny
var len _Socklen = SizeofSockaddrAny
@@ -334,13 +351,21 @@ func SetsockoptLinger(fd, level, opt int, l *Linger) (err error) {
}
func SetsockoptString(fd, level, opt int, s string) (err error) {
- return setsockopt(fd, level, opt, unsafe.Pointer(&[]byte(s)[0]), uintptr(len(s)))
+ var p unsafe.Pointer
+ if len(s) > 0 {
+ p = unsafe.Pointer(&[]byte(s)[0])
+ }
+ return setsockopt(fd, level, opt, p, uintptr(len(s)))
}
func SetsockoptTimeval(fd, level, opt int, tv *Timeval) (err error) {
return setsockopt(fd, level, opt, unsafe.Pointer(tv), unsafe.Sizeof(*tv))
}
+func SetsockoptUint64(fd, level, opt int, value uint64) (err error) {
+ return setsockopt(fd, level, opt, unsafe.Pointer(&value), 8)
+}
+
func Socket(domain, typ, proto int) (fd int, err error) {
if domain == AF_INET6 && SocketDisableIPv6 {
return -1, EAFNOSUPPORT
@@ -359,13 +384,6 @@ func Socketpair(domain, typ, proto int) (fd [2]int, err error) {
return
}
-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)
-}
-
var ioSync int64
func CloseOnExec(fd int) { fcntl(fd, F_SETFD, FD_CLOEXEC) }
@@ -392,3 +410,22 @@ func SetNonblock(fd int, nonblocking bool) (err error) {
func Exec(argv0 string, argv []string, envv []string) error {
return syscall.Exec(argv0, argv, envv)
}
+
+// Lutimes sets the access and modification times tv on path. If path refers to
+// a symlink, it is not dereferenced and the timestamps are set on the symlink.
+// If tv is nil, the access and modification times are set to the current time.
+// Otherwise tv must contain exactly 2 elements, with access time as the first
+// element and modification time as the second element.
+func Lutimes(path string, tv []Timeval) error {
+ if tv == nil {
+ return UtimesNanoAt(AT_FDCWD, path, nil, AT_SYMLINK_NOFOLLOW)
+ }
+ if len(tv) != 2 {
+ return EINVAL
+ }
+ ts := []Timespec{
+ NsecToTimespec(TimevalToNsec(tv[0])),
+ NsecToTimespec(TimevalToNsec(tv[1])),
+ }
+ return UtimesNanoAt(AT_FDCWD, path, ts, AT_SYMLINK_NOFOLLOW)
+}