Linux readv/writev functions

1. Function prototype
#include <sys/uio.h>

ssize_t readv(int filedes, const struct iovec *iov, int iovcnt);

ssize_t writev(int filedes, const struct iovec *iov, int iovcnt);

返回值:
	成功:读入或写出的字节数
	失败:-1
作用:
	readv和writev允许 单个系统调用 读入或写出 自一个或多个缓冲区;
	分散读和集中写
2. Function parameter iovec structure and iovcnt
struct iovec {
    
    
    void     *iov_base;  /* starting address of buffer */
    					/*读入或写出的首地址*/
    size_t   iov_len;    /* size of buffer */
    					/*读入或写出的字节个数*/
};

  iovcnt : the number of iovecs used

It's not easy to organize your likes and attention, which is a great encouragement to me
insert image description here

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324372936&siteId=291194637