From 1f4e9e88ac79782db42ee32d9a37623f1a181512 Mon Sep 17 00:00:00 2001 From: visa Date: Sat, 25 Dec 2021 11:27:19 +0000 Subject: [PATCH] Adjust pty case for kqueue-based poll(2) Unlike the old code, kqueue-based poll(2) sets POLLIN when the other end of a pty has been closed. Calling read(2) on such a pty returns zero anyway. FreeBSD sets POLLIN too. --- regress/sys/kern/poll/poll_iocond.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/regress/sys/kern/poll/poll_iocond.c b/regress/sys/kern/poll/poll_iocond.c index ad4d7eb6d49..a292bd9166c 100644 --- a/regress/sys/kern/poll/poll_iocond.c +++ b/regress/sys/kern/poll/poll_iocond.c @@ -1,4 +1,4 @@ -/* $OpenBSD: poll_iocond.c,v 1.1 2021/12/06 05:52:07 visa Exp $ */ +/* $OpenBSD: poll_iocond.c,v 1.2 2021/12/25 11:27:19 visa Exp $ */ /* * Copyright (c) 2021 Visa Hankala @@ -804,14 +804,8 @@ proc_parent(int fd, int bfd) assert(pfd[0].revents == POLLHUP); assert(pfd[1].revents == POLLHUP); #else - /* XXX */ - if (filetype == FTYPE_PTY) { - assert(pfd[0].revents == POLLHUP); - assert(pfd[1].revents == POLLHUP); - } else { - assert(pfd[0].revents == (POLLIN | POLLHUP)); - assert(pfd[1].revents == POLLHUP); - } + assert(pfd[0].revents == (POLLIN | POLLHUP)); + assert(pfd[1].revents == POLLHUP); #endif break; case FTYPE_SOCKET_TCP: -- 2.20.1