Commit 2058511e authored by Shenghou Ma's avatar Shenghou Ma Committed by Brad Fitzpatrick

runtime: os.Executable runtime support for Darwin

Change-Id: Ie21df37016c90cd0479c23ec4845f8195dd90fda
Reviewed-on: https://go-review.googlesource.com/16518Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent f335fcf0
......@@ -551,3 +551,21 @@ func sigaddset(mask *sigset, i int) {
func sigdelset(mask *sigset, i int) {
*mask &^= 1 << (uint32(i) - 1)
}
//go:linkname executablePath os.executablePath
var executablePath string
func sysargs(argc int32, argv **byte) {
// skip over argv, envv and the first string will be the path
n := argc + 1
for argv_index(argv, n) != nil {
n++
}
executablePath = gostringnocopy(argv_index(argv, n+1))
// strip "executable_path=" prefix if available, it's added after OS X 10.11.
const prefix = "executable_path="
if len(executablePath) > len(prefix) && executablePath[:len(prefix)] == prefix {
executablePath = executablePath[len(prefix):]
}
}
......@@ -3,6 +3,7 @@
// license that can be found in the LICENSE file.
// +build !linux
// +build !darwin
package runtime
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment