Subject: Re: [PATCH v2 05/10] compat/posix: introduce writev(3p) wrapper

From: Patrick Steinhardt <[email-masked]>
Date: Tue, 10 Mar 2026 13:09:51 +0100

On Thu, Mar 05, 2026 at 10:22:45PM +0000, brian m. carlson wrote:
> On 2026-03-05 at 06:39:13, Johannes Sixt wrote:
> > Please don't. The use of writev may mislead you to depend on guarantees
> > that a kernel implementation of writev can provide, but a compat/
> > implementation cannot. (For example, I read something about "the file
> > pointer shall be unchanged" in the case of errors.) Please use simple
> > and stupid functions (write). I highly doubt that you can squeeze out a
> > noticable performance improvement with writev.
> 
> I have Rust code that does show a substantial performance improvement
> with writev and I use it for a very similar purpose (printing the size
> before a packet of data).
> 
> I am okay with slightly loosening the guarantees to support our compat
> implementation if that's what we need to do.

Yeah, I think that having a syscall like writev(3p) in our codebase
could likely also lead to improvements in other areas. Nice to see that
it'll also help your use case.

So for now I'll stick with it, but will fix overflow handling as
suggested by Junio.

Thanks!

Patrick