AFS
view release on metacpan or search on metacpan
This is the README file for the Perl extension module bundle AFS (Version v2.6.4)
DESCRIPTION
The AFS module bundle is a dynamically loadable extension to Perl.
It gives the AFS user and AFS administrator access to many of the
AFS programming APIs, allowing them to make these calls directly from
Perl, rather than processing the output of a command.
WHAT'S NEW?
Version v2.6.4 is just a bug fixing release.
For more details, please see the file named 'CHANGES' which should
have been included in the AFS module distribution.
RESTRICTIONS
This release
examples/v2/bos/create view on Meta::CPAN
#!/usr/local/bin/perl
use blib;
use strict;
use warnings;
use AFS::BOS;
my ($server, $process, $type, $commands, @commands, $notifier, $bos, $ok);
die "Usage: $0 server process type commands [notifier]\n" if $#ARGV < 3;
$server = shift;
$process = shift;
$type = shift;
$commands = shift;
$notifier = shift;
#warn ">$server< >$process< >$type< >$commands< >$notifier< \n";
if (defined $commands and $commands =~ / /) { @commands = split / /, $commands; }
$bos = AFS::BOS->new($server);
$AFS::CODE and print "AFS::CODE = $AFS::CODE\n" and die;
if (@commands) {
if ($notifier) { $ok = $bos->create($process, $type, \@commands, $notifier); }
else { $ok = $bos->create($process, $type, \@commands); }
}
else {
if ($notifier) { $ok = $bos->create($process, $type, $commands, $notifier); }
else { $ok = $bos->create($process, $type, $commands); }
}
if ($AFS::CODE) { print "AFS::CODE = $AFS::CODE\n"; }
else { print "OK = $ok \n"; }
$bos->DESTROY;
pod/v2/afsperl.pod view on Meta::CPAN
=head1 COMPATIBILITY
B<This release does NOT support any features and interfaces from
version 1.>
=head1 DESCRIPTION
The AFS module bundle is a dynamically loadable (where available)
extension to Perl. It gives the AFS user and administrator access to
most of the AFS programming APIs, allowing you to make these calls
directly from Perl, rather than processing the output of a command.
The AFS module bundle is a thin layer above the low-level AFS APIs. When
possible, function names are similar to the actual API names, or to the
AFS command suite names. The ordering of function parameters is not
always the same though.
The AFS module bundle includes the following features:
=over 4
pod/v2/afsperlbos.pod view on Meta::CPAN
$ok = $bos->salvage('/vicepa');
$ok = $bos->setauth('on');
$ok = $bos->setcellname('newcell.example.com');
=head1 DESCRIPTION
This class is used to communicate with a B<AFS Basic Overseer Server>,
which runs on every AFS server machine. It monitors and administers
the other server processes on that machine. It has also methods to
maintain system configuration files.
Before you can submit any tasks to a Basic OverSeer (BOS) Server you
must establish a connection to a BOS Server. This is done by the
constructor method I<new> which returns a BOS object. A BOS object is
essentially a handle to talk to a Basic OverSeer Server on a given
server machine. Such a BOS object is required before any of the other
BOS instance methods can be called.
=head1 COMPATIBILITY
pod/v2/afsperlbos.pod view on Meta::CPAN
Adds the given USER to the list of privileged users in the local
C<UserList> file. USER is either a scalar value or a reference to an
array of names. It calls the AFS system library function
I<BOZO_AddSUser>.
=item B<$ok = $bos-E<gt>create(PROCESS, TYPE, COMMAND [, NOTIFIER]);>
=item B<$ok = $bos-E<gt>create(PROCESS, TYPE, \@COMMAND [, NOTIFIER]);>
Creates a server PROCESS entry in the local C<BosConfig> file on the
server machine, sets the process's status to I<Run> in the
C<BosConfig> file and in memory, and starts the process. TYPE
specifies the process's type. Acceptable values are: 'simple', 'cron',
and 'fs'. COMMAND is either a scalar value or an array reference
containing the commands the BOS Server should run to start the
process. NOTIFIER specifies the complete pathname of a program that
the BOS Server invokes when the process terminates. It calls the AFS
system library function I<BOZO_CreateBnode>.
=item B<$ok = $bos-E<gt>delete(INSTANCE);>
=item B<$ok = $bos-E<gt>delete(\@INSTANCE);>
Deletes the entry INSTANCE from the local C<BosConfig> file. INSTANCE
is either a scalar value or a reference to an array of instance names.
Before using this method, issue the stop method to stop the process
and set its status flag in the BosConfig file to NotRun. The delete
method fails with an error message if a process's status flag is Run.
It calls the AFS system library function I<BOZO_DeleteBnode>.
=item B<$ok = $bos-E<gt>exec(COMMAND);>
Executes the indicated COMMAND on the BOS server machine. It calls
the AFS system library function I<BOZO_Exec>.
=item B<@logfile = $bos-E<gt>getlog(LOGFILE);>
Returns an array with the contents of the specified LOGFILE from the
BOS server. It calls the AFS system library function
I<StartBOZO_GetLog>.
=item B<($GTIME, $BTIME) = $bos-E<gt>getrestart;>
Returns the restart times GTIME and BTIME from the local C<BosConfig>
file. GTIME is the general restart time at which the BOS Server
process automatically restarts itself. BTIME is the binary restart
time at which the BOS Server automatically restarts any process for
which the time stamp on the binary file in the local C</usr/afs/bin>
directory is later than the last restart time for the process. It
calls the AFS system library function I<BOZO_GetRestartTime>.
=item B<$restricted = $bos-E<gt>getrestricted;>
Returns the current I<restricted mode> of the BOS server. Return value
1 means I<restriced mode> enabled, 0 means disabled. This method is
only available under OpenAFS if the AFS system libraries were compiled
with the I<Restricted Mode Option>. It calls the AFS system library
function I<BOZO_GetRestrictedMode>.
pod/v2/afsperlbos.pod view on Meta::CPAN
=item B<$ok = $bos-E<gt>removeuser(USER);>
=item B<$ok = $bos-E<gt>removeuser(\@USER);>
Removes the privileged USER from the local C<UserList> file. USER is
either a scalar value or a reference to an array of users. It calls
the AFS system library function I<BOZO_DeleteSuser>.
=item B<$ok = $bos-E<gt>restart_bos;>
Stops and immediately restarts all AFS server processes, including the
BOS Server. A new BOS Server starts immediately, and it starts a new
instance of each process that is marked with the I<run status flag>.
It calls the AFS system library function I<BOZO_ReBozo>.
=item B<$ok = $bos-E<gt>restart_all;>
Stops and immediately restarts all AFS server processes, except the
BOS Server, that are marked with the I<run status flag>.
It calls the AFS system library function I<BOZO_RestartAll>.
=item B<$ok = $bos-E<gt>restart(SERVER);>
=item B<$ok = $bos-E<gt>restart(\@SERVER);>
Stops and immediately restarts the SERVER processes on the server
machine, regardless of its I<run status flag>. SERVER is either a
scalar value or a reference to an array of server names.
It calls the AFS system library function I<BOZO_Restart>.
=item B<$ok = $bos-E<gt>salvage([PARTITION] ...));>
B<NOT YET RELEASED>
??? The argument list must be completed CORRECTLY !!!
pod/v2/afsperlbos.pod view on Meta::CPAN
are supported: debug, nowrite, force, oktozap, rootfiles, salvagedirs,
blockreads, ListResidencies, SalvageRemote, SalvageArchival,
IgnoreCheck, ForceOnLine, UseRootDirACL, TraceBadLinkCounts,
DontAskFS, LogLevel, rxdebug, Residencies.
Internally, a temporary cron job is created via 'BOZO_CreateBnode>.
=item B<$ok = $bos-E<gt>setauth('on' | 'off');>
Enables ('on') or disables('off') authorization checking for all
server processes on the server machine. It calls the AFS system
library function I<BOZO_SetNoAuthFlag>.
=item B<$ok = $bos-E<gt>setcellname(NAME);>
B<NOT YET RELEASED>
Establishes the cell's NAME and makes the server machine a member of
it. And it records the NAME in the two local files C<ThisCell> and
C<CellServDB>. It calls the AFS system library function
I<BOZO_SetCellName>.
B<Cautions>
Use this method only when installing the cell's first AFS server
machine. The I<AFS Quick Beginnings> documentation explains how to
copy over the C<ThisCell> and C<CellServDB> files from this or another
appropriate machine during installation of additional server machines.
=item B<$ok = $bos-E<gt>setrestart(TIME [, GENERAL [, NEWBINARY]]);>
Sets the restart TIME at which the BOS Server restarts processes. Set
GENERAL to 1 (default 0) to set the restart time of the BOS Server to
TIME. This TIME is once per week. Set NEWBINARY to 1 (default 0) to
set the binary restart time. The TIME is once per day. Only one of
the arguments GENERAL and NEWBINARY can be set. It calls the AFS
system library function I<BOZO_SetRestartTime>.
=item B<$ok = $bos-E<gt>setrestricted(MODE);>
Enables (MODE = 1) or disables (MODE = 0) the I<restricted mode> for
the BOS server which disables certain bosserver functionality. This
method is only available under OpenAFS if the AFS system libraries were
compiled with the I<Restricted Mode Option>. It calls the AFS system
library function I<BOZO_SetRestrictedMode>.
=item B<$ok = $bos-E<gt>shutdown([SERVER, ] [WAIT]);>
=item B<$ok = $bos-E<gt>shutdown([\@SERVER, ] [WAIT]);>
Stops on the server machine either all running server processes,
excluding the BOS server process or the SERVER process. SERVER is
either a scalar value or a reference to an array of process names. It
does not change its status flag in the local C<BosConfig> file but
only in the BOS Server's memory. Set WAIT to 1 (default 0) to delay
the program flow until all processes actually stop. Otherwise the
method returns almost immediately even if all processes are not
stopped. It calls the AFS system library function I<BOZO_WaitAll>.
=item B<$ok = $bos-E<gt>start(SERVER);>
=item B<$ok = $bos-E<gt>start(\@SERVER);>
Sets the I<status flag> for each SERVER process to I<Run> in the local
C<BosConfig> file and in the BOS Server's memory on the server
machine, then starts it. If the SERVER process is already running,
the only effect is to guarantee that the status flag is I<Run>; it
does not restart the process. SERVER is either a scalar value or a
reference to an array of process names. It calls the AFS system
library function I<BOZO_SetStatus>.
=item B<$ok = $bos-E<gt>startup([SERVER]);>
=item B<$ok = $bos-E<gt>startup([\@SERVER]);>
Starts on the server machine either all server processes not currently
running but marked with the I<run status flag> in the local
C<BosConfig> file or the process SERVER even if its status flag in the
C<BosConfig> file is I<NotRun>. SERVER is either a scalar value or a
reference to an array of process names. The I<run status flag> in the
local C<BosConfig> file will not be changed. It calls the AFS system
library function I<BOZO_StartupAll> or I<BOZO_SetTStatus>.
=item B<$STATUS = $bos-E<gt>status([LONG [, SERVER]]);>
=item B<$STATUS = $bos-E<gt>status([LONG [, \@SERVER]]);>
Returns the STATUS of either all server processes listed in the local
C<BosConfig> file or the process SERVER. SERVER is either a scalar
value or a reference to an array of process names. STATUS is a hash
reference containing the current process status. Set LONG to 1
(default 0) to get extended information about the process status. It
calls the AFS system library function I<BOZO_GetStatus>.
You can find an example how to print the entire content of the hash
reference C<$STATUS> in the C<examples/v2/bos> directory.
=item B<$ok = $bos-E<gt>stop(SERVER [, WAIT]);>
=item B<$ok = $bos-E<gt>stop(\@SERVER [, WAIT]);>
Sets the status flag for each SERVER process to I<NotRun> in the local
C<BosConfig> file on the server machine, then stops it. SERVER is
either a scalar value or a reference to an array of process names.
Set WAIT to 1 (default 0) to delay the program flow until all
processes actually stop. Otherwise the method returns almost
immediately even if all processes are not stopped. It calls the AFS
system library function I<>.
=back
=head1 AUTHORS
The code and documentation for this class were contributed by Stanford
Linear Accelerator Center, a department of Stanford University. This
documentation were written by
pod/v2/afsperlpts.pod view on Meta::CPAN
}
print "Convert(nog): ", $pts->id('nog'), "\n";
=head1 DESCRIPTION
This class is used to communicate with the B<AFS Protection Server> in
order to maintain and to administer the Protection Database maintained
by the Protection Server. The Protection Database stores information
about AFS users, client machines, and groups which the File Server
process uses to determine whether clients are authorized to access AFS
data.
This class provides methods to map back and forth between user account
names and their internal numerical AFS identifiers. It also manages
the creation, manipulation, and update of user-defined groups suitable
for use on ACLs. It has methods to query the information held for any
given AFS user or group and to create, modify, and delete the records
in the PDB where the above information is held.
Before you can access any PDB records you must establish a connection
pod/v2/afsperlutils.pod view on Meta::CPAN
print 'Server Version = ', get_server_version('pts', 'ibm-1'), "\n";
my $sysname = sysname;
unlog;
=head1 DESCRIPTION
This module provides several utility functions for the B<AFS module
bundle>. You can retrieve the version number for the underlying AFS
system libraries, for the XS module, and for the AFS server processes.
And it contains several commands that do not belong to any AFS command
suites like creating a new PAG or retrieving and setting the
CPU/operating system type. Any function required must by explicitly
listed by the C<use> statement to be exported into the calling package.
=head1 COMPATIBILITY
B<This release does NOT support any features and interfaces
from version 1.>
pod/v2/afsperlutils.pod view on Meta::CPAN
specifically ask that they be imported.
=over 4
=item B<$version = XSVERSION;>
Reports the version number of the underlying XS file.
=item B<$version = get_server_version(SERVER [, HOST [, VERBOSE]]);>
Reports the version number of the SERVER process running at HOST
(default localhost). If VERBOSE (default 0) is set to 1 some program
trace is printed.
=item B<$version = get_syslib_version;>
Reports the version number of the underlying AFS system library.
=item B<$ok = setpag;>
Creates a new command shell (owned by the issuer of the command) and
associates a new process authentication group (PAG) with the shell and
the user. A PAG is a number guaranteed to identify the issuer of
commands in the new shell uniquely to the local Cache Manager.
=item B<$sysname = sysname([NEWSYSNAME]);>
Reports the CPU/operating system type or sets the CPU/operating system
type to NEWSYSNAME.
=item B<unlog;>
goto &$AUTOLOAD;
}
END {
AFS::_finalize();
}
bootstrap AFS;
# Preloaded methods go here. Autoload methods go after __END__, and are
# processed by the autosplit program.
1;
__END__
break;
case VOLSERNOVOL:
sprintf(buffer,
"VOLSER: no such volume - location specified incorrectly or volume does not exist\n");
break;
case VOLSERMULTIRWVOL:
sprintf(buffer,
"VOLSER: multiple RW volumes with same ID, one of which should be deleted\n");
break;
case VOLSERFAILEDOP:
sprintf(buffer, "VOLSER: not all entries were successfully processed\n");
break;
default:
sprintf(buffer, "Unknown ERROR code\n");
break;
}
return 0;
}
#ifdef AFS_PTHREAD_ENV
void IOMGR_Sleep (seconds)
}
rx_initialized = 1;
}
rx_SetRxDeadTime(deadtime);
if (sauth) { /* -localauth */
tdir = afsconf_Open(AFSDIR_SERVER_ETC_DIRPATH);
if (!tdir) {
char buffer[256];
sprintf(buffer,
"%s: Could not process files in configuration directory (%s).\n",
funcName, AFSDIR_SERVER_ETC_DIRPATH);
code = -1;
VSETCODE(code, buffer);
return (code);
}
code = afsconf_ClientAuth(tdir, &sc, &scIndex); /* sets sc,scIndex */
if (code) {
afsconf_Close(tdir);
char buffer[256];
sprintf(buffer,
funcName, cellName, AFSDIR_SERVER_ETC_DIRPATH,
AFSDIR_CELLSERVDB_FILE);
VSETCODE(code, buffer);
return (code);
}
} else { /* not -localauth */
tdir = afsconf_Open(confDir);
if (!tdir) {
char buffer[256];
sprintf(buffer,
"%s: Could not process files in configuration directory (%s).\n",
funcName, confDir);
code = -1;
VSETCODE(code, buffer);
return (code);
}
if (!cellName) {
code = afsconf_GetLocalCell(tdir, cellstr, sizeof(cellstr));
if (code) {
char buffer[256];
Zero(&arrayEntries, 1, nbulkentries); /* initialize to hint the stub to alloc space */
vcode = VLDB_ListAttributes(&attributes, &nentries, &arrayEntries);
if (vcode) {
VSETCODE(vcode, "Could not access the VLDB for attributes");
XSRETURN_UNDEF;
}
/* a bunch of output generation code deleted. A.W. */
/* printf("vos-backupsys DEBUG-13\n"); */
for (j = 0; j < nentries; j++) { /* process each vldb entry */
vllist = &arrayEntries.nbulkentries_val[j];
/* printf("vos-backupsys DEBUG-13-1 Name %s\n", vllist->name); */
if (seenprefix) {
av = (AV *) SvRV(seenprefix);
len = av_len(av);
/* printf("vos-backupsys DEBUG-14 Len %d\n", len); */
for (i = 0; i <= len; i++) {
regex = *av_fetch(av, i, 0);
itp = SvPV_nolen(regex);
code = UV_BackupVolume(aserver1, apart1, avolid);
if (code) {
av_push(av2, newSVpv(vllist->name, strlen(vllist->name)));
fprintf(STDOUT, "Could not backup %s\n", vllist->name);
totalFail++;
}
else {
av_push(av1, newSVpv(vllist->name, strlen(vllist->name)));
totalBack++;
}
} /* process each vldb entry */
/* printf("vos-backupsys DEBUG-22: Succ %d Fail %d\n", totalBack, totalFail); */
if (arrayEntries.nbulkentries_val)
free(arrayEntries.nbulkentries_val);
SETCODE(0);
XPUSHs(sv_2mortal(newRV_inc((SV *) (av1))));
XPUSHs(sv_2mortal(newRV_inc((SV *) (av2))));
XSRETURN(2);
}
if (vcode) {
char buffer[256];
sprintf(buffer, "Could not access the VLDB for attributes\n");
VSETCODE(vcode, buffer);
XSRETURN_UNDEF;
}
nentries += centries;
/* We don't sort, so just print the entries now */
/* printf("DEBUG-17 \n"); */
for (j = 0; j < centries; j++) { /* process each entry */
/* printf("DEBUG-18 \n"); */
vllist = &arrayEntries.nbulkentries_val[j];
MapHostToNetwork(vllist);
stats = newHV();
myEnumerateEntry(stats, vllist);
safe_hv_store(status, vllist->name, strlen(vllist->name), newRV_inc((SV *) (stats)),
0);
}
if (arrayEntries.nbulkentries_val)
free(arrayEntries.nbulkentries_val);
attributes.flag = VLOP_ALLOPERS;
attributes.Mask |= VLLIST_FLAG;
Zero(&arrayEntries, 1, nbulkentries); /*initialize to hint the stub to alloc space */
vcode = VLDB_ListAttributes(&attributes, &nentries, &arrayEntries);
if (vcode) {
char buffer[256];
sprintf(buffer, "Could not access the VLDB for attributes\n");
VSETCODE(vcode, buffer);
goto done;
}
for (j = 0; j < nentries; j++) { /* process each entry */
vllist = &arrayEntries.nbulkentries_val[j];
volid = vllist->volumeId[RWVOL];
vcode =
ubik_Call(VL_ReleaseLock, cstruct, 0, volid, -1,
LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP);
if (vcode) {
char buffer[256];
sprintf(buffer, "Could not unlock entry for volume %s\n", vllist->name);
VSETCODE(vcode, buffer);
totalE++;
if (all) {
code = BOZO_RestartAll(self);
if (code) {
char buffer[256];
sprintf(buffer, "AFS::BOS: failed to restart servers (%s)\n", em(code));
BSETCODE(code, buffer);
}
}
else {
char buffer[256];
sprintf(buffer, "AFS::BOS: To restart all processes please specify 'all'\n");
BSETCODE(-1, buffer);
}
RETVAL = (code == 0);
goto done;
}
else {
if (all) {
char buffer[256];
sprintf(buffer, "AFS::BOS: Can't use 'all' along with individual instances\n");
BSETCODE(-1, buffer);
/* printf("DEBUG-XS-bos-stop-4 \n"); */
}
/* printf("DEBUG-XS-bos-stop-5 \n"); */
if (wait) {
/* printf("DEBUG-XS-bos-stop-5-1 \n"); */
code = BOZO_WaitAll(self);
/* printf("DEBUG-XS-bos-stop-5-2 %d \n", code); */
if (code) {
char buffer[256];
sprintf(buffer, "AFS::BOS: can't wait for processes to shutdown (%s)\n",
em(code));
BSETCODE(code, buffer);
goto done;
}
}
/* printf("DEBUG-XS-bos-stop-6 \n"); */
SETCODE(code);
done:
/* printf("DEBUG-XS-bos-stop-7 \n"); */
RETVAL = (code == 0);
sprintf(buffer, "AFS::BOS: failed to shutdown servers (%s)\n", em(code));
BSETCODE(code, buffer);
goto done;
}
}
if (wait) {
code = BOZO_WaitAll(self);
if (code) {
char buffer[256];
sprintf(buffer, "AFS::BOS: can't wait for processes to shutdown (%s)\n",
em(code));
BSETCODE(code, buffer);
goto done;
}
}
SETCODE(code);
done:
RETVAL = (code == 0);
}
OUTPUT:
src/BOS/BOS.pm view on Meta::CPAN
$VERSION = 'v2.6.4';
sub DESTROY {
my (undef, undef, undef, $subroutine) = caller(1);
if (! defined $subroutine or $subroutine !~ /eval/) { undef $_[0]; } # self->DESTROY
else { AFS::BOS::_DESTROY($_[0]); } # undef self
}
sub create {
my $self = shift;
my $process = shift;
my $type = shift;
my $command = shift;
my $notifier = shift;
if (! defined $process ||
! defined $type ||
! defined $command) {
carp "AFS::BOS->create: incomplete arguements specified ...\n";
return 0;
}
if (ref($command) eq 'ARRAY') {
if ($notifier) { $self->_create($process, $type, $command, $notifier); }
else { $self->_create($process, $type, $command); }
}
elsif (ref($command) eq '' ) {
my @commands;
$commands[0] = $command;
if ($notifier) { $self->_create($process, $type, \@commands, $notifier); }
else { $self->_create($process, $type, \@commands); }
}
else {
carp "AFS::BOS->create: not a valid COMMAND input ...\n";
return 0;
}
}
sub restart {
my $self = shift;
src/ppport.h view on Meta::CPAN
pop_scope|||
populate_isa|||v
pregcomp||5.009005|
pregexec|||
pregfree2||5.011000|
pregfree|||
prepend_madprops|||
prescan_version||5.011004|
printbuf|||
printf_nocontext|||vn
process_special_blocks|||
ptr_hash|||n
ptr_table_clear||5.009005|
ptr_table_fetch||5.009005|
ptr_table_find|||n
ptr_table_free||5.009005|
ptr_table_new||5.009005|
ptr_table_split||5.009005|
ptr_table_store||5.009005|
push_scope|||
put_byte|||
( run in 0.319 second using v1.01-cache-2.11-cpan-8d75d55dd25 )