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 X-MimeOLE: Produced By Microsoft Exchange V6.0.4417.0 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Subject: FW: Process does not respond to signals on read() of win32 handle. Date: Wed, 6 Nov 2002 16:24:09 -0500 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: From: "Harig, Mark A." To: , Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id gA6LOMJ14198 Please send all replies to the Cygwin users' mailing list. This serves two purposes: 1. More people can see your problem description. This will increase the chance that someone will know a solution to your problem. 2. The problem and its solution are added to the mailing-list archives. This is one of the main knowledge databases for Cygwin. Even if a solution is not found, then other readers are made aware of the problem and know that it is not unique to them. > -----Original Message----- > From: sanjayl AT mindspring DOT com [mailto:sanjayl AT mindspring DOT com] > Sent: Wednesday, November 06, 2002 4:20 PM > To: Harig, Mark A. > Subject: RE: Process does not respond to signals on read() of win32 > handle. > > > 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/