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

Method ShrinkToFit

util/system/file.cpp:462–471  ·  view source on GitHub ↗

Pair for FallocateNoResize

Source from the content-addressed store, hash-verified

460
461// Pair for FallocateNoResize
462bool TFileHandle::ShrinkToFit() noexcept {
463 if (!IsOpen()) {
464 return false;
465 }
466#if defined(_linux_) && (!defined(_android_) || __ANDROID_API__ >= 21)
467 return !ftruncate(Fd_, (off_t)GetLength());
468#else
469 return true;
470#endif
471}
472
473bool TFileHandle::Flush() noexcept {
474 if (!IsOpen()) {

Callers 1

ShrinkToFitMethod · 0.45

Calls 2

ftruncateFunction · 0.70
GetLengthFunction · 0.50

Tested by

no test coverage detected