MCPcopy Create free account
hub / github.com/catboost/catboost / Pread

Method Pread

util/system/file.cpp:562–585  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

560}
561
562i32 TFileHandle::Pread(void* buffer, ui32 byteCount, i64 offset) const noexcept {
563#if defined(_win_)
564 OVERLAPPED io;
565 Zero(io);
566 DWORD bytesRead = 0;
567 io.Offset = (ui32)offset;
568 io.OffsetHigh = (ui32)(offset >> 32);
569 if (::ReadFile(Fd_, buffer, byteCount, &bytesRead, &io)) {
570 return bytesRead;
571 }
572 if (::GetLastError() == ERROR_HANDLE_EOF) {
573 return 0;
574 }
575 return -1;
576#elif defined(_unix_)
577 i32 ret;
578 do {
579 ret = ::pread(Fd_, buffer, byteCount, offset);
580 } while (ret == -1 && errno == EINTR);
581 return ret;
582#else
583 #error unsupported platform
584#endif
585}
586
587i32 TFileHandle::Pwrite(const void* buffer, ui32 byteCount, i64 offset) const noexcept {
588#if defined(_win_)

Callers 4

RawPreadMethod · 0.45
TestPreadMethod · 0.45
Y_UNIT_TESTFunction · 0.45
DoReadMethod · 0.45

Calls 1

ZeroFunction · 0.85

Tested by 1

TestPreadMethod · 0.36