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

Christopher Faylor
Mon Feb 17 16:45:00 GMT 2003

On Mon, Feb 17, 2003 at 05:37:20PM +0100, Vaclav Haisman wrote:
>> UNIX has a method for producing sparse files.  If this is desired functionality,
>> Cygwin should mimic that not invent a new way of doing things.
>> cgf
>I have prepared another patch that implements parse files for Cygwin. It is
>smaller and, I think, even better than the previous. No new CYGWIN options.
>I have also been searching internet for some informations abut sparse files in
>Unix systems. It seems that if OS and file system supports it then it supports
>it without any extra system call. Some systems (SunOS) have fcntl() command
>F_FREESP that is supposed to free allocated disk space. But all unices I have
>had look at only support such combination of parameters that the deallocated
>block of space is at the end of file. In this case it works as ftruncate(). If
>I should implement this fcntl() command such that it would be able to
>deallocate disk space in a middle of a file then I would be inventing
>something new.

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.


>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.

More information about the Cygwin-patches mailing list