Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

sunos: implement uv_fs_futime()

  • Loading branch information...
bnoordhuis committed Oct 12, 2011
1 parent 014394d commit 721ad8c74f5d1d7d83fd5bfcabd322812b48eb8c
Showing with 12 additions and 8 deletions.
  1. +1 −1 src/unix/eio/config_sunos.h
  2. +4 −0 src/unix/eio/eio.c
  3. +6 −2 src/unix/fs.c
  4. +1 −5 src/unix/internal.h
@@ -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
@@ -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>
@@ -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);
@@ -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

0 comments on commit 721ad8c

Please sign in to comment.
You can’t perform that action at this time.