aboutsummaryrefslogtreecommitdiffstats
path: root/fs/eventpoll.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/eventpoll.c')
-rw-r--r--fs/eventpoll.c35
1 files changed, 23 insertions, 12 deletions
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 990c01d2d66b..7cc0eb756b55 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -1041,25 +1041,27 @@ retry:
1041} 1041}
1042 1042
1043/* 1043/*
1044 * It opens an eventpoll file descriptor. The "size" parameter is there 1044 * Open an eventpoll file descriptor.
1045 * for historical reasons, when epoll was using an hash instead of an
1046 * RB tree. With the current implementation, the "size" parameter is ignored
1047 * (besides sanity checks).
1048 */ 1045 */
1049asmlinkage long sys_epoll_create(int size) 1046asmlinkage long sys_epoll_create1(int flags)
1050{ 1047{
1051 int error, fd = -1; 1048 int error, fd = -1;
1052 struct eventpoll *ep; 1049 struct eventpoll *ep;
1053 1050
1051 /* Check the EPOLL_* constant for consistency. */
1052 BUILD_BUG_ON(EPOLL_CLOEXEC != O_CLOEXEC);
1053
1054 if (flags & ~EPOLL_CLOEXEC)
1055 return -EINVAL;
1056
1054 DNPRINTK(3, (KERN_INFO "[%p] eventpoll: sys_epoll_create(%d)\n", 1057 DNPRINTK(3, (KERN_INFO "[%p] eventpoll: sys_epoll_create(%d)\n",
1055 current, size)); 1058 current, flags));
1056 1059
1057 /* 1060 /*
1058 * Sanity check on the size parameter, and create the internal data 1061 * Create the internal data structure ( "struct eventpoll" ).
1059 * structure ( "struct eventpoll" ).
1060 */ 1062 */
1061 error = -EINVAL; 1063 error = ep_alloc(&ep);
1062 if (size <= 0 || (error = ep_alloc(&ep)) < 0) { 1064 if (error < 0) {
1063 fd = error; 1065 fd = error;
1064 goto error_return; 1066 goto error_return;
1065 } 1067 }
@@ -1068,17 +1070,26 @@ asmlinkage long sys_epoll_create(int size)
1068 * Creates all the items needed to setup an eventpoll file. That is, 1070 * Creates all the items needed to setup an eventpoll file. That is,
1069 * a file structure and a free file descriptor. 1071 * a file structure and a free file descriptor.
1070 */ 1072 */
1071 fd = anon_inode_getfd("[eventpoll]", &eventpoll_fops, ep); 1073 fd = anon_inode_getfd("[eventpoll]", &eventpoll_fops, ep,
1074 flags & O_CLOEXEC);
1072 if (fd < 0) 1075 if (fd < 0)
1073 ep_free(ep); 1076 ep_free(ep);
1074 1077
1075error_return: 1078error_return:
1076 DNPRINTK(3, (KERN_INFO "[%p] eventpoll: sys_epoll_create(%d) = %d\n", 1079 DNPRINTK(3, (KERN_INFO "[%p] eventpoll: sys_epoll_create(%d) = %d\n",
1077 current, size, fd)); 1080 current, flags, fd));
1078 1081
1079 return fd; 1082 return fd;
1080} 1083}
1081 1084
1085asmlinkage long sys_epoll_create(int size)
1086{
1087 if (size < 0)
1088 return -EINVAL;
1089
1090 return sys_epoll_create1(0);
1091}
1092
1082/* 1093/*
1083 * The following function implements the controller interface for 1094 * The following function implements the controller interface for
1084 * the eventpoll file that enables the insertion/removal/change of 1095 * the eventpoll file that enables the insertion/removal/change of