[gambit-list] Question for os_tty.c:1063 to solve closed-TTY input Gambit zombie+CPU hogging bug

Mikael mikael.rcv at gmail.com
Sat Jan 24 21:43:02 EST 2015


Dear Marc,

I've tracked down a TTY IO bug here,
https://github.com/feeley/gambit/issues/100 .

On os_tty.c:1062 which is "if ((n = read (d->fd, buf, len)) < 0)", the <
should be changed to <= because a 0 return value *always* means EOF in the
sense that the TTY has been closed, see issue for more info.

Then, os_tty.c:1063 needs to be updated from: "return err_code_from_errno
();" to something like "return n == 0 ? ___FIX([EOF-ERROR-VALUE]) :
err_code_from_errno ();".


The purpose of ___FIX([EOF-ERROR-VALUE]) is to signal to the underlying
logic, which is the Gambit C VTBL IO abstraction, that the TTY is closed so
that the REPL's input will be #!eof and Gambit supposedly will shut down,
instead of repeating the read() infinitely, as is the case now.

You know best which value is suitable in the place of [EOF-ERROR-VALUE]
here - can you please suggest so a patch can be produced?

Thanks,
Mikael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20150125/3bea4ef0/attachment.htm>


More information about the Gambit-list mailing list