Skip to content

Commit 094464b

Browse files
authored
Merge pull request rust-lang#4321 from Berrysoft/cygwin-rustix
cygwin: add statfs & fcntl
2 parents 1c65dda + f007c3e commit 094464b

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

src/unix/cygwin/mod.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,19 @@ s! {
435435
pub f_flag: c_ulong,
436436
pub f_namemax: c_ulong,
437437
}
438+
439+
pub struct statfs {
440+
pub f_type: c_ulong,
441+
pub f_bsize: c_ulong,
442+
pub f_blocks: c_ulong,
443+
pub f_bfree: c_ulong,
444+
pub f_bavail: c_ulong,
445+
pub f_files: c_ulong,
446+
pub f_ffree: c_ulong,
447+
pub f_fsid: c_ulong,
448+
pub f_namelen: c_ulong,
449+
pub f_spare: [c_ulong; 6],
450+
}
438451
}
439452

440453
s_no_extra_traits! {
@@ -1786,6 +1799,20 @@ pub const POSIX_SPAWN_SETSCHEDULER: c_int = 0x08;
17861799
pub const POSIX_SPAWN_SETSIGDEF: c_int = 0x10;
17871800
pub const POSIX_SPAWN_SETSIGMASK: c_int = 0x20;
17881801

1802+
pub const POSIX_FADV_NORMAL: c_int = 0;
1803+
pub const POSIX_FADV_SEQUENTIAL: c_int = 1;
1804+
pub const POSIX_FADV_RANDOM: c_int = 2;
1805+
pub const POSIX_FADV_WILLNEED: c_int = 3;
1806+
pub const POSIX_FADV_DONTNEED: c_int = 4;
1807+
pub const POSIX_FADV_NOREUSE: c_int = 5;
1808+
1809+
pub const FALLOC_FL_PUNCH_HOLE: c_int = 0x0001;
1810+
pub const FALLOC_FL_ZERO_RANGE: c_int = 0x0002;
1811+
pub const FALLOC_FL_UNSHARE_RANGE: c_int = 0x0004;
1812+
pub const FALLOC_FL_COLLAPSE_RANGE: c_int = 0x0008;
1813+
pub const FALLOC_FL_INSERT_RANGE: c_int = 0x0010;
1814+
pub const FALLOC_FL_KEEP_SIZE: c_int = 0x1000;
1815+
17891816
f! {
17901817
pub fn FD_CLR(fd: c_int, set: *mut fd_set) -> () {
17911818
let fd = fd as usize;
@@ -2472,4 +2499,11 @@ extern "C" {
24722499
result: *mut *mut crate::group,
24732500
) -> c_int;
24742501
pub fn initgroups(user: *const c_char, group: crate::gid_t) -> c_int;
2502+
2503+
pub fn statfs(path: *const c_char, buf: *mut statfs) -> c_int;
2504+
pub fn fstatfs(fd: c_int, buf: *mut statfs) -> c_int;
2505+
2506+
pub fn posix_fadvise(fd: c_int, offset: off_t, len: off_t, advise: c_int) -> c_int;
2507+
pub fn posix_fallocate(fd: c_int, offset: off_t, len: off_t) -> c_int;
2508+
pub fn fallocate(fd: c_int, mode: c_int, offset: off_t, len: off_t) -> c_int;
24752509
}

0 commit comments

Comments
 (0)