|
Lines 135-148
static uint32_t vfswrap_fs_capabilities(struct vfs_handle_struct *handle,
Link Here
|
| 135 |
* See what filetime set primitives we have. |
135 |
* See what filetime set primitives we have. |
| 136 |
*/ |
136 |
*/ |
| 137 |
#if defined(HAVE_UTIMENSAT) |
137 |
#if defined(HAVE_UTIMENSAT) |
|
|
138 |
struct timespec ts[2]; |
| 139 |
ts[0].tv_sec = 0; |
| 140 |
ts[0].tv_nsec = UTIME_OMIT; |
| 141 |
ts[1] = ts[0]; |
| 142 |
if (!(utimensat(AT_FDCWD, "/", ts, AT_SYMLINK_NOFOLLOW) == -1 && errno == ENOSYS)) { |
| 138 |
*p_ts_res = TIMESTAMP_SET_NT_OR_BETTER; |
143 |
*p_ts_res = TIMESTAMP_SET_NT_OR_BETTER; |
| 139 |
#elif defined(HAVE_UTIMES) |
144 |
} else { |
|
|
145 |
DEBUG(0,("vfswrap_fs_capabilities: utimensat returns ENOSYS. " |
| 146 |
"never us a glibc which is much more recent than your kernel.\n")); |
| 147 |
#else |
| 148 |
{ |
| 149 |
#endif |
| 150 |
#if defined(HAVE_UTIMES) |
| 140 |
/* utimes allows msec timestamps to be set. */ |
151 |
/* utimes allows msec timestamps to be set. */ |
| 141 |
*p_ts_res = TIMESTAMP_SET_MSEC; |
152 |
*p_ts_res = TIMESTAMP_SET_MSEC; |
| 142 |
#elif defined(HAVE_UTIME) |
153 |
#elif defined(HAVE_UTIME) |
| 143 |
/* utime only allows sec timestamps to be set. */ |
154 |
/* utime only allows sec timestamps to be set. */ |
| 144 |
*p_ts_res = TIMESTAMP_SET_SECONDS; |
155 |
*p_ts_res = TIMESTAMP_SET_SECONDS; |
| 145 |
#endif |
156 |
#endif |
|
|
157 |
} |
| 146 |
|
158 |
|
| 147 |
DEBUG(10,("vfswrap_fs_capabilities: timestamp " |
159 |
DEBUG(10,("vfswrap_fs_capabilities: timestamp " |
| 148 |
"resolution of %s " |
160 |
"resolution of %s " |
|
Lines 541-554
static int copy_reg(const char *source, const char *dest)
Link Here
|
| 541 |
|
553 |
|
| 542 |
/* Try to copy the old file's modtime and access time. */ |
554 |
/* Try to copy the old file's modtime and access time. */ |
| 543 |
#if defined(HAVE_UTIMENSAT) |
555 |
#if defined(HAVE_UTIMENSAT) |
|
|
556 |
int result; |
| 544 |
{ |
557 |
{ |
| 545 |
struct timespec ts[2]; |
558 |
struct timespec ts[2]; |
| 546 |
|
559 |
|
| 547 |
ts[0] = source_stats.st_ex_atime; |
560 |
ts[0] = source_stats.st_ex_atime; |
| 548 |
ts[1] = source_stats.st_ex_mtime; |
561 |
ts[1] = source_stats.st_ex_mtime; |
|
|
562 |
result = |
| 549 |
utimensat(AT_FDCWD, dest, ts, AT_SYMLINK_NOFOLLOW); |
563 |
utimensat(AT_FDCWD, dest, ts, AT_SYMLINK_NOFOLLOW); |
| 550 |
} |
564 |
} |
| 551 |
#elif defined(HAVE_UTIMES) |
565 |
if (result == -1 && errno == ENOSYS) /* try other methods if utimensat is not supported */ |
|
|
566 |
#endif |
| 567 |
#if defined(HAVE_UTIMES) |
| 552 |
{ |
568 |
{ |
| 553 |
struct timeval tv[2]; |
569 |
struct timeval tv[2]; |
| 554 |
|
570 |
|
|
Lines 568-573
static int copy_reg(const char *source, const char *dest)
Link Here
|
| 568 |
tv.modtime = convert_timespec_to_time_t(source_stats.st_ex_mtime); |
584 |
tv.modtime = convert_timespec_to_time_t(source_stats.st_ex_mtime); |
| 569 |
utime(dest, &tv); |
585 |
utime(dest, &tv); |
| 570 |
} |
586 |
} |
|
|
587 |
#else |
| 588 |
{} |
| 571 |
#endif |
589 |
#endif |
| 572 |
|
590 |
|
| 573 |
if (unlink (source) == -1) |
591 |
if (unlink (source) == -1) |
|
Lines 898-904
static int vfswrap_ntimes(vfs_handle_struct *handle,
Link Here
|
| 898 |
} else { |
916 |
} else { |
| 899 |
result = utimensat(AT_FDCWD, smb_fname->base_name, NULL, 0); |
917 |
result = utimensat(AT_FDCWD, smb_fname->base_name, NULL, 0); |
| 900 |
} |
918 |
} |
| 901 |
#elif defined(HAVE_UTIMES) |
919 |
if (result == -1 && errno == ENOSYS) /* try other methods if utimensat is not supported */ |
|
|
920 |
#endif |
| 921 |
{ |
| 922 |
#if defined(HAVE_UTIMES) |
| 902 |
if (ft != NULL) { |
923 |
if (ft != NULL) { |
| 903 |
struct timeval tv[2]; |
924 |
struct timeval tv[2]; |
| 904 |
tv[0] = convert_timespec_to_timeval(ft->atime); |
925 |
tv[0] = convert_timespec_to_timeval(ft->atime); |
|
Lines 920-925
static int vfswrap_ntimes(vfs_handle_struct *handle,
Link Here
|
| 920 |
errno = ENOSYS; |
941 |
errno = ENOSYS; |
| 921 |
result = -1; |
942 |
result = -1; |
| 922 |
#endif |
943 |
#endif |
|
|
944 |
} |
| 923 |
|
945 |
|
| 924 |
out: |
946 |
out: |
| 925 |
END_PROFILE(syscall_ntimes); |
947 |
END_PROFILE(syscall_ntimes); |
| 926 |
- |
|
|