X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=perl%2FAmanda%2FXfer.pm;h=2b8c3ff5a35be936cd48775625a39af20cd8e889;hb=c6f0a88c567f8536c498f554285aed1f8150da18;hp=724e618ca3cc2470088cdc6263b92d6d6c3f852e;hpb=b116e9366c7b2ea2c2eb53b0a13df4090e176235;p=debian%2Famanda diff --git a/perl/Amanda/Xfer.pm b/perl/Amanda/Xfer.pm index 724e618..2b8c3ff 100644 --- a/perl/Amanda/Xfer.pm +++ b/perl/Amanda/Xfer.pm @@ -1,5 +1,5 @@ # This file was automatically generated by SWIG (http://www.swig.org). -# Version 1.3.39 +# Version 2.0.4 # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. @@ -68,6 +68,7 @@ package Amanda::Xfer; *xfer_source_directtcp_connect = *Amanda::Xferc::xfer_source_directtcp_connect; *xfer_filter_xor = *Amanda::Xferc::xfer_filter_xor; *xfer_filter_process = *Amanda::Xferc::xfer_filter_process; +*get_err_fd = *Amanda::Xferc::get_err_fd; *xfer_dest_null = *Amanda::Xferc::xfer_dest_null; *xfer_dest_buffer = *Amanda::Xferc::xfer_dest_buffer; *xfer_dest_buffer_get = *Amanda::Xferc::xfer_dest_buffer_get; @@ -118,7 +119,7 @@ Amanda::Xfer - the transfer architecture if ($msg->{'type'} == $XMSG_DONE) { Amanda::MainLoop::quit(); } - }); + }, 0, 0); Amanda::MainLoop::run(); See L for background on the @@ -134,9 +135,12 @@ The resulting object has the following methods: =over -=item start($cb) +=item start($cb, $offset, $size) -Start this transfer. Processing takes place asynchronously, and messages will +Start this transfer. It transfer $size bytes starting from offset $offset. +$offset must be 0. $size is only supported by Amanda::Xfer::Source::Recovery. +A size of 0 transfer everything to EOF. +Processing takes place asynchronously, and messages will begin queueing up immediately. If C<$cb> is given, then it is installed as the callback for messages from this transfer. The callback receives three arguments: the event source, the message, and a reference to the controlling @@ -304,15 +308,18 @@ C<$addrs> and reads the transfer data from the connection. =head3 Amanda::Xfer::Filter:Process - Amanda::Xfer::Filter::Process->new([@args], $need_root, $log_stderr); + $xfp = Amanda::Xfer::Filter::Process->new([@args], $need_root); This filter will pipe data through the standard file descriptors of the subprocess specified by C<@args>. If C<$need_root> is true, it will attempt to -change to uid 0 before executing the process. Standard output from the process -is redirected to the debug log. Note that the process is invoked directly, not -via a shell, so shell metacharcters (e.g., C<< 2>&1 >>) will not function as -expected. If C<$log_stderr> is set, then the filter's standard error is sent -to the debug log; otherwise, it is sent to the parent process's stderr. +change to uid 0 before executing the process. Note that the process is +invoked directly, not via a shell, so shell metacharcters (e.g., C<< 2>&1 >>) +will not function as expected. This method create a pipe for the process +stderr and the caller must read it or a hang may occur. + + $xfp->get_stderr_fd() + +Return the file descriptor of the stderr pipe to read from. =head3 Amanda::Xfer::Filter:Xor @@ -639,7 +646,7 @@ $_xmsg_type_VALUES{"XMSG_READY"} = $XMSG_READY; push @{$EXPORT_TAGS{"constants"}}, @{$EXPORT_TAGS{"xmsg_type"}}; sub xfer_start_with_callback { - my ($xfer, $cb) = @_; + my ($xfer, $cb, $offset, $size) = @_; if (defined $cb) { my $releasing_cb = sub { my ($src, $msg, $xfer) = @_; @@ -650,7 +657,9 @@ sub xfer_start_with_callback { }; $xfer->get_source()->set_callback($releasing_cb); } - xfer_start($xfer); + $offset = 0 if !defined $offset; + $size = 0 if !defined $size; + xfer_start($xfer, $offset, $size); } sub xfer_set_callback { @@ -789,6 +798,7 @@ sub new { Amanda::Xfer::xfer_filter_process(@_); } +*get_stderr_fd = *Amanda::Xfer::get_err_fd; package Amanda::Xfer::Dest::Fd;