fread reading directories
- From
- Kyle Evans <kevans@freebsd.org>
- Date
- Jun 6, 2020, 22:36 UTC
- Message-ID
- <CACNAnaG19QD1PbVS93nFm3XY70CZCrRosmVq-_3j+puAKSPj9Q@mail.gmail.com>
Hi,
I was looking at FREAD_READS_DIRECTORIES to measure some performance differences, then stumbled upon [0] that dropped fread() from the autoconf test that causes git to use its git_fopen shim [1] even on Linux.
I've read the commit message a couple of times, but I'm really not seeing the rationale for *why* git wants this knob to be set on Linux.
Unless I'm missing something, this would seem to regress the almost certainly much-more-common case of fopen() a file and fread() it with an unconditional fstat() from grep_fopen(), rather than just using two syscalls at all times (directories and non-directories) and letting it get rejected in fread().
Thoughts?
Thanks,
Kyle Evans
[0] https://github.com/git/git/commit/3adf9fdecfb0cd31a83ef3af1d8d631a1acd392b [1] https://github.com/git/git/blob/master/compat/fopen.c