projects
/
tools.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1670374
)
add fastrecat
author
Jann Horn
<jann@thejh.net>
Sun, 24 Nov 2013 03:01:13 +0000
(
04:01
+0100)
committer
Jann Horn
<jann@thejh.net>
Sun, 24 Nov 2013 03:01:13 +0000
(
04:01
+0100)
tools/fastrecat.c
[new file with mode: 0644]
patch
|
blob
diff --git a/tools/fastrecat.c
b/tools/fastrecat.c
new file mode 100644
(file)
index 0000000..
ff57776
--- /dev/null
+++ b/
tools/fastrecat.c
@@ -0,0
+1,19
@@
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sched.h>
+#include <unistd.h>
+
+int main(int argc, char **argv) {
+ while (1) {
+ char buf[4096];
+ int fd = open(argv[1], O_RDONLY);
+ if (fd < 0) continue;
+ ssize_t s = read(fd, buf, 4096);
+ if (s>0) {
+ write(1, buf, s);
+ }
+ close(fd);
+ sched_yield();
+ }
+}