From ac8967f99c74b6725e5e39a9010d8a3b0ee8d1cb Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 9 May 2009 18:51:11 -0700 Subject: Always open files with O_NOATIME Avoid generating unnecessary disk activity. --- fadvise.c | 2 +- mincore.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fadvise.c b/fadvise.c index c2392f4..349ac42 100644 --- a/fadvise.c +++ b/fadvise.c @@ -16,7 +16,7 @@ static void apply_fadvise(const char *path, off_t offset, off_t len, int advice) { int fd; - if ((fd = open(path, O_RDONLY)) < 0) { + if ((fd = open(path, O_RDONLY|O_NOATIME)) < 0) { fprintf(stderr, "%s: open(): %s\n", path, strerror(errno)); return; } diff --git a/mincore.c b/mincore.c index 3309bd9..c6915f1 100644 --- a/mincore.c +++ b/mincore.c @@ -10,7 +10,7 @@ static void mincore_stats(const char *path) int fd; size_t i; - if ((fd = open(path, O_RDONLY)) < 0) { + if ((fd = open(path, O_RDONLY|O_NOATIME)) < 0) { fprintf(stderr, "%s: open(): %s\n", path, strerror(errno)); return; } -- cgit v1.2.3-24-ge0c7