Commit 9c8ae6ca authored by Alex Brainman's avatar Alex Brainman

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
parent ab9ccede
...@@ -7,23 +7,12 @@ ...@@ -7,23 +7,12 @@
package os package os
import ( import (
"sync/atomic"
"syscall" "syscall"
"time" "time"
) )
func sigpipe() // implemented in package runtime func sigpipe() // implemented in package runtime
func epipecheck(file *File, e error) {
if e == syscall.EPIPE {
if atomic.AddInt32(&file.nepipe, 1) >= 10 {
sigpipe()
}
} else {
atomic.StoreInt32(&file.nepipe, 0)
}
}
// Link creates newname as a hard link to the oldname file. // Link creates newname as a hard link to the oldname file.
// If there is an error, it will be of type *LinkError. // If there is an error, it will be of type *LinkError.
func Link(oldname, newname string) error { func Link(oldname, newname string) error {
......
...@@ -8,6 +8,7 @@ package os ...@@ -8,6 +8,7 @@ package os
import ( import (
"runtime" "runtime"
"sync/atomic"
"syscall" "syscall"
) )
...@@ -53,6 +54,16 @@ type dirInfo struct { ...@@ -53,6 +54,16 @@ type dirInfo struct {
bufp int // location of next record in buf. 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.'' // DevNull is the name of the operating system's ``null device.''
// On Unix-like systems, it is "/dev/null"; on Windows, "NUL". // On Unix-like systems, it is "/dev/null"; on Windows, "NUL".
const DevNull = "/dev/null" const DevNull = "/dev/null"
......
...@@ -54,6 +54,9 @@ type dirInfo struct { ...@@ -54,6 +54,9 @@ type dirInfo struct {
path string path string
} }
func epipecheck(file *File, e error) {
}
const DevNull = "NUL" const DevNull = "NUL"
func (f *file) isdir() bool { return f != nil && f.dirinfo != nil } func (f *file) isdir() bool { return f != nil && f.dirinfo != nil }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment