mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Schwartzmeyer <>
Subject Re: Review Request 66455: Windows: Fixed `os::ftruncate()` to use `FileEndOfFileInfo`.
Date Fri, 06 Apr 2018 23:09:14 GMT

This is an automatically generated e-mail. To reply, visit:

(Updated April 6, 2018, 4:09 p.m.)

Review request for mesos, Akash Gupta, Eric Mumau, John Kordich, Joseph Wu, and Michael Park.


Use `FileEndOfFileInfo` instead of `SetEndOfFile()`.

Summary (updated)

Windows: Fixed `os::ftruncate()` to use `FileEndOfFileInfo`.

Bugs: MESOS-8692

Repository: mesos

Description (updated)

This previously used the CRT API `_chsize_s()`, which required a CRT
integer file descriptor. Instead, we can achieve the same behavior by
calling `SetFileInformationByHandle(FileEndOfFileInfo)`. This is
significantly easier than using `SetEndOfFile()`, as that requires (1)
saving the original position, (2) seeking to the new position, (3)
setting the end of the file at the new position, then (4) seeking back
to the original position. Instead, this method just sets the end of
the file directly based on the given `length`, much like `ftruncate()`
on POSIX systems.

Diffs (updated)

  3rdparty/stout/include/stout/os/windows/ftruncate.hpp fc4a8b5040d56fa9766687e44ce17fbe47d9e8f0





Andrew Schwartzmeyer

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message