summary refs log tree commit diff stats
path: root/lib/pure/marshal.nim
diff options
context:
space:
mode:
authorc-blake <c-blake@users.noreply.github.com>2023-02-15 11:41:28 -0500
committerGitHub <noreply@github.com>2023-02-15 17:41:28 +0100
commitc91ef1a09f3284315e9e66c32532f5a8e3ba9297 (patch)
treeee11511a58e78e17085448ffb508f6eeaf199fe3 /lib/pure/marshal.nim
parente24d0e5faf1f6f2906262457007261e2358f1e5d (diff)
downloadNim-c91ef1a09f3284315e9e66c32532f5a8e3ba9297.tar.gz
Fix `closeHandle` bug, add `setFileSize`, make `resize` work on Windows (#21375)
* Add general purpose `setFileSize` (unexported for now).  Use to simplify
`memfiles.open` as well as make robust (via hard allocation, not merely
`ftruncate` address space allocation) on systems with `posix_fallocate`.

As part of this, fix a bad `closeHandle` return check bug on Windows and
add `MemFile.resize` for Windows now that setFileSize makes that easier.

* Adapt existing test to exercise newly portable `MemFile.resize`.

* Since Apple has never provided `posix_fallocate`, provide a fallback.
This is presently written in terms of `ftruncate`, but it can be
improved to use `F_PREALLOCATE` instead, as mentioned in a comment.
Diffstat (limited to 'lib/pure/marshal.nim')
0 files changed, 0 insertions, 0 deletions