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

2011-05-10 Thread Jim Meyering
Jim Meyering wrote: > Bastien ROUCARIES wrote: > >> I disagree here: >>>       else >>>         { >>> +          /* Detect whether /proc/self/fd/../fd exists.  On Linux, that >>> name >>> +             resolves to /proc/self/fd, which was opened above.  However, >>> on >>> +             Solaris,

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

2011-05-10 Thread Jim Meyering
Bastien ROUCARIES wrote: > I disagree here: >>       else >>         { >> +          /* Detect whether /proc/self/fd/../fd exists.  On Linux, that name >> +             resolves to /proc/self/fd, which was opened above.  However, on >> +             Solaris, it may resolve to /proc/self/fd/fd, whi

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

2011-05-10 Thread Bastien ROUCARIES
I disagree here: >       else >         { > +          /* Detect whether /proc/self/fd/../fd exists.  On Linux, that name > +             resolves to /proc/self/fd, which was opened above.  However, on > +             Solaris, it may resolve to /proc/self/fd/fd, which cannot exist, > +            

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

2011-05-10 Thread Jim Meyering
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. ... > diff --git a/lib/openat-proc.c b/lib/openat-proc.c ... > @@ -80,15 +79,9 @@ open

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

2011-05-09 Thread Eric Blake
On 05/09/2011 05:15 PM, Bruno Haible wrote: > Eric Blake wrote: >> - 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); > > What is the point of playin

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

2011-05-09 Thread Bruno Haible
Eric Blake wrote: > -      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); What is the point of playing with O_NOCTTY and O_NONBLOCK here? It could trigger

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

2011-05-09 Thread Eric Blake
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 > --- > > I'm pushing this.

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

2011-05-09 Thread Eric Blake
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 --- I'm pushing this. ChangeLog |7 +++ lib/openat-proc.c | 13 +