dragonflybsd: fix uv_fs_futime()

This commit is contained in:
Ben Noordhuis 2012-11-20 00:38:24 +01:00
parent 5aa6298099
commit e997dd5981
2 changed files with 5 additions and 18 deletions

View File

@ -119,14 +119,17 @@ static ssize_t uv__fs_futime(uv_fs_t* req) {
ts[1].tv_sec = req->mtime;
ts[1].tv_nsec = (unsigned long)(req->mtime * 1000000) % 1000000 * 1000;
return uv__utimesat(req->file, NULL, ts, 0);
#elif HAVE_FUTIMES
#elif defined(__APPLE__) \
|| defined(__DragonFly__) \
|| defined(__FreeBSD__) \
|| defined(__sun)
struct timeval tv[2];
tv[0].tv_sec = req->atime;
tv[0].tv_usec = (unsigned long)(req->atime * 1000000) % 1000000;
tv[1].tv_sec = req->mtime;
tv[1].tv_usec = (unsigned long)(req->mtime * 1000000) % 1000000;
return futimes(req->file, tv);
#else /* !HAVE_FUTIMES */
#else
errno = ENOSYS;
return -1;
#endif

View File

@ -31,13 +31,10 @@
# define inline __inline
#endif
#undef HAVE_FUTIMES
#undef HAVE_KQUEUE
#undef HAVE_PORTS_FS
#if __linux__
# include "linux/syscalls.h"
# define HAVE_FUTIMES 1 /* emulated with utimesat() */
#endif /* __linux__ */
#if defined(__sun)
@ -46,22 +43,9 @@
# ifdef PORT_SOURCE_FILE
# define HAVE_PORTS_FS 1
# endif
# define HAVE_FUTIMES 1
# define futimes(fd, tv) futimesat(fd, (void*)0, tv)
#endif /* __sun */
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun)
# define HAVE_FUTIMES 1
#endif
/* FIXME exact copy of the #ifdef guard in uv-unix.h */
#if defined(__APPLE__) \
|| defined(__FreeBSD__) \
|| defined(__OpenBSD__) \
|| defined(__NetBSD__)
# define HAVE_KQUEUE 1
#endif
#if defined(__APPLE__) && !TARGET_OS_IPHONE
# include <CoreServices/CoreServices.h>
#endif