diff options
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/lib/brand/lx/lx_brand/common/lx_brand.c | 8 | ||||
-rw-r--r-- | usr/src/lib/brand/lx/lx_brand/common/misc.c | 18 | ||||
-rw-r--r-- | usr/src/lib/brand/lx/lx_brand/sys/lx_syscall.h | 2 | ||||
-rw-r--r-- | usr/src/uts/common/brand/lx/os/lx_syscall.c | 8 | ||||
-rw-r--r-- | usr/src/uts/common/brand/lx/sys/lx_syscalls.h | 2 | ||||
-rw-r--r-- | usr/src/uts/common/brand/lx/syscall/lx_epoll.c | 92 | ||||
-rw-r--r-- | usr/src/uts/intel/Makefile.files | 1 |
7 files changed, 103 insertions, 28 deletions
diff --git a/usr/src/lib/brand/lx/lx_brand/common/lx_brand.c b/usr/src/lib/brand/lx/lx_brand/common/lx_brand.c index dafbe9c862..6fa66d1343 100644 --- a/usr/src/lib/brand/lx/lx_brand/common/lx_brand.c +++ b/usr/src/lib/brand/lx/lx_brand/common/lx_brand.c @@ -1141,7 +1141,7 @@ static lx_syscall_handler_t lx_handlers[] = { lx_io_cancel, /* 210: io_cancel */ NULL, /* 211: get_thread_area */ NULL, /* 212: lookup_dcookie */ - lx_epoll_create, /* 213: epoll_create */ + NULL, /* 213: epoll_create */ NULL, /* 214: epoll_ctl_old */ NULL, /* 215: epoll_wait_old */ NULL, /* 216: remap_file_pages */ @@ -1219,7 +1219,7 @@ static lx_syscall_handler_t lx_handlers[] = { lx_accept4, /* 288: accept4 */ lx_signalfd4, /* 289: signalfd4 */ lx_eventfd2, /* 290: eventfd2 */ - lx_epoll_create1, /* 291: epoll_create1 */ + NULL, /* 291: epoll_create1 */ lx_dup3, /* 292: dup3 */ NULL, /* 293: pipe2 */ lx_inotify_init1, /* 294: inotify_init1 */ @@ -1513,7 +1513,7 @@ static lx_syscall_handler_t lx_handlers[] = { NULL, /* 251: nosys */ lx_group_exit, /* 252: group_exit */ NULL, /* 253: lookup_dcookie */ - lx_epoll_create, /* 254: epoll_create */ + NULL, /* 254: epoll_create */ lx_epoll_ctl, /* 255: epoll_ctl */ lx_epoll_wait, /* 256: epoll_wait */ NULL, /* 257: remap_file_pages */ @@ -1588,7 +1588,7 @@ static lx_syscall_handler_t lx_handlers[] = { lx_timerfd_gettime, /* 326: timerfd_gettime */ lx_signalfd4, /* 327: signalfd4 */ lx_eventfd2, /* 328: eventfd2 */ - lx_epoll_create1, /* 329: epoll_create1 */ + NULL, /* 329: epoll_create1 */ lx_dup3, /* 330: dup3 */ NULL, /* 331: pipe2 */ lx_inotify_init1, /* 332: inotify_init1 */ diff --git a/usr/src/lib/brand/lx/lx_brand/common/misc.c b/usr/src/lib/brand/lx/lx_brand/common/misc.c index 03a6df70dd..bedfff5d5b 100644 --- a/usr/src/lib/brand/lx/lx_brand/common/misc.c +++ b/usr/src/lib/brand/lx/lx_brand/common/misc.c @@ -675,24 +675,6 @@ lx_epoll_pwait(int epfd, void *events, int maxevents, int timeout, } long -lx_epoll_create(int size) -{ - int r; - - r = epoll_create(size); - return ((r == -1) ? -errno : r); -} - -long -lx_epoll_create1(int flags) -{ - int r; - - r = epoll_create1(flags); - return ((r == -1) ? -errno : r); -} - -long lx_epoll_wait(int epfd, void *events, int maxevents, int timeout) { int r; diff --git a/usr/src/lib/brand/lx/lx_brand/sys/lx_syscall.h b/usr/src/lib/brand/lx/lx_brand/sys/lx_syscall.h index 1ba5d81b07..7cdda82ebb 100644 --- a/usr/src/lib/brand/lx/lx_brand/sys/lx_syscall.h +++ b/usr/src/lib/brand/lx/lx_brand/sys/lx_syscall.h @@ -282,8 +282,6 @@ extern long lx_chroot(const char *); extern long lx_creat(const char *, mode_t); extern long lx_dup(int); extern long lx_epoll_pwait(int, void *, int, int, const sigset_t *); -extern long lx_epoll_create(int); -extern long lx_epoll_create1(int); extern long lx_epoll_wait(int, void *, int, int); extern long lx_eventfd(unsigned int); extern long lx_eventfd2(unsigned int, int); diff --git a/usr/src/uts/common/brand/lx/os/lx_syscall.c b/usr/src/uts/common/brand/lx/os/lx_syscall.c index c141a1ea28..c5058df787 100644 --- a/usr/src/uts/common/brand/lx/os/lx_syscall.c +++ b/usr/src/uts/common/brand/lx/os/lx_syscall.c @@ -777,7 +777,7 @@ lx_sysent_t lx_sysent32[] = { {"nosys", NULL, 0, 0}, /* 251 */ {"group_exit", NULL, 0, 1}, /* 252 */ {"lookup_dcookie", NULL, NOSYS_NO_EQUIV, 0}, /* 253 */ - {"epoll_create", NULL, 0, 1}, /* 254 */ + {"epoll_create", lx_epoll_create, 0, 1}, /* 254 */ {"epoll_ctl", NULL, 0, 4}, /* 255 */ {"epoll_wait", NULL, 0, 4}, /* 256 */ {"remap_file_pages", NULL, NOSYS_NO_EQUIV, 0}, /* 257 */ @@ -856,7 +856,7 @@ lx_sysent_t lx_sysent32[] = { {"timerfd_gettime", NULL, 0, 2}, /* 326 */ {"signalfd4", NULL, 0, 4}, /* 327 */ {"eventfd2", NULL, 0, 2}, /* 328 */ - {"epoll_create1", NULL, 0, 1}, /* 329 */ + {"epoll_create1", lx_epoll_create1, 0, 1}, /* 329 */ {"dup3", NULL, 0, 3}, /* 330 */ {"pipe2", lx_pipe2, 0, 2}, /* 331 */ {"inotify_init1", NULL, 0, 1}, /* 332 */ @@ -1107,7 +1107,7 @@ lx_sysent_t lx_sysent64[] = { {"io_cancel", NULL, 0, 3}, /* 210 */ {"get_thread_area", lx_get_thread_area, 0, 1}, /* 211 */ {"lookup_dcookie", NULL, NOSYS_NO_EQUIV, 0}, /* 212 */ - {"epoll_create", NULL, 0, 1}, /* 213 */ + {"epoll_create", lx_epoll_create, 0, 1}, /* 213 */ {"epoll_ctl_old", NULL, NOSYS_NULL, 0}, /* 214 */ {"epoll_wait_old", NULL, NOSYS_NULL, 0}, /* 215 */ {"remap_file_pages", NULL, NOSYS_NO_EQUIV, 0}, /* 216 */ @@ -1185,7 +1185,7 @@ lx_sysent_t lx_sysent64[] = { {"accept4", NULL, 0, 4}, /* 288 */ {"signalfd4", NULL, 0, 4}, /* 289 */ {"eventfd2", NULL, 0, 2}, /* 290 */ - {"epoll_create1", NULL, 0, 1}, /* 291 */ + {"epoll_create1", lx_epoll_create1, 0, 1}, /* 291 */ {"dup3", NULL, 0, 3}, /* 292 */ {"pipe2", lx_pipe2, 0, 2}, /* 293 */ {"inotify_init1", NULL, 0, 1}, /* 294 */ diff --git a/usr/src/uts/common/brand/lx/sys/lx_syscalls.h b/usr/src/uts/common/brand/lx/sys/lx_syscalls.h index 6ceb748914..fe8c0e3b61 100644 --- a/usr/src/uts/common/brand/lx/sys/lx_syscalls.h +++ b/usr/src/uts/common/brand/lx/sys/lx_syscalls.h @@ -44,6 +44,8 @@ extern long lx_clock_getres(); extern long lx_clock_gettime(); extern long lx_clock_settime(); extern long lx_connect(); +extern long lx_epoll_create(); +extern long lx_epoll_create1(); extern long lx_fallocate(); extern long lx_fallocate32(); extern long lx_fchmod(); diff --git a/usr/src/uts/common/brand/lx/syscall/lx_epoll.c b/usr/src/uts/common/brand/lx/syscall/lx_epoll.c new file mode 100644 index 0000000000..eec1caf631 --- /dev/null +++ b/usr/src/uts/common/brand/lx/syscall/lx_epoll.c @@ -0,0 +1,92 @@ +/* + * 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 + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2015 Joyent, Inc. + */ + +#include <sys/types.h> +#include <sys/systm.h> +#include <sys/thread.h> +#include <sys/proc.h> +#include <sys/zone.h> +#include <sys/brand.h> +#include <sys/epoll.h> +#include <sys/devpoll.h> +#include <sys/fcntl.h> +#include <sys/sunddi.h> +#include <sys/sunldi.h> +#include <sys/lx_brand.h> +#include <sys/lx_types.h> + +long +lx_epoll_create1(int flags) +{ + int err, fd, rv; + int fmode = FREAD | FWRITE; + boolean_t cloexec = B_FALSE; + vnode_t *vp = NULL; + file_t *fp = NULL; + + if (flags & EPOLL_CLOEXEC) { + cloexec = B_TRUE; + flags &= ~EPOLL_CLOEXEC; + } + if (flags != 0) { + /* No other flags accepted at this time */ + return (set_errno(EINVAL)); + } + + if (falloc((vnode_t *)NULL, fmode, &fp, &fd) != 0) { + err = EMFILE; + goto error; + } + if (ldi_vp_from_name("/devices/pseudo/poll@0:poll", &vp) != 0) { + err = ENOENT; + goto error; + } + if ((err = VOP_OPEN(&vp, fmode | FKLYR, CRED(), NULL)) != 0) { + goto error; + } + err = VOP_IOCTL(vp, DP_EPOLLCOMPAT, 0, fmode, CRED(), &rv, NULL); + if (err != 0) { + (void) VOP_CLOSE(vp, fmode, 0, 0, CRED(), NULL); + goto error; + } + + fp->f_vnode = vp; + mutex_exit(&fp->f_tlock); + setf(fd, fp); + if (cloexec) { + f_setfd(fd, FD_CLOEXEC); + } + return (fd); + +error: + if (fp != NULL) { + setf(fd, NULL); + unfalloc(fp); + } + if (vp != NULL) { + VN_RELE(vp); + } + return (set_errno(err)); +} + +long +lx_epoll_create(int size) +{ + if (size <= 0) { + return (set_errno(EINVAL)); + } + + return (lx_epoll_create1(0)); +} diff --git a/usr/src/uts/intel/Makefile.files b/usr/src/uts/intel/Makefile.files index 43eadd2bd3..8961b756d7 100644 --- a/usr/src/uts/intel/Makefile.files +++ b/usr/src/uts/intel/Makefile.files @@ -295,6 +295,7 @@ LX_BRAND_OBJS = \ lx_clone.o \ lx_cpu.o \ lx_errno.o \ + lx_epoll.o \ lx_fallocate.o \ lx_fcntl.o \ lx_futex.o \ |