[PATCH] posix: if glob has a trailing slash match directories only.
Paul Eggert
eggert@cs.ucla.edu
Thu Nov 30 06:03:00 GMT 2017
Dmitry Goncharov wrote:
> Paul, i am missing where you see the performance hit.
> The current contract makes the caller check after the library by calling stat
> on each entry.
No, these callers need not call stat. glob itself doesn't call stat, when it
calls itself recursively with this flag. Instead, glob simply charges ahead and
gets an ENOTDIR (or whatever( in the next level of recursion. For this sort of
usage, it is a win for glob to filter out directories if that is easy (because
there is then no need even to issue the syscalls that result in ENOTDIR), but it
can be a loss for glob to filter out directories via stat calls.
More information about the Libc-alpha
mailing list