Skip to content

Commit

Permalink
tiny mq_open optimization
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Ulrich Drepper authored and torvalds committed May 3, 2008
1 parent d35c7b0 commit 269f213
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions ipc/mqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 269f213

Please sign in to comment.