Skip to content

Commit cab81d3

Browse files
authored
extend comments on HUP vs RDHUP
1 parent f9a7d6e commit cab81d3

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/tools/miri/src/shims/unix/linux/epoll.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ pub struct EpollReadyEvents {
7171
pub epollrdhup: bool,
7272
/// For stream socket, this event merely indicates that the peer
7373
/// closed its end of the channel.
74+
/// Unlike epollrdhup, this should only be set when the stream is fully closed.
75+
/// epollrdhup also gets set when only the write half is closed, which is possible
76+
/// via `shutdown(_, SHUT_WR)`.
7477
pub epollhup: bool,
7578
}
7679

src/tools/miri/src/shims/unix/socket.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ impl FileDescription for SocketPair {
6969
epoll_ready_events.epollout = true;
7070
}
7171
} else {
72-
// Peer FD has been closed.
72+
// Peer FD has been closed. This always sets both the RDHUP and HUP flags
73+
// as we do not support `shutdown` that could be used to partially close the stream.
7374
epoll_ready_events.epollrdhup = true;
7475
epoll_ready_events.epollhup = true;
7576
// Since the peer is closed, even if no data is available reads will return EOF and

0 commit comments

Comments
 (0)