* When poll(2)ing /dev/tty dev_dkqfilter gets called twice,
on the inner call, since EOPNOTSUPP is returned the outer
call returns ENODEV leading to a checkloop panic.
* A new testcase in test/testcases/io/poll_1 will panic
the system if started without this patch applied.
if (needmplock)
rel_mplock();
- if (error == 0)
+ if (error == 0)
return(ap.a_result);
+ else if (error == EOPNOTSUPP)
+ return(EOPNOTSUPP);
return(ENODEV);
}
SUBDIR+= select_1 select_2 select_3 select_4
SUBDIR+= sendfd_1
SUBDIR+= kqueue_1 kqueue_2
+SUBDIT+= poll_1
.include <bsd.subdir.mk>
--- /dev/null
+PROG= poll_1
+NOMAN=
+
+.include <bsd.prog.mk>
--- /dev/null
+#include <fcntl.h>
+#include <stdio.h>
+#include <poll.h>
+
+int main()
+{
+ struct pollfd fds[1];
+
+ int p = open("/dev/tty", O_RDWR);
+
+ printf("tty: %d\n", p);
+
+ fds[0].fd = p;
+ fds[0].events = 3;
+ fds[0].revents = 0;
+
+ poll(fds, 1, -1);
+
+ printf("polled\n");
+}