diff options
Diffstat (limited to 'src/util')
| -rw-r--r-- | src/util/io.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/util/io.h b/src/util/io.h index ac326c8..81b8f51 100644 --- a/src/util/io.h +++ b/src/util/io.h @@ -1,7 +1,8 @@ /* See LICENSE file for copyright and license details. */ -#define ewriteall(...) enwriteall(1, __VA_ARGS__) -#define ereadall(...) enreadall(1, __VA_ARGS__) +#define ewriteall(...) enwriteall(1, __VA_ARGS__) +#define ereadall(...) enreadall(1, __VA_ARGS__) +#define epwriteall(...) enpwriteall(1, __VA_ARGS__) int writeall(int fd, void *buf, size_t n); @@ -22,3 +23,12 @@ enreadall(int status, int fd, void *buf, size_t n, const char *fname) enprintf(status, "read %s:", fname); return (size_t)r; } + +int pwriteall(int fd, void *buf, size_t n, size_t ptr); + +static inline void +enpwriteall(int status, int fd, void *buf, size_t n, size_t ptr, const char *fname) +{ + if (pwriteall(fd, buf, n, ptr)) + enprintf(status, "pwrite %s:", fname); +} |
