From: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
To: Clemens Ladisch <clemens@ladisch.de>
Cc: vinod.koul@intel.com, alsa-devel@alsa-project.org,
tiwai@suse.com, Takashi Sakamoto <o-takashi@sakamocchi.jp>
Subject: Re: [PATCH 1/5] ALSA: pcm: Fix poll error return codes
Date: Thu, 5 May 2016 12:46:02 +0100 [thread overview]
Message-ID: <20160505114602.GF1646@localhost.localdomain> (raw)
In-Reply-To: <cb0c26e2-d594-844d-62b3-36e6f2f830f6@ladisch.de>
On Thu, May 05, 2016 at 11:39:34AM +0200, Clemens Ladisch wrote:
> Takashi Sakamoto wrote:
> > On May 4 2016 22:59, Charles Keepax wrote:
> >> if (PCM_RUNTIME_CHECK(substream))
> >> - return -ENXIO;
> >> + return POLLIN | POLLRDNORM | POLLERR;
> >
> > [...]
> > On the other hand, I think POLLOUT, POLLIN, POLLWRNORM and POLLRDNORM
> > should not be included in the value. PCM_RUNTIME_CHECK() ensures PCM
> > substream or PCM runtime is NULL. This means that subsequent I/O
> > operations are failed, at least for handling PCM frames.
> >
> > I think it better to return 'POLLERR | POLLHUP'.
>
> To expand on this: POLLIN/POLLOUT imply that it is possible to read/
> write data without blocking. Sockets and pipes combine POLLHUP with
> POLLIN because the read() (or recv()) returns 0 bytes without blocking
> to indicate the end of the stream.
>
> But in this situation, snd_pcm_read*/write* will always fail, so it is,
> strictly speaking, indeed not appropriate to set POLLIN/OUT.
>
> On the other hand, PCM devices do include the POLLIN/OUT bits when they
> are in a wrong state. (This is probably to catch programs that do not
> check the error bits; with POLLIN/OUT set, these programs will try to
> read/write, and will then get the error code.)
>
> So for consistency, the bits should be included. (Or the other error
> case fixed to remove these bits.)
Thanks for the explaination guys. I definitely agree that all
the return values should be consistent. I am happy to change the
values if people prefer but I guess the decision really rests
with Takashi and if he is happy to change the returns to
POLLERR | POLLHUP, as I guess there is the potential for some
user-space fall out. Perhaps I should do this as a seperate patch
on top of this chain, so we can review explicitly.
I have had a look and both tinyalsa and alsalib look like they
would handle the change correctly.
Thanks,
Charles
next prev parent reply other threads:[~2016-05-05 11:46 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-04 13:59 [PATCH 0/5] Fix poll error returns Charles Keepax
2016-05-04 13:59 ` [PATCH 1/5] ALSA: pcm: Fix poll error return codes Charles Keepax
2016-05-04 23:26 ` Takashi Sakamoto
2016-05-05 9:39 ` Clemens Ladisch
2016-05-05 11:46 ` Charles Keepax [this message]
2016-05-06 18:11 ` Takashi Sakamoto
2016-05-04 13:59 ` [PATCH 2/5] ALSA: compress: Use snd_compr_get_poll on error path Charles Keepax
2016-05-04 13:59 ` [PATCH 3/5] ALSA: compress: Remove pointless NULL check Charles Keepax
2016-05-04 13:59 ` [PATCH 4/5] ALSA: compress: Fix poll error return codes Charles Keepax
2016-05-04 13:59 ` [PATCH v6 RESEND 5/5] ALSA: compress: Replace complex if statement with switch Charles Keepax
2016-05-09 12:13 ` [PATCH 0/5] Fix poll error returns Takashi Iwai
2016-05-09 15:19 ` Vinod Koul
2016-05-09 15:36 ` Takashi Iwai
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=20160505114602.GF1646@localhost.localdomain \
--to=ckeepax@opensource.wolfsonmicro.com \
--cc=alsa-devel@alsa-project.org \
--cc=clemens@ladisch.de \
--cc=o-takashi@sakamocchi.jp \
--cc=tiwai@suse.com \
--cc=vinod.koul@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.