[comp.unix.questions] Is SIGIO possible for named pipes in Ultrix 4.0?

bobp@TALOS.UUCP (Bob Pearson) (12/04/90)

Machine:	DEC 5400 (Mips Risc)
OS:		Ultirix 4.0
Synopsis:	SIGIO behavior for named pipe differs from socket behavior

While the Ultrix manual pages make no definitive statements concerning
SIGIO behavior for it's named pipes, the manual pages for fcntl(2) imply
that you should be able to get SIGIO signals sent to a process on write(2)s
to a named pipe as no restriction is made limiting F_SETOWN or FASYNC commands
to socket descriptors.

Does anyone out there know if you can get a named pipe to generate a SIGIO
on a write(2) to a pipe (under Ultrix 4.0).  The following code fragment
demonstrates what I am attempting to do:

	int fd, stat, my_pid;

	my_pid = getpid();
	signal(SIGIO, Sigio);
	if (mknod("PIPE", S_IFIFO | 0666, 0) < 0) {
		perror("mknod");
		exit(1);
	}
		
	if ((fd = open("PIPE", O_RDONLY | O_NDELAY)) < 0) {
		perror("R> open for read of PIPE");
		exit(1);
	}
	if ((stat = fcntl(fd, F_SETFL, FASYNC)) < 0) {
		perror("fcntl FASYNC\n");
		exit(1);
	}
	if ((stat = fcntl(fd, F_SETOWN, my_pid)) < 0) {
		perror("fcntl F_SETOWN);
		exit(1);
	}
	if ((stat = fcntl(fd, F_GETOWN, 0)) != my_pid) {
		perror("fcntl F_GETOWN);
		exit(1);
	}

	while (notDone)
		sigpause(0);

A test program shows another process writing repeatly and a SIGIO is only
generated on close(2) of the fd.  Does the BRL System V emulation support
SIGIO on named pipes with the same semantics as BSD sockets?  That is, a
SIGIO signal is delivered to the process or process group on each write(2)
if SIGIO is not already set?

Thanks...
-------------------------------------------------------------------------------
From UNIX Research System Programmer's Manual, Tenth Edition Volume I,
intro(2), errno value 37

	37  EGREG   It's all Greg's fault    Something went wrong.
-------------------------------------------------------------------------------
-- 

-bobp   Bob Pearson, Software Engineer		#include <std/disclaimer.h>
UUCP:	uunet!{ uupsi | vrdxhq | csed-1 | ida.org }!pbs!npri6!talos!bobp
VOICE:	(703)683-9090 ext 322