diff options
author | Ian Lance Taylor <iant@golang.org> | 2017-10-19 16:01:43 -0700 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2017-10-20 22:26:30 +0000 |
commit | 23aad448b1e3f7c3b4ba2af90120bde91ac865b4 (patch) | |
tree | d0b60cd4e817998a50a07b9ce62b92954b110e69 /src/runtime/defs_dragonfly.go | |
parent | 4e64ee423c3a755ed31c3c98bfba98adc5995b4a (diff) | |
download | go-23aad448b1e3f7c3b4ba2af90120bde91ac865b4.tar.gz go-23aad448b1e3f7c3b4ba2af90120bde91ac865b4.zip |
runtime: for kqueue treat EVFILT_READ with EV_EOF as permitting a write
On systems that use kqueue, we always register descriptors for both
EVFILT_READ and EVFILT_WRITE. On at least FreeBSD and OpenBSD, when
the write end of a pipe is registered for EVFILT_READ and EVFILT_WRITE
events, and the read end of the pipe is closed, kqueue reports an
EVFILT_READ event with EV_EOF set, but does not report an EVFILT_WRITE
event. Since the write to the pipe is waiting for an EVFILT_WRITE
event, closing the read end of a pipe can cause the write end to hang
rather than attempt another write which will fail with EPIPE.
Fix this by treating EVFILT_READ with EV_EOF set as making both reads
and writes ready to proceed.
The real test for this is in CL 71770, which tests using various
timeouts with pipes.
Updates #22114
Change-Id: Ib23fbaaddbccd8eee77bdf18f27a7f0aa50e2742
Reviewed-on: https://go-review.googlesource.com/71973
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/runtime/defs_dragonfly.go')
-rw-r--r-- | src/runtime/defs_dragonfly.go | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/runtime/defs_dragonfly.go b/src/runtime/defs_dragonfly.go index ed00be0f44..95014fe6e7 100644 --- a/src/runtime/defs_dragonfly.go +++ b/src/runtime/defs_dragonfly.go @@ -103,6 +103,7 @@ const ( EV_DELETE = C.EV_DELETE EV_CLEAR = C.EV_CLEAR EV_ERROR = C.EV_ERROR + EV_EOF = C.EV_EOF EVFILT_READ = C.EVFILT_READ EVFILT_WRITE = C.EVFILT_WRITE ) |