-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
34bd364
commit 6643c46
Showing
3 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
use crate::convert_res; | ||
use libc::{c_int, off_t}; | ||
use rustix::fd::BorrowedFd; | ||
use rustix::fs::FallocateFlags; | ||
|
||
#[no_mangle] | ||
unsafe extern "C" fn fallocate(fd: c_int, mode: c_int, offset: off_t, len: off_t) -> c_int { | ||
libc!(libc::fallocate(fd, mode, offset, len)); | ||
|
||
let fd = BorrowedFd::borrow_raw(fd); | ||
let mode = FallocateFlags::from_bits_retain(mode as _); | ||
match convert_res(rustix::fs::fallocate(fd, mode, offset as _, len as _)) { | ||
Some(()) => 0, | ||
None => -1, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ mod access; | |
mod chmod; | ||
mod dir; | ||
mod fadvise; | ||
mod fallocate; | ||
mod fcntl; | ||
mod flock; | ||
mod inotify; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters