This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

cvs HEAD: com device path handling (ATTN Pierre)


$ uname -a
CYGWIN_NT-5.1 fordpc 1.5.10(0.114/4/2) 2004-04-21 10:02 i686 unknown
unknown Cygwin

$ cat com.c
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>

int
main(void)
{
    int fd;

    fd = open("/dev/ttyS0", O_RDWR);
    printf("fd %d\n", fd);

    return fd;
}

$ gcc -g -O2 -Wall com.c -o com.exe

$ ./com.exe
fd -1

   58   17074 [main] com 6504 open: open (/dev/ttyS0, 0x2)
   57   17131 [main] com 6504 normalize_posix_path: src /dev/ttyS0
   50   17181 [main] com 6504 normalize_posix_path: /dev/ttyS0 =
normalize_posix_path (/dev/ttyS0)
   50   17231 [main] com 6504 mount_info::conv_to_win32_path:
conv_to_win32_path (/dev/ttyS0)
   61   17292 [main] com 6504 mount_info::conv_to_win32_path: src_path
/dev/ttyS0, dst \\.\com1, flags 0x2, rc 0
   58   17350 [main] com 6504 build_fh_pc: fh 0x616E4C94
  247   17597 [main] com 6504 fhandler_serial::open: fhandler_serial::open
(/dev/ttyS0, 0x2, 0xD7)
   77   17674 [main] com 6504 fhandler_base::open: (\\.\com1, 0x2)
4501889 4519563 [main] com 6504 seterrno_from_win_error:
../../../../cygwin/winsup/cygwin/fhandler.cc:662 windows error 53
   91 4519654 [main] com 6504 geterrno_from_win_error: windows error 53 ==
errno 136
   54 4519708 [main] com 6504 __set_errno: void
seterrno_from_win_error(const char*, int, long unsigned int):295 val 136
   48 4519756 [main] com 6504 fhandler_base::open: 0 = fhandler_base::open
(\\.\com1, 0x2)
   50 4519806 [main] com 6504 open: -1 = open (/dev/ttyS0, 0x2)

Looks like it thinks the win32 path is a network path.  I'm not sure where
the correct place to fix this is, or I'd do it myself.

Why is the native path defined as "\\\\.\\com1" instead of "\\.\com1"?  I
know that would cause it to print funny, but it would then work in the
CreateFile call?

-- 
Brian Ford
Senior Realtime Software Engineer
VITAL - Visual Simulation Systems
FlightSafety International
Phone: 314-551-8460
Fax:   314-551-8444

--
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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]