The read and write functions (and relatives, such as send , recv , readv , ...) can return the number of bytes less than the requested read / write length if the signal is interrupted (under certain circumstances) and, possibly, in other cases. Is there a specific set of conditions for when this can happen, or is it largely implementation dependent? Here are some specific questions that I am interested in answering:
- If the signal handler is not interrupted (
SA_RESTART ), this will interrupt the I / O operations before any data is restarted after the signal handler returns. But if partial read / write has already occurred and the signal handler is not interrupted, will syscall return immediately with a partial length or will it resume trying to read / write the rest? - Obviously, read functions can return short reads in network, pipe, and terminal file descriptors when less data is available than the requested amount. But can writing functions return short records in these cases due to the limited buffer size or will they be blocked until all data has been written?
I would be interested in all three standards, required, general and Linux-specific behavior.
c posix signals
R ..
source share