Mail Archives: cygwin/2007/01/31/09:46:42
---559023410-961103355-1170254760=:3176
Content-Type: TEXT/PLAIN; charset=US-ASCII
On Fri, 26 Jan 2007, Peter Rehley wrote:
> Hello,
>
> I tried the latest release of cygwin1.dll (1.5.24-1) and it still is
> hanging in the same way. I've tried to debug further with gdb, but
> so far I haven't got any useful information out of gdb.
>
> I'll keep trying to get some debug information, but if any one else
> can reproduce the problem I would be most appreciative.
I can reproduce a problem. Your descriptions of it are a bit hard to
follow, so I'm not sure if it is your problem or not. Unfortunately, I
don't have time to debug it right now. I do have a few comments, though.
Why are you creating a thread just to fork/exec another process?
Pedantically, I believe you are supposed to call _exit, not exit, if fork
fails as stated here in the Solaris man page for fork:
An applications should call _exit() rather than exit(3C) if
it cannot execve(), since exit() will flush and close stan-
dard I/O channels and thereby corrupt the parent process's
standard I/O data structures. Using exit(3C) will flush buf-
fered data twice. See exit(2).
I don't know, however, if this is really true in Cygwin, but it might
explain some misdiagnosed hangs on your part.
Also, the execve call appears to be suspect. Again, the Solaris man page
for execve states:
The value in
argv[0] should point to a filename that is associated with
the process being started by one of the exec functions.
[snip]
As indicated, argc is at least one and the
first member of the array points to a string containing the
name of the file.
Attached is a modified test case that fixes a few of these issues, but
still hangs (or stutters; it does appear to proceed after long periods of
time).
--
Brian Ford
Lead Realtime Software Engineer
VITAL - Visual Simulation Systems
FlightSafety International
the best safety device in any aircraft is a well-trained crew...
---559023410-961103355-1170254760=:3176
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="main.cc"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine DOT CYG DOT 4 DOT 58 DOT 0701310846000 DOT 3176 AT PC1163-8460-XP DOT flightsafety DOT com>
Content-Description:
Content-Disposition: attachment; filename="main.cc"
LyogbWFpbi5jYw0NCiAqDQ0KICovDQ0KDQ0KI2luY2x1ZGUgPHN0ZGlvLmg+
DQ0KI2luY2x1ZGUgPHVuaXN0ZC5oPg0NCiNpbmNsdWRlIDxzdGRsaWIuaD4N
DQoj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ICAgcmV0dXJuIDE7
DQ0KICAgIH0NDQoNDQogIHdoaWxlICghcXVpdCkNDQogICAgew0NCiAgICBw
cmludGYoImhlcmUgd2UgZ29cbiIpOw0NCiANDQojaWZkZWYgUFJGQUlMDQ0K
ICAgIHByaW50ZigiY3JlYXRpbmcgdGhyZWFkXG4iKTsNDQojZW5kaWYNDQog
ICAgcmM9cHRocmVhZF9jcmVhdGUoJnRocmVhZElkLCAmdGEsIGZvcmtpdDJt
ZSwgcHJvZzJydW4pOw0NCiAgICBpZiAocmMpDQ0KICAgICAgew0NCiAgICAg
IHByaW50ZigicHRocmVhZF9jcmVhdGUgZmFpbGVkOiByYyAoJWQpXG4iLHJj
KTsNDQogICAgICBicmVhazsNDQogICAgICB9DQ0KI2lmZGVmIFBSRkFJTA0N
CiAgICBwcmludGYoImNyZWF0ZWRcbiIpOw0NCiNlbmRpZg0NCiAgICB9DQ0K
DQ0KICByZXR1cm4gMDsNDQogIH0NDQoNDQo=
---559023410-961103355-1170254760=:3176
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/
---559023410-961103355-1170254760=:3176--
- Raw text -