aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2019-01-09 10:04:58 -0800
committerIan Lance Taylor <iant@golang.org>2019-01-09 21:50:11 +0000
commita5318bf5d676b3dfc10a1843668e3593cbdc87c5 (patch)
tree00fa30aa532e5a20c7568cfb74a41b14c4c61e4b
parent9a5a5043e10dbc8338e21b8c7f4081a56a019b7d (diff)
downloadgo-a5318bf5d676b3dfc10a1843668e3593cbdc87c5.tar.gz
go-a5318bf5d676b3dfc10a1843668e3593cbdc87c5.zip
os: always treat files as unpollable on FreeBSD
Fixes #29633 Updates #27619 Change-Id: I1e38569ea2a02423b028331f2ed987d3ae47fd2e Reviewed-on: https://go-review.googlesource.com/c/157099 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
-rw-r--r--src/os/file_unix.go22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/os/file_unix.go b/src/os/file_unix.go
index c91efa8185..7d68a7659f 100644
--- a/src/os/file_unix.go
+++ b/src/os/file_unix.go
@@ -123,15 +123,25 @@ func newFile(fd uintptr, name string, kind newFileKind) *File {
if kind == kindOpenFile {
var st syscall.Stat_t
switch runtime.GOOS {
- // Don't try to use kqueue with regular files on *BSDs.
- // on FreeBSD with older kernels it used to crash the system unpredictably while running all.bash.
- // while with newer kernels a regular file is always reported as ready for writing.
- // on Dragonfly, NetBSD and OpenBSD the fd is signaled only once as ready (both read and write).
- // Issue 19093.
- case "dragonfly", "freebsd", "netbsd", "openbsd":
+ case "freebsd":
+ // On FreeBSD before 10.4 it used to crash the
+ // system unpredictably while running all.bash.
+ // When we stop supporting FreeBSD 10 we can merge
+ // this into the dragonfly/netbsd/openbsd case.
+ // Issue 27619.
+ pollable = false
+
+ case "dragonfly", "netbsd", "openbsd":
+ // Don't try to use kqueue with regular files on *BSDs.
+ // On FreeBSD a regular file is always
+ // reported as ready for writing.
+ // On Dragonfly, NetBSD and OpenBSD the fd is signaled
+ // only once as ready (both read and write).
+ // Issue 19093.
if err := syscall.Fstat(fdi, &st); err == nil && st.Mode&syscall.S_IFMT == syscall.S_IFREG {
pollable = false
}
+
case "darwin":
// In addition to the behavior described above for regular files,
// on Darwin, kqueue does not work properly with fifos: