From da0bd5caff9bc31532701c8bcbe0294f37386e4f Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Tue, 25 Jun 2024 16:19:51 +0200 Subject: executor: use ftruncate instead of fallocate OpenBSD has neither fallocate nor posix_fallocate. --- executor/shmem.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'executor/shmem.h') 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"); -- cgit mrf-deployment