From 2bb6dc4b762a4574d658d543ab1a56c92d90ef0c Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Mon, 14 Jun 2021 07:58:30 +0000 Subject: doc: allreadwrite: document scatter/gatter functions Signed-off-by: Jesse Young --- doc/libstddjb/allreadwrite.html | 53 ++++++++++++++++++++++++++++++++++++++ src/include/skalibs/allreadwrite.h | 5 ++-- 2 files changed, 55 insertions(+), 3 deletions(-) diff --git a/doc/libstddjb/allreadwrite.html b/doc/libstddjb/allreadwrite.html index 2619153..1c31022 100644 --- a/doc/libstddjb/allreadwrite.html +++ b/doc/libstddjb/allreadwrite.html @@ -51,6 +51,18 @@ and write().

+

+ typedef ssize_t iovfunc_t (int fd, struct iovec const *v, unsigned int vlen)
+This is the simplified type of IO functions such as +readv() +and +writev(), +where the content to perform IO on is specified as a +scatter/gather array of vlen +elements instead of a single string. +

+ +

typedef size_t alliofunc_t (int fd, char *buf, size_t len)
This is the type of an IO operation that expects all of its @@ -82,6 +94,11 @@ semantics are appropriate, so EPIPE is a good candidate to signal EOF on reading.)

+

+ ssize_t unsanitize_read (ssize_t r)
+Returns the inverse of sanitize_read. +

+

size_t allreadwrite (iofunc_t *f, int fd, char *s, size_t len)
*f must be a basic reading or writing function such as @@ -94,6 +111,14 @@ blocking mode; if fd is in non-blocking mode, it might set errno to EWOULDBLOCK or EAGAIN.

+

+ size_t allreadwritev (iovfunc_t *f, int fd, struct iovec const *v, unsigned int vlen)
+Like allreadwrite +but the content to perform IO on is specified as a +scatter/gather array of vlen +elements instead of a single string. +

+

ssize_t fd_read (int fd, char *s, size_t len)
Safe wrapper around the @@ -107,6 +132,20 @@ function. write() function.

+

+ + ssize_t fd_readv (int fd, struct iovec const *v, unsigned int vlen)
+Safe wrapper around the +readv() +function. +

+ +

+ ssize_t fd_writev (int fd, struct iovec const *v, unsigned int vlen)
+Safe wrapper around the +writev() +function. +

ssize_t fd_recv (int fd, char *s, size_t len, unsigned int flags)
@@ -138,5 +177,19 @@ around fd_write() if necessary, until either len bytes are written or an error occurs.

+

+ size_t allreadv (int fd, struct iovec *v, unsigned int vlen)
+Like allread, but the bytes from fd are read into a +scatter/gather array of vlen +elements instead of a single string. +

+ +

+ size_t allwritev (int fd, struct iovec const *v, unsigned int vlen)
+Like allwrite, but the content to write is taken from a +scatter/gather array of vlen +elements instead of a single string. +

+ diff --git a/src/include/skalibs/allreadwrite.h b/src/include/skalibs/allreadwrite.h index 254d766..3df1ed1 100644 --- a/src/include/skalibs/allreadwrite.h +++ b/src/include/skalibs/allreadwrite.h @@ -14,6 +14,8 @@ extern size_t allreadwritev (iovfunc_t_ref, int, struct iovec const *, unsigned extern ssize_t fd_read (int, char *, size_t) ; extern ssize_t fd_write (int, char const *, size_t) ; +extern ssize_t fd_readv (int, struct iovec const *, unsigned int) ; +extern ssize_t fd_writev (int, struct iovec const *, unsigned int) ; extern ssize_t fd_recv (int, char *, size_t, unsigned int) ; extern ssize_t fd_send (int, char const *, size_t, unsigned int) ; @@ -23,7 +25,4 @@ extern size_t allwrite (int, char const *, size_t) ; extern size_t allreadv (int, struct iovec const *, unsigned int) ; extern size_t allwritev (int, struct iovec const *, unsigned int) ; -extern ssize_t fd_readv (int, struct iovec const *, unsigned int) ; -extern ssize_t fd_writev (int, struct iovec const *, unsigned int) ; - #endif -- cgit v1.2.3