5 ms·
While open[1] is documented for macOS to be able to return EINTR, the documentation for sigaction[2] seems to specify (in confusing wording) that setting SA_RES
by jorams 6y ago
While open[1] is documented for macOS to be able to return EINTR, the documentation for sigaction[2] seems to specify (in confusing wording) that setting SA_RESTART prevents that. It seems to me like a bug in macOS, since they're going against their own documentation.
[1]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/open.2.html#//apple_ref/doc/man/2/open https://developer.apple.com/library/archive/documentation/Sy...
[2]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/sigaction.2.html https://developer.apple.com/library/archive/documentation/Sy...
specifically:
> If a signal is caught during the system calls listed below, the call may
be forced to terminate with the error EINTR, the call may return with a
data transfer shorter than requested, or the call may be restarted.
Restart of pending calls is requested by setting the SA_RESTART bit in
sa_flags. The affected system calls include open(2), read(2), write(2),
sendto(2), recvfrom(2), sendmsg(2) and recvmsg(2) on a communications
channel or a slow device (such as a terminal, but not a regular file) and
during a wait(2) or ioctl(2). However, calls that have already committed
are not restarted, but instead return a partial success (for example, a
short read count).
- fanf2 6y agoThe Apple documentation matches POSIX so if open() is returning EINTR for reasons other than a signal, that is a standards conformance bug.