/** * @defgroup uio Uio * @ingroup libc */ #ifndef _SYS_UIO_H #define _SYS_UIO_H #ifdef __cplusplus extern "C" { #endif #include #define __NEED_size_t #define __NEED_ssize_t #define __NEED_struct_iovec #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) #define __NEED_off_t #endif #ifdef _GNU_SOURCE #define __NEED_pid_t #endif #ifdef __XLT_OS__ #define __NEED_int64_t #endif #include #define UIO_MAXIOV 1024 /** * @ingroup uio * * @par Description: * The readv() function shall be equivalent to read(), except as described below. * The readv() function shall place the input data into the iovcnt buffers specified by the members * of the iov array: iov[0], iov[1], ..., iov[iovcnt-1]. * Each iovec entry specifies the base address and length of an area in memory where data should be placed. * The readv() function shall always fill an area completely before proceeding to the next. * * @param fd [IN] File descriptor (or socket descriptor) to read from * @param iov [OUT] The array that user-provided to save the data * @param iovcnt [IN] The number of members in the array * * @attention * * * @retval #ssize_t A positive non-zero number of bytes read on success. * @retval #0 End-of-file or failed in read(). * @retval #-1 The iov is a null pointer or out of memory. * * @par Errors * * * @par Dependency: * * @see writev * @since Huawei LiteOS V100R001C00 */ ssize_t readv (int, const struct iovec *, int); /** * @ingroup uio * * @par Description: * The writev() function shall be equivalent to write(), except as described below. * The writev() function shall gather output data from the iovcnt buffers specified by the members * of the iov array: iov[0], iov[1], ..., iov[iovcnt-1]. * Each iovec entry specifies the base address and length of an area in memory from which data should be written. * The writev() function shall always write a complete area before proceeding to the next. * * @param fd [IN] File descriptor (or socket descriptor) to read from * @param iov [IN] The array of data that user-provided to write * @param iovcnt [IN] The number of members in the array * * @attention * * * @retval #ssize_t On success, the number of bytes written are returned (zero indicates nothing was written). * @retval #-1 On error, -1 is returned, and errno is set appropriately. * * @par Errors * * * @par Dependency: * * @see readv * @since Huawei LiteOS V100R001C00 */ ssize_t writev (int, const struct iovec *, int); #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) ssize_t preadv (int, const struct iovec *, int, off_t); ssize_t pwritev (int, const struct iovec *, int, off_t); #if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) #define preadv64 preadv #define pwritev64 pwritev #ifdef __XLT_OS__ #define off64_t int64_t #else #define off64_t off_t #endif #endif #endif #ifdef _GNU_SOURCE ssize_t process_vm_writev(pid_t, const struct iovec *, unsigned long, const struct iovec *, unsigned long, unsigned long); ssize_t process_vm_readv(pid_t, const struct iovec *, unsigned long, const struct iovec *, unsigned long, unsigned long); #endif #ifdef __cplusplus } #endif #endif