The many return values of read() (plus some other cases)
https://utcc.utoronto.ca/~cks/space/blog/unix/ReadManyReturnValues [utcc.utoronto.ca]
2019-01-14 07:25
This is a good example of the potential complexity of the Unix API in practice, and to illustrate it I’m going to run down as many of the cases that I can remember. In all cases, we’ll start with ‘n = read(fd, buf, bufsize)’.
Sometimes end of file is not the end.
Somewhat related: https://utcc.utoronto.ca/~cks/space/blog/unix/AcceptErrnoProblem