summaryrefslogtreecommitdiffstats
path: root/ctdb/common/ctdb_io.c
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronniesahlberg@gmail.com>2012-01-04 21:41:12 +1100
committerRonnie Sahlberg <ronniesahlberg@gmail.com>2012-01-04 21:41:12 +1100
commitb5b4c1a2eacefcac39e0932bae9397be363945e3 (patch)
tree73c3b7742e71049be35b68fade1ba5e11a984408 /ctdb/common/ctdb_io.c
parente6480454990a2736928541b63db4ee8f8e07ef48 (diff)
downloadsamba-b5b4c1a2eacefcac39e0932bae9397be363945e3.tar.gz
samba-b5b4c1a2eacefcac39e0932bae9397be363945e3.tar.xz
samba-b5b4c1a2eacefcac39e0932bae9397be363945e3.zip
explain why we use FIONREAD
(This used to be ctdb commit d0f85478c37828eb8a24315d4326eb4eaedb9afc)
Diffstat (limited to 'ctdb/common/ctdb_io.c')
-rw-r--r--ctdb/common/ctdb_io.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/ctdb/common/ctdb_io.c b/ctdb/common/ctdb_io.c
index 86e54e0ac9..810fd41dd1 100644
--- a/ctdb/common/ctdb_io.c
+++ b/ctdb/common/ctdb_io.c
@@ -78,6 +78,12 @@ static void queue_io_read(struct ctdb_queue *queue)
ssize_t nread;
uint8_t *data;
+ /* check how much data is available on the socket for immediately
+ guaranteed nonblocking access.
+ as long as we are careful never to try to read more than this
+ we know all reads will be successful and will neither block
+ nor fail with a "data not available right now" error
+ */
if (ioctl(queue->fd, FIONREAD, &num_ready) != 0) {
return;
}