summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-12-19 01:57:19 -0500
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-12-19 01:57:19 -0500
commit9709d1ec5dc9e1cd1ef17b8cc4f5257cae6bf31c (patch)
tree5dfdfa38b3cbeda7cf442f2ff0105f0a2d3e4b03
parent93740fc6f14bf6b285efa010af0b309e9086d0b8 (diff)
Use golang.org/x/sys/unix instead of the deprecated syscall.
-rw-r--r--sd_daemon/listen_fds.go5
-rw-r--r--sd_daemon/notify.go11
2 files changed, 7 insertions, 9 deletions
diff --git a/sd_daemon/listen_fds.go b/sd_daemon/listen_fds.go
index bf30432..cdcb3cd 100644
--- a/sd_daemon/listen_fds.go
+++ b/sd_daemon/listen_fds.go
@@ -19,7 +19,8 @@ import (
"os"
"strconv"
"strings"
- "syscall"
+
+ "golang.org/x/sys/unix"
)
// ListenFds returns a list of file descriptors passed in by the
@@ -55,7 +56,7 @@ func ListenFds(unsetEnv bool) []*os.File {
files := make([]*os.File, 0, nfds)
for i := 0; i < nfds; i++ {
fd := i + 3
- syscall.CloseOnExec(fd)
+ unix.CloseOnExec(fd)
name := "unknown"
if i < len(names) {
name = names[i]
diff --git a/sd_daemon/notify.go b/sd_daemon/notify.go
index 360e364..76ffe81 100644
--- a/sd_daemon/notify.go
+++ b/sd_daemon/notify.go
@@ -20,7 +20,8 @@ import (
"bytes"
"net"
"os"
- "syscall"
+
+ "golang.org/x/sys/unix"
)
// Notify sends a message from process pid to the service manager
@@ -81,17 +82,13 @@ func Notify(pid int, unsetEnv bool, state string, files []*os.File) error {
for i := range files {
fds[i] = int(files[i].Fd())
}
- cmsg := syscall.UnixRights(fds...)
+ cmsg := unix.UnixRights(fds...)
cmsgs = append(cmsgs, cmsg)
}
havePid := pid > 0 && pid != os.Getpid()
if havePid {
- // The types of members of syscall.Ucred aren't
- // guaranteed across processors. However,
- // fortunately, they are the same on all supported
- // processors as of go 1.7.4.
- cmsg := syscall.UnixCredentials(&syscall.Ucred{
+ cmsg := unix.UnixCredentials(&unix.Ucred{
Pid: int32(pid),
Uid: uint32(os.Getuid()),
Gid: uint32(os.Getgid()),