Revert "wrapper: introduce writev(3p) wrappers"

This reverts commit 1970fcef93adcc5a35f6468d00a5a634d5af2b3c; let's not use writev() for now.

Junio C Hamano committed Apr 9, 2026 at 14:48 UTC dc1b8b2cc8da78c592a54ee4ca3776a7f83cbd31
4 files changed -59
wrapper.c
-41
@@ -323,47 +323,6 @@ ssize_t write_in_full(int fd, const void *buf, size_t count)
323 return total;
324 }
325
326 -ssize_t writev_in_full(int fd, struct iovec *iov, int iovcnt)
327 -{
328 - ssize_t total_written = 0;
329 -
330 - while (iovcnt) {
331 - ssize_t bytes_written = writev(fd, iov, iovcnt);
332 - if (bytes_written < 0) {
333 - if (errno == EINTR || errno == EAGAIN)
334 - continue;
335 - return -1;
336 - }
337 - if (!bytes_written) {
338 - errno = ENOSPC;
339 - return -1;
340 - }
341 -
342 - total_written += bytes_written;
343 -
344 - /*
345 - * We first need to discard any iovec entities that have been
346 - * fully written.
347 - */
348 - while (iovcnt && (size_t)bytes_written >= iov->iov_len) {
349 - bytes_written -= iov->iov_len;
350 - iov++;
351 - iovcnt--;
352 - }
353 -
354 - /*
355 - * Finally, we need to adjust the last iovec in case we have
356 - * performed a partial write.
357 - */
358 - if (iovcnt && bytes_written) {
359 - iov->iov_base = (char *) iov->iov_base + bytes_written;
360 - iov->iov_len -= bytes_written;
361 - }
362 - }
363 -
364 - return total_written;
365 -}
366 -
326 ssize_t pread_in_full(int fd, void *buf, size_t count, off_t offset)
327 {
328 char *p = buf;
wrapper.h
-9
@@ -47,15 +47,6 @@ ssize_t read_in_full(int fd, void *buf, size_t count);
47 ssize_t write_in_full(int fd, const void *buf, size_t count);
48 ssize_t pread_in_full(int fd, void *buf, size_t count, off_t offset);
49
50 -/*
51 - * Try to write all iovecs. Returns -1 in case an error occurred with a proper
52 - * errno set, the number of bytes written otherwise.
53 - *
54 - * Note that the iovec will be modified as a result of this call to adjust for
55 - * partial writes!
56 - */
57 -ssize_t writev_in_full(int fd, struct iovec *iov, int iovcnt);
58 -
50 static inline ssize_t write_str_in_full(int fd, const char *str)
51 {
52 return write_in_full(fd, str, strlen(str));
write-or-die.c
-8
@@ -96,14 +96,6 @@ void write_or_die(int fd, const void *buf, size_t count)
96 }
97 }
98
99 -void writev_or_die(int fd, struct iovec *iov, int iovlen)
100 -{
101 - if (writev_in_full(fd, iov, iovlen) < 0) {
102 - check_pipe(errno);
103 - die_errno("writev error");
104 - }
105 -}
106 -
99 void fwrite_or_die(FILE *f, const void *buf, size_t count)
100 {
101 if (fwrite(buf, 1, count, f) != count)
write-or-die.h
-1
@@ -7,7 +7,6 @@ void fprintf_or_die(FILE *, const char *fmt, ...);
7 void fwrite_or_die(FILE *f, const void *buf, size_t count);
8 void fflush_or_die(FILE *f);
9 void write_or_die(int fd, const void *buf, size_t count);
10 -void writev_or_die(int fd, struct iovec *iov, int iovlen);
10
11 /*
12 * These values are used to help identify parts of a repository to fsync.