On Wed, 8 Nov 2006 15:51:13 +0100
Eric Dumazet <[EMAIL PROTECTED]> wrote:

> [PATCH] eventpoll : In case a fault occurs during copy_to_user(), we should 
> report the count of events that were successfully copied into user space, 
> instead of EFAULT. That would be consistent with behavior of read/write() 
> syscalls for example.
> 
> Signed-off-by: Eric Dumazet <[EMAIL PROTECTED]>
> 
> 
> 
> [eventpoll.patch  text/plain (424B)]
> --- linux/fs/eventpoll.c      2006-11-08 15:37:36.000000000 +0100
> +++ linux/fs/eventpoll.c      2006-11-08 15:38:31.000000000 +0100
> @@ -1447,7 +1447,7 @@
>                                      &events[eventcnt].events) ||
>                           __put_user(epi->event.data,
>                                      &events[eventcnt].data))
> -                             return -EFAULT;
> +                             return eventcnt ? eventcnt : -EFAULT;
>                       if (epi->event.events & EPOLLONESHOT)
>                               epi->event.events &= EP_PRIVATE_BITS;
>                       eventcnt++;
> 

Definitely a better interface, but I wonder if it's too late to change it.

An app which does

        if (epoll_wait(...) == -1)
                barf(errno);
        else
                assume_all_events_were_received();

will now do the wrong thing.

otoh, such an applciation basically _has_ to use the epoll_wait()
return value to work out how many events it received, so maybe it's OK...
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to