Create new files as sparse on NT systems. (2nd try)

Max Bowsher
Mon Feb 17 17:50:00 GMT 2003

> On Mon, Feb 17, 2003 at 05:37:20PM +0100, Vaclav Haisman wrote:
>> I have prepared another patch that implements sparse files for
>> Cygwin. It is smaller and, I think, even better than the previous.
>> No new CYGWIN options.

>> 2003-02-17  Vaclav Haisman  <>
>> * include/winioctl.h (FSCTL_SET_SPARSE): Define.
>> 2003-02-17  Vaclav Haisman  <>
>> * fhandler.h: Include winioctl.h for DeviceIoControl.
>> (fhandler::open): Try to set newly created and truncated files as
>> sparse on NT systems.

Christopher Faylor wrote:
> This looks pretty good but the cygwin convention is to use wincap
> settings for this kind of thing rather than using is_winnt.  So,
> please add a wincap capability to accomplish this.

Is it wise to set *all* new files to sparse? Surely if this was actually
advantageous, Windows would do it anyway? From MSDN: "Note  It is up to the
application to maintain sparseness by writing zeros with
FSCTL_SET_ZERO_DATA." I.e., this will gain nothing unless the application
knows about sparse-ness, in which case, it should explicitly specify that
the file should be sparse. So, all this patch will do is to force Windows to
examine more metadata for every file read. This seems *extremely


More information about the Cygwin-patches mailing list