next up previous Back to Operating Systems Home Page
Next: A4: socket closing Up: 1998 term messages Previous: A4 - Re: Conflicts

Re: A4 - select(2) / fdopen(3)

On Sat, 4 Apr 1998, Andrew McCoubrey wrote:

> > Well, let me point you to two cases, both on the client side:
> 
> I could be mistaken, but isn't the second case on the server side? It's
> the server that has to read the running application output, for
> redirection to the client through a socket, as well as the incoming input
> from the client in case an END is set. So the server select()s the client
> input socket and the running job output for reading, and if the client is
> ready for a read we read it in case it's an END message. Right?

Right. In the message I sent I was thinking to an interactive client
case, hence the pointer to telnet(1). It is true that, literally, the
message I sent to Nick Roy (copy on the web page under the title 
"Flip-flop...") referred to server side, but almost identical 
considerastions would apply to the client side as well.
 
> An unrelated question: why can't I find fdopen in any of my Linux
> headers? I'm using it despite the warning that it's undefined and it seems
> to work. (I thought it was a part of stdio.h, is it not?)

Which version of libc are you using? Here's what I see here:
        
        % ls -l /lib/libc.so
        /lib/libc.so.6.1 -> libc-2.0.6.so*

        % less /usr/include/stdio.h 
        [...]
        #if !defined(__STRICT_ANSI__) || defined(__USE_POSIX)
        extern FILE *fdopen __P ((int, __const char *));
        [...]

So the prototype is there allright.

You may try to #undef __STRICT_ANSI__  or  #define __USE_POSIX . YMMV.

Ciao
Franco


\ Franco Callari