From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: "TATSUKAWA KOSUKE(立川 江介)" <tatsu-ab1@nec.com>
Cc: Jiri Slaby <jirislaby@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] n_tty: wake up poll(POLLRDNORM) on receiving data
Date: Wed, 26 Jan 2022 14:49:10 +0100 [thread overview]
Message-ID: <YfFRVkmtSsXPanS5@kroah.com> (raw)
In-Reply-To: <TYCPR01MB81902ACABDEC2602282FB81DA55E9@TYCPR01MB8190.jpnprd01.prod.outlook.com>
On Mon, Jan 24, 2022 at 08:17:22AM +0000, TATSUKAWA KOSUKE(立川 江介) wrote:
> Event POLLRDNORM should be equivalent to POLLIN when used as event in
> poll().
Where is that documented?
> However, in n_tty driver, POLLRDNORM does not return until
> timeout even if there is terminal input, whereas POLLIN returns.
>
> The following test program works until kernel-3.17, but the test stops
> in poll() after commit 57087d515441 ("tty: Fix spurious poll() wakeups").
>
> [Steps to run test program]
> $ cc -o test-pollrdnorm test-pollrdnorm.c
> $ ./test-pollrdnorm
> foo <-- Type in something from the terminal followed by [RET].
> The string should be echoed back.
>
> ------------------------< test-pollrdnorm.c >------------------------
> #include <stdio.h>
> #include <errno.h>
> #include <poll.h>
> #include <unistd.h>
>
> void main(void)
> {
> int n;
> unsigned char buf[8];
> struct pollfd fds[1] = {{ 0, POLLRDNORM, 0 }};
>
> n = poll(fds, 1, -1);
> if (n < 0)
> perror("poll");
> n = read(0, buf, 8);
> if (n < 0)
> perror("read");
> if (n > 0)
> write(1, buf, n);
> }
> ------------------------------------------------------------------------
>
> The attached patch fixes this problem.
>
> Signed-off-by: Kosuke Tatsukawa <tatsu-ab1@nec.com>
> Fixes: commit 57087d515441 ("tty: Fix spurious poll() wakeups")
No need for "commit" here, please remove as the documentation asks you
to.
Can you resend this with this fixed up, and a pointer to where the
documentation is for this functionality.
thanks,
greg k-h
next prev parent reply other threads:[~2022-01-26 13:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-24 8:17 TATSUKAWA KOSUKE(立川 江介)
2022-01-26 13:49 ` Greg Kroah-Hartman [this message]
2022-01-26 23:34 ` TATSUKAWA KOSUKE(立川 江介)
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=YfFRVkmtSsXPanS5@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tatsu-ab1@nec.com \
/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
Powered by JetHome