Path: utzoo!utgpu!water!watmath!clyde!rutgers!im4u!milano!titan!janssen From: janssen@titan.SW.MCC.COM (Bill Janssen) Newsgroups: comp.unix.wizards Subject: Efficiency of detecting input FD after SIGIO? Keywords: SIGIO, socket, select, ioctl Message-ID: <108@titan.SW.MCC.COM> Date: 8 Feb 88 07:27:38 GMT Organization: MCC Software Technology Lines: 18 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