From: Joshua M. Clulow Date: Fri, 6 Nov 2020 21:11:58 +0000 (-0800) Subject: os/exec: use "pfiles" for fd debugging on illumos X-Git-Tag: go1.16beta1~297 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=bb9a96d03a35ab56f3e1a3e6a6c835f7f2120d54;p=gostls13.git os/exec: use "pfiles" for fd debugging on illumos On illumos (and Solaris) systems, the native "pfiles" tool provides the best information about open file descriptors for a process: https://illumos.org/man/1/pfiles Use that instead of "lsof" when debugging file descriptor leaks. Updates #42431. Change-Id: If1250c4e6c9e8adbd076495a09fb1ce63abcc68b Reviewed-on: https://go-review.googlesource.com/c/go/+/268019 Run-TryBot: Ian Lance Taylor TryBot-Result: Go Bot Reviewed-by: Ian Lance Taylor Reviewed-by: Dmitri Shuralyov Trust: Dmitri Shuralyov --- diff --git a/src/os/exec/read3.go b/src/os/exec/read3.go index 8852023e77..8cc24da8cb 100644 --- a/src/os/exec/read3.go +++ b/src/os/exec/read3.go @@ -56,7 +56,7 @@ func main() { switch runtime.GOOS { case "plan9": args = []string{fmt.Sprintf("/proc/%d/fd", os.Getpid())} - case "aix": + case "aix", "solaris", "illumos": args = []string{fmt.Sprint(os.Getpid())} default: args = []string{"-p", fmt.Sprint(os.Getpid())} @@ -71,6 +71,8 @@ func main() { ofcmd = "/bin/cat" case "aix": ofcmd = "procfiles" + case "solaris", "illumos": + ofcmd = "pfiles" } cmd := exec.Command(ofcmd, args...)