summaryrefslogtreecommitdiffabout
path: root/src/dropcache.c
Side-by-side diff
Diffstat (limited to 'src/dropcache.c') (more/less context) (ignore whitespace changes)
-rw-r--r--src/dropcache.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/dropcache.c b/src/dropcache.c
new file mode 100644
index 0000000..659f00a
--- a/dev/null
+++ b/src/dropcache.c
@@ -0,0 +1,24 @@
+#include <stdio.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+char const drop_caches[] = "/proc/sys/vm/drop_caches";
+
+int
+main(int argc, char **argv)
+{
+ int fd;
+ fd = open(drop_caches, O_WRONLY);
+ if (fd == -1)
+ {
+ perror(drop_caches);
+ return 1;
+ }
+ if (write(fd, "3\n", 2) != 2)
+ {
+ perror(drop_caches);
+ return 1;
+ }
+ close(fd);
+ return 0;
+}

Return to:

Send suggestions and report system problems to the System administrator.