mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
os: move epipecheck from file_posix.go and into file_unix.go to fix windows build
R=golang-dev CC=golang-dev https://golang.org/cl/6450058
This commit is contained in:
parent
ab9ccedefe
commit
9c8ae6ca34
3 changed files with 14 additions and 11 deletions
|
|
@ -8,6 +8,7 @@ package os
|
|||
|
||||
import (
|
||||
"runtime"
|
||||
"sync/atomic"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
|
|
@ -53,6 +54,16 @@ type dirInfo struct {
|
|||
bufp int // location of next record in buf.
|
||||
}
|
||||
|
||||
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"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue