eio: don't use futimes() on linux
uclibc does not provide the syscall wrapper. Translate it into a direct utimesat syscall if available, else fail with ENOSYS.
This commit is contained in:
parent
e53302fcea
commit
4a5f3bbd51
@ -13,8 +13,8 @@
|
||||
/* utimes(2) is available */
|
||||
#define HAVE_UTIMES 1
|
||||
|
||||
/* futimes(2) is available */
|
||||
#define HAVE_FUTIMES 1
|
||||
/* futimes(2) is available but we make the syscall directly. */
|
||||
#undef HAVE_FUTIMES
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#define HAVE_INTTYPES_H 1
|
||||
@ -56,6 +56,9 @@
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/syscall.h> header file. */
|
||||
#define HAVE_SYS_SYSCALL_H 1
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#define HAVE_UNISTD_H 1
|
||||
|
||||
|
||||
@ -1039,8 +1039,15 @@ eio__utimes (const char *filename, const struct timeval times[2])
|
||||
static int
|
||||
eio__futimes (int fd, const struct timeval tv[2])
|
||||
{
|
||||
#if defined(__linux) && defined(__NR_utimensat)
|
||||
struct timespec ts[2];
|
||||
ts[0].tv_sec = tv[0].tv_sec, ts[0].tv_nsec = tv[0].tv_usec * 1000;
|
||||
ts[1].tv_sec = tv[1].tv_sec, ts[1].tv_nsec = tv[1].tv_usec * 1000;
|
||||
return syscall(__NR_utimensat, fd, NULL, ts, 0);
|
||||
#else
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Loading…
Reference in New Issue
Block a user