]> git.tuebingen.mpg.de Git - paraslash.git/commit
Introduce the new nonblock API.
authorAndre Noll <maan@systemlinux.org>
Sun, 25 Apr 2010 17:27:45 +0000 (19:27 +0200)
committerAndre Noll <maan@systemlinux.org>
Sun, 25 Apr 2010 17:27:45 +0000 (19:27 +0200)
commit98f2c8aea52a49fad3fd6df67b1eb32c1499176c
tree789ffa02ae68529753960daf579ff7f1a4a69437
parent3aca09b886727eeae5c7084331b4f78ed21c261b
Introduce the new nonblock API.

This patch is an attempt to create a better API for reads from
non-blocking file descriptors. It adds readv_nonblock() and implements
read_nonblock() as a simple wrapper for readv_nonblock(). Both new
functions check the given file descriptor for readability and read
as much as possible until an error occurs or the buffer is full.

Two additional parameters are introduced: An fd_set and a result
pointer for the number of bytes that have been read successfully. The
optional fd_set pointer is used to have the fixup code for unreliable
returns of FD_ISSET() at one place only.

Having an extra parameter for storing the number of bytes read allows
to treat EOF as an error condition but EAGAIN as a normal condition.
This will simplify callers (dccp_recv and upd_recv) a bit.
error.h
fd.c
fd.h