Skip to contentSkip to conversation

Q, SIGIO on pipe

DISCUSSION J. R. Okajima 2 participants 3 messages Jan 9, 2020 – Jan 22, 2020 VFS

lore
Share & tools
lore
#0 lore raw

Between v5.4 and v5.5-rc5, big changes are made around pipe and my test program behaves differently.

{
	err = mknod(fname, S_IFIFO | 0644, /*dev*/0);
	fd = open(fname, O_RDWR, /*mode*/0);
	err = sigaction(SIGIO, &sa, NULL);

	pid = getpid();
	err = fcntl(fd, F_SETOWN, pid);
	err = fcntl(fd, F_SETSIG, SIGIO);
	flags = fcntl(fd, F_GETFL);
	err = fcntl(fd, F_SETFL, O_NONBLOCK | O_ASYNC | flags);

	ssz = write(fd, &i, 1);
	ssz = read(fd, &i, 1);
}

In v5.4, the final write(2) and read(2) generate/send SIGIO for each, POLLIN and POLLOUT respectively.
But in v5.5-rc5, read(2) doesn't generate/send SIGIO POLLOUT while it reads 1 byte successfully.

Reading new pipe.c, pipe_read() fires the signal only when the pipe buffer was full (16 as PIPE_DEF_BUFFERS defines), so my test program which writes only 1 byte doesn't receive the signal. Am I right? If so, is this an intentional behaviour and the previous behaviour was wrong and violated some standards?

J. R. Okajima

#1 lore raw
Quoted 2 lines · J. R. Okajima

Between v5.4 and v5.5-rc5, big changes are made around pipe and my test program behaves differently.

Do you have a full test program I can look at?

David

#2 lore raw

David Howells:

Quoted 1 line

Do you have a full test program I can look at?

Here you are.