diff --git a/options.c b/options.c index 6ee3e01..8a42823 100644 --- a/options.c +++ b/options.c @@ -125,6 +125,7 @@ long block_size = 0; /* "long" because popt can't set an int32. */ char number_separator; char *skip_compress = NULL; item_list dparam_list = EMPTY_ITEM_LIST; +int noatime = 0; /** Network address family. **/ int default_af_hint @@ -783,6 +784,7 @@ void usage(enum logcode F) #ifdef ICONV_OPTION rprintf(F," --iconv=CONVERT_SPEC request charset conversion of filenames\n"); #endif + rprintf(F," --noatime do not alter atime when opening source files\n"); rprintf(F," -4, --ipv4 prefer IPv4\n"); rprintf(F," -6, --ipv6 prefer IPv6\n"); rprintf(F," --version print version number\n"); @@ -996,6 +998,7 @@ static struct poptOption long_options[] = { {"iconv", 0, POPT_ARG_STRING, &iconv_opt, 0, 0, 0 }, {"no-iconv", 0, POPT_ARG_NONE, 0, OPT_NO_ICONV, 0, 0 }, #endif + {"noatime", 0, POPT_ARG_VAL, &noatime, 1, 0, 0 }, {"ipv4", '4', POPT_ARG_VAL, &default_af_hint, AF_INET, 0, 0 }, {"ipv6", '6', POPT_ARG_VAL, &default_af_hint, AF_INET6, 0, 0 }, {"8-bit-output", '8', POPT_ARG_VAL, &allow_8bit_chars, 1, 0, 0 }, @@ -2661,6 +2664,9 @@ void server_options(char **args, int *argc_p) else if (remove_source_files) args[ac++] = "--remove-sent-files"; + if (noatime) + args[ac++] = "--noatime"; + if (ac > MAX_SERVER_ARGS) { /* Not possible... */ rprintf(FERROR, "argc overflow in server_options().\n"); exit_cleanup(RERR_MALLOC); diff --git a/rsync.yo b/rsync.yo index 2016272..e6e16f7 100644 --- a/rsync.yo +++ b/rsync.yo @@ -437,6 +437,7 @@ to the detailed description below for a complete description. verb( --protocol=NUM force an older protocol version to be used --iconv=CONVERT_SPEC request charset conversion of filenames --checksum-seed=NUM set block/file checksum seed (advanced) + --noatime do not alter atime when opening source files -4, --ipv4 prefer IPv4 -6, --ipv6 prefer IPv6 --version print version number @@ -2377,6 +2378,16 @@ daemon uses the charset specified in its "charset" configuration parameter regardless of the remote charset you actually pass. Thus, you may feel free to specify just the local charset for a daemon transfer (e.g. bf(--iconv=utf8)). +dit(bf(--noatime)) Use the O_NOATIME open flag on systems that support it. +The effect of this flag is to avoid altering the access time (atime) of the +opened files. + +If the system does not support the O_NOATIME flag, this option does nothing +but is sent to the remote host, which may support it. + +Currently, systems known to support O_NOATIME are Linux >= 2.6.8 with glibc +>= 2.3.4. + dit(bf(-4, --ipv4) or bf(-6, --ipv6)) Tells rsync to prefer IPv4/IPv6 when creating sockets. This only affects sockets that rsync has direct control over, such as the outgoing socket when directly contacting an diff --git a/syscall.c b/syscall.c index aba0009..d437991 100644 --- a/syscall.c +++ b/syscall.c @@ -36,6 +36,7 @@ extern int read_only; extern int list_only; extern int preserve_perms; extern int preserve_executability; +extern int noatime; #define RETURN_ERROR_IF(x,e) \ do { \ @@ -185,6 +186,10 @@ int do_open(const char *pathname, int flags, mode_t mode) RETURN_ERROR_IF(dry_run, 0); RETURN_ERROR_IF_RO_OR_LO; } +#ifdef O_NOATIME + if (noatime) + flags |= O_NOATIME; +#endif return open(pathname, flags | O_BINARY, mode); }