Mail Archives: cygwin/2004/01/08/14:15:33
------=_NextPart_000_0000_01C3D61A.CE2B64F0
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
Ever had one of those weeks where *every* feature you try and use seems
not to want to work for you? sigh :-{
Well, unless I've done something really dumb, this simple testcase ought
to wait 1/4 of a second to receive a char from com1 and then exit.
But it doesn't. It locks up in some very serious way that prevents the
process from being killed with ctrl-c and in fact even prevents a debugger
from attaching to it. However it's still possible to kill the process with
the task manager.
When I try and debug it with vs.net, I get an error that says 'The process
appears to be deadlocked (or is not running any user-mode code).' OTOH gdb
seems to manage to get attached to it ok. Strange.
Also, running it under strace makes it responsive to ctrl-c again (but
doesn't otherwise change the behaviour). It also shows that the select does
in fact timeout, but never seems to make it through the cleanup routines and
back to the main function.
This problem may be related to either
http://sources.redhat.com/ml/cygwin/2003-06/msg00477.html
http://sources.redhat.com/ml/cygwin/2003-06/msg00493.html
which describe select failing to notice serial input, and/or
http://sources.redhat.com/ml/cygwin/2003-03/msg02097.html
which describes select returning spurious 'read ready' indications. I
couldn't find any indication that either of these problems have been
addressed since they were discussed on the list.
Anyway, I'm about to get down and build a debug version of the .dll and
see where I can get with this problem, and I'll report any progress I make.
I just need to figure out why every single testcase in 'make check' fails
with "child process exited abnormally". It seems not to be finding the
newly-built .dll and so failing to execute any of them.
If anyone feels like taking a look over the attached testcase just to
confirm that this is a real bug and not some silly mistake I've made in
opening and setting up the com port, and that the problem is reproducible
for them, that would be most helpful.
Also if anyone has any useful information about what goes on during the
post-select cleanup stage, that might give me a clue or two as well.
cheers,
DaveK
------=_NextPart_000_0000_01C3D61A.CE2B64F0
Content-Type: application/octet-stream;
name="strace.out"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="strace.out"
**********************************************
Program name: C:\artimi.src\davek\test\ser-test\sertest.exe (672)
App version: 1005.5, api: 0.94
DLL version: 1005.6, api: 0.108
DLL build: 20040103 13:16:07SNP
OS version: Windows NT-5.1
Heap size: 402653184
Date/Time: 2004-01-08 18:33:04
**********************************************
424 792 [main] sertest 672 environ_init: 0xA040008: !::=3D::\
76 868 [main] sertest 672 environ_init: 0xA0420C0: !C:=3DC:\cygwin\b=
in
61 929 [main] sertest 672 environ_init: 0xA0420D8: ALLUSERSPROFILE=
=3DC:\Documents and Settings\All Users
61 990 [main] sertest 672 environ_init: 0xA042110: APPDATA=3DC:\Docu=
ments and Settings\dk\Application Data
61 1051 [main] sertest 672 environ_init: 0xA042150: ARTIMI_ROOT=3D/ar=
timi-src/artimi
144 1195 [main] sertest 672 environ_init: 0xA042178: ASIC=3D/win/c/asic
50 1245 [main] sertest 672 environ_init: 0xA042190: CLIENTNAME=3DCons=
ole
47 1292 [main] sertest 672 environ_init: 0xA0421A8: COMMONPROGRAMFILE=
S=3DC:\Program Files\Common Files
48 1340 [main] sertest 672 environ_init: 0xA0421E0: COMPUTERNAME=3DMA=
CE
47 1387 [main] sertest 672 environ_init: 0xA0421F8: COMSPEC=3DC:\WIND=
OWS\system32\cmd.exe
47 1434 [main] sertest 672 environ_init: 0xA042220: CVSROOT=3D:pserve=
r:dk AT pepper:2401/cvsroot
47 1481 [main] sertest 672 environ_init: 0xA042250: CVS_RSH=3D/bin/ssh
50 1531 [main] sertest 672 parse_options: ntsec 1
47 1578 [main] sertest 672 parse_options: returning
26 1604 [main] sertest 672 environ_init: 0xA042268: CYGWIN=3Dntsec
47 1651 [main] sertest 672 environ_init: 0xA042290: DDKROOT=3DC:\WIND=
DK\NTDDK
47 1698 [main] sertest 672 environ_init: 0xA0422B0: DEVMGR_SHOW_DETAI=
LS=3D1
47 1745 [main] sertest 672 environ_init: 0xA0422D0: DEVMGR_SHOW_NONPR=
ESENT_DEVICES=3D1
54 1799 [main] sertest 672 getwinenv: can't set native for HOME=3D si=
nce no environ yet
58 1857 [main] sertest 672 mount_info::conv_to_posix_path: conv_to_po=
six_path (C:\cygwin\home\dk, no-keep-rel, no-add-slash)
31 1888 [main] sertest 672 normalize_win32_path: C:\cygwin\home\dk =
=3D normalize_win32_path (C:\cygwin\home\dk)
38 1926 [main] sertest 672 mount_info::conv_to_posix_path: /home/dk =
=3D conv_to_posix_path (C:\cygwin\home\dk)
70 1996 [main] sertest 672 win_env::add_cache: posix /home/dk
26 2022 [main] sertest 672 win_env::add_cache: native HOME=3DC:\cygwi=
n\home\dk
26 2048 [main] sertest 672 posify: env var converted to HOME=3D/home/=
dk
47 2095 [main] sertest 672 environ_init: 0xA042318: HOME=3D/home/dk
47 2142 [main] sertest 672 environ_init: 0xA042458: HOMEDRIVE=3DC:
47 2189 [main] sertest 672 environ_init: 0xA042470: HOMEPATH=3D\Docum=
ents and Settings\dk
47 2236 [main] sertest 672 environ_init: 0xA042498: HOSTNAME=3Dmace
47 2283 [main] sertest 672 environ_init: 0xA0424B0: INCLUDE=3DC:\Prog=
ram Files\Microsoft Visual Studio .NET\FrameworkSDK\include\
48 2331 [main] sertest 672 environ_init: 0xA042500: INFOPATH=3D/artim=
i-src/artimi/swtools/windows/info:/usr/local/info:/usr/info:/usr/share/info=
:/usr/autotool/devel/info:/usr/autotool/stable/info:
49 2380 [main] sertest 672 environ_init: 0xA042598: LIB=3DC:\Program =
Files\Microsoft Visual Studio .NET\FrameworkSDK\Lib\
47 2427 [main] sertest 672 environ_init: 0xA0422F8: LOGONSERVER=3D\\N=
UTMEG
48 2475 [main] sertest 672 environ_init: 0xA0425E0: MAKE_MODE=3Dunix
47 2522 [main] sertest 672 environ_init: 0xA0425F8: MANPATH=3D/usr/lo=
cal/man:/usr/man:/usr/share/man:/usr/autotool/devel/man::/usr/X11R6/man:/us=
r/ssl/man
48 2570 [main] sertest 672 environ_init: 0xA042660: NUMBER_OF_PROCESS=
ORS=3D1
47 2617 [main] sertest 672 environ_init: 0xA042680: OLDPWD=3D/usr/bui=
ld/obj
47 2664 [main] sertest 672 environ_init: 0xA0426A0: OS=3DWindows_NT
47 2711 [main] sertest 672 getwinenv: can't set native for PATH=3D si=
nce no environ yet
37 2748 [main] sertest 672 normalize_posix_path: src .
32 2780 [main] sertest 672 mount_info::conv_to_posix_path: conv_to_po=
six_path (C:\artimi.src\davek\test\ser-test, no-keep-rel, no-add-slash)
76 2856 [main] sertest 672 normalize_win32_path: C:\artimi.src\davek\=
test\ser-test =3D normalize_win32_path (C:\artimi.src\davek\test\ser-test)
30 2886 [main] sertest 672 mount_info::conv_to_posix_path: /test/ser-=
test =3D conv_to_posix_path (C:\artimi.src\davek\test\ser-test)
34 2920 [main] sertest 672 cwdstuff::get: posix /test/ser-test
27 2947 [main] sertest 672 cwdstuff::get: (/test/ser-test) =3D cwdstu=
ff::get (0x22DDA8, 260, 1, 0), errno 13
27 2974 [main] sertest 672 normalize_posix_path: /test/ser-test =3D n=
ormalize_posix_path (.)
28 3002 [main] sertest 672 mount_info::conv_to_win32_path: conv_to_wi=
n32_path (/test/ser-test)
36 3038 [main] sertest 672 set_flags: flags: binary (0x2)
27 3065 [main] sertest 672 mount_info::conv_to_win32_path: src_path /=
test/ser-test, dst C:\artimi.src\davek\test\ser-test, flags 0xA, rc 0
161 3226 [main] sertest 672 symlink_info::check: not a symlink
36 3262 [main] sertest 672 symlink_info::check: 0 =3D symlink.check (=
C:\artimi.src\davek\test\ser-test, 0x22DA68) (0xA)
30 3292 [main] sertest 672 path_conv::check: root_dir(C:\), this->pat=
h(C:\artimi.src\davek\test\ser-test), set_has_acls(8)
54 3346 [main] sertest 672 mount_info::conv_to_posix_path: conv_to_po=
six_path (C:\artimi.src\artimi\swtools\windows\bin, keep-rel, no-add-slash)
27 3373 [main] sertest 672 normalize_win32_path: C:\artimi.src\artimi=
\swtools\windows\bin =3D normalize_win32_path (C:\artimi.src\artimi\swtools=
\windows\bin)
30 3403 [main] sertest 672 mount_info::conv_to_posix_path: /artimi-sr=
c/artimi/swtools/windows/bin =3D conv_to_posix_path (C:\artimi.src\artimi\s=
wtools\windows\bin)
28 3431 [main] sertest 672 mount_info::conv_to_posix_path: conv_to_po=
six_path (C:\cygwin\usr\local\bin, keep-rel, no-add-slash)
26 3457 [main] sertest 672 normalize_win32_path: C:\cygwin\usr\local\=
bin =3D normalize_win32_path (C:\cygwin\usr\local\bin)
29 3486 [main] sertest 672 mount_info::conv_to_posix_path: /usr/local=
/bin =3D conv_to_posix_path (C:\cygwin\usr\local\bin)
27 3513 [main] sertest 672 mount_info::conv_to_posix_path: conv_to_po=
six_path (C:\cygwin\bin, keep-rel, no-add-slash)
27 3540 [main] sertest 672 normalize_win32_path: C:\cygwin\bin =3D no=
rmalize_win32_path (C:\cygwin\bin)
28 3568 [main] sertest 672 mount_info::conv_to_posix_path: /usr/bin =
=3D conv_to_posix_path (C:\cygwin\bin)
27 3595 [main] sertest 672 mount_info::conv_to_posix_path: conv_to_po=
six_path (C:\cygwin\bin, keep-rel, no-add-slash)
26 3621 [main] sertest 672 normalize_win32_path: C:\cygwin\bin =3D no=
rmalize_win32_path (C:\cygwin\bin)
28 3649 [main] sertest 672 mount_info::conv_to_posix_path: /usr/bin =
=3D conv_to_posix_path (C:\cygwin\bin)
27 3676 [main] sertest 672 mount_info::conv_to_posix_path: conv_to_po=
six_path (C:\cygwin\usr\X11R6\bin, keep-rel, no-add-slash)
27 3703 [main] sertest 672 normalize_win32_path: C:\cygwin\usr\X11R6\=
bin =3D normalize_win32_path (C:\cygwin\usr\X11R6\bin)
28 3731 [main] sertest 672 mount_info::conv_to_posix_path: /usr/X11R6=
/bin =3D conv_to_posix_path (C:\cygwin\usr\X11R6\bin)
27 3758 [main] sertest 672 mount_info::conv_to_posix_path: conv_to_po=
six_path (C:\WINDOWS\system32, keep-rel, no-add-slash)
27 3785 [main] sertest 672 normalize_win32_path: C:\WINDOWS\system32 =
=3D normalize_win32_path (C:\WINDOWS\system32)
28 3813 [main] sertest 672 mount_info::conv_to_posix_path: /win/c/WIN=
DOWS/system32 =3D conv_to_posix_path (C:\WINDOWS\system32)
27 3840 [main] sertest 672 mount_info::conv_to_posix_path: conv_to_po=
six_path (C:\WINDOWS, keep-rel, no-add-slash)
27 3867 [main] sertest 672 normalize_win32_path: C:\WINDOWS =3D norma=
lize_win32_path (C:\WINDOWS)
27 3894 [main] sertest 672 mount_info::conv_to_posix_path: /win/c/WIN=
DOWS =3D conv_to_posix_path (C:\WINDOWS)
28 3922 [main] sertest 672 mount_info::conv_to_posix_path: conv_to_po=
six_path (C:\WINDOWS\System32\Wbem, keep-rel, no-add-slash)
83 4005 [main] sertest 672 normalize_win32_path: C:\WINDOWS\System32\=
Wbem =3D normalize_win32_path (C:\WINDOWS\System32\Wbem)
31 4036 [main] sertest 672 mount_info::conv_to_posix_path: /win/c/WIN=
DOWS/System32/Wbem =3D conv_to_posix_path (C:\WINDOWS\System32\Wbem)
28 4064 [main] sertest 672 mount_info::conv_to_posix_path: conv_to_po=
six_path (C:\cygwin\bin, keep-rel, no-add-slash)
27 4091 [main] sertest 672 normalize_win32_path: C:\cygwin\bin =3D no=
rmalize_win32_path (C:\cygwin\bin)
27 4118 [main] sertest 672 mount_info::conv_to_posix_path: /usr/bin =
=3D conv_to_posix_path (C:\cygwin\bin)
71 4189 [main] sertest 672 win_env::add_cache: posix /artimi-src/arti=
mi/swtools/windows/bin:/usr/local/bin:/usr/bin:/usr/bin:/usr/X11R6/bin:/win=
/c/WINDOWS/system32:/win/c/WINDOWS:/win/c/WINDOWS/System32/Wbem:/usr/bin
27 4216 [main] sertest 672 win_env::add_cache: native PATH=3DC:\artim=
i.src\artimi\swtools\windows\bin;C:\cygwin\usr\local\bin;C:\cygwin\bin;C:\c=
ygwin\bin;C:\cygwin\usr\X11R6\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS=
\System32\Wbem;C:\cygwin\bin
28 4244 [main] sertest 672 posify: env var converted to PATH=3D/artim=
i-src/artimi/swtools/windows/bin:/usr/local/bin:/usr/bin:/usr/bin:/usr/X11R=
6/bin:/win/c/WINDOWS/system32:/win/c/WINDOWS:/win/c/WINDOWS/System32/Wbem:/=
usr/bin
49 4293 [main] sertest 672 environ_init: 0xA042780: PATH=3D/artimi-sr=
c/artimi/swtools/windows/bin:/usr/local/bin:/usr/bin:/usr/bin:/usr/X11R6/bi=
n:/win/c/WINDOWS/system32:/win/c/WINDOWS:/win/c/WINDOWS/System32/Wbem:/usr/=
bin
52 4345 [main] sertest 672 environ_init: 0xA0426B8: PATHEXT=3D.COM;.E=
XE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
48 4393 [main] sertest 672 environ_init: 0xA0426F8: PKG_CONFIG_PATH=
=3D:/usr/X11R6/lib/pkgconfig
48 4441 [main] sertest 672 environ_init: 0xA042728: PROCESSOR_ARCHITE=
CTURE=3Dx86
48 4489 [main] sertest 672 environ_init: 0xA042B60: PROCESSOR_IDENTIF=
IER=3Dx86 Family 15 Model 2 Stepping 9, GenuineIntel
48 4537 [main] sertest 672 environ_init: 0xA042748: PROCESSOR_LEVEL=
=3D15
48 4585 [main] sertest 672 environ_init: 0xA042760: PROCESSOR_REVISIO=
N=3D0209
47 4632 [main] sertest 672 environ_init: 0xA042BA8: PROGRAMFILES=3DC:=
\Program Files
48 4680 [main] sertest 672 environ_init: 0xA042BD0: PROMPT=3D$P$G
47 4727 [main] sertest 672 environ_init: 0xA042BE0: PS1=3D\u@\h \w>=
=20
47 4774 [main] sertest 672 environ_init: 0xA042BF8: PWD=3D/test/ser-t=
est
48 4822 [main] sertest 672 environ_init: 0xA042C10: PYTHONPATH=3D/art=
imi-src/artimi/tools/activedoc/:/artimi-src/artimi/models/pylab/library:/ar=
timi-src/artimi/chips/lomond/bin:C:\artimi.src\artimi\tools\activedoc\
50 4872 [main] sertest 672 environ_init: 0xA042CB8: SESSIONNAME=3DCon=
sole
47 4919 [main] sertest 672 environ_init: 0xA042CD0: SHLVL=3D1
47 4966 [main] sertest 672 environ_init: 0xA042CE0: SYSTEMDRIVE=3DC:
47 5013 [main] sertest 672 environ_init: 0xA042CF8: SYSTEMROOT=3DC:\W=
INDOWS
48 5061 [main] sertest 672 getwinenv: can't set native for TEMP=3D si=
nce no environ yet
47 5108 [main] sertest 672 mount_info::conv_to_posix_path: conv_to_po=
six_path (C:\DOCUME~1\dk\LOCALS~1\Temp, no-keep-rel, no-add-slash)
27 5135 [main] sertest 672 normalize_win32_path: C:\DOCUME~1\dk\LOCAL=
S~1\Temp =3D normalize_win32_path (C:\DOCUME~1\dk\LOCALS~1\Temp)
28 5163 [main] sertest 672 mount_info::conv_to_posix_path: /win/c/DOC=
UME~1/dk/LOCALS~1/Temp =3D conv_to_posix_path (C:\DOCUME~1\dk\LOCALS~1\Temp)
69 5232 [main] sertest 672 win_env::add_cache: posix /win/c/DOCUME~1/=
dk/LOCALS~1/Temp
26 5258 [main] sertest 672 win_env::add_cache: native TEMP=3DC:\DOCUM=
E~1\dk\LOCALS~1\Temp
27 5285 [main] sertest 672 posify: env var converted to TEMP=3D/win/c=
/DOCUME~1/dk/LOCALS~1/Temp
46 5331 [main] sertest 672 environ_init: 0xA042D40: TEMP=3D/win/c/DOC=
UME~1/dk/LOCALS~1/Temp
48 5379 [main] sertest 672 environ_init: 0xA042EA0: TERM=3Dcygwin
48 5427 [main] sertest 672 getwinenv: can't set native for TMP=3D sin=
ce no environ yet
47 5474 [main] sertest 672 mount_info::conv_to_posix_path: conv_to_po=
six_path (C:\DOCUME~1\dk\LOCALS~1\Temp, no-keep-rel, no-add-slash)
31 5505 [main] sertest 672 normalize_win32_path: C:\DOCUME~1\dk\LOCAL=
S~1\Temp =3D normalize_win32_path (C:\DOCUME~1\dk\LOCALS~1\Temp)
29 5534 [main] sertest 672 mount_info::conv_to_posix_path: /win/c/DOC=
UME~1/dk/LOCALS~1/Temp =3D conv_to_posix_path (C:\DOCUME~1\dk\LOCALS~1\Temp)
77 5611 [main] sertest 672 win_env::add_cache: posix /win/c/DOCUME~1/=
dk/LOCALS~1/Temp
26 5637 [main] sertest 672 win_env::add_cache: native TMP=3DC:\DOCUME=
~1\dk\LOCALS~1\Temp
27 5664 [main] sertest 672 posify: env var converted to TMP=3D/win/c/=
DOCUME~1/dk/LOCALS~1/Temp
47 5711 [main] sertest 672 environ_init: 0xA042EB0: TMP=3D/win/c/DOCU=
ME~1/dk/LOCALS~1/Temp
47 5758 [main] sertest 672 environ_init: 0xA043010: USER=3Ddk
47 5805 [main] sertest 672 environ_init: 0xA042D18: USERDNSDOMAIN=3DC=
AM.ARTIMI.COM
48 5853 [main] sertest 672 environ_init: 0xA043020: USERDOMAIN=3DARTI=
MI_CAM
47 5900 [main] sertest 672 environ_init: 0xA043040: USERNAME=3Ddk
47 5947 [main] sertest 672 environ_init: 0xA043050: USERPROFILE=3DC:\=
Documents and Settings\dk
48 5995 [main] sertest 672 environ_init: 0xA043080: VSCOMNTOOLS=3D"C:=
\Program Files\Microsoft Visual Studio .NET\Common7\Tools\"
47 6042 [main] sertest 672 environ_init: 0xA0430D0: WINDIR=3DC:\WINDO=
WS
47 6089 [main] sertest 672 environ_init: 0xA0430E8: _=3D/usr/bin/stra=
ce
41 6130 [main] sertest 672 pinfo_init: pid 672, pgid 672
85 6215 [main] sertest 672 dtable::extend: size 32, fds 0x61670638
39 6254 [main] sertest 672 normalize_posix_path: src /etc/passwd
27 6281 [main] sertest 672 normalize_posix_path: /etc/passwd =3D norm=
alize_posix_path (/etc/passwd)
27 6308 [main] sertest 672 mount_info::conv_to_win32_path: conv_to_wi=
n32_path (/etc/passwd)
31 6339 [main] sertest 672 set_flags: flags: binary (0x2)
26 6365 [main] sertest 672 mount_info::conv_to_win32_path: src_path /=
etc/passwd, dst C:\cygwin\etc\passwd, flags 0xA, rc 0
128 6493 [main] sertest 672 symlink_info::check: not a symlink
33 6526 [main] sertest 672 symlink_info::check: 0 =3D symlink.check (=
C:\cygwin\etc\passwd, 0x22DC28) (0xA)
29 6555 [main] sertest 672 path_conv::check: root_dir(C:\), this->pat=
h(C:\cygwin\etc\passwd), set_has_acls(8)
95 6650 [main] sertest 672 etc::test_file_change: FindFirstFile succe=
eded
31 6681 [main] sertest 672 etc::test_file_change: fn[1] C:\cygwin\etc=
\passwd res 1
27 6708 [main] sertest 672 etc::init: fn[1] C:\cygwin\etc\passwd, cur=
r_ix 1
26 6734 [main] sertest 672 pwdgrp::load: /etc/passwd
433 7167 [main] sertest 672 pwdgrp::load: /etc/passwd curr_lines 41
35 7202 [main] sertest 672 pwdgrp::load: /etc/passwd load succeeded
52 7254 [main] sertest 672 normalize_posix_path: src /etc/group
27 7281 [main] sertest 672 normalize_posix_path: /etc/group =3D norma=
lize_posix_path (/etc/group)
29 7310 [main] sertest 672 mount_info::conv_to_win32_path: conv_to_wi=
n32_path (/etc/group)
44 7354 [main] sertest 672 set_flags: flags: binary (0x2)
27 7381 [main] sertest 672 mount_info::conv_to_win32_path: src_path /=
etc/group, dst C:\cygwin\etc\group, flags 0xA, rc 0
142 7523 [main] sertest 672 symlink_info::check: not a symlink
33 7556 [main] sertest 672 symlink_info::check: 0 =3D symlink.check (=
C:\cygwin\etc\group, 0x22DBE8) (0xA)
29 7585 [main] sertest 672 path_conv::check: root_dir(C:\), this->pat=
h(C:\cygwin\etc\group), set_has_acls(8)
88 7673 [main] sertest 672 etc::test_file_change: FindFirstFile succe=
eded
31 7704 [main] sertest 672 etc::test_file_change: fn[2] C:\cygwin\etc=
\group res 1
26 7730 [main] sertest 672 etc::init: fn[2] C:\cygwin\etc\group, curr=
_ix 2
27 7757 [main] sertest 672 pwdgrp::load: /etc/group
286 8043 [main] sertest 672 pwdgrp::load: /etc/group curr_lines 23
32 8075 [main] sertest 672 pwdgrp::load: /etc/group load succeeded
34 8109 [main] sertest 672 cygheap_user::ontherange: what 2, pw 0xA04=
4CB8
104 8213 [main] sertest 672 cygheap_user::ontherange: HOME is already =
in the environment /home/dk
196 8409 [main] sertest 672 sigproc_init: process/signal handling enab=
led(1)
92 8501 [main] sertest 672 build_argv: argv[0] =3D 'sertest.exe'
27 8528 [main] sertest 672 build_argv: argc 1
81 8609 [main] sertest 672 build_fh_pc: fh 0x616707A0
64 8673 [main] sertest 672 open_shared: name (null), shared 0xA020000=
(wanted 0xA020000), h 0x71C
38 8711 [main] sertest 672 _pinfo::set_ctty: checking if /dev/tty-1 d=
iffers from input
27 8738 [main] sertest 672 _pinfo::set_ctty: attached tty1073741824 s=
id 672, pid 672, tty->pgid 672, tty->sid 672
28 8766 [main] sertest 672 _pinfo::set_ctty: resetting tty1073741824 =
sid. Was 672, now 672. pgid was 0, now 672.
1428 10194 [sig] sertest 672 wait_sig: sigcomplete_main 0x6FC
146 10340 [main] sertest 672 fhandler_base::set_flags: flags 0x10002, s=
upplied_bin 0x0
35 10375 [main] sertest 672 fhandler_base::set_flags: O_TEXT/O_BINARY =
set in flags 0x10000
28 10403 [main] sertest 672 fhandler_base::set_flags: filemode set to =
binary
187 10590 [main] sertest 672 fhandler_console::open: incremented open_f=
hs, now 1
33 10623 [main] sertest 672 fhandler_console::open: opened conin$ 0x2B=
, conout$ 0x2F
48 10671 [main] sertest 672 fhandler_console::output_tcsetattr: 0 =3D =
tcsetattr (,A020018) (ENABLE FLAGS 3) (lflag 107 oflag 9)
39 10710 [main] sertest 672 dtable::init_std_file_from_handle: fd 0, h=
andle 0xB
52 10762 [main] sertest 672 build_fh_pc: fh 0x61670BA8
29 10791 [main] sertest 672 fhandler_base::set_flags: flags 0x10002, s=
upplied_bin 0x0
28 10819 [main] sertest 672 fhandler_base::set_flags: O_TEXT/O_BINARY =
set in flags 0x10000
28 10847 [main] sertest 672 fhandler_base::set_flags: filemode set to =
binary
85 10932 [main] sertest 672 fhandler_console::open: incremented open_f=
hs, now 2
31 10963 [main] sertest 672 fhandler_console::open: opened conin$ 0xB,=
conout$ 0x33
43 11006 [main] sertest 672 fhandler_console::output_tcsetattr: 0 =3D =
tcsetattr (,A020018) (ENABLE FLAGS 3) (lflag 107 oflag 9)
38 11044 [main] sertest 672 dtable::init_std_file_from_handle: fd 1, h=
andle 0x13
56 11100 [main] sertest 672 build_fh_pc: fh 0x61670FB0
29 11129 [main] sertest 672 fhandler_base::set_flags: flags 0x10002, s=
upplied_bin 0x0
28 11157 [main] sertest 672 fhandler_base::set_flags: O_TEXT/O_BINARY =
set in flags 0x10000
27 11184 [main] sertest 672 fhandler_base::set_flags: filemode set to =
binary
83 11267 [main] sertest 672 fhandler_console::open: incremented open_f=
hs, now 3
30 11297 [main] sertest 672 fhandler_console::open: opened conin$ 0x13=
, conout$ 0x37
44 11341 [main] sertest 672 fhandler_console::output_tcsetattr: 0 =3D =
tcsetattr (,A020018) (ENABLE FLAGS 3) (lflag 107 oflag 9)
37 11378 [main] sertest 672 dtable::init_std_file_from_handle: fd 2, h=
andle 0x17
31 11409 [main] sertest 672 dll_crt0_1: user_data->main 0x40127F
29 11438 [main] sertest 672 wait_for_sigthread: wait_sig_inited 0x720
157 11595 [main] sertest 672 open: open (/dev/com1, 0x1C002)
34 11629 [main] sertest 672 normalize_posix_path: src /dev/com1
28 11657 [main] sertest 672 normalize_posix_path: /dev/com1 =3D normal=
ize_posix_path (/dev/com1)
29 11686 [main] sertest 672 mount_info::conv_to_win32_path: conv_to_wi=
n32_path (/dev/com1)
36 11722 [main] sertest 672 mount_info::conv_to_win32_path: src_path /=
dev/com1, dst \.\com1, flags 0x2, rc 0
36 11758 [main] sertest 672 build_fh_pc: fh 0x616713B8
31 11789 [main] sertest 672 fhandler_serial::open: fhandler_serial::op=
en (/dev/com1, 0x1C002, 0x547)
32 11821 [main] sertest 672 fhandler_base::open: (\.\com1, 0x1C002) qu=
ery_open 0
539 12360 [main] sertest 672 fhandler_base::open: 0x720 =3D CreateFile =
(\.\com1, 0xC0000000, 0x7, 0x22E180, 0x3, 0x80, 0)
59 12419 [main] sertest 672 fhandler_base::set_flags: flags 0x1C002, s=
upplied_bin 0x10000
43 12462 [main] sertest 672 fhandler_base::set_flags: O_TEXT/O_BINARY =
set in flags 0x10000
28 12490 [main] sertest 672 fhandler_base::set_flags: filemode set to =
binary
28 12518 [main] sertest 672 fhandler_base::open: 1 =3D fhandler_base::=
open (\.\com1, 0x1C002)
76 12594 [main] sertest 672 fhandler_serial::open: 0x1 =3D fhandler_se=
rial::open (/dev/com1, 0x1C002, 0x547)
31 12625 [main] sertest 672 open: 3 =3D open (/dev/com1, 0x1C002)
35 12660 [main] sertest 672 fhandler_base::set_flags: flags 0x1C002, s=
upplied_bin 0x0
28 12688 [main] sertest 672 fhandler_base::set_flags: O_TEXT/O_BINARY =
set in flags 0x10000
28 12716 [main] sertest 672 fhandler_base::set_flags: filemode set to =
binary
27 12743 [main] sertest 672 fcntl_worker: 0 =3D fcntl (3, 4, 0x4000)
59 12802 [main] sertest 672 fhandler_serial::tcgetattr: vmin_ 0, vtime=
_ 0
29 12831 [main] sertest 672 tcgetattr: iflag 4, oflag 0, cflag 830, lf=
lag 0, VMIN 0, VTIME 0
30 12861 [main] sertest 672 fhandler_serial::tcsetattr: action 2
62 12923 [main] sertest 672 fhandler_serial::tcsetattr: vtime 0, vmin 0
30 12953 [main] sertest 672 tcsetattr: iflag 0x4, oflag 0x0, cflag 0x8=
B0, lflag 0x0, VMIN 0, VTIME 0
28 12981 [main] sertest 672 tcsetattr: 0 =3D tcsetattr (3, 2, 22E2B8)
35 13016 [main] sertest 672 _cygwin_istext_for_stdio: _cygwin_istext_f=
or_stdio (0)
28 13044 [main] sertest 672 _cygwin_istext_for_stdio: _cifs: fd not d=
isk file
28 13072 [main] sertest 672 _cygwin_istext_for_stdio: _cygwin_istext_f=
or_stdio (1)
27 13099 [main] sertest 672 _cygwin_istext_for_stdio: _cifs: fd not d=
isk file
28 13127 [main] sertest 672 _cygwin_istext_for_stdio: _cygwin_istext_f=
or_stdio (2)
27 13154 [main] sertest 672 _cygwin_istext_for_stdio: _cifs: fd not d=
isk file
42 13196 [main] sertest 672 fhandler_base::fstat: here
34 13230 [main] sertest 672 fstat64: 0 =3D fstat (1, 0x22CA20)
56 13286 [main] sertest 672 isatty: 1 =3D isatty (1)
45 13331 [main] sertest 672 writev: writev (1, 0x22C9D0, 1)
32 13363 [main] sertest 672 fhandler_console::write: A045558, 48
29 13392 [main] sertest 672 fhandler_console::write: at 98(b) state is=
0
422 13814 [main] sertest 672 fhandler_console::write: 48 =3D write_cons=
ole (,..48)
58 13872 [main] sertest 672 writev: 48 =3D write (1, 0x22C9D0, 1), err=
no 0
46 13918 [main] sertest 672 cygwin_select: 4, 0x22E270, 0x0, 0x0, 0x22=
E280
65 13983 [main] sertest 672 dtable::select_read: /dev/com1 fd 3
27 14010 [main] sertest 672 cygwin_select: to->tv_sec 0, to->tv_usec 2=
50000, ms 250
28 14038 [main] sertest 672 cygwin_select: sel.always_ready 0
341 14379 [select_serial] sertest 672 peek_serial: fh->overlapped_armed=
0
90 14469 [main] sertest 672 select_stuff::wait: m 2, ms 250
242517 256986 [main] sertest 672 select_stuff::wait: timed out
504 257490 [main] sertest 672 select_stuff::wait: returning 1
71 257561 [main] sertest 672 select_stuff::cleanup: calling cleanup rou=
tines
2970788 3228349 [unknown (0xCE4)] sertest 672 kill: kill (-672, 2)
71 3228420 [unknown (0xCE4)] sertest 672 kill_pgrp: pid 672, signal 2
728 3229148 [unknown (0xCE4)] sertest 672 kill_pgrp: killing pid 672, pgr=
p 672, p->ctty 1073741824, myself->ctty 1073741824
54 3229202 [unknown (0xCE4)] sertest 672 sig_send: pid 672, signal 2, it=
s_me 1
44 3229246 [unknown (0xCE4)] sertest 672 sig_send: Waiting for pack.wake=
up 0x6FC
39 3229285 [sig] sertest 672 sig_handle: signal 2 processing
------=_NextPart_000_0000_01C3D61A.CE2B64F0
Content-Type: application/octet-stream;
name="makefile"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="makefile"
# Configurable flags for compilation
CFLAGS?=3D-O0 -g -D_MT -D_REENTRANT
LFLAGS?=3D-lm -lpthread
ALLFLAGS?=3D-Wall
all: sertest.exe
sertest.exe: sertest.c
gcc $(CFLAGS) $(LFLAGS) $(ALLFLAGS) sertest.c -o sertest.exe
------=_NextPart_000_0000_01C3D61A.CE2B64F0
Content-Type: text/plain;
name="sertest.c"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="sertest.c"
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <pthread.h>
#include <termios.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/select.h>
/** Reads the serial port, implementing a timeout.
*
* @param serialfd Fd returned earlier from serial_init (...)
* @param buffer The destination address for received bytes.
* @param buflen The maximum amount of space available in the buffer.
* @param timeout_ms Timeout in milliseconds; zero to poll, -ve for infinit=
e.
*
* @return -1 if error, 0 if timeout before any data rx'd, else num
* bytes placed into buffer (up to max of buflen).
*
* @todo Perhaps implement win32 style serial handling
*/
int serial_read_with_timeout (int serialfd, void *buffer, int buflen, int t=
imeout_ms)
{
struct timeval tmo, *tmoptr;
int rv;
fd_set readfds;
//fd_set dummy1, dummy2;
//FD_ZERO (&dummy1); FD_ZERO (&dummy2);
FD_ZERO (&readfds);
FD_SET (serialfd, &readfds);
tmo.tv_sec =3D timeout_ms / 1000;
tmo.tv_usec =3D (timeout_ms - (1000 * tmo.tv_sec)) * 1000;
tmoptr =3D (timeout_ms < 0) ? NULL : &tmo;
printf ("b4sel %d, %p, 0, 0, %p { %ld, %ld }\n", 1+serialfd, &readfds, =
tmoptr, tmo.tv_sec, tmo.tv_usec);
rv =3D select (1 + serialfd, &readfds, NULL, NULL, tmoptr);
//rv =3D select (1 + serialfd, &readfds, &dummy1, &dummy2, tmoptr);
printf ("afsel\n");
// So what happened? rv is 0 =3D> no fd set, -1 =3D error, else there m=
ust be readable data
if (rv <=3D 0)
return rv;
// huzzah! there is some data to actually read....
// we could always do int bytes; ioctl(fd, FIONREAD, &bytes);
// at this point, but nonblocking means we should be ok anyway.......
rv =3D read (serialfd, buffer, buflen);
return rv;
}
int main (int argc, const char **argv)
{
int rv, fd;
char buff[8];
struct termios tio;
fd =3D open ("/dev/com1", O_RDWR | O_BINARY | /* O_NONBLOCK | */ O_NOCT=
TY | O_NDELAY );
if (fd < 0)
{
fprintf (stderr, "oops error opening com1 %d\n", errno);
return -1;
}
// Dunno for sure if this just duplicates setting O_NONBLOCK
fcntl(fd, F_SETFL, FNDELAY);
// Set the serial port to the baud rate chosen and 8n1.
rv =3D tcgetattr (fd, &tio);
if (rv)
{
fprintf (stderr, "Can't get options - error %d\n", errno);
close (fd);
return -1;
}
// Not implemented.... cfmakeraw (&tio); ... equivalent is....
tio.c_iflag &=3D ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON|I=
XOFF|IXANY|INPCK|IUCLC);
tio.c_oflag &=3D ~OPOST;
tio.c_lflag &=3D ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN|ECHOE);
tio.c_cflag &=3D ~(CSIZE|PARENB);
tio.c_cflag |=3D CS8 | CLOCAL | CREAD;
// Now modify the defaults with chosen settings.
rv =3D cfsetospeed (&tio, B57600);
if (!rv)
rv =3D cfsetispeed (&tio, B57600);
if (rv)
fprintf (stderr, "ERROR: Baud rate not recognized\n");
tio.c_cflag =3D (tio.c_cflag & ~CSIZE) | CS8;
tio.c_cflag =3D (tio.c_cflag & ~PARENB);
tio.c_cflag =3D (tio.c_cflag & ~CSTOPB);
// and implement those settings.
rv =3D tcsetattr (fd, TCSANOW, &tio);
if (rv)
{
fprintf (stderr, "Error %d setting options\n", errno);
close (fd);
return -1;
}
// so try reading it
rv =3D serial_read_with_timeout (fd, buff, 1, 250);
fprintf (stderr, "serial read: rv %d char $%02x\n", rv, (unsigned int)b=
uff[0]);
// we done now.
rv =3D close (fd);
fprintf (stderr, "close gives %d\n", fd);
return 0;
}
------=_NextPart_000_0000_01C3D61A.CE2B64F0
Content-Type: text/plain; charset=us-ascii
--
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/
------=_NextPart_000_0000_01C3D61A.CE2B64F0--
- Raw text -