summaryrefslogtreecommitdiff
path: root/src/syscall/exec_unix.go
diff options
context:
space:
mode:
authorKeith Randall <keithr@alum.mit.edu>2018-11-07 15:27:16 -0800
committerKeith Randall <khr@golang.org>2018-11-08 03:01:54 +0000
commitc9762b8a7ec852d96ea040c28c5f65b1104ec844 (patch)
tree4c470a9fa7676dfe7081b16cb3a8406390b162ef /src/syscall/exec_unix.go
parent5d6e8f3142ae9cd118b887e02576943ce5544ed7 (diff)
downloadgo-git-c9762b8a7ec852d96ea040c28c5f65b1104ec844.tar.gz
syscall: move uses of Syscall to libSystem on darwin
Miscellaneous additional conversions from raw syscalls to using their libc equivalent. Update #17490 Change-Id: If9ab22cc1d676c1f20fb161ebf02b0c28f71585d Reviewed-on: https://go-review.googlesource.com/c/148257 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/syscall/exec_unix.go')
-rw-r--r--src/syscall/exec_unix.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/syscall/exec_unix.go b/src/syscall/exec_unix.go
index 3b84256b8e..997ccab07e 100644
--- a/src/syscall/exec_unix.go
+++ b/src/syscall/exec_unix.go
@@ -248,7 +248,8 @@ func runtime_AfterExec()
// execveLibc is non-nil on OS using libc syscall, set to execve in exec_libc.go; this
// avoids a build dependency for other platforms.
-var execveLibc func(path uintptr, argv uintptr, envp uintptr) (err Errno)
+var execveLibc func(path uintptr, argv uintptr, envp uintptr) Errno
+var execveDarwin func(path *byte, argv **byte, envp **byte) error
// Exec invokes the execve(2) system call.
func Exec(argv0 string, argv []string, envv []string) (err error) {
@@ -266,13 +267,16 @@ func Exec(argv0 string, argv []string, envv []string) (err error) {
}
runtime_BeforeExec()
- var err1 Errno
+ var err1 error
if runtime.GOOS == "solaris" || runtime.GOOS == "aix" {
// RawSyscall should never be used on Solaris or AIX.
err1 = execveLibc(
uintptr(unsafe.Pointer(argv0p)),
uintptr(unsafe.Pointer(&argvp[0])),
uintptr(unsafe.Pointer(&envvp[0])))
+ } else if runtime.GOOS == "darwin" {
+ // Similarly on Darwin.
+ err1 = execveDarwin(argv0p, &argvp[0], &envvp[0])
} else {
_, _, err1 = RawSyscall(SYS_EXECVE,
uintptr(unsafe.Pointer(argv0p)),