[PATCH] xfstests: add test for ctimes updates in futimens

Eric Sandeen sandeen at sandeen.net
Thu Jan 28 14:59:12 CST 2010


Christoph Hellwig wrote:
> This adds Erik's testcase for the ctime update in futimes that I fixed
> a while ago.
> 
> Erik, can you double check the attribution and licensing for your
> testcase?
> 
> 

> +main(int argc, char **argv)
> +{
> +	int fd = creat ("file", 0600);
> +	struct stat st1, st2;
> +	struct timespec t[2] = { { 1000000000, 0 }, { 0, UTIME_OMIT } };
> +
> +	fstat(fd, &st1);
> +	sleep(1);
> +	futimens(fd, t);
> +	fstat(fd, &st2);
> +
> +	if (st1.st_ctime == st2.st_ctime)
> +		printf("failed to update ctime!\n");
> +	return 0;
> +}

Late on review, but this won't build on older glibc's  :(

need some auto-fu somewhere? was going to put:

+# 
+# Check if we have a working futimens libc call
+# 
+AC_DEFUN([AC_HAVE_FUTIMENS],
+  [ AC_MSG_CHECKING([for futimens ])
+    AC_TRY_COMPILE([
+#define _GNU_SOURCE
+#include <sys/stat.h>
+    ], [
+       struct timespec t[2] = { { 1000000000, 0 }, { 0, UTIME_OMIT } };
+       futimens(0, t);
+    ], have_futimens=yes
+       AC_MSG_RESULT(yes),
+       AC_MSG_RESULT(no))
+    AC_SUBST(have_futimens)
+  ])

into m4/package_libcdev.m4 but the whole file seems unused.

my auto-fu is weaker than it used to be.  Anyone know offhand how to
fix this up?

Thanks,
-Eric




More information about the xfs mailing list