From: Ian Jackson Subject: Re: [PATCH v2] tools/libxc: Implement writev_exact() in the same style as write_exact() Date: Tue, 8 Jul 2014 17:53:18 +0100 Message-ID: <21436.8702.766266.441030@mariner.uk.xensource.com> References: <1404728318-13474-1-git-send-email-andrew.cooper3@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1404728318-13474-1-git-send-email-andrew.cooper3@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andrew Cooper Cc: Ian Campbell , Xen-devel List-Id: xen-devel@lists.xenproject.org Andrew Cooper writes ("[PATCH v2] tools/libxc: Implement writev_exact() in the same style as write_exact()"): > This implementation of writev_exact() will cope with an iovcnt greater than > IOV_MAX because glibc will actually let this work anyway, and it is very > useful not to have to work about this in the caller of writev_exact(). The > caller is still required to ensure that the sum of iov_len's doesn't overflow > a ssize_t. ... > + /* writev() guarentees atomicity of individual iov[] elements. > + * Sanity check that the returned len did lie on an iov[] > + * element boundary. */ > + assert(len == 0); I think you have misunderstood something that I wrote. writev does not (in the general case) guarantee not to stop within an iov element. Ian.