lkml.org 
[lkml]   [2007]   [Aug]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH take2] Use ERESTART_RESTARTBLOCK if poll() is interrupted by a signal
On 08/15, Chris Wright wrote:
>
> fs/select.c | 31 ++++++++++++++++++++++++++++++-
> 1 files changed, 30 insertions(+), 1 deletions(-)
>
> diff --git a/fs/select.c b/fs/select.c
> index a974082..5562195 100644
> --- a/fs/select.c
> +++ b/fs/select.c
> @@ -736,10 +736,28 @@ out_fds:
> return err;
> }
>
> +long do_restart_poll(struct restart_block *restart_block)
> +{
> + struct pollfd __user *ufds = (struct pollfd __user*)restart_block->arg0;
> + int nfds = restart_block->arg1;
> + s64 timeout = ((s64)restart_block->arg3<<32) | (s64)restart_block->arg2;
> + int ret;
> +
> + ret = do_sys_poll(ufds, nfds, &timeout);
> + if (ret == -EINTR) {
> + restart_block->fn = do_restart_poll;
> + restart_block->arg2 = timeout & 0xFFFFFFFF;
> + restart_block->arg3 = (u64)timeout >> 32;
> + ret = -ERESTART_RESTARTBLOCK;
> + }
> + return ret;
> +}
> +
> asmlinkage long sys_poll(struct pollfd __user *ufds, unsigned int nfds,
> long timeout_msecs)
> {
> s64 timeout_jiffies;
> + int ret;
>
> if (timeout_msecs > 0) {
> #if HZ > 1000
> @@ -754,7 +772,18 @@ asmlinkage long sys_poll(struct pollfd __user *ufds, unsigned int nfds,
> timeout_jiffies = timeout_msecs;
> }
>
> - return do_sys_poll(ufds, nfds, &timeout_jiffies);
> + ret = do_sys_poll(ufds, nfds, &timeout_jiffies);
> + if (ret == -EINTR) {
> + struct restart_block *restart_block;
> + restart_block = &current_thread_info()->restart_block;
> + restart_block->fn = do_restart_poll;
> + restart_block->arg0 = (unsigned long)ufds;
> + restart_block->arg1 = nfds;
> + restart_block->arg2 = timeout_jiffies & 0xFFFFFFFF;
> + restart_block->arg3 = (u64)timeout_jiffies >> 32;
> + ret = -ERESTART_RESTARTBLOCK;
> + }
> + return ret;
> }
>
> #ifdef TIF_RESTORE_SIGMASK

Great, I think the patch is correct.

Oleg.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-08-16 17:51    [W:2.555 / U:1.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site