From dd46636e7c455955e3e3d6c2bb3141975494564f Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Mon, 1 Apr 2024 15:53:50 -0600 Subject: [PATCH] Add _PC_MIN_HOLE_SIZE for use with pathconf --- changelog/2349.added.md | 1 + src/unistd.rs | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 changelog/2349.added.md diff --git a/changelog/2349.added.md b/changelog/2349.added.md new file mode 100644 index 0000000000..277ded2c98 --- /dev/null +++ b/changelog/2349.added.md @@ -0,0 +1 @@ +Added `_PC_MIN_HOLE_SIZE` for `pathconf` and `fpathconf`. diff --git a/src/unistd.rs b/src/unistd.rs index 4502766c5d..c73786a6f5 100644 --- a/src/unistd.rs +++ b/src/unistd.rs @@ -2031,6 +2031,18 @@ pub enum PathconfVar { /// queue; therefore, the maximum number of bytes a conforming application /// may require to be typed as input before reading them. MAX_INPUT = libc::_PC_MAX_INPUT, + #[cfg(any( + solarish, + freebsdlike, + target_os = "netbsd", + ))] + /// If a file system supports the reporting of holes (see lseek(2)), + /// pathconf() and fpathconf() return a positive number that represents the + /// minimum hole size returned in bytes. The offsets of holes returned will + /// be aligned to this same value. A special value of 1 is returned if the + /// file system does not specify the minimum hole size but still reports + /// holes. + MIN_HOLE_SIZE = libc::_PC_MIN_HOLE_SIZE, /// Maximum number of bytes in a filename (not including the terminating /// null of a filename string). NAME_MAX = libc::_PC_NAME_MAX,