xfs
[Top] [All Lists]

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

To: Eric Sandeen <sandeen@xxxxxxxxxxx>
Subject: Re: [PATCH] xfstests: add test for ctimes updates in futimens
From: Eric Blake <ebb9@xxxxxxx>
Date: Tue, 02 Feb 2010 07:02:42 -0700
Cc: Christoph Hellwig <hch@xxxxxxxxxxxxx>, xfs@xxxxxxxxxxx
In-reply-to: <4B61FAA0.8020304@xxxxxxxxxxx>
References: <20100110215227.GA15354@xxxxxxxxxxxxx> <4B61FAA0.8020304@xxxxxxxxxxx>
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666
According to Eric Sandeen on 1/28/2010 1:59 PM:
> 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)
> +  ])

You are missing some m4 quoting, and are using deprecated macros; also,
caching the value speeds up subsequent configure runs.  Furthermore, you
are impinging on the autoconf macro namespace, which is discouraged (what
if autoconf later introduces AC_HAVE_FUTIMENS with different semantics
than your macro?).  Then, since you are only checking for compilation, you
can avoid messing with struct timespec.  AC_SUBST is useful for makefiles,
but AC_DEFINE is useful for preprocessor macros; I'm assuming you wanted
the latter?

So, assuming that you are using xfs_ as your package-specific namespace, I
would write this as:

AC_DEFUN([XFS_HAVE_FUTIMENS], [
  AC_CACHE_CHECK([for futimens], [xfs_cv_have_futimens], [
    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#define _GNU_SOURCE
#include <sys/stat.h>
      ]], [[futimens (0, 0);
      ]])], [xfs_cv_have_futimens=yes], [xfs_cv_have_futimens=no])
    ])
  if test "x$xfs_cv_have_futimens" = xyes; then
    AC_DEFINE([HAVE_FUTIMENS], [1], [Define to 1 if futimens compiles])
  fi
])

-- 
Don't work too hard, make some time for fun as well!

Eric Blake             ebb9@xxxxxxx

<Prev in Thread] Current Thread [Next in Thread>
  • Re: [PATCH] xfstests: add test for ctimes updates in futimens, Eric Blake <=