sunos: implement uv_fs_futime()
This commit is contained in:
parent
014394df3a
commit
721ad8c74f
@ -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
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user