From: Eric Blake <eblake@redhat.com>
To: cygwin <cygwin@cygwin.com>
Subject: bug in pipe() and pipe2()
Date: Wed, 29 Jun 2011 21:30:00 -0000 [thread overview]
Message-ID: <4E0B9959.6060903@redhat.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1110 bytes --]
I was testing the behavior when pipe() fails, in order to propose an
update to POSIX wording: http://austingroupbugs.net/view.php?id=467
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 = 0;
while (1) {
int fd[2] = {-2,-3};
int err = 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.
--
Eric Blake eblake@redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 619 bytes --]
next reply other threads:[~2011-06-29 21:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-29 21:30 Eric Blake [this message]
2011-06-30 9:39 ` Corinna Vinschen
2011-06-30 11:51 ` Ryan Johnson
2011-06-30 14:07 ` Corinna Vinschen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4E0B9959.6060903@redhat.com \
--to=eblake@redhat.com \
--cc=cygwin@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).