summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorPatrick Mooney <pmooney@pfmooney.com>2020-06-27 22:43:08 +0000
committerPatrick Mooney <pmooney@oxide.computer>2020-07-08 15:06:27 +0000
commit66373fa702508a0a41753138f0b10f985c7e058d (patch)
tree51f222854dadb3bf79c8050e8db96aa2bbb47c50 /usr/src
parent33f84ecfada5880d94e9bfc5af7954d41e5664d5 (diff)
downloadillumos-joyent-66373fa702508a0a41753138f0b10f985c7e058d.tar.gz
12902 epoll should nominally support EPOLLEXCLUSIVE
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com> Reviewed by: Mike Zeller <mike.zeller@joyent.com> Approved by: Dan McDonald <danmcd@joyent.com>
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/lib/libc/port/sys/epoll.c8
-rw-r--r--usr/src/man/man3c/epoll_ctl.3c20
-rw-r--r--usr/src/uts/common/sys/epoll.h2
3 files changed, 28 insertions, 2 deletions
diff --git a/usr/src/lib/libc/port/sys/epoll.c b/usr/src/lib/libc/port/sys/epoll.c
index e510b0b247..230860d391 100644
--- a/usr/src/lib/libc/port/sys/epoll.c
+++ b/usr/src/lib/libc/port/sys/epoll.c
@@ -11,6 +11,7 @@
/*
* Copyright 2017 Joyent, Inc.
+ * Copyright 2020 Oxide Computer Company
*/
#include <sys/types.h>
@@ -56,7 +57,7 @@
* Events that we ignore entirely. They can be set in events, but they will
* never be returned.
*/
-#define EPOLLIGNORED (EPOLLMSG | EPOLLWAKEUP)
+#define EPOLLIGNORED (EPOLLMSG | EPOLLWAKEUP | EPOLLEXCLUSIVE)
/*
* Events that we swizzle into other bit positions.
@@ -140,6 +141,11 @@ epoll_ctl(int epfd, int op, int fd, struct epoll_event *event)
break;
case EPOLL_CTL_MOD:
+ /* EPOLLEXCLUSIVE is prohibited for modify operations */
+ if ((event->events & EPOLLEXCLUSIVE) != 0) {
+ errno = EINVAL;
+ return (-1);
+ }
/*
* In the modify case, we pass down two events: one to
* remove the event and another to add it back.
diff --git a/usr/src/man/man3c/epoll_ctl.3c b/usr/src/man/man3c/epoll_ctl.3c
index 3b3dfabcba..b80efb8b33 100644
--- a/usr/src/man/man3c/epoll_ctl.3c
+++ b/usr/src/man/man3c/epoll_ctl.3c
@@ -1,5 +1,6 @@
'\" te
.\" Copyright (c) 2014, Joyent, Inc. All Rights Reserved.
+.\" Copyright 2020 Oxide Computer Company
.\" This file and its contents are supplied under the terms of the
.\" Common Development and Distribution License ("CDDL"), version 1.0.
.\" You may only use this file in accordance with the terms of version
@@ -8,7 +9,7 @@
.\" A full copy of the text of the CDDL should have accompanied this
.\" source. A copy of the CDDL is also available via the Internet at
.\" http://www.illumos.org/license/CDDL.
-.TH EPOLL_CTL 3C "April 9, 2016"
+.TH EPOLL_CTL 3C "June 29, 2020"
.SH NAME
epoll_ctl \- control an epoll instance
.SH SYNOPSIS
@@ -206,6 +207,23 @@ exclusive with \fBEPOLLIN\fR.
.sp
.ne 2
.na
+\fBEPOLLEXCLUSIVE\fR
+.ad
+.RS 14n
+This is present for binary compatibility and is effectively a no-op on illumos.
+
+The flag was added to Linux in v4.5 to provide a means to mitigate thundering
+herd problems when multiple epoll instances contain the same event source. Set
+on a specified event source during \fBEPOLL_CTL_ADD\fR (and not allowed with
+\fBEPOLL_CTL_MOD\fR), it indicates that epoll should attempt to limit the scope
+of pollers woken when a shared target resource changes state. All pollers
+without the flag set in the event will be notified and one \fIor more\fR of
+those with it set will be as well.
+.RE
+
+.sp
+.ne 2
+.na
\fBEPOLLWAKEUP\fR
.ad
.RS 14n
diff --git a/usr/src/uts/common/sys/epoll.h b/usr/src/uts/common/sys/epoll.h
index f2e4b90ab7..3b38d9f629 100644
--- a/usr/src/uts/common/sys/epoll.h
+++ b/usr/src/uts/common/sys/epoll.h
@@ -11,6 +11,7 @@
/*
* Copyright (c) 2014, Joyent, Inc. All rights reserved.
+ * Copyright 2020 Oxide Computer Company
*/
#ifndef _SYS_EPOLL_H
@@ -60,6 +61,7 @@ typedef struct epoll_event {
#define EPOLLHUP 0x0010
#define EPOLLRDHUP 0x2000
+#define EPOLLEXCLUSIVE (1UL << 28) /* sets exclusive wake-up mode */
#define EPOLLWAKEUP (1UL << 29) /* no meaning; silently ignored */
#define EPOLLONESHOT (1UL << 30) /* translated to POLLONESHOT */
#define EPOLLET (1UL << 31) /* translated to POLLET */