Re: [PATCH 0/5] Reintroduce writev(3p)

Johannes Sixt <[email protected]> Wed, 5 Aug 2026 19:55:30 +0200
Newsgroups org.kernel.vger.git
Message-ID <[email protected]>
Am 05.08.26 um 18:36 schrieb Junio C Hamano:
>>> I think Patrick's writev(2) follows the pattern our previous compat/
>>> routines have taken.  We use real writev(2) where it is available,
>>> and in the fake implementations in compat/ we have comments that
>>> essentially say "the real function offers X, Y, and Z, but we only
>>> want X and Z and do not need Y, so this implementation does not
>>> support Y".

> A different way to put the same question is "what is Y in the
> context of the intended uses of writev(2) in our codebase"?
The Y that I am thinking of primarily is the atomicity guarantee:

> The  data transfers performed by readv() and writev() are atomic: the
> data written by writev() is written as a single block that is not
> intermingled with output from writes in  other  processes; [...]

(See `man 2 writev`; this isn't spelled out explicitly in the Open Group
Base Specification.)

This is basically unimplementable by any emulation that has to call
write() multiple times.

-- Hannes