diff options
| author | Keith Randall <khr@golang.org> | 2018-09-24 07:13:36 -0700 |
|---|---|---|
| committer | Keith Randall <khr@golang.org> | 2018-11-07 20:27:01 +0000 |
| commit | a3b01440fef3d2833909f6651455924a1c86d192 (patch) | |
| tree | b7c90b36c39caf7e6aae5019fc89d54b72a625aa /src/syscall/exec_bsd.go | |
| parent | 0fcd40503b41b84beb8d355615d1ad5ebc4eae57 (diff) | |
| download | go-a3b01440fef3d2833909f6651455924a1c86d192.tar.xz | |
syscall: implement syscalls on Darwin using libSystem
There are still some references to the bare Syscall functions
in the stdlib. I will root those out in a following CL.
(This CL is big enough as it is.)
Most are in vendor directories:
cmd/vendor/golang.org/x/sys/unix/
vendor/golang_org/x/net/route/syscall.go
syscall/bpf_bsd.go
syscall/exec_unix.go
syscall/flock.go
Update #17490
Change-Id: I69ab707811530c26b652b291cadee92f5bf5c1a4
Reviewed-on: https://go-review.googlesource.com/c/141639
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Elias Naur <elias.naur@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/syscall/exec_bsd.go')
| -rw-r--r-- | src/syscall/exec_bsd.go | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/src/syscall/exec_bsd.go b/src/syscall/exec_bsd.go index 17ca6f06cf..30b88eba7a 100644 --- a/src/syscall/exec_bsd.go +++ b/src/syscall/exec_bsd.go @@ -2,12 +2,11 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build darwin dragonfly freebsd netbsd openbsd +// +build dragonfly freebsd netbsd openbsd package syscall import ( - "runtime" "unsafe" ) @@ -43,7 +42,7 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr // Declare all variables at top in case any // declarations require heap allocation (e.g., err1). var ( - r1, r2 uintptr + r1 uintptr err1 Errno nextfd int i int @@ -62,25 +61,15 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr } nextfd++ - darwin := runtime.GOOS == "darwin" - // About to call fork. // No more allocation or calls of non-assembly functions. runtime_BeforeFork() - r1, r2, err1 = RawSyscall(SYS_FORK, 0, 0, 0) + r1, _, err1 = RawSyscall(SYS_FORK, 0, 0, 0) if err1 != 0 { runtime_AfterFork() return 0, err1 } - // On Darwin: - // r1 = child pid in both parent and child. - // r2 = 0 in parent, 1 in child. - // Convert to normal Unix r1 = 0 in child. - if darwin && r2 == 1 { - r1 = 0 - } - if r1 != 0 { // parent; return PID runtime_AfterFork() |
