child process initialization as part of fork() -- STC

Corinna Vinschen corinna-cygwin@cygwin.com
Tue Mar 8 12:50:00 GMT 2016


Hi Mark,

On Mar  8 00:20, Mark Geisert wrote:
> -------- compile, link, and run
> ~ gcc -nostdlib -pg -g -o stc stc.c build/gcrt0.o build/crt0.o
> build/libgmon.a build/libcygwin.a /c/Windows/system32/kernel32.dll -lgcc
> 
> ~ strace -o stc.out --mask=debug+sigp+syscall ./stc 5592: _monstartup called
> 5592: monstartup called
> 5592: moncontrol called
> 5592: profile_off called
> 5592: profile_on called
> 5592: _monstartup called  <-- this is the odd message I'm asking about
> 5592: I'm a constructor
> 5592: I'm the parent
> 5504: I'm the child
> 5504: I'm a destructor
> 5504: _mcleanup called
> 5504: moncontrol called
> 5504: profile_off called
> 5592: I'm a destructor
> 5592: _mcleanup called
> 5592: moncontrol called
> 5592: profile_off called
> 
> ~
> 
> In the above compilation command, "build" is a symlink to
> /oss/build/x86_64-unknown-cygwin/winsup/cygwin/
> 
> I've patched several routines in Cygwin DLL and libgmon.a to call my note()
> function just to announce they've been reached and to say what pid they're
> running in.  It looks like libgmon's _monstartup() is called twice, which is
> expected, but both times in the parent's process, which is not expected.

I'm not set up to test this locally.  Can you please check the *Windows*
PID as well in your note function?  There's a chance this is a false
positive.  Dependent on when the constructors are called, the Cygwin
PID might not be set yet in the child.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-developers/attachments/20160308/8577cc34/attachment.sig>


More information about the Cygwin-developers mailing list