diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2017-09-13 15:19:14 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2017-09-15 10:27:13 +0200 |
commit | 98041b685e9cbe4916d8684372389e899698da16 (patch) | |
tree | 4ad2fbeb8eb626b0e71c6b810398740f62ec3fe5 /cpukit/libcsupport/src/readv.c | |
parent | libio: LIBIO_GET_IOP() LIBIO_GET_IOP_WITH_ACCESS() (diff) | |
download | rtems-98041b685e9cbe4916d8684372389e899698da16.tar.bz2 |
libio: Unify readv() and writev()
Update #3132.
Diffstat (limited to 'cpukit/libcsupport/src/readv.c')
-rw-r--r-- | cpukit/libcsupport/src/readv.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/cpukit/libcsupport/src/readv.c b/cpukit/libcsupport/src/readv.c index 8c901cabe7..6d4f1b3cf1 100644 --- a/cpukit/libcsupport/src/readv.c +++ b/cpukit/libcsupport/src/readv.c @@ -22,6 +22,16 @@ #include <rtems/libio_.h> +static ssize_t readv_adapter( + rtems_libio_t *iop, + const struct iovec *iov, + int iovcnt, + ssize_t total +) +{ + return ( *iop->pathinfo.handlers->readv_h )( iop, iov, iovcnt, total ); +} + /** * readv() - POSIX 1003.1 - Read a Vector * @@ -35,14 +45,11 @@ ssize_t readv( int iovcnt ) { - ssize_t total; - rtems_libio_t *iop; - - total = rtems_libio_iovec_eval( fd, iov, iovcnt, LIBIO_FLAGS_READ, &iop ); - - if ( total > 0 ) { - total = ( *iop->pathinfo.handlers->readv_h )( iop, iov, iovcnt, total ); - } - - return total; + return rtems_libio_iovec_eval( + fd, + iov, + iovcnt, + LIBIO_FLAGS_READ, + readv_adapter + ); } |