Stefan Beller <sbeller@xxxxxxxxxx> writes: > So if we get an EAGAIN or EWOULDBLOCK error the fd must be nonblocking. > As the intend of xread is to read as much as possible either until the > fd is EOF or an actual error occurs, we can ease the feeder of the fd > by not spinning the whole time, but rather wait for it politely by not > busy waiting. As you said in the cover letter, this does look questionable. It is sweeping the problem under the rug (the hard-coded 100ms is a good clue to tell that). If the caller does want us to read thru to the end, then we would need to make it easier for such a caller to stop marking the file descriptor to be non-blocking, but this does not do anything to help that. An alternative might be to automatically turn nonblocking off temporarily once we get EAGAIN (and turn it on again before leaving); that would be an approach to make it unnecessary to fix the caller (which has its own set of problems, though). > + if (i < 0) { > + if (errno == EINTR || errno == ENOMEM) > + continue; I can sort of see EINTR but why is ENOMEM any special than other errors? > + else > + die_errno("poll"); > + } > + } > + } > return nr; > } > } -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html