This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, libfortran] Use access(2) instead of stat(2) to test file existence

On 07/31/2010 03:41 PM, Janne Blomqvist wrote:

this simple patch uses access(2) instead of stat(2) in the
file_exists() function used to test whether a file pathname exists.
The reason why this is better is because stat() is potentially a
heavyweight operation (as those who have waited half an hour for 'ls
-l' to complete on a distributed fs such as Lustre can attest). This
does not change any the behavior for any corner cases such as dangling
symlinks (see PR 41387), as both access(2) and stat(2) will follow

As an aside, we seem to be quite happily using stat(2). One way to
reduce it would be to cache the device and inode numbers for open
units; as Fortran apparently forbids having multiple units pointing to
the same file (?), every time we open a file we walk through all
existing units and compare device and inode numbers.

Regtested on x86_64-unknown-linux-gnu, ok for trunk?

OK, thanks.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]