view m4/utimens.m4 @ 12158:899dd13e9f8b

utimens: add lutimens interface Wraps utimensat(,AT_SYMLINK_NOFOLLOW) or lutimes, when supported; otherwise fail with ENOSYS. Allows coreutils' copy.c to preserve symlink timestamps on more systems. Note that cygwin's lstat changes atime of symlinks, but mtime can reliably be set. * lib/utimens.c (lutimens): New function. * m4/utimens.m4 (gl_UTIMENS): Check for lutimes. * lib/utimens.h (lutimens): Declare new interface. * tests/test-utimens.c (main): Enhance test. * tests/test-lutimens.h (test_lutimens): New file. * modules/utimens-tests (Files): Distribute it. (Depends-on): Add symlink. (configure.ac): Check for usleep. Signed-off-by: Eric Blake <ebb9@byu.net>
author Eric Blake <ebb9@byu.net>
date Wed, 07 Oct 2009 13:36:45 -0600
parents bbccff5988c3
children 407921985bc0
line wrap: on
line source

dnl Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free
dnl Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.

dnl serial 3

AC_DEFUN([gl_UTIMENS],
[
  AC_LIBOBJ([utimens])

  dnl Prerequisites of lib/utimens.c.
  AC_REQUIRE([gl_FUNC_UTIMES])
  AC_REQUIRE([gl_CHECK_TYPE_STRUCT_TIMESPEC])
  AC_REQUIRE([gl_CHECK_TYPE_STRUCT_UTIMBUF])
  AC_CHECK_FUNCS_ONCE([futimes futimesat futimens utimensat lutimes])
])