/*
* 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
* 1.0 of the CDDL.
*
* 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
*/
/*
* Copyright 2016 Joyent, Inc.
*/
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <poll.h>
/*
* Events that match their epoll(7) equivalents.
*/
#endif
#endif
#endif
#if EPOLLRDNORM != POLLRDNORM
#endif
#if EPOLLRDBAND != POLLRDBAND
#endif
#endif
#endif
/*
* Events that we ignore entirely. They can be set in events, but they will
* never be returned.
*/
/*
* Events that we swizzle into other bit positions.
*/
#define EPOLLSWIZZLED \
int
{
int fd;
/*
* From the epoll_create() man page: "Since Linux 2.6.8, the size
* argument is ignored, but must be greater than zero." You keep using
* that word "ignored"...
*/
if (size <= 0) {
return (-1);
}
return (-1);
return (-1);
}
return (fd);
}
int
{
if (flags & EPOLL_CLOEXEC) {
flags ^= EPOLL_CLOEXEC;
}
/* Reject unrecognized flags */
if (flags != 0) {
return (-1);
}
return (-1);
return (-1);
}
return (fd);
}
int
{
int i = 0, res;
switch (op) {
case EPOLL_CTL_DEL:
ev = POLLREMOVE;
break;
case EPOLL_CTL_MOD:
/*
* In the modify case, we pass down two events: one to
* remove the event and another to add it back.
*/
/* FALLTHROUGH */
case EPOLL_CTL_ADD:
/*
* Mask off the events that we ignore, and then swizzle the
* events for which our values differ from their epoll(7)
* equivalents.
*/
if (events & EPOLLRDHUP)
if (events & EPOLLONESHOT)
ev |= POLLONESHOT;
if (events & EPOLLWRNORM)
ev |= POLLWRNORM;
if (events & EPOLLWRBAND)
ev |= POLLWRBAND;
break;
default:
errno = EOPNOTSUPP;
return (-1);
}
if (res == -1) {
/*
* Linux does not document EINTR as an allowed error
* for epoll_ctl. The write must be retried if it is
* not done automatically via SA_RESTART.
*/
goto retry;
}
/*
* loop into what is expected from the Linux epoll
* interface.
*/
}
return (-1);
}
return (0);
}
int
{
if (maxevents <= 0) {
return (-1);
}
}
int
{
if (maxevents <= 0) {
return (-1);
}
}