Skip to content

Commit

Permalink
Add special implementation for raw_fallocate for OpenBSD
Browse files Browse the repository at this point in the history
  • Loading branch information
mvieth committed Feb 8, 2024
1 parent 2fd6558 commit 6a0cb35
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions io/include/pcl/io/low_level_io.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,12 @@ namespace pcl
// All other errors are passed up.
if (errno != EINVAL)
return -1;
# elif defined(__OpenBSD__)
// OpenBSD does not have neither posix_fallocate nor fallocate
if (::ftruncate(fd, length) == 0)
return 0;
if (errno != EINVAL)
return -1;
# else
// Conforming POSIX systems have posix_fallocate.
const int res = ::posix_fallocate(fd, 0, length);
Expand Down

0 comments on commit 6a0cb35

Please sign in to comment.