Subject: Asynchronous I/O and SIGIO
From: [email-masked] (John Knottenbelt)

27 Jul 1998 11:02:32 -0700
Message-ID: <[email-masked]>
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
To: [email-masked]

Hi

I've been trying to get asynchronous I/O going. I would like to be able to
receive SIGIO signals when a file descriptor becomes ready for reading or
writing.

I have had some success by performing an fcntl:

int flags = fcntl( fd, F_GETFL, 0 );
fcntl( fd, F_SETFL, flags | O_NONBLOCK | FASYNC );

and then subsequently an ioctl

int yesplease = 1;
ioctl( fd, FIOASYNC, &yesplease );

(I'll admit I don't really know what the argument to the FIOASYNC ioctl
has got to be :)) It seems the the FIOASYNC actually enables the SIGIO
signals.

I tried using the fcntl F_SETOWN, but that didn't seem to work at all.

Any way this seems to work quite well for sockets and gives me SIGIOs.
However, it does not give me a SIGIO when the other end of the socket is
closed, which is desirable.

I would also like to get some SIGIOs when standard input / output are
ready for reading/writing but the ioctl does not succeed on fd 0.

Has any one had similar experience or can offer any advice?

Thanks

Johnny

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".