aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/syscall/exec_linux.go
diff options
context:
space:
mode:
authorDmitriy Vyukov <dvyukov@google.com>2013-08-13 13:01:30 +0400
committerDmitriy Vyukov <dvyukov@google.com>2013-08-13 13:01:30 +0400
commite33e476e074c3f424ca5b9d14cf67acacd5250aa (patch)
tree17dc781f20f0f494e3429b5790a2077abbc36e1a /src/pkg/syscall/exec_linux.go
parent9707f269c1eb7ee68a2be93e87eb49d481fb1a84 (diff)
downloadgo-e33e476e074c3f424ca5b9d14cf67acacd5250aa.tar.xz
syscall: disable cpu profiling around fork
Fixes #5517. Fixes #5659. R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/12183044
Diffstat (limited to 'src/pkg/syscall/exec_linux.go')
-rw-r--r--src/pkg/syscall/exec_linux.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/pkg/syscall/exec_linux.go b/src/pkg/syscall/exec_linux.go
index 934c657712..f332b7069c 100644
--- a/src/pkg/syscall/exec_linux.go
+++ b/src/pkg/syscall/exec_linux.go
@@ -22,6 +22,10 @@ type SysProcAttr struct {
Pdeathsig Signal // Signal that the process will get when its parent dies (Linux only)
}
+// Implemented in runtime package.
+func runtime_BeforeFork()
+func runtime_AfterFork()
+
// Fork, dup fd onto 0..len(fd), and exec(argv0, argvv, envv) in child.
// If a dup or exec fails, write the errno error to pipe.
// (Pipe is close-on-exec so if exec succeeds, it will be closed.)
@@ -56,13 +60,16 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr
// About to call fork.
// No more allocation or calls of non-assembly functions.
+ runtime_BeforeFork()
r1, _, err1 = RawSyscall(SYS_FORK, 0, 0, 0)
if err1 != 0 {
+ runtime_AfterFork()
return 0, err1
}
if r1 != 0 {
// parent; return PID
+ runtime_AfterFork()
return int(r1), 0
}