add fastrecat
[tools.git] / tools / fastrecat.c
1 #include <sys/types.h>
2 #include <sys/stat.h>
3 #include <fcntl.h>
4 #include <sched.h>
5 #include <unistd.h>
6
7 int main(int argc, char **argv) {
8   while (1) {
9     char buf[4096];
10     int fd = open(argv[1], O_RDONLY);
11     if (fd < 0) continue;
12     ssize_t s = read(fd, buf, 4096);
13     if (s>0) {
14       write(1, buf, s);
15     }
16     close(fd);
17     sched_yield();
18   }
19 }