Mail Archives: cygwin/2004/01/09/07:34:11
> -----Original Message-----
> From: cygwin-owner AT cygwin DOT com
> [mailto:cygwin-owner AT cygwin DOT com] On Behalf Of Dave Korn
> Right. The attached sertest.c is a very simple program
> that attempts to open the serial port, does a select () call
> waiting for a byte to read with a 250ms timeout, and closes it.
OK, I just did an even more cutdown testcase, and it still hangs up, when
it ought to be non-blocking, and it still can't be ctrl-c'd, and it doesn't
even have a select call in it any more. So I think that means it's probably
something to do with the tcflush change. Here's the testcase, and the tail
of the strace output from running it up to the point it hangs up.
cheers,
DaveK
---begin sertest2.c---
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
int main (int argc, const char **argv)
{
int rv, fd;
char buff[8];
fd = open ("/dev/com1", O_RDWR | O_BINARY | O_NONBLOCK | O_NOCTTY |
O_NDELAY );
if (fd < 0)
{
fprintf (stderr, "oops error opening com1 %d\n", errno);
return -1;
}
// so try reading it
rv = read (fd, buff, 1);
fprintf (stderr, "serial read: rv %d char $%02x\n", rv, (unsigned
int)buff[0]);
// we done now.
rv = close (fd);
fprintf (stderr, "close gives %d\n", fd);
return 0;
}
---end sertest2.c---
---begin strace---
383 465625 [main] sertest2 228 open: open (/dev/com1, 0x1C002)
211 465836 [main] sertest2 228 normalize_posix_path: src /dev/com1
131 465967 [main] sertest2 228 normalize_posix_path: /dev/com1 =
normalize_posix_path (/dev/com1)
150 466117 [main] sertest2 228 mount_info::conv_to_win32_path:
conv_to_win32_path (/dev/com1)
149 466266 [main] sertest2 228 mount_info::conv_to_win32_path: src_path
/dev/com1, dst \.\com1, flags 0x2, rc 0
87612 553878 [main] sertest2 228 build_fh_pc: fh 0x616713B8
241 554119 [main] sertest2 228 fhandler_serial::open:
fhandler_serial::open (/dev/com1, 0x1C002, 0xAE0)
168 554287 [main] sertest2 228 fhandler_base::open: (\.\com1, 0x1C002)
query_open 0
382 554669 [main] sertest2 228 fhandler_base::open: 0x724 = CreateFile
(\.\com1, 0xC0000000, 0x7, 0x22E1B0, 0x3, 0x80, 0)
242 554911 [main] sertest2 228 fhandler_base::set_flags: flags 0x1C002,
supplied_bin 0x10000
139 555050 [main] sertest2 228 fhandler_base::set_flags: O_TEXT/O_BINARY
setin flags 0x10000
137 555187 [main] sertest2 228 fhandler_base::set_flags: filemode set to
binary
127 555314 [main] sertest2 228 fhandler_base::open: 1 =
fhandler_base::open (\.\com1, 0x1C002)
208 555522 [main] sertest2 228 fhandler_serial::open: 0x1 =
fhandler_serial::open (/dev/com1, 0x1C002, 0xAE0)
167 555689 [main] sertest2 228 open: 3 = open (/dev/com1, 0x1C002)
130 555819 [main] sertest2 228 readv: readv (3, 0x22E2B0, 1) nonblocking,
sigcatchers 0
156 555975 [main] sertest2 228 peek_serial: fh->overlapped_armed 0
---end strace---
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -