sunos: implement uv_fs_futime()

This commit is contained in:
Ben Noordhuis 2011-10-12 02:05:52 +00:00
parent 014394df3a
commit 721ad8c74f
4 changed files with 12 additions and 8 deletions

View File

@ -11,7 +11,7 @@
#define HAVE_UTIMES 1
/* futimes(2) is available */
/* #undef HAVE_FUTIMES */
#define HAVE_FUTIMES 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1

View File

@ -108,6 +108,10 @@ static void eio_destroy (eio_req *req);
#define EIO_ENOSYS() EIO_ERRNO (ENOSYS, -1)
#ifdef __sun
# define futimes(fd, times) futimesat (fd, NULL, times)
#endif
#ifdef _WIN32
#include <direct.h>

View File

@ -496,7 +496,7 @@ int uv_fs_utime(uv_loop_t* loop, uv_fs_t* req, const char* path, double atime,
}
#if defined(HAVE_FUTIMES)
#if HAVE_FUTIMES
static int _futime(const uv_file file, double atime, double mtime) {
struct timeval tv[2];
@ -507,14 +507,18 @@ static int _futime(const uv_file file, double atime, double mtime) {
tv[1].tv_sec = mtime;
tv[1].tv_usec = (unsigned long)(mtime * 1000000) % 1000000;
#ifdef __sun
return futimesat(file, NULL, tv);
#else
return futimes(file, tv);
#endif
}
#endif
int uv_fs_futime(uv_loop_t* loop, uv_fs_t* req, uv_file file, double atime,
double mtime, uv_fs_cb cb) {
#if defined(HAVE_FUTIMES)
#if HAVE_FUTIMES
const char* path = NULL;
uv_fs_req_init(loop, req, UV_FS_FUTIME, path, cb);

View File

@ -49,11 +49,7 @@
#endif /* __linux__ */
#ifdef __APPLE__
# define HAVE_FUTIMES 1
#endif
#ifdef __FreeBSD__
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun)
# define HAVE_FUTIMES 1
#endif