Mail Archives: cygwin/2011/06/29/17:30:24
--------------enig3949EC4F562740A3C5F81E2B
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
I was testing the behavior when pipe() fails, in order to propose an
update to POSIX wording: http://austingroupbugs.net/view.php?id=3D467
However, cygwin's pipe implementation dumps core when it runs out of
fds, so I could not definitively state whether cygwin properly leaves
the fd array unchanged on error, the way Linux does. According to a gdb
run and while using stock 1.7.9 cygwin1.dll, the crash is in
fhandler_pipe::create().
#define _POSIX_C_SOURCE 200811L
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>
int
main (int argc, char **argv)
{
int i =3D 0;
while (1) {
int fd[2] =3D {-2,-3};
int err =3D pipe(fd);
if (err) {
printf ("iteration %d, pipe returned %d errno %d %s, fds %d %d\n",
i, err, errno, strerror(errno), fd[0], fd[1]);
break;
}
i++;
}
return 0;
}
Expected behavior is EMFILE and fd unchanged, after however many
iterations it takes to reach the ulimit on max fd.
--=20
Eric Blake eblake AT redhat DOT com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
--------------enig3949EC4F562740A3C5F81E2B
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/
iQEcBAEBCAAGBQJOC5lZAAoJEKeha0olJ0Nq9p4H/i0CSyHCKNCmu57n9FCk/Y3Z
gsQ15Vxj3brofFgG62AiXjRx99ttDKfMr106OOTjlCpasJRf92Wr2BqPU+OxiShD
+LNrYVAhZ4v51K3ycAfMi0/TxSaxTXbl9Do3mp+Hv3DFQ7iLW/0KKKdqFCHweF6r
hbhiBbzmqEiriZQYFRUmMgB5vTERdZUrgW70+XDj8aAFh2s/X5+p5kh1izjqybXR
b8FIwNIB64gkt0qYCZYU/ErLVwqGn0Tu/EGTG/alBC/efpmpqpn29xsPwmXT4qKf
xVPxX1FPP1uOswuR+KuJXFJKZoXKahr/z3A1lSj5AX4lXN9x69OFcYc3IunlXo8=
=EzQ6
-----END PGP SIGNATURE-----
--------------enig3949EC4F562740A3C5F81E2B--
- Raw text -