lkml.org 
[lkml]   [2003]   [Jul]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [Patch][RFC] epoll and half closed TCP connections
On Sat, 12 Jul 2003, Eric Varsanyi wrote:

> > (Sorry, I missed this)
> > You can work that out very easily. When your read/write returns a lower
> > number of bytes, it means that it is time to stop processing this fd. If
> > events happened meanwhile, you will get them at the next epoll_wait(). If
> > not, the next time they'll happen. There's no blind spot if you follow
> > this simple rule, and you do not even have the extra syscall with EAGAIN.
>
> The scenario that I think is still uncovered (edge trigger only):
>
> User Kernel
> -------- ----------
> Read data added to socket
>
> Socket posts read event to epfd
>
> epoll_wait() Event cleared from epfd, EPOLLIN
> returned to user
>
> more read data added to socket
>
> Socket posts a new read event to epfd
>
> read() until short read with EAGAIN all data read from socket
>
> epoll_wait() returns another EPOLLIN for socket and
> clears it from epfd
>
> read(), returns 0 right away socket buffer is empty

read will return -1 with errno=EAGAIN in that case, not zero.



- Davide

-
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: 2005-03-22 13:46    [W:0.403 / U:0.720 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site