Skip to contentSkip to conversation

epoll: remove unnecessary bit operation in epoll_create1 syscall

PATCH In review Namhyung Kim 3 participants 3 messages Jan 12, 2011 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 epoll: remove unnecessary bit operation in epoll_create1 syscall

@flags can have O_CLOEXEC only so bitwise AND is not necessary.

---
 fs/eventpoll.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/eventpoll.c +1 -1
index 8cf07242067d..2e21fb85b8b6 100644
@@ -1209,7 +1209,7 @@ SYSCALL_DEFINE1(epoll_create1, int, flags)
 	 * a file structure and a free file descriptor.
 	 */
 	error = anon_inode_getfd("[eventpoll]", &eventpoll_fops, ep,
-				 O_RDWR | (flags & O_CLOEXEC));
+				 O_RDWR | flags);
 	if (error < 0)
 		ep_free(ep);
 
Signature · 1 line
1.7.3.4.600.g982838b0
#1 lore raw
Quoted 12 lines · Namhyung Kim

@flags can have O_CLOEXEC only so bitwise AND is not necessary.

---
 fs/eventpoll.c |    2 +-

 1 files changed, 1 insertions(+), 1 deletions(-)
fs/eventpoll.c +0 -0
index 8cf07242067d..2e21fb85b8b6 100644

fs/eventpoll.c SYSCALL_DEFINE1(epoll_create1, int, flags) · line 1212

Quoted 5 lines
fs/eventpoll.c +1 -1
@@ -1209,7 +1209,7 @@ SYSCALL_DEFINE1(epoll_create1, int, flags)
         * a file structure and a free file descriptor.
         */
        error = anon_inode_getfd("[eventpoll]", &eventpoll_fops, ep,
-                                O_RDWR | (flags & O_CLOEXEC));
+                                O_RDWR | flags);

I'm strong against this.
Whenever a new flag is allowed this will explode...

Quoted 12 lines
fs/eventpoll.c +0 -1
        if (error < 0)
                ep_free(ep);
 
--

1.7.3.4.600.g982838b0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Signature · 2 lines
Thanks,
//richard
#2 lore raw
Quoted 8 lines · richard -rw- weinberger
Quoted 7 lines · Namhyung Kim

@flags can have O_CLOEXEC only so bitwise AND is not necessary.

---
 fs/eventpoll.c |    2 +-

 1 files changed, 1 insertions(+), 1 deletions(-)
Quoted 13 lines

fs/eventpoll.c SYSCALL_DEFINE1(epoll_create1, int, flags) · line 1212

Quoted 10 lines
fs/eventpoll.c +1 -1
index 8cf07242067d..2e21fb85b8b6 100644
@@ -1209,7 +1209,7 @@ SYSCALL_DEFINE1(epoll_create1, int, flags)
         * a file structure and a free file descriptor.
         */
        error = anon_inode_getfd("[eventpoll]", &eventpoll_fops, ep,
-                                O_RDWR | (flags & O_CLOEXEC));
+                                O_RDWR | flags);

I'm strong against this.
Whenever a new flag is allowed this will explode...

His point might be that there is a check right ahead, so flags can't be enything outside such mask.
But yeah, this is not worth creating another couple of objects in the GIT tree IMO.

- Davide