diff options
| author | Joel Sing <joel@sing.id.au> | 2025-08-10 00:40:07 +1000 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2025-08-21 11:19:31 -0700 |
| commit | 8dcab6f4505d198b5609182b4b5928bd190b21a8 (patch) | |
| tree | 8fa5048adcb5c4c3b24d70545faf4c82bf501999 /src/syscall/exec_libc.go | |
| parent | ba840c1bf9be0c3b133f2efd638ec6d32dbedaff (diff) | |
| download | go-8dcab6f4505d198b5609182b4b5928bd190b21a8.tar.xz | |
syscall: simplify execve handling on libc platforms
Rather than providing three different execve variables for different
platforms, use a single variable. Provide a small wrapper that handles
conversion to uintptr for the AIX/Solaris case.
Note that this removes special handling for openbsd/mips64, which is
now a dead port.
Updates #61546
Change-Id: I3d6387c31669f64bfb61639536803e595f478647
Reviewed-on: https://go-review.googlesource.com/c/go/+/693880
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Diffstat (limited to 'src/syscall/exec_libc.go')
| -rw-r--r-- | src/syscall/exec_libc.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/syscall/exec_libc.go b/src/syscall/exec_libc.go index 0e88650873..2e7e33d9ef 100644 --- a/src/syscall/exec_libc.go +++ b/src/syscall/exec_libc.go @@ -61,7 +61,13 @@ func write1(fd uintptr, buf uintptr, nbyte uintptr) (n uintptr, err Errno) // syscall defines this global on our behalf to avoid a build dependency on other platforms func init() { - execveLibc = execve + execveLibc = execveLibcWrapper +} + +func execveLibcWrapper(path *byte, argv **byte, envp **byte) error { + return execve(uintptr(unsafe.Pointer(path)), + uintptr(unsafe.Pointer(argv)), + uintptr(unsafe.Pointer(envp))) } // Fork, dup fd onto 0..len(fd), and exec(argv0, argvv, envv) in child. |
