mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime,syscall: convert syscall on openbsd/amd64 to libc
Convert the syscall package on openbsd/amd64 to use libc rather than performing direct system calls. Updates #36435 Change-Id: Ieb5926a91ed34f7c722e3667004ec484c86804ef Reviewed-on: https://go-review.googlesource.com/c/go/+/270380 Trust: Joel Sing <joel@sing.id.au> Reviewed-by: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org>
This commit is contained in:
parent
1d5e14632e
commit
8634a234df
19 changed files with 1770 additions and 181 deletions
|
|
@ -272,6 +272,7 @@ func runtime_AfterExec()
|
|||
// avoids a build dependency for other platforms.
|
||||
var execveLibc func(path uintptr, argv uintptr, envp uintptr) Errno
|
||||
var execveDarwin func(path *byte, argv **byte, envp **byte) error
|
||||
var execveOpenBSD 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) {
|
||||
|
|
@ -299,6 +300,9 @@ func Exec(argv0 string, argv []string, envv []string) (err error) {
|
|||
} else if runtime.GOOS == "darwin" || runtime.GOOS == "ios" {
|
||||
// Similarly on Darwin.
|
||||
err1 = execveDarwin(argv0p, &argvp[0], &envvp[0])
|
||||
} else if runtime.GOOS == "openbsd" && runtime.GOARCH == "amd64" {
|
||||
// Similarly on OpenBSD.
|
||||
err1 = execveOpenBSD(argv0p, &argvp[0], &envvp[0])
|
||||
} else {
|
||||
_, _, err1 = RawSyscall(SYS_EXECVE,
|
||||
uintptr(unsafe.Pointer(argv0p)),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue