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

cygwin: add statfs & fcntl #4321

Merged
merged 1 commit into from
Mar 11, 2025
Merged
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
34 changes: 34 additions & 0 deletions src/unix/cygwin/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,19 @@ s! {
pub f_flag: c_ulong,
pub f_namemax: c_ulong,
}

pub struct statfs {
pub f_type: c_ulong,
pub f_bsize: c_ulong,
pub f_blocks: c_ulong,
pub f_bfree: c_ulong,
pub f_bavail: c_ulong,
pub f_files: c_ulong,
pub f_ffree: c_ulong,
pub f_fsid: c_ulong,
pub f_namelen: c_ulong,
pub f_spare: [c_ulong; 6],
}
}

s_no_extra_traits! {
Expand Down Expand Up @@ -1786,6 +1799,20 @@ pub const POSIX_SPAWN_SETSCHEDULER: c_int = 0x08;
pub const POSIX_SPAWN_SETSIGDEF: c_int = 0x10;
pub const POSIX_SPAWN_SETSIGMASK: c_int = 0x20;

pub const POSIX_FADV_NORMAL: c_int = 0;
pub const POSIX_FADV_SEQUENTIAL: c_int = 1;
pub const POSIX_FADV_RANDOM: c_int = 2;
pub const POSIX_FADV_WILLNEED: c_int = 3;
pub const POSIX_FADV_DONTNEED: c_int = 4;
pub const POSIX_FADV_NOREUSE: c_int = 5;

pub const FALLOC_FL_PUNCH_HOLE: c_int = 0x0001;
pub const FALLOC_FL_ZERO_RANGE: c_int = 0x0002;
pub const FALLOC_FL_UNSHARE_RANGE: c_int = 0x0004;
pub const FALLOC_FL_COLLAPSE_RANGE: c_int = 0x0008;
pub const FALLOC_FL_INSERT_RANGE: c_int = 0x0010;
pub const FALLOC_FL_KEEP_SIZE: c_int = 0x1000;

f! {
pub fn FD_CLR(fd: c_int, set: *mut fd_set) -> () {
let fd = fd as usize;
Expand Down Expand Up @@ -2472,4 +2499,11 @@ extern "C" {
result: *mut *mut crate::group,
) -> c_int;
pub fn initgroups(user: *const c_char, group: crate::gid_t) -> c_int;

pub fn statfs(path: *const c_char, buf: *mut statfs) -> c_int;
pub fn fstatfs(fd: c_int, buf: *mut statfs) -> c_int;

pub fn posix_fadvise(fd: c_int, offset: off_t, len: off_t, advise: c_int) -> c_int;
pub fn posix_fallocate(fd: c_int, offset: off_t, len: off_t) -> c_int;
pub fn fallocate(fd: c_int, mode: c_int, offset: off_t, len: off_t) -> c_int;
}
Loading