Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add _PC_MIN_HOLE_SIZE for use with pathconf #2349

Merged
merged 1 commit into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/2349.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added `_PC_MIN_HOLE_SIZE` for `pathconf` and `fpathconf`.
12 changes: 12 additions & 0 deletions src/unistd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems that this is also supported by macOS, though this constant hasn't been added to libc. Anyway, let's merge this PR first:)

https://keith.github.io/xcode-man-pages/pathconf.2.html#_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,
Expand Down