diff options
| author | Ralf Jung <post@ralfj.de> | 2024-08-17 10:36:46 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-17 10:36:46 +0200 |
| commit | cab81d3fa96268472a121d8920fc59a9caa483df (patch) | |
| tree | ae1f31df6a3cb3280026a6da5be396807031a45f | |
| parent | f9a7d6ec6fefb417a59347aeb81e7b3eec09a3e7 (diff) | |
| download | rust-cab81d3fa96268472a121d8920fc59a9caa483df.tar.gz rust-cab81d3fa96268472a121d8920fc59a9caa483df.zip | |
extend comments on HUP vs RDHUP
| -rw-r--r-- | src/tools/miri/src/shims/unix/linux/epoll.rs | 3 | ||||
| -rw-r--r-- | src/tools/miri/src/shims/unix/socket.rs | 3 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/tools/miri/src/shims/unix/linux/epoll.rs b/src/tools/miri/src/shims/unix/linux/epoll.rs index a47d9fe0826..53f27868aeb 100644 --- a/src/tools/miri/src/shims/unix/linux/epoll.rs +++ b/src/tools/miri/src/shims/unix/linux/epoll.rs @@ -71,6 +71,9 @@ pub struct EpollReadyEvents { pub epollrdhup: bool, /// For stream socket, this event merely indicates that the peer /// closed its end of the channel. + /// Unlike epollrdhup, this should only be set when the stream is fully closed. + /// epollrdhup also gets set when only the write half is closed, which is possible + /// via `shutdown(_, SHUT_WR)`. pub epollhup: bool, } diff --git a/src/tools/miri/src/shims/unix/socket.rs b/src/tools/miri/src/shims/unix/socket.rs index f7c168c58b9..3f2adb6e79c 100644 --- a/src/tools/miri/src/shims/unix/socket.rs +++ b/src/tools/miri/src/shims/unix/socket.rs @@ -69,7 +69,8 @@ impl FileDescription for SocketPair { epoll_ready_events.epollout = true; } } else { - // Peer FD has been closed. + // Peer FD has been closed. This always sets both the RDHUP and HUP flags + // as we do not support `shutdown` that could be used to partially close the stream. epoll_ready_events.epollrdhup = true; epoll_ready_events.epollhup = true; // Since the peer is closed, even if no data is available reads will return EOF and |
