|
@ -25,6 +25,8 @@ |
|
|
#include <sys/stat.h>
|
|
|
#include <sys/stat.h>
|
|
|
#include <sys/time.h>
|
|
|
#include <sys/time.h>
|
|
|
|
|
|
|
|
|
|
|
|
#include "fs_base_stat.hpp"
|
|
|
|
|
|
|
|
|
#ifndef UTIME_NOW
|
|
|
#ifndef UTIME_NOW
|
|
|
# define UTIME_NOW ((1l << 30) - 1l)
|
|
|
# define UTIME_NOW ((1l << 30) - 1l)
|
|
|
#endif
|
|
|
#endif
|
|
@ -123,6 +125,8 @@ _set_utime_omit_to_current_value(const int dirfd, |
|
|
{ |
|
|
{ |
|
|
int rv; |
|
|
int rv; |
|
|
struct stat st; |
|
|
struct stat st; |
|
|
|
|
|
timespec *atime; |
|
|
|
|
|
timespec *mtime; |
|
|
|
|
|
|
|
|
if(!_any_timespec_is_utime_omit(ts)) |
|
|
if(!_any_timespec_is_utime_omit(ts)) |
|
|
return 0; |
|
|
return 0; |
|
@ -131,10 +135,13 @@ _set_utime_omit_to_current_value(const int dirfd, |
|
|
if(rv == -1) |
|
|
if(rv == -1) |
|
|
return -1; |
|
|
return -1; |
|
|
|
|
|
|
|
|
|
|
|
atime = fs::stat_atime(st); |
|
|
|
|
|
mtime = fs::stat_mtime(st); |
|
|
|
|
|
|
|
|
if(ts[0].tv_nsec == UTIME_OMIT) |
|
|
if(ts[0].tv_nsec == UTIME_OMIT) |
|
|
TIMESPEC_TO_TIMEVAL(&tv[0],&st.st_atim); |
|
|
|
|
|
|
|
|
TIMESPEC_TO_TIMEVAL(&tv[0],atime); |
|
|
if(ts[1].tv_nsec == UTIME_OMIT) |
|
|
if(ts[1].tv_nsec == UTIME_OMIT) |
|
|
TIMESPEC_TO_TIMEVAL(&tv[1],&st.st_mtim); |
|
|
|
|
|
|
|
|
TIMESPEC_TO_TIMEVAL(&tv[1],mtime); |
|
|
|
|
|
|
|
|
return 0; |
|
|
return 0; |
|
|
} |
|
|
} |
|
@ -148,6 +155,8 @@ _set_utime_omit_to_current_value(const int fd, |
|
|
{ |
|
|
{ |
|
|
int rv; |
|
|
int rv; |
|
|
struct stat st; |
|
|
struct stat st; |
|
|
|
|
|
timespec *atime; |
|
|
|
|
|
timespec *mtime; |
|
|
|
|
|
|
|
|
if(!_any_timespec_is_utime_omit(ts)) |
|
|
if(!_any_timespec_is_utime_omit(ts)) |
|
|
return 0; |
|
|
return 0; |
|
@ -156,10 +165,13 @@ _set_utime_omit_to_current_value(const int fd, |
|
|
if(rv == -1) |
|
|
if(rv == -1) |
|
|
return -1; |
|
|
return -1; |
|
|
|
|
|
|
|
|
|
|
|
atime = fs::stat_atime(st); |
|
|
|
|
|
mtime = fs::stat_mtime(st); |
|
|
|
|
|
|
|
|
if(ts[0].tv_nsec == UTIME_OMIT) |
|
|
if(ts[0].tv_nsec == UTIME_OMIT) |
|
|
TIMESPEC_TO_TIMEVAL(&tv[0],&st.st_atim); |
|
|
|
|
|
|
|
|
TIMESPEC_TO_TIMEVAL(&tv[0],atime; |
|
|
if(ts[1].tv_nsec == UTIME_OMIT) |
|
|
if(ts[1].tv_nsec == UTIME_OMIT) |
|
|
TIMESPEC_TO_TIMEVAL(&tv[1],&st.st_mtim); |
|
|
|
|
|
|
|
|
TIMESPEC_TO_TIMEVAL(&tv[1],mtime); |
|
|
|
|
|
|
|
|
return 0; |
|
|
return 0; |
|
|
} |
|
|
} |
|
|