bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] openat: reduce syscalls in first probe of /proc


From: Eric Blake
Subject: Re: [PATCH] openat: reduce syscalls in first probe of /proc
Date: Mon, 09 May 2011 16:41:22 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.10

On 05/09/2011 04:37 PM, Eric Blake wrote:
> open/access/close is cheaper than open/stat/stat/close.
> 
> * lib/openat-proc.c (openat_proc_name): Simplify.
> * modules/openat (Depends-on): Drop same-inode.
> Reported by Bastien ROUCARIES.
> 
> Signed-off-by: Eric Blake <address@hidden>
> ---
> 
> I'm pushing this.

Oh, and while touching this, I'm squashing in:

diff --git c/lib/openat-proc.c w/lib/openat-proc.c
index d4659ff..5711896 100644
--- c/lib/openat-proc.c
+++ w/lib/openat-proc.c
@@ -74,7 +74,8 @@ openat_proc_name (char buf[OPENAT_BUFFER_SIZE], int
fd, char const *file)
          problem is exhibited on code that built on Solaris 8 and
          running on Solaris 10.  */

-      int proc_self_fd = open ("/proc/self/fd", O_SEARCH);
+      int proc_self_fd = open ("/proc/self/fd",
+                               O_SEARCH | O_DIRECTORY | O_NOCTTY |
O_NONBLOCK);
       if (proc_self_fd < 0)
         proc_status = -1;
       else


-- 
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]