Skip to content

Commit 10543d0

Browse files
committed
Add posix_fadvise() and related constants
1 parent 0113d68 commit 10543d0

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/unix/bsd/freebsdlike/mod.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,13 @@ pub const POSIX_MADV_SEQUENTIAL: ::c_int = 2;
365365
pub const POSIX_MADV_WILLNEED: ::c_int = 3;
366366
pub const POSIX_MADV_DONTNEED: ::c_int = 4;
367367

368+
pub const POSIX_FADV_NORMAL: ::c_int = 0;
369+
pub const POSIX_FADV_RANDOM: ::c_int = 1;
370+
pub const POSIX_FADV_SEQUENTIAL: ::c_int = 2;
371+
pub const POSIX_FADV_WILLNEED: ::c_int = 3;
372+
pub const POSIX_FADV_DONTNEED: ::c_int = 4;
373+
pub const POSIX_FADV_NOREUSE: ::c_int = 5;
374+
368375
pub const _SC_IOV_MAX: ::c_int = 56;
369376
pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 70;
370377
pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 71;
@@ -630,6 +637,10 @@ extern {
630637
hdtr: *mut ::sf_hdtr,
631638
sbytes: *mut ::off_t,
632639
flags: ::c_int) -> ::c_int;
640+
641+
pub fn posix_fadvise(fd: ::c_int, offset: ::off_t, len: ::off_t,
642+
advise: ::c_int) -> ::c_int;
643+
633644
}
634645

635646
cfg_if! {

src/unix/notbsd/mod.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,13 @@ pub const SPLICE_F_GIFT: ::c_uint = 0x08;
534534

535535
pub const RTLD_LOCAL: ::c_int = 0;
536536

537+
pub const POSIX_FADV_NORMAL: ::c_int = 0;
538+
pub const POSIX_FADV_RANDOM: ::c_int = 1;
539+
pub const POSIX_FADV_SEQUENTIAL: ::c_int = 2;
540+
pub const POSIX_FADV_WILLNEED: ::c_int = 3;
541+
pub const POSIX_FADV_DONTNEED: ::c_int = 4;
542+
pub const POSIX_FADV_NOREUSE: ::c_int = 5;
543+
537544
f! {
538545
pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () {
539546
let fd = fd as usize;
@@ -642,6 +649,9 @@ extern {
642649
iov: *const ::iovec,
643650
nr_segs: ::size_t,
644651
flags: ::c_uint) -> ::ssize_t;
652+
653+
pub fn posix_fadvise(fd: ::c_int, offset: ::off_t, len: ::off_t,
654+
advise: ::c_int) -> ::c_int;
645655
}
646656

647657
cfg_if! {

0 commit comments

Comments
 (0)