diff --git a/daemon/2server.go b/daemon/2server.go index dd54b4d..042e1e4 100644 --- a/daemon/2server.go +++ b/daemon/2server.go @@ -99,7 +99,7 @@ func handleConn(conn net.Conn) { // pidToPath returns the path of the executable that has the given PID. func pidToPath(pid int) string { - path, _ := os.Readlink(fmt.Sprintf("/proc/%d/exe", pid)) + path, _ := os.Readlink(fmt.Sprintf("/proc/%d/"+pidPathFile, pid)) return path } diff --git a/daemon/2serverFreeBSD.go b/daemon/2serverFreeBSD.go new file mode 100644 index 0000000..0094621 --- /dev/null +++ b/daemon/2serverFreeBSD.go @@ -0,0 +1,5 @@ +//go:build freebsd + +package daemon + +const pidPathFile = "file" diff --git a/daemon/2serverLinux.go b/daemon/2serverLinux.go new file mode 100644 index 0000000..718d068 --- /dev/null +++ b/daemon/2serverLinux.go @@ -0,0 +1,5 @@ +//go:build linux + +package daemon + +const pidPathFile = "exe"