mirror of git://git.suckless.org/sbase
Add readahead(8)
This commit is contained in:
parent
32efa14595
commit
debcf4447d
1
Makefile
1
Makefile
|
@ -51,6 +51,7 @@ SRC = \
|
|||
pidof.c \
|
||||
pivot_root.c \
|
||||
ps.c \
|
||||
readahead.c \
|
||||
respawn.c \
|
||||
rmmod.c \
|
||||
stat.c \
|
||||
|
|
4
README
4
README
|
@ -9,8 +9,8 @@ The following programs are currently implemented:
|
|||
chvt clear ctrlaltdel dd df dmesg eject fallocate free freeramdisk
|
||||
fsfreeze getty halt hwclock id insmod killall5 login lsmod lsusb
|
||||
mknod mkswap mount mountpoint pagesize passwd pidof pivot_root ps
|
||||
respawn rmmod stat su swapoff swapon switch_root sysctl truncate
|
||||
umount unshare uptime watch who
|
||||
readahead respawn rmmod stat su swapoff swapon switch_root sysctl
|
||||
truncate umount unshare uptime watch who
|
||||
|
||||
The complement of ubase is sbase[1] which mostly follows POSIX and
|
||||
provides all the portable tools. Together they are intended to form a
|
||||
|
|
1
TODO
1
TODO
|
@ -16,7 +16,6 @@ Tools to be implemented
|
|||
* ifconfig
|
||||
* hwclock
|
||||
* partprobe
|
||||
* readahead
|
||||
* rfkill
|
||||
* taskset
|
||||
* acpi
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
/* See LICENSE file for copyright and license details. */
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "util.h"
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
eprintf("usage: %s file...\n", argv0);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
FILE *fp;
|
||||
|
||||
ARGBEGIN {
|
||||
default:
|
||||
usage();
|
||||
} ARGEND;
|
||||
|
||||
if (argc == 0)
|
||||
usage();
|
||||
|
||||
for (; argc > 0; argc--, argv++) {
|
||||
if (!(fp = fopen(argv[0], "r"))) {
|
||||
weprintf("fopen %s:", argv[0]);
|
||||
continue;
|
||||
}
|
||||
if (readahead(fileno(fp), 0, -1) < 0)
|
||||
weprintf("readahead %s:", argv[0]);
|
||||
fclose(fp);
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
Loading…
Reference in New Issue