--- ./fs/eventpoll.c.epoll1	2010-01-25 14:52:25.000000000 +0300
+++ ./fs/eventpoll.c	2010-01-25 20:26:51.000000000 +0300
@@ -206,7 +206,7 @@ struct ep_pqueue {
 
 static void ep_poll_safewake_init(struct poll_safewake *psw);
 static void ep_poll_safewake(struct poll_safewake *psw, wait_queue_head_t *wq);
-static int ep_getfd(int *efd, struct inode **einode, struct file **efile);
+static int ep_getfd(int *efd, struct inode **einode, struct file **efile, int flags);
 static int ep_file_init(struct file *file);
 static void ep_free(struct eventpoll *ep);
 struct epitem *ep_find(struct eventpoll *ep, struct file *file, int fd);
@@ -399,25 +399,24 @@ void eventpoll_release_file(struct file 
  * file descriptors inside the epoll interface. It is the kernel part of
  * the userspace epoll_create(2).
  */
-asmlinkage long sys_epoll_create(int size)
+asmlinkage long sys_epoll_create1(int flags)
 {
 	int error, fd;
 	struct inode *inode;
 	struct file *file;
 
-	DNPRINTK(3, (KERN_INFO "[%p] eventpoll: sys_epoll_create(%d)\n",
-		     current, size));
+	/* Check the EPOLL_* constant for consistency.  */
+	if (flags & ~EPOLL_CLOEXEC)
+		return -EINVAL;
 
-	/* Sanity check on the size parameter */
-	error = -EINVAL;
-	if (size <= 0)
-		goto eexit_1;
+	DNPRINTK(3, (KERN_INFO "[%p] eventpoll: sys_epoll_create(%d)\n",
+		     current, flags));
 
 	/*
 	 * Creates all the items needed to setup an eventpoll file. That is,
 	 * a file structure, and inode and a free file descriptor.
 	 */
-	error = ep_getfd(&fd, &inode, &file);
+	error = ep_getfd(&fd, &inode, &file, flags);
 	if (error)
 		goto eexit_1;
 
@@ -428,7 +427,7 @@ asmlinkage long sys_epoll_create(int siz
 
 
 	DNPRINTK(3, (KERN_INFO "[%p] eventpoll: sys_epoll_create(%d) = %d\n",
-		     current, size, fd));
+		     current, flags, fd));
 
 	return fd;
 
@@ -436,9 +435,19 @@ eexit_2:
 	sys_close(fd);
 eexit_1:
 	DNPRINTK(3, (KERN_INFO "[%p] eventpoll: sys_epoll_create(%d) = %d\n",
-		     current, size, error));
+		     current, flags, error));
 	return error;
 }
+
+asmlinkage long sys_epoll_create(int size)
+{
+	/* Sanity check on the size parameter */
+	if (size <= 0)
+		return -EINVAL;
+
+	return sys_epoll_create1(0);
+
+}
 EXPORT_SYMBOL(sys_epoll_create);
 
 
@@ -606,7 +615,7 @@ eexit_1:
 /*
  * Creates the file descriptor to be used by the epoll interface.
  */
-static int ep_getfd(int *efd, struct inode **einode, struct file **efile)
+static int ep_getfd(int *efd, struct inode **einode, struct file **efile, int flags)
 {
 	struct qstr this;
 	char name[32];
@@ -628,7 +637,7 @@ static int ep_getfd(int *efd, struct ino
 		goto eexit_2;
 
 	/* Allocates a free descriptor to plug the file onto */
-	error = get_unused_fd();
+	error = get_unused_fd_flags(flags);
 	if (error < 0)
 		goto eexit_3;
 	fd = error;
--- ./include/linux/eventpoll.h.epoll1	2010-01-25 14:52:26.000000000 +0300
+++ ./include/linux/eventpoll.h	2010-01-25 20:27:12.000000000 +0300
@@ -14,8 +14,12 @@
 #ifndef _LINUX_EVENTPOLL_H
 #define _LINUX_EVENTPOLL_H
 
+/* For O_CLOEXEC */
+#include <linux/fcntl.h>
 #include <linux/types.h>
 
+/* Flags for epoll_create1.  */
+#define EPOLL_CLOEXEC O_CLOEXEC
 
 /* Valid opcodes to issue to sys_epoll_ctl() */
 #define EPOLL_CTL_ADD 1
--- ./include/linux/syscalls.h.epoll1	2010-01-25 20:22:02.000000000 +0300
+++ ./include/linux/syscalls.h	2010-01-25 20:27:45.000000000 +0300
@@ -425,6 +425,7 @@ asmlinkage long sys_poll(struct pollfd _
 asmlinkage long sys_select(int n, fd_set __user *inp, fd_set __user *outp,
 			fd_set __user *exp, struct timeval __user *tvp);
 asmlinkage long sys_epoll_create(int size);
+asmlinkage long sys_epoll_create1(int flags);
 asmlinkage long sys_epoll_ctl(int epfd, int op, int fd,
 				struct epoll_event __user *event);
 asmlinkage long sys_epoll_wait(int epfd, struct epoll_event __user *events,
