[PATCH] Use syscall() for some platforms like Android without futimes() function
Rafael EspĂndola
rafael.espindola at gmail.com
Fri Apr 11 09:07:52 PDT 2014
Why? setLastModificationAndAccessTime is only used by llvm-ar, are you
using that on Android?
On 6 April 2014 10:43, waxiadao at gmail.com <waxiadao at gmail.com> wrote:
> A very simple patch...It's tested and works fine.
>
> Index: autoconf/configure.ac
> ===================================================================
> --- autoconf/configure.ac (revision 205687)
> +++ autoconf/configure.ac (working copy)
> @@ -1723,6 +1723,7 @@
> AC_CHECK_HEADERS([dlfcn.h execinfo.h fcntl.h inttypes.h link.h])
> AC_CHECK_HEADERS([malloc.h setjmp.h signal.h stdint.h termios.h unistd.h])
> AC_CHECK_HEADERS([utime.h])
> +AC_CHECK_HEADERS([sys/syscall.h])
> AC_CHECK_HEADERS([sys/mman.h sys/param.h sys/resource.h sys/time.h sys/uio.h])
> AC_CHECK_HEADERS([sys/ioctl.h malloc/malloc.h mach/mach.h])
> AC_CHECK_HEADERS([valgrind/valgrind.h])
> @@ -1804,6 +1805,7 @@
> AC_CHECK_FUNCS([strtoll strtoq sysconf malloc_zone_statistics ])
> AC_CHECK_FUNCS([setjmp longjmp sigsetjmp siglongjmp writev])
> AC_CHECK_FUNCS([futimes futimens])
> +AC_CHECK_FUNCS([syscall])
> AC_C_PRINTF_A
> AC_FUNC_RAND48
>
> Index: lib/Support/Unix/Path.inc
> ===================================================================
> --- lib/Support/Unix/Path.inc (revision 205687)
> +++ lib/Support/Unix/Path.inc (working copy)
> @@ -43,6 +43,9 @@
> # if HAVE_NDIR_H
> # include <ndir.h>
> # endif
> +# if HAVE_SYS_SYSCALL_H
> +# include <sys/syscall.h>
> +# endif
> #endif
>
> #ifdef __APPLE__
> @@ -464,6 +467,14 @@
> if (::futimes(FD, Times))
> return error_code(errno, system_category());
> return error_code::success();
> +#elif defined(HAVE_SYSCALL)
> + timeval Times[2];
> + Times[0].tv_sec = Time.toEpochTime();
> + Times[0].tv_usec = 0;
> + Times[1] = Times[0];
> + if (::syscall(__NR_utimensat, FD, 0, Times, 0))
> + return error_code(errno, system_category());
> + return error_code::success();
> #else
> #warning Missing futimes() and futimens()
> return make_error_code(errc::not_supported);
>
> _______________________________________________
> 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