internal: add read() method

Add the read() method to the internal syscall interface.

Change-Id: Iea2a137df5b6ba2085c7363ca150d4e4b8864048
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/internal/sys.cpp b/internal/sys.cpp
index b99a2f2..46c6642 100644
--- a/internal/sys.cpp
+++ b/internal/sys.cpp
@@ -29,6 +29,11 @@
     return ::open(pathname, flags);
 }
 
+int SysImpl::read(int fd, void* buf, std::size_t count) const
+{
+    return static_cast<int>(::read(fd, buf, count));
+}
+
 int SysImpl::close(int fd) const
 {
     return ::close(fd);
diff --git a/internal/sys.hpp b/internal/sys.hpp
index 98b6e5c..2975b8c 100644
--- a/internal/sys.hpp
+++ b/internal/sys.hpp
@@ -26,6 +26,7 @@
     virtual ~Sys() = default;
 
     virtual int open(const char* pathname, int flags) const = 0;
+    virtual int read(int fd, void* buf, std::size_t count) const = 0;
     virtual int close(int fd) const = 0;
     virtual void* mmap(void* addr, std::size_t length, int prot, int flags,
                        int fd, off_t offset) const = 0;
@@ -44,6 +45,7 @@
 {
   public:
     int open(const char* pathname, int flags) const override;
+    int read(int fd, void* buf, std::size_t count) const override;
     int close(int fd) const override;
     void* mmap(void* addr, std::size_t length, int prot, int flags, int fd,
                off_t offset) const override;