From e3c58bbeb8c76fa3abc0f7153edbab72208c1f88 Mon Sep 17 00:00:00 2001 From: Antonio Huete Jimenez Date: Wed, 28 Oct 2020 11:44:26 +0000 Subject: os: do not use procfs for os.Executable in dragonfly procfs(5) is not always mounted in DragonFly BSD, for example during the binary package build with synth. os.Executable() consumers will then fail, we've spotted this when trying to build tinygo: [...] copying source files ./build/tinygo build-builtins -target=armv6m-none-eabi [...] panic: could not get executable path: readlink /proc/curproc/file: no such file or directory [...] Use KERN_PROC_PATHNAME as FreeBSD does. Change-Id: Ic65bea02cd0309fb24dec8ba8d2b151d1acde67b GitHub-Last-Rev: 083120a43b3158bb45d7e1a66fa32e3335a2d407 GitHub-Pull-Request: golang/go#36826 Reviewed-on: https://go-review.googlesource.com/c/go/+/216622 Run-TryBot: Tobias Klauser TryBot-Result: Go Bot Reviewed-by: Tobias Klauser Trust: Brad Fitzpatrick --- src/os/executable_dragonfly.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/os/executable_dragonfly.go (limited to 'src/os/executable_dragonfly.go') diff --git a/src/os/executable_dragonfly.go b/src/os/executable_dragonfly.go new file mode 100644 index 0000000000..b0deb7bbe5 --- /dev/null +++ b/src/os/executable_dragonfly.go @@ -0,0 +1,12 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package os + +// From DragonFly's +const ( + _CTL_KERN = 1 + _KERN_PROC = 14 + _KERN_PROC_PATHNAME = 9 +) -- cgit v1.3 From d7974c31d0eb0ef377a8681f6f7306d46854eb1c Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Thu, 12 Nov 2020 11:01:23 +0100 Subject: os: gofmt As reported by John Papandriopoulos, some parts of CL 216622 weren't properly formatted. Change-Id: I3a76abb6213bb17ef440036295c86d930703b456 Reviewed-on: https://go-review.googlesource.com/c/go/+/269218 Run-TryBot: Tobias Klauser TryBot-Result: Go Bot Reviewed-by: Alberto Donizetti Trust: Alberto Donizetti Trust: Tobias Klauser --- src/os/executable_dragonfly.go | 6 +++--- src/os/executable_freebsd.go | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/os/executable_dragonfly.go') diff --git a/src/os/executable_dragonfly.go b/src/os/executable_dragonfly.go index b0deb7bbe5..19c2ae890f 100644 --- a/src/os/executable_dragonfly.go +++ b/src/os/executable_dragonfly.go @@ -6,7 +6,7 @@ package os // From DragonFly's const ( - _CTL_KERN = 1 - _KERN_PROC = 14 - _KERN_PROC_PATHNAME = 9 + _CTL_KERN = 1 + _KERN_PROC = 14 + _KERN_PROC_PATHNAME = 9 ) diff --git a/src/os/executable_freebsd.go b/src/os/executable_freebsd.go index 57930b1b16..95f1a93cb9 100644 --- a/src/os/executable_freebsd.go +++ b/src/os/executable_freebsd.go @@ -6,7 +6,7 @@ package os // From FreeBSD's const ( - _CTL_KERN = 1 - _KERN_PROC = 14 - _KERN_PROC_PATHNAME = 12 + _CTL_KERN = 1 + _KERN_PROC = 14 + _KERN_PROC_PATHNAME = 12 ) -- cgit v1.3