diff options
author | Ian Lance Taylor <iant@golang.org> | 2015-03-26 08:02:16 -0700 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2015-03-26 17:29:08 +0000 |
commit | 28074d5baad961f931df9895c57a82d164641f06 (patch) | |
tree | dd528561e322bdb79e9965df076e107e9d3b0cb0 /src/syscall/zsyscall_freebsd_386.go | |
parent | ec2c7e6659c1ab3a10dc74df2c1303b749fbc364 (diff) | |
download | go-git-28074d5baad961f931df9895c57a82d164641f06.tar.gz |
syscall: change Dup,Dup2,Dup3 to use Syscall, not RawSyscall
This avoids hanging when a Go program uses a FUSE filesystem and the
dup system call has to close a file descriptor. When dup uses
RawSyscall then the goroutine calling dup will occupy a scheduler slot
(a p structure) during the call, and may block waiting for some other
goroutine to respond to the close call on the FUSE filesystem.
Changing to Syscall avoids the problem. This makes Dup a tiny bit
slower but is quite unlikely to make a difference for any real
programs.
Fixes #10202.
Change-Id: If6490a8f9b3c9cfed6acbfb4bfd1eaeac62ced17
Reviewed-on: https://go-review.googlesource.com/8095
Reviewed-by: Rob Pike <r@golang.org>
Diffstat (limited to 'src/syscall/zsyscall_freebsd_386.go')
-rw-r--r-- | src/syscall/zsyscall_freebsd_386.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/syscall/zsyscall_freebsd_386.go b/src/syscall/zsyscall_freebsd_386.go index c8c636fa11..8264305fcb 100644 --- a/src/syscall/zsyscall_freebsd_386.go +++ b/src/syscall/zsyscall_freebsd_386.go @@ -389,7 +389,7 @@ func Close(fd int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup(fd int) (nfd int, err error) { - r0, _, e1 := RawSyscall(SYS_DUP, uintptr(fd), 0, 0) + r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0) nfd = int(r0) if e1 != 0 { err = e1 @@ -400,7 +400,7 @@ func Dup(fd int) (nfd int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup2(from int, to int) (err error) { - _, _, e1 := RawSyscall(SYS_DUP2, uintptr(from), uintptr(to), 0) + _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0) if e1 != 0 { err = e1 } |