Patrick Venture | f9ee95f | 2021-02-12 12:33:31 -0800 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | /* NOTE: IIRC, wak@ is working on exposing some of this in stdplus, so we can |
| 4 | * transition when that's ready. |
| 5 | * |
| 6 | * Copied some from gpioplus to enable unit-testing of lpc nuvoton and later |
| 7 | * other pieces. |
| 8 | */ |
| 9 | |
| 10 | #include <poll.h> |
| 11 | #include <sys/mman.h> |
| 12 | |
| 13 | #include <cinttypes> |
| 14 | #include <cstddef> |
| 15 | |
| 16 | namespace ipmiblob |
| 17 | { |
| 18 | namespace internal |
| 19 | { |
| 20 | |
| 21 | /** |
| 22 | * @class Sys |
| 23 | * @brief Overridable direct syscall interface |
| 24 | */ |
| 25 | class Sys |
| 26 | { |
| 27 | public: |
| 28 | virtual ~Sys() = default; |
| 29 | |
| 30 | virtual int open(const char* pathname, int flags) const = 0; |
| 31 | virtual int read(int fd, void* buf, std::size_t count) const = 0; |
| 32 | virtual int close(int fd) const = 0; |
| 33 | virtual void* mmap(void* addr, std::size_t length, int prot, int flags, |
| 34 | int fd, off_t offset) const = 0; |
| 35 | virtual int munmap(void* addr, std::size_t length) const = 0; |
| 36 | virtual int getpagesize() const = 0; |
| 37 | virtual int ioctl(int fd, unsigned long request, void* param) const = 0; |
| 38 | virtual int poll(struct pollfd* fds, nfds_t nfds, int timeout) const = 0; |
| 39 | }; |
| 40 | |
| 41 | } // namespace internal |
| 42 | } // namespace ipmiblob |