Why doesn't _IO_do_write in fileops.c check for EINTR?

George T. Talbot george@moberg.com
Thu Apr 20 07:13:00 GMT 2000


...or for that matter, _IO_do_read()?

In Linux, the threading implementation uses signals to implement various
operations, and these signals can, at periods of high load, regularly cause
read() and write() to return EINTR.

Might a better sequence in (for example) _IO_do_write() look like this:

  do {
    count = _IO_SYSWRITE (fp, data, to_do);
  } while ((count == (_IO_size_t) -1) && (errno == EINTR));

I could be misinterpreting the code in there, but I didn't see anywhere that
it would retry this operation.  Am I correct in being suspicious of this?

I looked through the implementation of _IO_file_xsputn and the
functions/methods which call _IO_file_xsputn (the only place that calls
_IO_do_write), and I didn't see anywhere that would explicitly retry a read
that failed with EINTR, but I'm not sure that I looked in all the right
places.

I don't want to patch this code until I'm sure that this case isn't handled.

--
George T. Talbot
<george at moberg dot com>


More information about the Libstdc++ mailing list