diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2020-06-15 15:29:41 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2020-06-15 15:29:41 +0000 |
commit | 86476d56c2cae894d47711779ba6feee8523ce25 (patch) | |
tree | d8f2c5f42bc09ae30306dd02e4bfcf86b7a5c3ae /sys/kern/uipc_socket.c | |
parent | e4d9693938acba40c0757300ec31349367a49890 (diff) |
Set __EV_HUP when the conditions matching poll(2)'s POLLUP are found.
This is only done in poll-compatibility mode, when __EV_POLL is set.
ok visa@, millert@
Diffstat (limited to 'sys/kern/uipc_socket.c')
-rw-r--r-- | sys/kern/uipc_socket.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index d6f2eb6ca3c..68685c0d83f 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_socket.c,v 1.244 2020/04/12 16:15:18 anton Exp $ */ +/* $OpenBSD: uipc_socket.c,v 1.245 2020/06/15 15:29:40 mpi Exp $ */ /* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */ /* @@ -2064,6 +2064,10 @@ filt_soread(struct knote *kn, long hint) #endif /* SOCKET_SPLICE */ if (so->so_state & SS_CANTRCVMORE) { kn->kn_flags |= EV_EOF; + if (kn->kn_flags & __EV_POLL) { + if (so->so_state & SS_ISDISCONNECTED) + kn->kn_flags |= __EV_HUP; + } kn->kn_fflags = so->so_error; rv = 1; } else if (so->so_error) { /* temporary udp error */ @@ -2102,6 +2106,10 @@ filt_sowrite(struct knote *kn, long hint) kn->kn_data = sbspace(so, &so->so_snd); if (so->so_state & SS_CANTSENDMORE) { kn->kn_flags |= EV_EOF; + if (kn->kn_flags & __EV_POLL) { + if (so->so_state & SS_ISDISCONNECTED) + kn->kn_flags |= __EV_HUP; + } kn->kn_fflags = so->so_error; rv = 1; } else if (so->so_error) { /* temporary udp error */ |