summaryrefslogtreecommitdiff
path: root/libgo/go/os/file_unix.go
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2012-10-03 05:27:36 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2012-10-03 05:27:36 +0000
commitbd2e46c8255fad4e75e589b3286ead560e910b39 (patch)
tree4f194bdb2e9edcc69ef2ab0dfb4aab15ca259267 /libgo/go/os/file_unix.go
parentbed6238ce677ba18a672a58bc077cec6de47f8d3 (diff)
libgo: Update to Go 1.0.3.
From-SVN: r192025
Diffstat (limited to 'libgo/go/os/file_unix.go')
-rw-r--r--libgo/go/os/file_unix.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/libgo/go/os/file_unix.go b/libgo/go/os/file_unix.go
index b8fb2e22c98..f677dbb986a 100644
--- a/libgo/go/os/file_unix.go
+++ b/libgo/go/os/file_unix.go
@@ -8,6 +8,7 @@ package os
import (
"runtime"
+ "sync/atomic"
"syscall"
)
@@ -24,7 +25,7 @@ type file struct {
fd int
name string
dirinfo *dirInfo // nil unless directory being read
- nepipe int // number of consecutive EPIPE in Write
+ nepipe int32 // number of consecutive EPIPE in Write
}
// Fd returns the integer Unix file descriptor referencing the open file.
@@ -52,6 +53,16 @@ type dirInfo struct {
dir *syscall.DIR // from opendir
}
+func epipecheck(file *File, e error) {
+ if e == syscall.EPIPE {
+ if atomic.AddInt32(&file.nepipe, 1) >= 10 {
+ sigpipe()
+ }
+ } else {
+ atomic.StoreInt32(&file.nepipe, 0)
+ }
+}
+
// DevNull is the name of the operating system's ``null device.''
// On Unix-like systems, it is "/dev/null"; on Windows, "NUL".
const DevNull = "/dev/null"