aboutsummaryrefslogtreecommitdiffstats
path: root/fs/eventfd.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/eventfd.c')
-rw-r--r--fs/eventfd.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/fs/eventfd.c b/fs/eventfd.c
index 6094265ca409..bd420e6478ad 100644
--- a/fs/eventfd.c
+++ b/fs/eventfd.c
@@ -198,11 +198,14 @@ struct file *eventfd_fget(int fd)
198 return file; 198 return file;
199} 199}
200 200
201asmlinkage long sys_eventfd(unsigned int count) 201asmlinkage long sys_eventfd2(unsigned int count, int flags)
202{ 202{
203 int fd; 203 int fd;
204 struct eventfd_ctx *ctx; 204 struct eventfd_ctx *ctx;
205 205
206 if (flags & ~EFD_CLOEXEC)
207 return -EINVAL;
208
206 ctx = kmalloc(sizeof(*ctx), GFP_KERNEL); 209 ctx = kmalloc(sizeof(*ctx), GFP_KERNEL);
207 if (!ctx) 210 if (!ctx)
208 return -ENOMEM; 211 return -ENOMEM;
@@ -214,9 +217,15 @@ asmlinkage long sys_eventfd(unsigned int count)
214 * When we call this, the initialization must be complete, since 217 * When we call this, the initialization must be complete, since
215 * anon_inode_getfd() will install the fd. 218 * anon_inode_getfd() will install the fd.
216 */ 219 */
217 fd = anon_inode_getfd("[eventfd]", &eventfd_fops, ctx, 0); 220 fd = anon_inode_getfd("[eventfd]", &eventfd_fops, ctx,
221 flags & O_CLOEXEC);
218 if (fd < 0) 222 if (fd < 0)
219 kfree(ctx); 223 kfree(ctx);
220 return fd; 224 return fd;
221} 225}
222 226
227asmlinkage long sys_eventfd(unsigned int count)
228{
229 return sys_eventfd2(count, 0);
230}
231