[gambit-list] How to use ports created from aopen file descriptors

Jörg F. Wittenberger Joerg.Wittenberger at softeyes.net
Sun Jul 19 13:08:22 EDT 2020


Hi,

once I learned that ##open-predefined could be used to create a port
from an already opened file descriptor (in addition to the standard
streams). This did work for me as long as I used just one FD that way
and used it until the programm terminated.

However now I need to actually close the port and want the FD being
closed too.  However in os_io.c around line 9932ff I found:

   * ...........  The responsibility for closing the stream is not
   * transferred to the runtime system because ...

I obviously need the other way around.  How would I transfer the
ownership of an FD to the runtime system?

(A second, related issue I'm looking into is that ##open-predefined
will add an exit job for each writable FD.  This too is not desirable
in my case.  However cut&paste of ##open-predefined and modification
looks easy enough to get rid of the latter.  What I wonder is how I
would have (ab)use the C code side with preferrable non to minimal
modifications.)

Best

Jörg





More information about the Gambit-list mailing list