Add writev() API to GOutputStream and GPollableOutputStream
See #1431 (closed)
writev
is implemented for local files on UNIX (the Windows API is weird and seems to require each buffer in the vector to be one page?), GUnixOutputStream
and GSocketOutputStream
. The latter is what I actually care about.
I didn't add GBytes
variants or any other bells and whistles on top of the minimum needed
One important part here is that the writev()
functions return gboolean
but even on FALSE
will potentially set bytes_written
to a value > 0
. That's the same behaviour as for write_all()
, and the docs say that this is only available from C (which is wrong btw: it should rather says that it's not available from some bindings, e.g. the Python ones... and even there it could be fixed by overrides).
While writev()
is supposed to be atomic, the fallback implementations around write()
are not
Another thing to note here is that the write_all
functions are modifying the passed in vectors if multiple iterations are needed. This can only be prevented by first copying to a alloca'd copy of the array.
Closes #1431 (closed)