From 1b09d430678d4a6f73b2443463d11f75851aba8a Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Fri, 16 Oct 2020 00:49:02 -0400 Subject: all: update references to symbols moved from io/ioutil to io The old ioutil references are still valid, but update our code to reflect best practices and get used to the new locations. Code compiled with the bootstrap toolchain (cmd/asm, cmd/dist, cmd/compile, debug/elf) must remain Go 1.4-compatible and is excluded. Also excluded vendored code. For #41190. Change-Id: I6d86f2bf7bc37a9d904b6cee3fe0c7af6d94d5b1 Reviewed-on: https://go-review.googlesource.com/c/go/+/263142 Trust: Russ Cox Run-TryBot: Russ Cox TryBot-Result: Go Bot Reviewed-by: Emmanuel Odeke --- src/os/exec/read3.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/os/exec/read3.go') diff --git a/src/os/exec/read3.go b/src/os/exec/read3.go index 25d732a991..8852023e77 100644 --- a/src/os/exec/read3.go +++ b/src/os/exec/read3.go @@ -15,7 +15,7 @@ package main import ( "fmt" "internal/poll" - "io/ioutil" + "io" "os" "os/exec" "runtime" @@ -24,7 +24,7 @@ import ( func main() { fd3 := os.NewFile(3, "fd3") - bs, err := ioutil.ReadAll(fd3) + bs, err := io.ReadAll(fd3) if err != nil { fmt.Printf("ReadAll from fd 3: %v\n", err) os.Exit(1) -- cgit v1.3 From bb9a96d03a35ab56f3e1a3e6a6c835f7f2120d54 Mon Sep 17 00:00:00 2001 From: "Joshua M. Clulow" Date: Fri, 6 Nov 2020 13:11:58 -0800 Subject: 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 --- src/os/exec/read3.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/os/exec/read3.go') 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...) -- cgit v1.3