| // Copyright 2024 Google LLC |
| // |
| // Licensed under the Apache License, Version 2.0 (the "License"); |
| // you may not use this file except in compliance with the License. |
| // You may obtain a copy of the License at |
| // |
| // http://www.apache.org/licenses/LICENSE-2.0 |
| // |
| // Unless required by applicable law or agreed to in writing, software |
| // distributed under the License is distributed on an "AS IS" BASIS, |
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| // See the License for the specific language governing permissions and |
| // limitations under the License. |
| |
| #pragma once |
| |
| #include <cstdint> |
| #include <sys/ioctl.h> |
| #include <unistd.h> |
| |
| namespace google |
| { |
| namespace hoth |
| { |
| namespace internal |
| { |
| |
| /** @class Sys |
| * @brief Overridable direct syscall interface |
| * |
| * TODO: factor this out into a syscall class shared by all upstream projects |
| */ |
| class Sys |
| { |
| public: |
| virtual ~Sys() = default; |
| |
| virtual int open(const char* pathname, int flags) const = 0; |
| virtual int close(int fd) const = 0; |
| virtual off_t lseek(int fd, off_t offset, int whence) const = 0; |
| virtual ssize_t read(int fd, void* buf, size_t count) const = 0; |
| virtual ssize_t write(int fd, const void* buf, size_t count) const = 0; |
| virtual int ioctl(int fd , uint64_t request, void* mtd) const = 0; |
| }; |
| |
| } // namespace internal |
| |
| } // namespace hoth |
| |
| } // namespace google |