diff --git a/pmirror/pmirror b/pmirror/pmirror index 0efa5c2..7bb8b3a 100755 --- a/pmirror/pmirror +++ b/pmirror/pmirror @@ -155,7 +155,7 @@ use Getopt::Long; use Sys::Hostname; use IO::File; use IO::Socket::INET; -use Fcntl ':mode'; +use Fcntl qw(:mode O_NOATIME); import My::Escaper; use Time::HiRes; @@ -172,7 +172,8 @@ our ($debug,$quiet,$fileop_noop,$fileop_debug,$delete); our ($slave_mode,$local_slave,$slave_unprivileged, $lockident,$safety,$identity_file,$mkdir_slave, $reduce,$force_status,$bandwidth,$allowremotefs, - $ssh_opt , $cksum , $nice , $unix_socket, $unix_socket_name); + $ssh_opt , $cksum , $nice , $unix_socket, $unix_socket_name, + $noatime); # globals @@ -466,7 +467,7 @@ sub send_file my $data_buf; my $len; - my $fh=IO::File->new($filename,O_RDONLY); + my $fh=IO::File->new($filename, O_RDONLY + ($noatime ? O_NOATIME : 0) ); unless (defined $fh) { # one reason to get here is that the file was deleted after it has been offered to # and requested by the client. @@ -1047,6 +1048,7 @@ usage: $0 [options] path [node:]path --nice EXPERIMENTAL nice --unix-socket EXPERIMENTAL establish data channel over ssh via AF unix sockets --socket-name PATH EXPERIMENTAL use PATH as name for AF unix sockets + --noatime don't touch atime on sender __EOF__ @@ -1075,6 +1077,7 @@ use constant OPTIONS => ( 'nice' => \$nice, 'unix-socket' => \$unix_socket, 'socket-name=s' => \$unix_socket_name, + 'noatime' => \$noatime, ); if ($ENV{SSH_ORIGINAL_COMMAND}) { @@ -1082,6 +1085,9 @@ if ($ENV{SSH_ORIGINAL_COMMAND}) { } GetOptions(OPTIONS) or die USAGE; +if ($noatime && $cksum) { + die "$0: --cksum together with --noatime not implemented\n"; +} if ($nice) { system "ionice -c idle -p $$ 2>/dev/null"