Last change
on this file since 2851 was 2725, checked in by Bruno Cornec, 14 years ago |
- Update mindi-busybox to 1.18.3 to avoid problems with the tar command which is now failing on recent versions with busybox 1.7.3
|
-
Property svn:eol-style
set to
native
|
File size:
899 bytes
|
Rev | Line | |
---|
[1765] | 1 | /* vi: set sw=4 ts=4: */
|
---|
| 2 | /*
|
---|
| 3 | * readahead implementation for busybox
|
---|
| 4 | *
|
---|
| 5 | * Preloads the given files in RAM, to reduce access time.
|
---|
| 6 | * Does this by calling the readahead(2) system call.
|
---|
| 7 | *
|
---|
| 8 | * Copyright (C) 2006 Michael Opdenacker <michael@free-electrons.com>
|
---|
| 9 | *
|
---|
[2725] | 10 | * Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
---|
[1765] | 11 | */
|
---|
| 12 |
|
---|
| 13 | #include "libbb.h"
|
---|
| 14 |
|
---|
[2725] | 15 | int readahead_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
---|
| 16 | int readahead_main(int argc UNUSED_PARAM, char **argv)
|
---|
[1765] | 17 | {
|
---|
| 18 | int retval = EXIT_SUCCESS;
|
---|
| 19 |
|
---|
[2725] | 20 | if (!argv[1]) {
|
---|
| 21 | bb_show_usage();
|
---|
| 22 | }
|
---|
[1765] | 23 |
|
---|
| 24 | while (*++argv) {
|
---|
[2725] | 25 | int fd = open_or_warn(*argv, O_RDONLY);
|
---|
| 26 | if (fd >= 0) {
|
---|
| 27 | off_t len;
|
---|
| 28 | int r;
|
---|
[1765] | 29 |
|
---|
[2725] | 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);
|
---|
| 34 | close(fd);
|
---|
| 35 | if (r >= 0)
|
---|
| 36 | continue;
|
---|
[1765] | 37 | }
|
---|
| 38 | retval = EXIT_FAILURE;
|
---|
| 39 | }
|
---|
| 40 |
|
---|
| 41 | return retval;
|
---|
| 42 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.