summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Kondratyev <wulf@FreeBSD.org>2019-11-24 20:51:09 +0000
committerVladimir Kondratyev <wulf@FreeBSD.org>2019-11-24 20:51:09 +0000
commit71b8e362c50a19dfed30a2794bf65ba19b065c63 (patch)
tree2011888d79804564acd27ebd38fa89f1328439d7
parent335fe0afb843171110fa4266c599bd6b3081eeb7 (diff)
Notes
-rw-r--r--sys/compat/linux/linux_event.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/sys/compat/linux/linux_event.c b/sys/compat/linux/linux_event.c
index b73610ca8587..11299c36c788 100644
--- a/sys/compat/linux/linux_event.c
+++ b/sys/compat/linux/linux_event.c
@@ -557,13 +557,13 @@ linux_epoll_wait_common(struct thread *td, int epfd, struct epoll_event *events,
return (error);
if (epfp->f_type != DTYPE_KQUEUE) {
error = EINVAL;
- goto leave1;
+ goto leave;
}
if (uset != NULL) {
error = kern_sigprocmask(td, SIG_SETMASK, uset,
&omask, 0);
if (error != 0)
- goto leave1;
+ goto leave;
td->td_pflags |= TDP_OLDMASK;
/*
* Make sure that ast() is called on return to
@@ -581,11 +581,12 @@ linux_epoll_wait_common(struct thread *td, int epfd, struct epoll_event *events,
coargs.count = 0;
coargs.error = 0;
- if (timeout != -1) {
- if (timeout < 0) {
- error = EINVAL;
- goto leave0;
- }
+ /*
+ * Linux epoll_wait(2) man page states that timeout of -1 causes caller
+ * to block indefinitely. Real implementation does it if any negative
+ * timeout value is passed.
+ */
+ if (timeout >= 0) {
/* Convert from milliseconds to timespec. */
ts.tv_sec = timeout / 1000;
ts.tv_nsec = (timeout % 1000) * 1000000;
@@ -605,11 +606,10 @@ linux_epoll_wait_common(struct thread *td, int epfd, struct epoll_event *events,
if (error == 0)
td->td_retval[0] = coargs.count;
-leave0:
if (uset != NULL)
error = kern_sigprocmask(td, SIG_SETMASK, &omask,
NULL, 0);
-leave1:
+leave:
fdrop(epfp, td);
return (error);
}