X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=complete_pread.h;h=b0f2bd7bc3e33adf9c8346b32b90c1a38e81c369;hb=63fd24efd774f1ed3f5dab82b934f35b7b039557;hp=fec57870c1c45d1a031118eee424c19a6f956ba1;hpb=acce03bb32917e21f2d1d49c5a460d3cd2f72a11;p=plocate diff --git a/complete_pread.h b/complete_pread.h index fec5787..b0f2bd7 100644 --- a/complete_pread.h +++ b/complete_pread.h @@ -3,8 +3,11 @@ #include -// A wrapper around pread() that returns an incomplete read. -// Always synchronous (no io_uring). +// A wrapper around pread() that retries on short reads and EINTR, +// so you never need to call it twice. Always synchronous (no io_uring). +bool try_complete_pread(int fd, void *ptr, size_t len, off_t offset); + +// Same, but exit on failure, so never returns a short read. void complete_pread(int fd, void *ptr, size_t len, off_t offset); #endif // !defined(COMPLETE_PREAD_H)