MCPcopy Create free account
hub / github.com/apache/arrow / FileTruncate

Function FileTruncate

cpp/src/arrow/util/io_util.cc:1741–1756  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1739}
1740
1741Status FileTruncate(int fd, const int64_t size) {
1742 int ret, errno_actual;
1743
1744#ifdef _WIN32
1745 errno_actual = _chsize_s(fd, static_cast<size_t>(size));
1746 ret = errno_actual == 0 ? 0 : -1;
1747#else
1748 ret = ftruncate(fd, static_cast<size_t>(size));
1749 errno_actual = errno;
1750#endif
1751
1752 if (ret == -1) {
1753 return IOErrorFromErrno(errno_actual, "Error writing bytes to file");
1754 }
1755 return Status::OK();
1756}
1757
1758//
1759// Environment variables

Callers 3

ResizeMethod · 0.85
InitMMapMethod · 0.85
CreateMethod · 0.85

Calls 2

IOErrorFromErrnoFunction · 0.85
OKFunction · 0.50

Tested by

no test coverage detected