[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v2] tools/libxc: Implement writev_exact() in the same style as write_exact()

On 08/07/14 17:58, Ian Jackson wrote:
> Andrew Cooper writes ("Re: [Xen-devel] [PATCH v2] tools/libxc: Implement 
> writev_exact() in the same style as write_exact()"):
>> Final paragraph in the DESCRIPTION
>> "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"
>> By my reading, it cannot guarantee atomicity if it would split an iov[]
>> element.
> Firstly, we should be using the spec, not manpages:
>  http://pubs.opengroup.org/onlinepubs/9699919799/functions/writev.html
>  http://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html
> etc.
> There are various guarantees that write and writev provide, including
> the special rule for pipes (from write.html):
>   Write requests to a pipe or FIFO shall be handled in the same way as
>   a regular file with the following exceptions:
>      [ complicated rules involving PIPE_BUF ]
> and the general rule about system call atomicity:
> http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_09_07
>  All of the following functions shall be atomic with respect to each
>  other in the effects specified in POSIX.1-2008 when they operate on
>  regular files or symbolic links:
>     [...] write() writev() [...]
> However neither of these are the guarantee that you are assuming.
> In particular, there is nothing saying that _if_ writev performs a
> partial write, it won't stop inside an iov.
> Ian.

Ok - in which case v1 of the patch is correct.  I shall submit v3 which
looks similar to v1, but with some comments improvements


Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.