* xpread() is the same as pread(), but it automatically restarts pread() * operations with a recoverable error (EAGAIN and EINTR). xpread() DOES * NOT GUARANTEE that "len" bytes is read even if the data is available. */
| 271 | * NOT GUARANTEE that "len" bytes is read even if the data is available. |
| 272 | */ |
| 273 | ssize_t xpread(int fd, void *buf, size_t len, off_t offset) |
| 274 | { |
| 275 | ssize_t nr; |
| 276 | if (len > MAX_IO_SIZE) |
| 277 | len = MAX_IO_SIZE; |
| 278 | while (1) { |
| 279 | nr = pread(fd, buf, len, offset); |
| 280 | if ((nr < 0) && (errno == EAGAIN || errno == EINTR)) |
| 281 | continue; |
| 282 | return nr; |
| 283 | } |
| 284 | } |
| 285 | |
| 286 | ssize_t read_in_full(int fd, void *buf, size_t count) |
| 287 | { |
no outgoing calls
no test coverage detected