mirror of git://sourceware.org/git/glibc.git
(do_test): Make sure noatime flag isn't set for filesystem.
This commit is contained in:
parent
ba5da1e2ed
commit
06a7803ca0
|
|
@ -4,6 +4,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include <sys/statvfs.h>
|
||||||
|
|
||||||
|
|
||||||
static int do_test (void);
|
static int do_test (void);
|
||||||
|
|
@ -21,6 +22,8 @@ do_test (void)
|
||||||
int ch;
|
int ch;
|
||||||
struct stat st1;
|
struct stat st1;
|
||||||
struct stat st2;
|
struct stat st2;
|
||||||
|
struct statvfs sv;
|
||||||
|
int e;
|
||||||
|
|
||||||
buf = (char *) malloc (strlen (test_dir) + sizeof "/tst-atime.XXXXXX");
|
buf = (char *) malloc (strlen (test_dir) + sizeof "/tst-atime.XXXXXX");
|
||||||
if (buf == NULL)
|
if (buf == NULL)
|
||||||
|
|
@ -37,6 +40,24 @@ do_test (void)
|
||||||
return 1;
|
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. */
|
/* Make sure it gets removed. */
|
||||||
add_temp_file (buf);
|
add_temp_file (buf);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue