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 Date: Wed, 06 Nov 2002 16:22:18 -0500 From: To: cygwin AT cygwin DOT com Reply-To: sanjayl AT mindspring DOT com Subject: RE: Process does not respond to signals on read() of win32 handle. (fwd) Message-ID: X-Originating-IP: 155.53.33.69 Hi Mark, I am running Cygwin on Windows 2000. Here is the output of uname -a CYGWIN_NT-5.0 REDBSUNJAY1 1.3.14(0.62/3/2) 2002-10-24 10:48 i686 unknown And here is a short program that can reproduce the bug. I just CreateFile() COM0 and then map it to a cygwin file desciptor. I then read() on the fd. At this point the program stops responding to any signals (CTRL-C) etc, until some data shows up on the device to wake up the read. I just use g++ com.cpp to compile the executable. Thanks again for all your help. Sanjay ================================================ #include #include #include #ifdef __CYGWIN__ #include #include #include extern "C" int cygwin_attach_handle_to_fd (char *name, int fd, HANDLE handle, int bin, int access); extern "C" void cygwin_conv_to_full_posix_path (const char *path,char *posix_path); #endif /* __CYGWIN__ */ int main (void) { /* Open the file */ int fd = -1; HANDLE m_Handle = INVALID_HANDLE_VALUE; m_Handle = CreateFile ("\\\\.\\COM1", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_SYSTEM, 0); if (m_Handle == INVALID_HANDLE_VALUE) { printf ("Create file on device failed\n"); } fd = cygwin_attach_handle_to_fd ("/dev/tap", -1, m_Handle, 1, GENERIC_READ | GENERIC_WRITE); printf ("Cygwin fd: %d\n", fd); char *Data = (char *) malloc (4096); int BytesRead; while (1) { if ((BytesRead = read (fd, Data, 1500)) < 0) { printf ("read() error: %d\n", errno); exit(errno); } printf ("Read %d bytes\n", BytesRead); } free (Data); } ============CUT HERE======================= > Source code of a small program that reproduces > your problem, > along with the commands you used to compile, > link, and run > the program would likely increase the chances > that someone > can and will help with this problem. > > > -----Original Message----- > > From: sanjayl AT mindspring DOT com > [mailto:sanjayl AT mindspring DOT com] > > Sent: Wednesday, November 06, 2002 1:51 PM > > To: cygwin AT cygwin DOT com > > Subject: Process does not respond to signals > on read() of > > win32 handle. > > > > > > I have a program that opens a Win2k driver > using CreateFile and then > > associates it with a file desciprtor using > > cygwin_attach_handle_to_fd(). > > I then do a read() on the descriptor. At this > point the program stops > > responding to CTRL-Cs etc. until something is > written to the > > device and > > the read() returns. Only then is the signal > caught and the > > process exits. > > > > I have tried the same program in a pure Win32 > environment > > using CreateFile() > > and ReadFile() calls, and things seem to > > work as expected. > > > > Any help would be greatly appreciated. > > > > Thanks in advance, > > Sanjay > > > > -- > > 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/ > > > > > -- 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/