Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <007001c24da6$858b3d40$0b01a8c0@Camelot> From: "Pierluigi 'Lanugo' Rolando" To: "Cygwin" Subject: Help with unix sockets and poll Date: Tue, 27 Aug 2002 10:35:35 +0200 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0036_01C24DB5.7A0EBA00" X-Priority: 3 X-MSMail-Priority: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Note-from-DJ: This may be spam ------=_NextPart_000_0036_01C24DB5.7A0EBA00 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Hi, I've tried to port some code that relies heavily on unix domain sockets for IPC from Linux to Cygwin, and I've encountered some problems. It seems that either unix domain sockets (created by socketpair() ) or the poll() library call are broken. I'm attaching the smallest test case I've been able to write that reproduces the problem. Under linux (2.4.19/2.4.18 w/ glibc 2.2.4) the program terminates correctly, while under cygwin it reports a POLLERR after the first character is written on the socket. My cygwin DLL is version 1.3.12-cygwin-1-3-12-1, and gcc -v reports "Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/specs | gcc version 2.95.3-5 (cygwin special)". I've done some researching on the net in order to find out whethere I'm the first to experience this problem, and I haven't found anything. I've also downloaded and quickly checked the winsup sources, but I really don't know Cygwin enough to be able to debug its sources (moreover, it could be a flaw in my code). Sorry for my bad english and thank you for you patience, P. Rolando aka Lanugo of the Wandering Souls ------=_NextPart_000_0036_01C24DB5.7A0EBA00 Content-Type: application/octet-stream; name="ubug.c" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="ubug.c" #include #include #include #include #include #include #include #include int main(void) { int ss[2]; int i, j; struct pollfd pfd[2]; char str[] = "w"; if(socketpair(PF_UNIX, SOCK_STREAM, 0, ss) != 0) { fprintf(stderr, "socketpair: failed\n"); return 1; } for(i = 0; i < 2; ++i) pfd[i].fd = ss[i]; for(j = 0; j < 10; ++j) { for(i = 0; i < 2; ++i) { pfd[i].events = (POLLIN | POLLOUT); } poll(pfd, 2, -1); for(i = 0; i < 2; ++i) if(pfd[i].revents & POLLERR) { fprintf(stderr, "POLLERR: %d\n", pfd[i].fd); return 1; } if(pfd[0].revents & POLLOUT) { send(pfd[0].fd, (void *)str, 1, 0); fprintf(stderr, "w"); } if(pfd[1].revents & POLLIN) { char buffer[1024]; recv(pfd[1].fd, buffer, sizeof(buffer), 0); printf("W"); } } return 0; } ------=_NextPart_000_0036_01C24DB5.7A0EBA00 Content-Type: text/plain; charset=us-ascii -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ ------=_NextPart_000_0036_01C24DB5.7A0EBA00--