Enabling SIGIO interrupts on stream sockets

David George dgeorge at svax.cs.cornell.edu
Tue Jun 20 14:34:46 AEST 1989


I have a rather specific UNIX question that has gone unanswered
on comp.unix.questions.  I'm sorry if this posting is not appropriate
for the wizards newsgroup, but I don't know where else to ask.

Anyways, I'm trying to trap to a handler routine each time that data
becomes available on a stream-type communication socket.  I'm using
HP-UX on a Series 800 machine (HP Release A.B3.00.5B).

The HP manuals suggest the following sequence of commands:

	pid = getpid();
	arg = 1;
	signal(SIGIO, my_handling_routine);
	ioctl(fildes, FIOSSAIOOWN, &pid);
	ioctl(fildes, FIOSSAIOSTAT, &arg);

So now a SIGIO signal should be generated each time that data becomes
available on socket fildes.  Instead, I get an "Operation not supported
on socket" error for the first ioctl() call.

A 4.3BSD Tutorial gave the alternative solution:

	signal(SIGIO, my_handling_routine);
	fcntl(fildes, F_SETOWN, getpid());
	fcntl(fildes, F_SETFL, FASYNC);

But F_SETOWN and FASYNC are not defined on my system.  Any ideas?

Dave George



More information about the Comp.unix.wizards mailing list