summaryrefslogtreecommitdiff
path: root/sd_daemon/notify_linux.go
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@datawire.io>2019-08-14 22:15:59 -0400
committerLuke Shumaker <lukeshu@datawire.io>2019-08-14 22:20:07 -0400
commitf675d9e62ace7b5a706ce2f499f6a18248a728b4 (patch)
tree5895348765ca0a41ad40c59c607f41fbf2ff90b1 /sd_daemon/notify_linux.go
parent8f32f1724fce55699a7a9675390c1c2b292190a4 (diff)
sd_daemon/notify_*.go:socketUnixgram(): Cross-reference with net
Diffstat (limited to 'sd_daemon/notify_linux.go')
-rw-r--r--sd_daemon/notify_linux.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/sd_daemon/notify_linux.go b/sd_daemon/notify_linux.go
index 903f1ad..085b25c 100644
--- a/sd_daemon/notify_linux.go
+++ b/sd_daemon/notify_linux.go
@@ -99,7 +99,16 @@ func (msg Notification) send(unsetEnv bool) error {
// the high-level interface of "net", and messing around with FileConn
// and UnixConn. Maybe we just drop to using unix.Socket and
// unix.SendmsgN directly.
+//
+// See: net/sock_cloexec.go:sysSocket()
func socketUnixgram(name string) (*net.UnixConn, error) {
+ // Don't bother with SOCK_NONBLOCK, net.FileConn() will call
+ // syscall.SetNonblock().
+ //
+ // BUG(lukeshu): On Linux, Notification.Send() depends on
+ // SOCK_CLOEXEC in Linux 2.6.27 (2008-10-09), which is
+ // slightly newer than Go itself depends on, 2.6.23
+ // (2007-10-09).
fd, err := unix.Socket(unix.AF_UNIX, unix.SOCK_DGRAM|unix.SOCK_CLOEXEC, 0)
if err != nil {
return nil, os.NewSyscallError("socket", err)