(stat(...) == -1 || faccessat(...) == -1) && errno == EINTR ?!??

Florian Weimer fweimer@redhat.com
Mon Feb 15 09:24:16 GMT 2021


* Tobias Bading via Libc-help:

> English isn't my first language, so I must be reading this wrong or
> interpreting it in the wrong context. If a POSIX implementation was
> allowed to add EINTR to the list of possible error codes returned by a
> function defined in the standard, what kind of standard would that be?
> How about an implementation of malloc() which returns NULL and sets
> errno to EINTR when a signal is raised while the calling thread was
> asleep because it was waiting for a disk read from swapspace? XD

Returning EINTR in stat would allow relatively straightforward
implementation of a timeout, in case the path resides on a network file
system and the server is unreachable.  So it's not a completely
unreasonable thing to do.  On the other hand, the cost in lost backwards
compatibility with applications that do not know about this behavior
appears to be pretty high, as this thread shows.

Thanks,
Florian
-- 
Red Hat GmbH, https://de.redhat.com/ , Registered seat: Grasbrunn,
Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Charles Cachera, Brian Klemm, Laurie Krebs, Michael O'Neill



More information about the Libc-help mailing list