diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2013-02-11 11:55:07 +0100 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2013-02-11 11:55:07 +0100 |
commit | 48bbd03f10d35111aaab3a538d388f765baf6b35 (patch) | |
tree | 58c7352544f7561931468cad4bb3c63a52d0d606 | |
parent | bb3e42a3e7cc40c920352a6eb19b24b1eec8830e (diff) | |
download | socket_wrapper-48bbd03f10d35111aaab3a538d388f765baf6b35.tar.gz socket_wrapper-48bbd03f10d35111aaab3a538d388f765baf6b35.tar.xz socket_wrapper-48bbd03f10d35111aaab3a538d388f765baf6b35.zip |
Add writev() wrapper.
-rw-r--r-- | src/socket_wrapper.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c index b88409b..c1827f2 100644 --- a/src/socket_wrapper.c +++ b/src/socket_wrapper.c @@ -411,6 +411,17 @@ static int real_socket(int domain, int type, int protocol) return libc_socket(domain, type, protocol); } +static ssize_t (*libc_writev)(int fd, const struct iovec *iov, int iovcnt); + +static ssize_t real_writev(int fd, const struct iovec *iov, int iovcnt) +{ + if (libc_writev == NULL) { + *(void **)(&libc_writev) = libc_dlsym("writev"); + } + + return libc_writev(fd, iov, iovcnt); +} + /********************************************************* * SWRAP HELPER FUNCTIONS *********************************************************/ @@ -2783,8 +2794,7 @@ ssize_t readv(int s, const struct iovec *vector, int count) return ret; } -#if 0 -ssize_t swrap_writev(int s, const struct iovec *vector, size_t count) +ssize_t writev(int s, const struct iovec *vector, int count) { struct msghdr msg; struct iovec tmp; @@ -2820,6 +2830,7 @@ ssize_t swrap_writev(int s, const struct iovec *vector, size_t count) return ret; } +#if 0 _PUBLIC_ int swrap_close(int fd) { struct socket_info *si = find_socket_info(fd); |