From f8ce7ddd6d8aee638afeab150503e7986f1606d6 Mon Sep 17 00:00:00 2001 From: Alfred Morgan Date: Wed, 30 Apr 2025 04:00:23 -0700 Subject: [PATCH] Patch 24922 (#24923) (cherry picked from commit b61a614e8af731020bb4aecb0e3f41d32c41f46f) --- lib/posix/posix.nim | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/posix/posix.nim b/lib/posix/posix.nim index a559367790..f0dbd1208a 100644 --- a/lib/posix/posix.nim +++ b/lib/posix/posix.nim @@ -215,6 +215,11 @@ when defined(osx): # 2001 POSIX evidently does not concern Apple # present size & has no good reason to call this unless it is growing. if fcntl(a1, F_PREALLOCATE, fst.addr) != cint(-1): ftruncate(a1, a2 + a3) else: cint(-1) +elif defined(openbsd): + proc posix_fallocate*(a1: cint, a2, a3: Off): cint = + # above assumption: "has no good reason to call this unless it is growing." + # man ftruncate "it will be extended as if by writing bytes with the value zero." + return ftruncate(a1, a2 + a3) else: proc posix_fallocate*(a1: cint, a2, a3: Off): cint {. importc, header: "".}