Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

lfc_perl(3) [debian man page]

lfc_perl(3)						 Perl Programmers Reference Guide					       lfc_perl(3)

NAME
lfc - Perl interface to the LFC SYNOPSIS
use lfc; printf "CNS_LIST_BEGIN is %d ", $lfc::CNS_LIST_BEGIN; DESCRIPTION
The lfc module permits you to access the LFC client interface from perl programs. The lfc module is a swig wrapping of the standard C interface. For detailed descriptions of each function see the individual man page of each function. There follows a series of examples of how to use selected functions and how to retrieve the information returned by them: Examples are finding the GUID of an existing entry, listing the replicas of a given GUID and setting and retrieving the comment associated with an entry. EXAMPLE
#!/usr/bin/perl -w use strict; use lfc; # stat an existing entry in the LFC and print the GUID my ($name,$stat,$guid,$res); $name = "/grid/dteam/my.test"; $stat = lfcc::new_lfc_filestatg(); $res = lfc::lfc_statg($name,undef,$stat); if ($res == 0) { $guid = lfcc::lfc_filestatg_guid_get($stat); print "The GUID for $name is $guid "; } else { my $err_num = $lfc::serrno; my $err_string = lfc::sstrerror($err_num); print "There was an error while looking for $name: Error $err_num ($err_string) "; exit(1); } lfcc::delete_lfc_filestatg($stat); EXAMPLE
#!/usr/bin/perl -w use strict; use lfc; # list the replicas of a given entry, starting from the GUID my ($guid,$listp,$flag,$num_replicas); $guid = "6a3164e0-a4d7-4abe-9f76-e3b8882735d1"; $listp = lfcc::new_lfc_list(); $flag = $lfc::CNS_LIST_BEGIN; print "Listing replicas for GUID $guid: "; $num_replicas=0; while(1) { my $res = lfc::lfc_listreplica(undef,$guid,$flag,$listp); $flag = $lfc::CNS_LIST_CONTINUE; if (!defined $res) { last; } else { my $rep_name = lfcc::lfc_filereplica_sfn_get($res); print "Replica: $rep_name "; $num_replicas++; } } lfc::lfc_listreplica(undef,$guid,$lfc::CNS_LIST_END,$listp); lfcc::delete_lfc_list($listp); print "Found $num_replicas replica(s) "; EXAMPLE
#!/usr/bin/perl -w use strict; use lfc; # setting and retrieving a comment on a file my ($file,$res,$bufspec,$buffer,$comment); $file = "/grid/dteam/my.test"; $comment = "MyComment"; $res = lfc::lfc_setcomment($file,$comment); if ($res != 0) { my $err_num = $lfc::serrno; my $err_string = lfc::sstrerror($err_num); print "Problem while setting comment for $file: Error $err_num ($err_string) "; exit(1); } $bufspec = "x".($lfc::CA_MAXCOMMENTLEN+1); $buffer = pack($bufspec); $res = lfc::lfc_getcomment($file,$buffer); if ($res != 0) { my $err_num = $lfc::serrno; my $err_string = lfc::sstrerror($err_num); print "Problem while reading the comment for $file: Error $err_num ($err_string) "; exit(1); } $comment = unpack("Z*", $buffer); print "Read back comment $comment "; NOTES
The current interface to the lfc_getcomment(3), lfc_getcwd(3), lfc_readlink(3), lfc_seterrbuf(3) requires the passing of a suitably allo- cated buffer (in a similar way to the C functions). However this is rather non standard in PERL. A future version of lfc perl interface may do away with the need to setup the buffer before the call and to explicitly unpack the result afterwards. SEE ALSO
LFC C interface man pages LFC
$Date: 2007/02/23 10:03:07 $ lfc_perl(3)

Check Out this Related Man Page

LFC_LISTLINKS(3)					       LFC Library Functions						  LFC_LISTLINKS(3)

NAME
lfc_listlinks - list link entries for a given file SYNOPSIS
#include <sys/types.h> #include "lfc_api.h" struct lfc_linkinfo *lfc_listlinks (const char *path, const char *guid, int flags, lfc_list *listp) DESCRIPTION
lfc_listlinks lists link entries for a given file. The first entry in the list is the actual file name, while the other entries are the symbolic links pointing at this file. path specifies the logical pathname. guid specifies the Grid Unique IDentifier. flags may be one of the following constant: CNS_LIST_BEGIN the first call must have this flag set to allocate buffers and initialize pointers. CNS_LIST_CONTINUE all the following calls must have this flag set. CNS_LIST_END final call to terminate the list and free resources. RETURN VALUE
This routine returns a pointer to a structure containing the current link entry if the operation was successful or NULL if all entries have been returned or if the operation failed. In the latter case, serrno is set appropriately. ERRORS
ENOENT The named file does not exist. EACCES Search permission is denied on a component of the parent directory. ENOMEM Memory could not be allocated for the output buffer. EFAULT path and guid are NULL pointers or listp is a NULL pointer. ENOTDIR A component of path prefix is not a directory. EINVAL The length of guid exceeds CA_MAXGUIDLEN or path and guid are both given and they point at a different file. ENAMETOOLONG The length of path exceeds CA_MAXPATHNAMELEN. SENOSHOST Host unknown. SENOSSERV Service unknown. SECOMERR Communication error. ENSNACT Name server is not running or is being shutdown. SEE ALSO
Castor_limits(4), lfc_symlink(3) LFC
$Date: 2010-09-14 13:37:49 +0200 (Tue, 14 Sep 2010) $ LFC_LISTLINKS(3)
Man Page