summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAkshat Kumar <seed@mail.nanosouffle.net>2013-01-30 09:41:16 -0800
committerAkshat Kumar <seed@mail.nanosouffle.net>2013-01-30 09:41:16 -0800
commitf808b37bece53d8bd7697901dfcd4efd5ad2c926 (patch)
tree3d82c01fcdd5809e71c59e0fb83210525c30edf4 /src
parent57c94b0bd9cb053f01233b99b528aba57f8527bc (diff)
downloadgo-f808b37bece53d8bd7697901dfcd4efd5ad2c926.tar.gz
os: don't hold ForkLock across opens on Plan 9
If os.OpenFile holds ForkLock on files that block opens, then threads that simultaneously try to do fork-exec will get hung up (until the open succeeds). Blocked opens are common enough on Plan 9 that protecting against fd leaks into fork-execs means not being able to do fork-execs properly in the general case. Thus, we forgo taking the lock. R=rsc, ality CC=golang-dev https://codereview.appspot.com/7235066 Committer: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src')
-rw-r--r--src/pkg/os/file_plan9.go2
1 files changed, 0 insertions, 2 deletions
diff --git a/src/pkg/os/file_plan9.go b/src/pkg/os/file_plan9.go
index fb2f2347d..fabe5b979 100644
--- a/src/pkg/os/file_plan9.go
+++ b/src/pkg/os/file_plan9.go
@@ -104,7 +104,6 @@ func OpenFile(name string, flag int, perm FileMode) (file *File, err error) {
append = true
}
- syscall.ForkLock.RLock()
if (create && trunc) || excl {
fd, e = syscall.Create(name, flag, syscallMode(perm))
} else {
@@ -117,7 +116,6 @@ func OpenFile(name string, flag int, perm FileMode) (file *File, err error) {
}
}
}
- syscall.ForkLock.RUnlock()
if e != nil {
return nil, &PathError{"open", name, e}