posix clocks: correct error value in posix_clock_poll()
PATCH 1/1 posix clocks: correct error value in posix_clock_poll()
---
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(-)
kernel/time/posix-clock.c +1 -1
@@ -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);
Signature · 1 line
1.7.5.rc3
Quoted 13 lines · Nicolas Kaiser
Signed-off-by Nicolas Kaiser <[email protected]>---
It looks to me like-ENODEVmight not be a good return value inpoll(). Would POLLERR be the correct one in this case?kernel/time/posix-clock.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)kernel/time/posix-clock.c +0
-0
kernel/time/posix-clock.c static unsigned int posix_clock_poll(struct file *fp, poll_table *wait) · line 74
Quoted 5 lines
kernel/time/posix-clock.c +1
-1@@ -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
* Richard Cochran <[email protected]>:
Quoted 9 lines · Nicolas Kaiser
Quoted 2 lines
It looks to me like
-ENODEVmight not be a good return value inpoll(). 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.
Quoted 6 lines
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