From 06a7803ca04aedaadec19e0a36c563f716553548 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 4 Sep 2002 20:50:52 +0000 Subject: (do_test): Make sure noatime flag isn't set for filesystem. --- libio/tst-atime.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'libio') diff --git a/libio/tst-atime.c b/libio/tst-atime.c index 2df64c3382..488963210e 100644 --- a/libio/tst-atime.c +++ b/libio/tst-atime.c @@ -4,6 +4,7 @@ #include #include #include +#include static int do_test (void); @@ -21,6 +22,8 @@ do_test (void) int ch; struct stat st1; struct stat st2; + struct statvfs sv; + int e; buf = (char *) malloc (strlen (test_dir) + sizeof "/tst-atime.XXXXXX"); if (buf == NULL) @@ -37,6 +40,24 @@ do_test (void) return 1; } + /* Make sure the filesystem doesn't have the noatime option set. If + statvfs is not available just continue. */ + e = fstatvfs (fd, &sv); + if (e != ENOSYS) + { + if (e != 0) + { + printf ("cannot statvfs '%s': %m\n", buf); + return 1; + } + + if ((sv.f_flag & ST_NOATIME) != 0) + { + puts ("Bah! The filesystem is mounted with noatime"); + return 0; + } + } + /* Make sure it gets removed. */ add_temp_file (buf); -- cgit 1.4.1