Skip to content

Commit b61a614

Browse files
authored
Patch 24922 (#24923)
1 parent 0506d5b commit b61a614

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/posix/posix.nim

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,11 @@ when defined(osx): # 2001 POSIX evidently does not concern Apple
215215
# present size & has no good reason to call this unless it is growing.
216216
if fcntl(a1, F_PREALLOCATE, fst.addr) != cint(-1): ftruncate(a1, a2 + a3)
217217
else: cint(-1)
218+
elif defined(openbsd):
219+
proc posix_fallocate*(a1: cint, a2, a3: Off): cint =
220+
# above assumption: "has no good reason to call this unless it is growing."
221+
# man ftruncate "it will be extended as if by writing bytes with the value zero."
222+
return ftruncate(a1, a2 + a3)
218223
else:
219224
proc posix_fallocate*(a1: cint, a2, a3: Off): cint {.
220225
importc, header: "<fcntl.h>".}

0 commit comments

Comments
 (0)