.quad compat_sys_timerfd_settime /* 325 */
.quad compat_sys_timerfd_gettime
.quad compat_sys_signalfd4
+ .quad sys_eventfd2
ia32_syscall_end:
.long sys_timerfd_settime /* 325 */
.long sys_timerfd_gettime
.long sys_signalfd4
+ .long sys_eventfd2
return file;
}
-asmlinkage long sys_eventfd(unsigned int count)
+asmlinkage long sys_eventfd2(unsigned int count, int flags)
{
int fd;
struct eventfd_ctx *ctx;
+ if (flags & ~EFD_CLOEXEC)
+ return -EINVAL;
+
ctx = kmalloc(sizeof(*ctx), GFP_KERNEL);
if (!ctx)
return -ENOMEM;
* When we call this, the initialization must be complete, since
* anon_inode_getfd() will install the fd.
*/
- fd = anon_inode_getfd("[eventfd]", &eventfd_fops, ctx, 0);
+ fd = anon_inode_getfd("[eventfd]", &eventfd_fops, ctx,
+ flags & O_CLOEXEC);
if (fd < 0)
kfree(ctx);
return fd;
}
+asmlinkage long sys_eventfd(unsigned int count)
+{
+ return sys_eventfd2(count, 0);
+}
+
#define __NR_timerfd_settime 325
#define __NR_timerfd_gettime 326
#define __NR_signalfd4 327
+#define __NR_eventfd2 328
#ifdef __KERNEL__
__SYSCALL(__NR_paccept, sys_paccept)
#define __NR_signalfd4 289
__SYSCALL(__NR_signalfd4, sys_signalfd4)
+#define __NR_eventfd2 290
+__SYSCALL(__NR_eventfd2, sys_eventfd2)
#ifndef __NO_STUBS
#ifdef CONFIG_EVENTFD
+/* For O_CLOEXEC */
+#include <linux/fcntl.h>
+
+/* Flags for eventfd2. */
+#define EFD_CLOEXEC O_CLOEXEC
+
struct file *eventfd_fget(int fd);
int eventfd_signal(struct file *file, int n);
struct itimerspec __user *otmr);
asmlinkage long sys_timerfd_gettime(int ufd, struct itimerspec __user *otmr);
asmlinkage long sys_eventfd(unsigned int count);
+asmlinkage long sys_eventfd2(unsigned int count, int flags);
asmlinkage long sys_fallocate(int fd, int mode, loff_t offset, loff_t len);
int kernel_execve(const char *filename, char *const argv[], char *const envp[]);
cond_syscall(compat_sys_timerfd_settime);
cond_syscall(compat_sys_timerfd_gettime);
cond_syscall(sys_eventfd);
+cond_syscall(sys_eventfd2);