[gambit-list] __cleanup() problem (OS X 10.6.6 / Gambit-C 4.6.0)

Marc Feeley feeley at iro.umontreal.ca
Wed Jan 12 09:06:11 EST 2011


On 2011-01-12, at 8:44 AM, David Dreisigmeyer wrote:

> This wasn't used with Python.  I started with modifying the client.c
> file included in gambit/tests and proceeded from there.  I'll check on
> commenting out the call to release_fn soon.
> 
> Thanks Marc,
> 
> -Dave

OK, I misunderstood.  Now I think the problem is that Gambit is closing stdin/stdout/stderr in ___cleanup(), so when you do a printf after the call to ___cleanup, there is no output.

Please try this: in lib/os_io.c in function ___device_file_close_raw_virt, replace

#ifdef USE_POSIX
      if (close_no_EINTR (d->fd) < 0)
        return err_code_from_errno ();
#endif

with

#ifdef USE_POSIX
      if (d->fd > 2 && close_no_EINTR (d->fd) < 0)
        return err_code_from_errno ();
#endif

This will prevent closing stdin/stdout/stderr.  If that fixes your problem, then I'll try to find a better fix.  By the way I notice this commented out code which seems to be relevant:

#if 0
        /*
         * The file descriptor must be dup'ed so that the standard
         * stdin/stdout/stderr are not closed.
         */

...

Marc




More information about the Gambit-list mailing list