All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] posix clocks: correct error value in posix_clock_poll()
@ 2011-05-24 10:51 Nicolas Kaiser
  2011-05-24 12:34 ` Richard Cochran
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Kaiser @ 2011-05-24 10:51 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: Richard Cochran, linux-kernel

Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
---
It looks to me like -ENODEV might not be a good return value
in poll(). Would POLLERR be the correct one in this case?

 kernel/time/posix-clock.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/time/posix-clock.c b/kernel/time/posix-clock.c
index c340ca6..2424d3f 100644
--- a/kernel/time/posix-clock.c
+++ b/kernel/time/posix-clock.c
@@ -71,7 +71,7 @@ static unsigned int posix_clock_poll(struct file *fp, poll_table *wait)
 	int result = 0;
 
 	if (!clk)
-		return -ENODEV;
+		return POLLERR;
 
 	if (clk->ops.poll)
 		result = clk->ops.poll(clk, fp, wait);
-- 
1.7.5.rc3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] posix clocks: correct error value in posix_clock_poll()
  2011-05-24 10:51 [PATCH] posix clocks: correct error value in posix_clock_poll() Nicolas Kaiser
@ 2011-05-24 12:34 ` Richard Cochran
  2011-05-24 14:08   ` Nicolas Kaiser
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Cochran @ 2011-05-24 12:34 UTC (permalink / raw)
  To: Nicolas Kaiser; +Cc: Thomas Gleixner, Richard Cochran, linux-kernel

On Tue, May 24, 2011 at 12:51:47PM +0200, Nicolas Kaiser wrote:
> Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
> ---
> It looks to me like -ENODEV might not be a good return value
> in poll(). Would POLLERR be the correct one in this case?
> 
>  kernel/time/posix-clock.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/kernel/time/posix-clock.c b/kernel/time/posix-clock.c
> index c340ca6..2424d3f 100644
> --- a/kernel/time/posix-clock.c
> +++ b/kernel/time/posix-clock.c
> @@ -71,7 +71,7 @@ static unsigned int posix_clock_poll(struct file *fp, poll_table *wait)
>  	int result = 0;
>  
>  	if (!clk)
> -		return -ENODEV;
> +		return POLLERR;

The condition (!clk) is only satisfied when 'zombie' is set,
indicating that the dynamic clock has disappeared. That is why the
file operations uniformly return ENODEV. So, I think it makes sense
the way that it is.

In addition, man 2 poll says,

   POLLERR
          Error condition (output only).

so using that error code would be misleading, IMHO.

Thanks,
Richard

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] posix clocks: correct error value in posix_clock_poll()
  2011-05-24 12:34 ` Richard Cochran
@ 2011-05-24 14:08   ` Nicolas Kaiser
  0 siblings, 0 replies; 3+ messages in thread
From: Nicolas Kaiser @ 2011-05-24 14:08 UTC (permalink / raw)
  To: Richard Cochran; +Cc: Thomas Gleixner, linux-kernel

* Richard Cochran <richardcochran@gmail.com>:
> On Tue, May 24, 2011 at 12:51:47PM +0200, Nicolas Kaiser wrote:
> > It looks to me like -ENODEV might not be a good return value
> > in poll(). Would POLLERR be the correct one in this case?

> The condition (!clk) is only satisfied when 'zombie' is set,
> indicating that the dynamic clock has disappeared. That is why the
> file operations uniformly return ENODEV. So, I think it makes sense
> the way that it is.
> 
> In addition, man 2 poll says,
> 
>    POLLERR
>           Error condition (output only).
> 
> so using that error code would be misleading, IMHO.

I see. Sorry for the noise.

Best regards,
Nicolas Kaiser

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-05-24 14:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-24 10:51 [PATCH] posix clocks: correct error value in posix_clock_poll() Nicolas Kaiser
2011-05-24 12:34 ` Richard Cochran
2011-05-24 14:08   ` Nicolas Kaiser

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.