tools/net: Handle files which don't support sendfile
This adds a fallback read / write model.
Tested: ran against non-sendfile compatible file and it sent to the BMC successfully.
Change-Id: I6fd781ad19cd37376ca90743f799988e50ed460e
Signed-off-by: William A. Kennington III <wak@google.com>
Signed-off-by: Willy Tu <wltu@google.com>
diff --git a/internal/sys.hpp b/internal/sys.hpp
index 7c56818..023d1d0 100644
--- a/internal/sys.hpp
+++ b/internal/sys.hpp
@@ -46,6 +46,8 @@
virtual int socket(int domain, int type, int protocol) const = 0;
virtual int connect(int sockfd, const struct sockaddr* addr,
socklen_t addrlen) const = 0;
+ virtual ssize_t send(int sockfd, const void* buf, size_t len,
+ int flags) const = 0;
virtual ssize_t sendfile(int out_fd, int in_fd, off_t* offset,
size_t count) const = 0;
virtual int getaddrinfo(const char* node, const char* service,
@@ -79,6 +81,8 @@
int socket(int domain, int type, int protocol) const override;
int connect(int sockfd, const struct sockaddr* addr,
socklen_t addrlen) const override;
+ ssize_t send(int sockfd, const void* buf, size_t len,
+ int flags) const override;
ssize_t sendfile(int out_fd, int in_fd, off_t* offset,
size_t count) const override;
int getaddrinfo(const char* node, const char* service,