diff options
| author | Patrick Steinhardt <ps@pks.im> | 2026-03-13 07:45:17 +0100 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-03-13 08:54:14 -0700 |
| commit | 1970fcef93adcc5a35f6468d00a5a634d5af2b3c (patch) | |
| tree | 72a7d14cd6856beff59ccdf49a71dcda0066f06a /wrapper.h | |
| parent | 3b9b2c2a29a1d529ca9884fa0a6529f6e2496abe (diff) | |
| download | git-1970fcef93adcc5a35f6468d00a5a634d5af2b3c.tar.xz | |
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 <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'wrapper.h')
| -rw-r--r-- | wrapper.h | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -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)); |
