[PATCH] Bug 16442 - Missing futimes() on Solaris

David Majnemer david.majnemer at gmail.com
Mon Jul 1 13:53:02 PDT 2013


LGTM

Sent from my iPhone

On Jul 1, 2013, at 1:48 PM, Игорь Пашев <pashev.igor at gmail.com> wrote:

> http://llvm.org/bugs/show_bug.cgi?id=16442
> 
> Solaris does not provide futimes(), OS X does not have futimens().
> futimens() is POSIX.1-2008 standard, futimes() is a BSD extension.
> glibc-based systems have both, illumos has futimens().
> 
> autotools files should be regenerated.
> 
> 
> 
> Index: lib/Support/Unix/PathV2.inc
> ===================================================================
> --- lib/Support/Unix/PathV2.inc (revision 184862)
> +++ lib/Support/Unix/PathV2.inc (working copy)
> @@ -445,11 +445,21 @@
> }
> 
> error_code setLastModificationAndAccessTime(int FD, TimeValue Time) {
> +#if HAVE_FUTIMENS
> +  timespec Times[2];
> +  Times[0].tv_sec = Time.toPosixTime();
> +  Times[0].tv_nsec = 0;
> +  Times[1] = Times[0];
> +  if (::futimens(FD, Times))
> +#elif HAVE_FUTIMES
>   timeval Times[2];
>   Times[0].tv_sec = Time.toPosixTime();
>   Times[0].tv_usec = 0;
>   Times[1] = Times[0];
>   if (::futimes(FD, Times))
> +#else
> +#error Missing futimes() and futimens()
> +#endif
>     return error_code(errno, system_category());
>   return error_code::success();
> }
> Index: cmake/config-ix.cmake
> ===================================================================
> --- cmake/config-ix.cmake       (revision 184862)
> +++ cmake/config-ix.cmake       (working copy)
> @@ -136,6 +136,8 @@
> check_symbol_exists(exp math.h HAVE_EXP)
> check_symbol_exists(exp2 math.h HAVE_EXP2)
> check_symbol_exists(exp10 math.h HAVE_EXP10)
> +check_symbol_exists(futimens sys/stat.h HAVE_FUTIMENS)
> +check_symbol_exists(futimes sys/time.h HAVE_FUTIMES)
> if( HAVE_SETJMP_H )
>   check_symbol_exists(longjmp setjmp.h HAVE_LONGJMP)
>   check_symbol_exists(setjmp setjmp.h HAVE_SETJMP)
> Index: autoconf/configure.ac
> ===================================================================
> --- autoconf/configure.ac       (revision 184862)
> +++ autoconf/configure.ac       (working copy)
> @@ -1612,6 +1612,7 @@
> AC_CHECK_FUNCS([strerror strerror_r setenv arc4random ])
> AC_CHECK_FUNCS([strtoll strtoq sysconf malloc_zone_statistics ])
> AC_CHECK_FUNCS([setjmp longjmp sigsetjmp siglongjmp writev])
> +AC_CHECK_FUNCS([futimes futimens])
> AC_C_PRINTF_A
> AC_FUNC_RAND48
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list