From 4e3788685ee820bccd72a997b34079ca8ea88580 Mon Sep 17 00:00:00 2001 From: oech3 <79379754+oech3@users.noreply.github.com> Date: Mon, 1 Jun 2026 14:43:31 +0900 Subject: [PATCH] cksum family: read ahead file --- src/uucore/src/lib/features/checksum/compute.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/uucore/src/lib/features/checksum/compute.rs b/src/uucore/src/lib/features/checksum/compute.rs index 0868137c6..66f2978bd 100644 --- a/src/uucore/src/lib/features/checksum/compute.rs +++ b/src/uucore/src/lib/features/checksum/compute.rs @@ -261,7 +261,15 @@ where Box::new(stdin_buf) as Box } else { file_buf = match File::open(filepath) { - Ok(file) => file, + Ok(file) => { + #[cfg(any( + target_os = "linux", + target_os = "android", + target_os = "freebsd" + ))] + let _ = rustix::fs::fadvise(&file, 0, None, rustix::fs::Advice::Sequential); + file + } Err(err) => { show!(err.map_err_context(|| filepath.to_string_lossy().into())); continue;