On Tue, Sep 22, 2015 at 05:14:42PM -0700, Stefan Beller wrote: > We should not care if the call to poll failed, as we're in an infinite loop and > can only get out with the correct read(..). So maybe an implementation like this > would already suffice: > > ssize_t xread(int fd, void *buf, size_t len) > { > ssize_t nr; > if (len > MAX_IO_SIZE) > len = MAX_IO_SIZE; > while (1) { > nr = read(fd, buf, len); > if (nr < 0) { > if (errno == EINTR) > continue; > if (errno == EAGAIN || errno == EWOULDBLOCK) { > struct pollfd pfd; > pfd.events = POLLIN; > pfd.fd = fd; > /* We deliberately ignore the return value of poll. */ > poll(&pfd, 1, -1); > continue; > } > } > return nr; > } > } FWIW, that is what I had imagined. -Peff -- 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