From d5aca360e7518791d21ca63b44ae2dfaa6c35072 Mon Sep 17 00:00:00 2001
From: compile_success <980965867@qq.com>
Date: Mon, 17 Oct 2022 14:18:53 +0000
Subject: [PATCH] add writev and readv

---
 src/api/posix_api.c     | 2 ++
 src/include/posix_api.h | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/src/api/posix_api.c b/src/api/posix_api.c
index e721381..b7334da 100644
--- a/src/api/posix_api.c
+++ b/src/api/posix_api.c
@@ -93,7 +93,9 @@ int posix_api_init(void)
     CHECK_DLSYM_RET_RETURN(posix_api->shutdown_fn = dlsym(handle, "shutdown"));
     CHECK_DLSYM_RET_RETURN(posix_api->close_fn = dlsym(handle, "close"));
     CHECK_DLSYM_RET_RETURN(posix_api->read_fn = dlsym(handle, "read"));
+    CHECK_DLSYM_RET_RETURN(posix_api->readv_fn = dlsym(handle, "readv"));
     CHECK_DLSYM_RET_RETURN(posix_api->write_fn = dlsym(handle, "write"));
+    CHECK_DLSYM_RET_RETURN(posix_api->writev_fn = dlsym(handle, "writev"));
     CHECK_DLSYM_RET_RETURN(posix_api->recv_fn = dlsym(handle, "recv"));
     CHECK_DLSYM_RET_RETURN(posix_api->send_fn = dlsym(handle, "send"));
     CHECK_DLSYM_RET_RETURN(posix_api->recv_msg = dlsym(handle, "recvmsg"));
diff --git a/src/include/posix_api.h b/src/include/posix_api.h
index e958ded..a73e2ec 100644
--- a/src/include/posix_api.h
+++ b/src/include/posix_api.h
@@ -54,7 +54,9 @@ typedef struct {
     int (*close_fn)(int fd);
     pid_t (*fork_fn)(void);
     ssize_t (*read_fn)(int fd, void *mem, size_t len);
+    ssize_t (*readv_fn)(int s, const struct iovec *iov, int iovcnt);
     ssize_t (*write_fn)(int fd, const void *data, size_t len);
+    ssize_t (*writev_fn)(int s, const struct iovec *iov, int iovcnt);
     ssize_t (*recv_fn)(int sockfd, void *buf, size_t len, int flags);
     ssize_t (*send_fn)(int sockfd, const void *buf, size_t len, int flags);
     ssize_t (*recv_msg)(int sockfd, const struct msghdr *msg, int flags);
-- 
2.33.0

