This is the mail archive of the cygwin-developers@cygwin.com 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]

Re: fixup_after_fork_not?


On Mon, Sep 10, 2001 at 10:01:52AM +1000, Robert Collins wrote:
>In my win95 pthread work, I'm attempting to add a new fixup_after_fork()
>routine, to be called from fork.cc after the fixup_signal_after_fork.
>The function I'm creating generates new mutex objects...
>
>However I have a problem, some insight would be appreciated :]
>
>1) I can't run a non-stripped cygwin1.dll - not enough memory to load
>cygwin1.dll. Don't know why, will try on win2k tonight. My changes don't
>cause this btw.
>2) either a) System_printfs consistently don't get written to the
>console by the forked process, or b) fork() doesn't trigger the fixup
>routine?! 
>
>By this I mean I've added a few system printf's as a substitute for a
>non-stripped .dll...
>
>in tcsh, calling ps will result in the printfs coming on screen - the
>routine is firing.
>in bash, calling ps will not result in the printfs showing. Now IIRC
>tcsh uses exec, bash uses fork? 
>
>anyway, the test program uses plain old fork(), and _never_ shows the
>system printfs. It also crashes as I would expect if the fixup routine
>isn't firing.
>
>Is there anything in the current .dll that would prevent the fixup_ set
>of routines being reached in the child by a plain old fork() call on
>win95?

I'm having no problems running a debugging version of cygwin.  I just did
it to track down the heap problem.

I set CYGWIN_SLEEP=5000 and attached, via gdb, to the displayed pid to
see why it was having problems.  You have to 'configure --enable-debug'
for this feature to be active, though.

I'm pretty sure that the fork fixup routines are running.  If they weren't
then fork wouldn't be operational.

I added a malloc mutex lock in the parent call to prevent heap instability
during fork.  I don't see how that could cause this, though.

You do have to make sure that you call anything which uses malloc at the
proper point or some things (like mutos) won't be properly initialized.
Putting your routine after signal_fixup may be too early.  Try putting
it before the sigproc_init.

I've just reduced the size of the problematic 'zombies' array.  I don't know
if that is what is causing your size problems but it should make the DLL
noticeably smaller.

If you can't, for some reason, debug a DLL that is entirely built with -g,
try compiling everything except fork.cc and thread.c (or whatever) with '-O2'
and those to files with '-g'.

You are using the latest version of binutils, right?

cgf


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