From 1970fcef93adcc5a35f6468d00a5a634d5af2b3c Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Fri, 13 Mar 2026 07:45:17 +0100 Subject: wrapper: introduce writev(3p) wrappers In the preceding commit we have added a compatibility wrapper for the writev(3p) syscall. Introduce some generic wrappers for this function that we nowadays take for granted in the Git codebase. Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- wrapper.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'wrapper.h') diff --git a/wrapper.h b/wrapper.h index 15ac3bab6e..27519b32d1 100644 --- a/wrapper.h +++ b/wrapper.h @@ -47,6 +47,15 @@ ssize_t read_in_full(int fd, void *buf, size_t count); ssize_t write_in_full(int fd, const void *buf, size_t count); ssize_t pread_in_full(int fd, void *buf, size_t count, off_t offset); +/* + * Try to write all iovecs. Returns -1 in case an error occurred with a proper + * errno set, the number of bytes written otherwise. + * + * Note that the iovec will be modified as a result of this call to adjust for + * partial writes! + */ +ssize_t writev_in_full(int fd, struct iovec *iov, int iovcnt); + static inline ssize_t write_str_in_full(int fd, const char *str) { return write_in_full(fd, str, strlen(str)); -- cgit v1.3