У меня есть файл, открытый с O_Direct, и я использую AIO для его прочтения. Но что, если размер файла не равен размеру блока? Как я могу прочитать последний бит файла?#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
template class ScopeExit {
public:
explicit ScopeExit(FuncT&& fn) : f(std::forward(fn)) {}
~ScopeExit() { f(); }
ScopeExit(const ScopeExit&) = delete;
ScopeExit& operator=(const ScopeExit&) = delete;
ScopeExit(ScopeExit&&) = delete;
ScopeExit& operator=(ScopeExit&&) = delete;
private:
FuncT f;
};
template ScopeExit(F&&) -> ScopeExit;
template long checked_syscall(long syscall_number, Args... args) {
long ret = syscall(syscall_number, args...);
if (ret < 0) {
auto error = errno;
std::cerr
Подробнее здесь: https://stackoverflow.com/questions/794 ... irect-file