Cygwin's writev() non-standard behavior

Eric Blake eblake@redhat.com
Wed Apr 23 16:24:00 GMT 2014


On 04/23/2014 08:53 AM, qq qq wrote:

[your mailer should really be taught to use In-Reply-To correctly; it's
annoying that every message from you starts a new thread]

>> furthermore, cygwin should emulate Linux behavior, even if POSIX
>> doesn't define the behavior.
> 
> And which is why I compared Linux vs. Cygwin in my original post ?

If you'll note, I was trying to be careful in my reply - I'm not opposed
to a change in cygwin, and in fact welcome one to bring us into
consistency with Linux behavior; but at the same time, I'm also pointing
out that your program is not portable and therefore it may be worth
fixing the portability assumptions in your program instead of waiting on
cygwin to provide the specific undefined behavior that you want to use.

> int main()
> {
>   struct iovec vec;
>   int fd = open("test.out", O_WRONLY | O_CREAT, 0666);
>   memset(&vec, 0, sizeof(vec));
>   if (writev(fd, &vec, 0) < 0)

POSIX allows, but not requires, writev() to fail with EINVAL when iovcnt
is 0.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://cygwin.com/pipermail/cygwin/attachments/20140423/d6d42361/attachment.sig>


More information about the Cygwin mailing list