public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tiny mq_open optimization
@ 2008-05-03 19:28 Ulrich Drepper
  0 siblings, 0 replies; only message in thread
From: Ulrich Drepper @ 2008-05-03 19:28 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm, torvalds

A very small cleanup for mq_open.  We do not have to call set_close_on_exit
if we create the file descriptor right away with the flag set.  We have a
function for this now.  The resulting code is smaller and a tiny bit faster.


Signed-off-by: Ulrich Drepper <drepper@redhat.com>

diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index 94fd3b0..b3b69fd 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -673,7 +673,7 @@ asmlinkage long sys_mq_open(const char __user *u_name, int oflag, mode_t mode,
 	if (IS_ERR(name = getname(u_name)))
 		return PTR_ERR(name);
 
-	fd = get_unused_fd();
+	fd = get_unused_fd_flags(O_CLOEXEC);
 	if (fd < 0)
 		goto out_putname;
 
@@ -709,7 +709,6 @@ asmlinkage long sys_mq_open(const char __user *u_name, int oflag, mode_t mode,
 		goto out_putfd;
 	}
 
-	set_close_on_exec(fd, 1);
 	fd_install(fd, filp);
 	goto out_upsem;
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2008-05-03 19:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-03 19:28 [PATCH] tiny mq_open optimization Ulrich Drepper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox