linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "J. R. Okajima" <hooanon05g@gmail.com>
To: dhowells@redhat.com
Cc: linux-fsdevel@vger.kernel.org
Subject: Q, SIGIO on pipe
Date: Thu, 09 Jan 2020 14:45:16 +0900	[thread overview]
Message-ID: <17045.1578548716@jrobl> (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

             reply	other threads:[~2020-01-09  5:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-09  5:45 J. R. Okajima [this message]
2020-01-22 14:22 ` Q, SIGIO on pipe David Howells
2020-01-22 17:45   ` J. R. Okajima

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=17045.1578548716@jrobl \
    --to=hooanon05g@gmail.com \
    --cc=dhowells@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).