[plt-scheme] Patch for truncate(2)/chsize
I've created a patch for plt/collects/mzlib/os.ss that provides ffi access
to truncate(2). I've tested it on gentoo linux 2.4 and Windows XP.
The patch can be found here:
http://www.cs.utah.edu/~farrer/truncate.patch
and a simple description of the function:
(truncate-file path [size]) truncates the given file to <size>. If the
<size> parameter is omited the file is truncated to 0 bytes. If <size> is larger than
the current file size it is extended to <size> bytes. An error is raised if
the file doesn't exist or if the process doesn't have sufficient rights to
truncate the file.
Caviates:
Perhaps this function belongs in plt/collects/mzlib/file.ss
When a file is extended on Windows null bytes are appended to the end. On
*nix the eof is extened creating a file with a hole in it. The end result is
similar but under windows the delay is relative to the size of the extended
file where under *nix the delay is constant.
Evan