From e33e476e074c3f424ca5b9d14cf67acacd5250aa Mon Sep 17 00:00:00 2001 From: Dmitriy Vyukov Date: Tue, 13 Aug 2013 13:01:30 +0400 Subject: syscall: disable cpu profiling around fork Fixes #5517. Fixes #5659. R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/12183044 --- src/pkg/syscall/exec_linux.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/pkg/syscall/exec_linux.go') 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 } -- cgit v1.3