aboutsummaryrefslogtreecommitdiffstats
path: root/executor
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2024-06-25 16:19:51 +0200
committerDmitry Vyukov <dvyukov@google.com>2024-06-25 14:27:55 +0000
commitda0bd5caff9bc31532701c8bcbe0294f37386e4f (patch)
treef9743ddcac96f62d9c0b6e44964aa8663e58bace /executor
parentdc5564eb36462b29de4a0dbf85ef9f91df2eecca (diff)
executor: use ftruncate instead of fallocate
OpenBSD has neither fallocate nor posix_fallocate.
Diffstat (limited to 'executor')
-rw-r--r--executor/shmem.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/executor/shmem.h b/executor/shmem.h
index b7722ff99..86492613d 100644
--- a/executor/shmem.h
+++ b/executor/shmem.h
@@ -18,8 +18,9 @@ public:
fd_ = mkstemp(file_name);
if (fd_ == -1)
failmsg("shmem open failed", "file=%s", file_name);
- if (posix_fallocate(fd_, 0, size))
- failmsg("shmem fallocate failed", "size=%zu", size);
+ // OpenBSD has neither fallocate nor posix_fallocate.
+ if (ftruncate(fd_, size))
+ failmsg("shmem ftruncate failed", "size=%zu", size);
Mmap(fd_, nullptr, size, true);
if (unlink(file_name))
fail("shmem unlink failed");