[Patch, libfortran] Reduce syscalls made

Jerry DeLisle jvdelisle@frontier.com
Tue Nov 9 13:08:00 GMT 2010


On 11/08/2010 11:56 AM, Janne Blomqvist wrote:
> Hi,
>
> the attached simple patch slightly reduces the amount of syscalls
> gfortran does.  The main issue addressed is that the Fortran standard
> forbids opening the same file on multiple units. Hence when opening an
> existing file, we need to go through every open file and compare the
> device and inode numbers. The patch caches these values when a file is
> opened, so it's no longer necessary to call fstat().
>
> Secondly, it's not necessary to call lseek() to test whether a file is
> seekable, as that information can already be found in the stat buffer.
>
> Third, when deciding whether to use buffering or not, only buffer
> regular files and block devices. While this won't solve the particular
> FIFO deadlock issue that was recently reported on the mailing list, it
> should at least reduce the chance of similar issues when using special
> files. Also, the isatty() test is moved last, doing the cheaper tests
> first.
>
> Finally, there is a token effort to support block devices, in case
> anyone is crazy enough to attempt accessing such things with gfortran.
> This is not tested, and I suspect that stuff will go wrong when trying
> to write past EOF.
>
> Tested on x86_64-unknown-linux-gnu, Ok for trunk?
>

OK, thanks!

Jerry



More information about the Gcc-patches mailing list