public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nikolai ZHUBR <zhubr@mail.ru>
To: linux-kernel@vger.kernel.org
Subject: epoll'ing tcp sockets for reading
Date: Sat, 19 Dec 2009 15:02:06 +0300	[thread overview]
Message-ID: <1257480306.20091219150206@mail.ru> (raw)

Hello people, I have a question about epoll'ing tcp sockets.

Is it possible (with epoll or some other good method) to get userspace
notified not only of the fact that some data has become available
for the socket, but also of the respective _size_ available for
reading connected with this exact event?

Yes, read'ing until EAGAIN or using FIONREAD would provide this
sort of information, but there is a problem. In case of subsequent
continuous data arrival, an application could get stuck reading
data for one socket infinitely (after epoll return, just before
the next epoll), unless it implements some kind of artifical safety
measures.

To my understanding, EPOLLONESHOT does not suffice here, because
it only "fixes" the epoll'ing part but not the read'ing part, whereas
_both_ epoll'ing and read'ing appear to be responsible. Therefore,
"event atomicity" is lost anyway. Or am I wrong?

(Please CC me, I'm not subscribed)

Thank you!

Nikolai ZHUBR



             reply	other threads:[~2009-12-19 11:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-19 12:02 Nikolai ZHUBR [this message]
2009-12-19 18:07 ` epoll'ing tcp sockets for reading Davide Libenzi
2009-12-19 22:38   ` Re[2]: " Nikolai ZHUBR
2009-12-19 22:56     ` Davide Libenzi
2009-12-20  0:26       ` Re[3]: " Nikolai ZHUBR
2009-12-20 15:54         ` Davide Libenzi
2009-12-20 16:14           ` Willy Tarreau
2009-12-20 23:26             ` Re[2]: " Nikolai ZHUBR
2009-12-21  5:46               ` Willy Tarreau
2009-12-21  9:34                 ` Re[2]: " Nikolai ZHUBR

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1257480306.20091219150206@mail.ru \
    --to=zhubr@mail.ru \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox