xfs
[Top] [All Lists]

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

To: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Subject: Re: [PATCH] xfstests: add test for ctimes updates in futimens
From: Eric Sandeen <sandeen@xxxxxxxxxxx>
Date: Thu, 28 Jan 2010 14:59:12 -0600
Cc: xfs@xxxxxxxxxxx, Eric Blake <ebb9@xxxxxxx>
In-reply-to: <20100110215227.GA15354@xxxxxxxxxxxxx>
References: <20100110215227.GA15354@xxxxxxxxxxxxx>
User-agent: Thunderbird 2.0.0.23 (Macintosh/20090812)
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

<Prev in Thread] Current Thread [Next in Thread>