Hi all,
This pertains to 21.4.24 and earlier; I have not checked the 21.5 branch.
There is a very rusty API called connec_to_file_descriptor() in
process-unix.c. I am using it in an emodule.
It works fine, from what I can tell. The problem I am encountering
now, is that when the in fd is a pipe, and the pipe has
less-than-internal-buffer-length it blocks on a subsequent read()
system call.
I am currently not sure how to "fix it". The culprit seems to be the
if in Lstream_read(), inside the while loop. And the result is that
it'll block on the read in filedesc_reader().
It's very wrong to adjust connect_to_file_descriptor() to make the resulting fd
stream allow quits when read()ing. That just pushes the bug into
user-visible space.
Adding poll or select into the filedesc reader seems like the wrong
solution, at first glance.
Ideally, there should be a way to tell XEmacs to read() exactly once,
but that also means getting rid of the while loop in Lstream_read()
from what I can tell.
Which may not be a good idea overall.
Is there a way to fix this problem with minimal refactoring? Or am I
cursed to have to fix all the internal buffering system in XEmacs to
make connect_to_file_descriptor() usable with pipes?
--
Johann
I'm not from the internet, I just work there.