Adjust pty case for kqueue-based poll(2)
authorvisa <visa@openbsd.org>
Sat, 25 Dec 2021 11:27:19 +0000 (11:27 +0000)
committervisa <visa@openbsd.org>
Sat, 25 Dec 2021 11:27:19 +0000 (11:27 +0000)
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

index ad4d7eb..a292bd9 100644 (file)
@@ -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: