5#ifndef SYSCALL_WRAPPERS_H
6#define SYSCALL_WRAPPERS_H
34template<
typename T,
size_t N>
35T&
at(T (&arr)[N],
size_t index)
38 throw std::logic_error(
"index out of bounds");
48template<
typename T,
size_t N>
68int open(
const std::string& path,
int flags);
77template<
typename... Args>
78int ioctl(Args&&... args)
81 return ::ioctl(std::forward<Args>(args)...);
85template<
typename... Args>
86int ioctl([[maybe_unused]] Args&&... args)
116template<
typename... Args>
118int fcntl(
int fd,
int cmd, Args&&... args)
121 return ::fcntl(fd, cmd, std::forward<Args>(args)...);
124int fcntl([[maybe_unused]]
int fd, [[maybe_unused]]
int cmd, [[maybe_unused]] Args&&... args)
@ system
System module.
Definition log.h:39
T & at(T(&arr)[N], size_t index)
Return a reference to an array element.
Definition syscall_wrappers.h:35
std::string errno_string(int err)
Wrapper for strerror that returns a std::string.
std::unique_ptr< T, decltype([](T *t) { free(t);})> unique_ptr_free
Convenience wrapper on top of std::unique_ptr that uses free() instead of delete() for managing objec...
Definition syscall_wrappers.h:60
int open(const std::string &path, int flags)
Wrapper implementation that deals with C++ linter (clang-tidy)
int fcntl(int fd, int cmd, Args &&... args)
Wrapper for fcntl that deals with C++ linter (clang-tidy)
Definition syscall_wrappers.h:124
int ioctl(Args &&... args)
Wrapper implementation that deals with C++ linter (clang-tidy)
Definition syscall_wrappers.h:86
size_t array_size(T(&arr)[N])
Return the size of a fixed size array.
Definition syscall_wrappers.h:49
Any entities that belong to the utils library.