[PATCH] PR 67585 Handle EINTR

Janne Blomqvist blomqvist.janne@gmail.com
Mon Oct 10 14:56:00 GMT 2016


Many POSIX systems have the bad habit of not restarting interrupted
syscalls. On these systems it's up to the user to check for an error
with errno == EINTR and restart manually. This patch does this for
libgfortran, so that GFortran users don't have to do it.

2016-10-09  Janne Blomqvist  <jb@gcc.gnu.org>

	PR libfortran/67585
	* io/io.h: TEMP_FAILURE_RETRY: Define macro if not found.
	* io/unix.c (raw_read): Handle EINTR.
	(raw_write): Check for return value -1.
	(raw_seek): Handle EINTR.
	(raw_tell): Likewise.
	(raw_size): Likewise.
	(raw_truncate): Likewise.
	(raw_close): Likewise.
	(buf_flush): Call raw_seek instead of lseek.
	(buf_read): Likewise.
	(buf_write): Likewise.
	(fd_to_stream): Likewise.
	(tempfile_open): Likewise.
	(regular_file2): Likewise.
	(compare_file_filename): Likewise.
	(find_file): Likewise.
	(inquire_sequential): Likewise.
	(inquire_direct): Likewise.
	(inquire_formatted): Likewise.

Version 2 of the patch: Use the TEMP_FAILURE_RETRY macro to do the
EINTR loop when appropriate, cover more functions (open, mk(o)stemp,
(f)stat).

Regtested on x86_64-pc-linux-gnu. Ok for trunk?
---
 libgfortran/io/io.h   | 15 +++++++++
 libgfortran/io/unix.c | 86 +++++++++++++++++++++++++++++++++++----------------
 2 files changed, 75 insertions(+), 26 deletions(-)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-PR-67585-Handle-EINTR.patch
Type: text/x-patch
Size: 8451 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20161010/0f6f060c/attachment.bin>


More information about the Fortran mailing list