Subject: Re: [take23 0/5] kevent: Generic event handling mechanism.

From: Eric Dumazet <[email-masked]>
Date: Thu, 09 Nov 2006 08:52:45 +0100

Eric Dumazet a écrit :
> Davide Libenzi a écrit :
>> Lost forever means? If there are more processes watching some fd 
>> (external events), they all get their own copy of the events in their 
>> own private epoll fd. It's not that we "steal" things out of the 
>> kernel, is not a 1:1 producer/consumer thing (one producer, 1 queue). 
>> It's one producer, broadcast to all listeners (consumers) thing. The 
>> only case where it'd matter is in the case of multiple threads sharing 
>> the same epoll fd.
> 
> In my particular epoll application, the producer is tcp stack, and I 
> have one consumer. If an network event is lost in the EFAULT handling, 
> its lost forever. In any case, my application do provide a correct user 
> area, so this problem is only theorical.

I realize I was not explicit, and dit not answer your question (Lost forever 
means ?)

                 if (epi->revents) {
                         if (__put_user(epi->revents,
                                        &events[eventcnt].events) ||
                             __put_user(epi->event.data,
                                        &events[eventcnt].data))
                                 return -EFAULT;
 >>                        if (epi->event.events & EPOLLONESHOT)
 >>                                epi->event.events &= EP_PRIVATE_BITS;
                         eventcnt++;
                 }

If one EPOLLONESHOT event is correctly copied to user space, its status is 
updated.

If other ready events in the same epoll_wait() call cannot be transferred 
because of an EFAULT (we reach the real end of user provided area), this 
EPOLLONESHOT event is lost forever, because it wont be requeued in ready list.

Eric