Re: [PATCH 1/5] ALSA: pcm: Fix poll error return codes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.)


Regards,
Clemens
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux