diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2024-06-25 16:19:51 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2024-06-25 14:27:55 +0000 |
| commit | da0bd5caff9bc31532701c8bcbe0294f37386e4f (patch) | |
| tree | f9743ddcac96f62d9c0b6e44964aa8663e58bace | |
| parent | dc5564eb36462b29de4a0dbf85ef9f91df2eecca (diff) | |
executor: use ftruncate instead of fallocate
OpenBSD has neither fallocate nor posix_fallocate.
| -rw-r--r-- | executor/shmem.h | 5 |
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"); |
