summaryrefslogtreecommitdiffstats
path: root/src/vcl/vcom_socket_wrapper.c
diff options
context:
space:
mode:
authorDave Wallace <dwallacelf@gmail.com>2017-11-13 21:21:53 -0500
committerKeith Burns <alagalah@gmail.com>2017-11-14 03:44:25 +0000
commit227867f5d3fb1b1dacbaf2f426812417b72ef03a (patch)
tree6d7b603b196d170717d5f81e23f122ec38989fb9 /src/vcl/vcom_socket_wrapper.c
parent49806fe252030a4cd993f598ff65a89590d57388 (diff)
VCL-LDPRELOAD: add sendfile/sendfile64 implementation.
Change-Id: If0c399269238912456d670432d7e953c9d91b9fb Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
Diffstat (limited to 'src/vcl/vcom_socket_wrapper.c')
-rw-r--r--src/vcl/vcom_socket_wrapper.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/vcl/vcom_socket_wrapper.c b/src/vcl/vcom_socket_wrapper.c
index d73f4b20562..de633d1cc7b 100644
--- a/src/vcl/vcom_socket_wrapper.c
+++ b/src/vcl/vcom_socket_wrapper.c
@@ -212,6 +212,8 @@ typedef int (*__libc_recvmsg) (int sockfd, const struct msghdr * msg,
int flags);
typedef int (*__libc_send) (int sockfd, const void *buf, size_t len,
int flags);
+typedef ssize_t (*__libc_sendfile) (int out_fd, int in_fd, off_t * offset,
+ size_t len);
typedef int (*__libc_sendmsg) (int sockfd, const struct msghdr * msg,
int flags);
typedef int (*__libc_sendto) (int sockfd, const void *buf, size_t len,
@@ -314,6 +316,7 @@ struct swrap_libc_symbols
SWRAP_SYMBOL_ENTRY (recvfrom);
SWRAP_SYMBOL_ENTRY (recvmsg);
SWRAP_SYMBOL_ENTRY (send);
+ SWRAP_SYMBOL_ENTRY (sendfile);
SWRAP_SYMBOL_ENTRY (sendmsg);
SWRAP_SYMBOL_ENTRY (sendto);
SWRAP_SYMBOL_ENTRY (setsockopt);
@@ -615,6 +618,7 @@ libc_listen (int sockfd, int backlog)
return swrap.libc.symbols._libc_listen.f (sockfd, backlog);
}
+/* TBD: libc_read() should return ssize_t not an int */
int
libc_read (int fd, void *buf, size_t count)
{
@@ -668,6 +672,14 @@ libc_send (int sockfd, const void *buf, size_t len, int flags)
return swrap.libc.symbols._libc_send.f (sockfd, buf, len, flags);
}
+ssize_t
+libc_sendfile (int out_fd, int in_fd, off_t * offset, size_t len)
+{
+ swrap_bind_symbol_libc (sendfile);
+
+ return swrap.libc.symbols._libc_sendfile.f (out_fd, in_fd, offset, len);
+}
+
int
libc_sendmsg (int sockfd, const struct msghdr *msg, int flags)
{