MCPcopy Create free account
hub / github.com/Niko1221/Strata / pread_full

Function pread_full

engine/src/core/expert_source.cpp:1131–1140  ·  view source on GitHub ↗

The whole range with pread (a short read continues); false on an error or an end of file.

Source from the content-addressed store, hash-verified

1129bool resident_sampled_n(const uint8_t* p, uint64_t n) { return resident_sampled(p, n) >= n; }
1130/// The whole range with pread (a short read continues); false on an error or an end of file.
1131bool pread_full(int fd, uint8_t* dst, uint64_t n, uint64_t off) {
1132 uint64_t done = 0;
1133 while (done < n) {
1134 const ssize_t r = ::pread(fd, dst + done, (size_t) (n - done), (off_t) (off + done));
1135 if (r < 0) { if (errno == EINTR) continue; return false; }
1136 if (r == 0) return false;
1137 done += (uint64_t) r;
1138 }
1139 return true;
1140}
1141} // namespace
1142#endif
1143

Callers 2

io_workerMethod · 0.85
copy_from_filesMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected