Closed worr closed 10 years ago
I believe that on Linux we can't get EINTR
until we set up the SIGWINCH
signal handler -- EINTR
can only happen if a signal arrives and is handled by a userspace signal handler (c.f. http://www.gnu.org/software/libc/manual/html_node/Interrupted-Primitives.html). And there's a handful of things that are retried by this patch (e.g. sscanf
) that can't ever (again, AFAIK) return EINTR
.
If we do need to go down this route, I think I'd rather adopt something like glibc's TEMP_FAILURE_RETRY
macro, instead of open-coding all the do / while
loops inline everywhere.
Wow, yeah. My notion of EINTR
semantics was totally wrong. Thanks for the information.
I believe that tcsetattr(3)
can be safely restarted on EINTR
. Would you accept a PR for that?
Hm. I see no mention in termios(3)
of those functions being allowed to return EINTR
, and, in general, I don't expect non-long-blocking functions to be ever return EINTR
.
I was going off of the POSIX docs, since the Linux manpages don't specify which values for errno
are valid: http://pubs.opengroup.org/onlinepubs/009695399/functions/tcsetattr.html
Hm, fair enough. Ok, I'd take that patch.
Most syscalls that can return EINTR aren't retried if they return EINTR. This diff just adds a simple pattern to retry whenever EINTR is returned.