29 constexpr 
int kDefaultBlockSize = 4096; 
 
   32 ROOT::Internal::RRawFileUnix::RRawFileUnix(std::string_view url, ROptions options)
 
   33    : RRawFile(url, options), fFileDes(-1)
 
   37 ROOT::Internal::RRawFileUnix::~RRawFileUnix()
 
   43 std::unique_ptr<ROOT::Internal::RRawFile> ROOT::Internal::RRawFileUnix::Clone()
 const 
   45    return std::make_unique<RRawFileUnix>(fUrl, fOptions);
 
   48 std::uint64_t ROOT::Internal::RRawFileUnix::GetSizeImpl()
 
   51    int res = fstat(fFileDes, &info);
 
   53       throw std::runtime_error(
"Cannot call fstat on '" + fUrl + 
"', error: " + std::string(strerror(errno)));
 
   57 void *ROOT::Internal::RRawFileUnix::MapImpl(
size_t nbytes, std::uint64_t offset, std::uint64_t &mapdOffset)
 
   59    static std::uint64_t szPageBitmap = sysconf(_SC_PAGESIZE) - 1;
 
   60    mapdOffset = offset & ~szPageBitmap;
 
   61    nbytes += offset & szPageBitmap;
 
   63    void *result = mmap(
nullptr, nbytes, PROT_READ, MAP_PRIVATE, fFileDes, mapdOffset);
 
   64    if (result == MAP_FAILED)
 
   65       throw std::runtime_error(std::string(
"Cannot perform memory mapping: ") + strerror(errno));
 
   69 void ROOT::Internal::RRawFileUnix::OpenImpl()
 
   71    fFileDes = open(GetLocation(fUrl).c_str(), O_RDONLY);
 
   73       throw std::runtime_error(
"Cannot open '" + fUrl + 
"', error: " + std::string(strerror(errno)));
 
   76    if (fOptions.fBlockSize >= 0)
 
   80    int res = fstat(fFileDes, &info);
 
   82       throw std::runtime_error(
"Cannot call fstat on '" + fUrl + 
"', error: " + std::string(strerror(errno)));
 
   84    if (info.st_blksize > 0) {
 
   85       fOptions.fBlockSize = info.st_blksize;
 
   87       fOptions.fBlockSize = kDefaultBlockSize;
 
   91 size_t ROOT::Internal::RRawFileUnix::ReadAtImpl(
void *buffer, 
size_t nbytes, std::uint64_t offset)
 
   93    size_t total_bytes = 0;
 
   95       ssize_t res = pread(fFileDes, buffer, nbytes, offset);
 
   99          throw std::runtime_error(
"Cannot read from '" + fUrl + 
"', error: " + std::string(strerror(errno)));
 
  100       } 
else if (res == 0) {
 
  103       R__ASSERT(static_cast<size_t>(res) <= nbytes);
 
  104       buffer = 
reinterpret_cast<unsigned char *
>(buffer) + res;
 
  112 void ROOT::Internal::RRawFileUnix::UnmapImpl(
void *region, 
size_t nbytes)
 
  114    int rv = munmap(region, nbytes);
 
  116       throw std::runtime_error(std::string(
"Cannot remove memory mapping: ") + strerror(errno));