From 9bd9d7dad54063cb1a648d92615d2f36169a4eb5 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Fri, 26 Jun 2026 23:23:38 -0500 Subject: [PATCH] Switch to posix_fadvise(POSIX_FADV_WILLNEED) --- toys/other/readahead.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/toys/other/readahead.c b/toys/other/readahead.c index 4d52e44b..3501540b 100644 --- a/toys/other/readahead.c +++ b/toys/other/readahead.c @@ -15,15 +15,11 @@ config READAHEAD Preload files into disk cache. */ -#define _LARGEFILE64_SOURCE // musl's _ALL_SOURCE lies, no off64_t #include "toys.h" -// glibc won't provide this prototype unless we claim Linux belongs to the FSF -ssize_t readahead(int fd, off64_t offset, size_t count); - static void do_readahead(int fd, char *name) { - if (readahead(fd, 0, INT_MAX)) perror_msg("readahead: %s", name); + if (posix_fadvise(fd, 0, 0, POSIX_FADV_WILLNEED)) perror_msg_raw(name); } void readahead_main(void) -- 2.39.5