-/* Like pread(), but keep trying until everything has been read or we know for
- * sure that there was an error (or end-of-file) */
-size_t
-full_pread(int fd, void *buf, size_t count, off_t offset)
+/*
+ * Wrapper around pread() that checks for errors and keeps retrying until all
+ * requested bytes have been read or until end-of file has occurred. This also
+ * transparently handle reading from pipe files, but the caller needs to be sure
+ * the requested offset is greater than or equal to the current offset, or else
+ * WIMLIB_ERR_RESOURCE_ORDER will be returned.
+ *
+ * Return values:
+ * WIMLIB_ERR_SUCCESS (0)
+ * WIMLIB_ERR_READ (errno set)
+ * WIMLIB_ERR_UNEXPECTED_END_OF_FILE (errno set to EINVAL)
+ * WIMLIB_ERR_RESOURCE_ORDER (errno set to ESPIPE)
+ */
+int
+full_pread(struct filedes *fd, void *buf, size_t count, off_t offset)