projects
/
debian
/
amanda
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Imported Upstream version 3.3.1
[debian/amanda]
/
perl
/
Amanda
/
Util.pm
diff --git
a/perl/Amanda/Util.pm
b/perl/Amanda/Util.pm
index 0a9f143aa37e0bc01b9bf7d677a9b86405b6f220..1443cb5307bcda39c1214a70d1339b133335c7da 100644
(file)
--- a/
perl/Amanda/Util.pm
+++ b/
perl/Amanda/Util.pm
@@
-1,5
+1,5
@@
# This file was automatically generated by SWIG (http://www.swig.org).
# 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.
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
@@
-67,6
+67,10
@@
package Amanda::Util;
*stream_server = *Amanda::Utilc::stream_server;
*stream_accept = *Amanda::Utilc::stream_accept;
*check_security = *Amanda::Utilc::check_security;
*stream_server = *Amanda::Utilc::stream_server;
*stream_accept = *Amanda::Utilc::stream_accept;
*check_security = *Amanda::Utilc::check_security;
+*match_host = *Amanda::Utilc::match_host;
+*match_disk = *Amanda::Utilc::match_disk;
+*match_datestamp = *Amanda::Utilc::match_datestamp;
+*match_level = *Amanda::Utilc::match_level;
*set_pname = *Amanda::Utilc::set_pname;
*get_pname = *Amanda::Utilc::get_pname;
*set_ptype = *Amanda::Utilc::set_ptype;
*set_pname = *Amanda::Utilc::set_pname;
*get_pname = *Amanda::Utilc::get_pname;
*set_ptype = *Amanda::Utilc::set_ptype;
@@
-90,7
+94,10
@@
sub new {
}
*lock = *Amanda::Utilc::file_lock_lock;
}
*lock = *Amanda::Utilc::file_lock_lock;
+*lock_wr = *Amanda::Utilc::file_lock_lock_wr;
+*lock_rd = *Amanda::Utilc::file_lock_lock_rd;
*unlock = *Amanda::Utilc::file_lock_unlock;
*unlock = *Amanda::Utilc::file_lock_unlock;
+*locked = *Amanda::Utilc::file_lock_locked;
*write = *Amanda::Utilc::file_lock_write;
*data = *Amanda::Utilc::file_lock_data;
sub DESTROY {
*write = *Amanda::Utilc::file_lock_write;
*data = *Amanda::Utilc::file_lock_data;
sub DESTROY {
@@
-281,7
+288,7
@@
bytes it read from the file descriptor.
Return a "safe" environment hash. For non-setuid programs, this means
filtering out any localization variables.
Return a "safe" environment hash. For non-setuid programs, this means
filtering out any localization variables.
-=item get_fs_usage(file
, disk
)
+=item get_fs_usage(file)
This is a wrapper around the Gnulib function of the same name. On success, it returns
a hash with keys:
This is a wrapper around the Gnulib function of the same name. On success, it returns
a hash with keys:
@@
-501,11
+508,17
@@
filename to lock:
my $fl = Amanda::Util::file_lock->new($filename)
my $fl = Amanda::Util::file_lock->new($filename)
-then, lock the file:
+then,
three ways to
lock the file:
- $fl->lock();
+ $fl->lock_wr(); # take a write lock (exclusive)
+ $fl->lock_rd(); # take a read lock
+ $fl->lock(); # take a write lock and reads the contents of
+ # the file into memory.
-which also reads the contents of the file into memory, accessible via
+they return -1 on failure, 0 if the lock is taken or 1 if the lock in not
+taken (you can retry later).
+
+to access the data in memory
my $state = $fl->data();
my $state = $fl->data();
@@
-533,7
+546,17
@@
function always completely overwrites the file.
burp $filename, $header;
These functions can (and should) be exported to the main namespace
burp $filename, $header;
These functions can (and should) be exported to the main namespace
-
+
+=head1 MATCHING
+
+The following functions are available to match strings against patterns using
+the rules described in amanda(8):
+
+ match_host($pat, $str);
+ match_disk($pat, $str);
+ match_datestamp($pat, $str);
+ match_level($pat, $str);
+
=cut
=cut
@@
-946,6
+969,8
@@
sub unmarshal_tapespec {
}
}
+push @EXPORT_OK, qw(match_host match_disk match_datestamp match_level);
+
sub check_std_fds {
fcntl(STDIN, F_GETFD, 0) or critical("Standard input is not open");
fcntl(STDOUT, F_GETFD, 0) or critical("Standard output is not open");
sub check_std_fds {
fcntl(STDIN, F_GETFD, 0) or critical("Standard input is not open");
fcntl(STDOUT, F_GETFD, 0) or critical("Standard output is not open");