1 // The UnixCredentials system call is currently only implemented on Linux 2 // http://golang.org/src/pkg/syscall/sockcmsg_linux.go 3 // https://golang.org/s/go1.4-syscall 4 // http://code.google.com/p/go/source/browse/unix/sockcmsg_linux.go?repo=sys 5 6 package dbus 7 8 import ( 9 "io" 10 "os" 11 "syscall" 12 ) 13 14 func (t *unixTransport) SendNullByte() error { 15 ucred := &syscall.Ucred{Pid: int32(os.Getpid()), Uid: uint32(os.Getuid()), Gid: uint32(os.Getgid())} 16 b := syscall.UnixCredentials(ucred) 17 _, oobn, err := t.UnixConn.WriteMsgUnix([]byte{0}, b, nil) 18 if err != nil { 19 return err 20 } 21 if oobn != len(b) { 22 return io.ErrShortWrite 23 } 24 return nil 25 } 26