Efficiency of detecting input FD after SIGIO?

Bill Janssen janssen at titan.SW.MCC.COM
Mon Feb 8 17:27:38 AEST 1988


I have a program that has between 1 and 20 sockets open.
It receives SIGIO when input is available on some one of them.
80% of the time there is only one open socket.
The OS is SunOS 3.4 (BSD 4.2, sort of).

Given this, what is the most efficient way to tell what fd the input
is available on?  Given that only one socket is open most of the time,
should I do an "ioctl (primary_fd, FIONREAD, &count)" on that one,
and do a "select" on the others, if any others are open?  Would a chain
of ioctl's be more efficient?  Should I just do a select on the whole
batch and stop messing around with ioctl's altogether?

By the way, doing a "fcntl (socket_fd, F_SETOWN, getpid())" on a socket
in order to specify that SIGIO's should be delivered when the socket
has something to read, only seems to work when the process is the
process group leader of its process group.  Is this correct behaviour?

Bill Janssen



More information about the Comp.unix.wizards mailing list