[gambit-list] Can Gambit programs be safely fork()'ed?

Jachym Holecek freza at dspfpga.com
Sun Jul 30 12:02:10 EDT 2006


# Christian 2006-07-30:
> At 18:13 Uhr +0800 29.07.2006, TJay wrote:
> >I'm wondering if programs
> >compiled with Gambit can be cleanly forked, with the child and parent
> >being completely separate.
> 
> I remember that Gambit closes filehandles if you call open-process. 
> But that does not only a fork, it also exec's. My question is, how 
> did you want to fork your child in the first place?
> 
> If you're using the C interface, you could probably just as well call 
> close on all fd's which are not of your interest. (A way to do that 
> (which some unix programs employ) is to just call close on all 
> numbers from 3 to 1023 or something like that, of course that's not 
> safe if there are more files open.)

fcntl(3, F_CLOSEM) or somesuch will do, on some unices.

	-- Jachym



More information about the Gambit-list mailing list