1 /* vi: set sw=4 ts=4: */
3 * readahead implementation for busybox
5 * Preloads the given files in RAM, to reduce access time.
6 * Does this by calling the readahead(2) system call.
8 * Copyright (C) 2006 Michael Opdenacker <michael@free-electrons.com>
10 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
15 int readahead_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
16 int readahead_main(int argc UNUSED_PARAM, char **argv)
18 int retval = EXIT_SUCCESS;
25 int fd = open_or_warn(*argv, O_RDONLY);
30 /* fdlength was reported to be unreliable - use seek */
31 len = xlseek(fd, 0, SEEK_END);
32 xlseek(fd, 0, SEEK_SET);
33 r = readahead(fd, 0, len);
38 retval = EXIT_FAILURE;