summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/sys_pipe.c6
-rw-r--r--sys/kern/tty.c4
-rw-r--r--sys/kern/tty_pty.c4
-rw-r--r--sys/kern/uipc_socket.c10
4 files changed, 20 insertions, 4 deletions
diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c
index fc221bfd8f1..7a05ad0649f 100644
--- a/sys/kern/sys_pipe.c
+++ b/sys/kern/sys_pipe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sys_pipe.c,v 1.119 2020/04/07 13:27:51 visa Exp $ */
+/* $OpenBSD: sys_pipe.c,v 1.120 2020/06/15 15:29:40 mpi Exp $ */
/*
* Copyright (c) 1996 John S. Dyson
@@ -967,6 +967,8 @@ filt_piperead(struct knote *kn, long hint)
if ((hint & NOTE_SUBMIT) == 0)
rw_exit_read(lock);
kn->kn_flags |= EV_EOF;
+ if (kn->kn_flags & __EV_POLL)
+ kn->kn_flags |= __EV_HUP;
return (1);
}
@@ -991,6 +993,8 @@ filt_pipewrite(struct knote *kn, long hint)
rw_exit_read(lock);
kn->kn_data = 0;
kn->kn_flags |= EV_EOF;
+ if (kn->kn_flags & __EV_POLL)
+ kn->kn_flags |= __EV_HUP;
return (1);
}
kn->kn_data = wpipe->pipe_buffer.size - wpipe->pipe_buffer.cnt;
diff --git a/sys/kern/tty.c b/sys/kern/tty.c
index 738ca2698df..08b44aff92d 100644
--- a/sys/kern/tty.c
+++ b/sys/kern/tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty.c,v 1.156 2020/05/29 04:42:25 deraadt Exp $ */
+/* $OpenBSD: tty.c,v 1.157 2020/06/15 15:29:40 mpi Exp $ */
/* $NetBSD: tty.c,v 1.68.4.2 1996/06/06 16:04:52 thorpej Exp $ */
/*-
@@ -1155,6 +1155,8 @@ filt_ttyread(struct knote *kn, long hint)
splx(s);
if (!ISSET(tp->t_cflag, CLOCAL) && !ISSET(tp->t_state, TS_CARR_ON)) {
kn->kn_flags |= EV_EOF;
+ if (kn->kn_flags & __EV_POLL)
+ kn->kn_flags |= __EV_HUP;
return (1);
}
return (kn->kn_data > 0);
diff --git a/sys/kern/tty_pty.c b/sys/kern/tty_pty.c
index 693abddfd29..97f41437f8d 100644
--- a/sys/kern/tty_pty.c
+++ b/sys/kern/tty_pty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty_pty.c,v 1.99 2020/05/21 09:34:06 mpi Exp $ */
+/* $OpenBSD: tty_pty.c,v 1.100 2020/06/15 15:29:40 mpi Exp $ */
/* $NetBSD: tty_pty.c,v 1.33.4.1 1996/06/02 09:08:11 mrg Exp $ */
/*
@@ -678,6 +678,8 @@ filt_ptcread(struct knote *kn, long hint)
if (!ISSET(tp->t_state, TS_CARR_ON)) {
kn->kn_flags |= EV_EOF;
+ if (kn->kn_flags & __EV_POLL)
+ kn->kn_flags |= __EV_HUP;
return (1);
}
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 */