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/include/rtems/libio_.h | |
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/include/rtems/libio_.h')
-rw-r--r-- | cpukit/libcsupport/include/rtems/libio_.h | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/cpukit/libcsupport/include/rtems/libio_.h b/cpukit/libcsupport/include/rtems/libio_.h index 9bf83206e3..adf137d2f6 100644 --- a/cpukit/libcsupport/include/rtems/libio_.h +++ b/cpukit/libcsupport/include/rtems/libio_.h @@ -921,12 +921,19 @@ static inline bool rtems_filesystem_is_parent_directory( return tokenlen == 2 && token [0] == '.' && token [1] == '.'; } -static inline ssize_t rtems_libio_iovec_eval( - int fd, +typedef ssize_t ( *rtems_libio_iovec_adapter )( + rtems_libio_t *iop, const struct iovec *iov, - int iovcnt, - uint32_t flags, - rtems_libio_t **iopp + int iovcnt, + ssize_t total +); + +static inline ssize_t rtems_libio_iovec_eval( + int fd, + const struct iovec *iov, + int iovcnt, + uint32_t flags, + rtems_libio_iovec_adapter adapter ) { ssize_t total; @@ -966,7 +973,10 @@ static inline ssize_t rtems_libio_iovec_eval( } LIBIO_GET_IOP_WITH_ACCESS( fd, iop, flags, EBADF ); - *iopp = iop; + + if ( total > 0 ) { + total = ( *adapter )( iop, iov, iovcnt, total ); + } return total; } |