mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
tsort: simplify code
This commit is contained in:
@@ -76,28 +76,12 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
#[cfg(not(windows))]
|
||||
{
|
||||
file = File::open(input)?;
|
||||
|
||||
// advise the OS we will access the data sequentially if available.
|
||||
#[cfg(any(
|
||||
target_os = "linux",
|
||||
target_os = "android",
|
||||
target_os = "fuchsia",
|
||||
target_env = "uclibc",
|
||||
target_os = "freebsd",
|
||||
))]
|
||||
{
|
||||
use rustix::fs::{Advice, fadvise};
|
||||
use std::os::unix::io::AsFd;
|
||||
|
||||
fadvise(
|
||||
file.as_fd(),
|
||||
0, // offset 0 => from the start of the file
|
||||
None, // None => for the whole file
|
||||
Advice::Sequential,
|
||||
)
|
||||
.ok();
|
||||
}
|
||||
}
|
||||
// advise the OS we will access the data sequentially if available.
|
||||
// offset 0 => from the start of the file. None => for the whole file.
|
||||
#[cfg(any(target_os = "linux", target_os = "android", target_os = "freebsd"))]
|
||||
let _ = rustix::fs::fadvise(&file, 0, None, rustix::fs::Advice::Sequential);
|
||||
|
||||
let reader = BufReader::new(file);
|
||||
process_input(reader, &mut g)?;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user