Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

gendlib(3) [debian man page]

GENDLIB(3)							      GENDLIB								GENDLIB(3)

NAME
gendlib - perl library for querying genders file SYNOPSIS
require ``/usr/lib/genders/gendlib.pl''; DESCRIPTION
This package contains common functions for manipulating the genders file. Previously this code existed only in the nodeattr command, but applications that must repeatedly call nodeattr would spend a great deal of time reading and parsing the genders file. These functions create an in-memory cache of genders on the first call; subsequent calls need only reference the in-memory copy and are thus speeded up. Initialization: Genders::init([$path_genders]) Function normally called internally for initialization. It can be called externally with a non-default genders file path and subse- quent operations will use this non-default data. May be called more than once to change genders file. Simple Queries: Genders::hasattr($attribute, [$node]) Return 1 if node has attribute, 0 if not. If node is not specified, use local node. Genders::getattrval($attribute, [$node]) Return value of attribute held by node, or empty string if no value or node does not have attribute. If node is not specified, use local node. Genders::getnode([$attribute]) Return a list of nodes having the specified attribute. If a value is also specified ("attr=val"), only nodes with the specified attribute and value are returned. If no attribute is specified, getnode returns all the nodes listed in the genders file. Genders::getattr([$node]) Return a list of attributes held by node. If node is not specified, use local node. Complex Queries: Genders::getallattr() Return a list of all attributes in the genders file (one cluster only). Genders::get_node_hash(\%node) Get a copy of hash of attributes to node lists for the current cluster (a "hash of lists"). Ensure that keys exist for all possible attributes across clusters (though they may point to empty lists). Genders::get_clusters() Return a list with the local cluster name as the first and only element. get_clusters() returns a list instead of a scalar for backwards compatability. If the local cluster name is not known, null is returned. Genders::gendexp($exp, [$node]) Evaluate expression involving genders attributes and return the result of the evaluation. Any legal perl expresion using numeric constants, genders attributes (which are converted into $variables), and the following operators is valid: !, ||, &&, *, +, -, /. If $node is not specified, assume the local host. Conversion: Genders::to_altnames() Given a list of hostnames as they appear in the genders file, return a list of alternate names. On the SP, genders names are assumed to be the initial_hostnames, and we use the SDR to convert to reliable_hostnames. On other systems, we look for the value of the altname attribute in the genders file. If the input hostname cannot be converted, it is preserved in the output. Genders::to_gendnames() Performs the inverse of the to_altnames() function. Just like to_altnames(), an input hostname is preserved in the output if it cannot be converted. SEE ALSO
nodeattr(1), libgenders(3), Libgenders(3) LLNL
10/10/97 GENDLIB(3)

Check Out this Related Man Page

GENDERS_TESTATTR(3)						    LIBGENDERS						       GENDERS_TESTATTR(3)

NAME
genders_testattr - test if a node has an attribute SYNOPSIS
#include <genders.h> int genders_testattr(genders_t handle, const char *node, const char *attr, char *val, int len); int genders_testattrval(genders_t handle, const char *node, const char *attr, const char *val); DESCRIPTION
genders_testattr() tests if the node pointed to by node contains the attribute pointed to by attr. If node is NULL, the current node is tested. If the attribute is found, its value is stored in the buffer pointed to by val. len should indicate the length of the buffer. If the attribute value is not needed, val can be set to NULL. To avoid passing in an attribute value buffer that is not large enough to store the attribute value, genders_getmaxvallen(3) should be used to determine the minimum buffer size that should be used. genders_testattrval() tests if the node pointed to by node contains the attribute pointed to by attr and if that attribute is equal to the attribute value pointed to by val. If val is NULL, only the attribute is tested. RETURN VALUES
For genders_testattr(), if the node contains the attribute, 1 is returned. 0 is returned if the node does not contain the attribute. For genders_testattrval(), if the node contains the attribute and it is equal to the attribute value, 1 is returned. 0 is returned if the node does not contain the attribute, or if the attribute is not equal to the attribute value. For both genders_testattr() and genders_testattrval(), -1 is returned on error, and an error code is returned in handle. The error code can be retrieved via genders_errnum(3) , and a description of the error code can be retrieved via genders_strerror(3). Error codes are defined in genders.h. ERRORS
GENDERS_ERR_NULLHANDLE The handle parameter is NULL. The genders handle must be created with genders_handle_create(3). GENDERS_ERR_NOTLOADED genders_load_data(3) has not been called to load genders data. GENDERS_ERR_OVERFLOW The buffer pointed to by val is not large enough to store the attribute value. GENDERS_ERR_PARAMETERS An incorrect parameter has been passed in. GENDERS_ERR_NOTFOUND The node pointed to by node cannot be found in the genders file or if node=NULL, the machine genders is running on is not listed in the genders database. GENDERS_ERR_MAGIC handle has an incorrect magic number. handle does not point to a genders handle or handle has been destroyed by genders_han- dle_destroy(3). FILES
/usr/include/genders.h SEE ALSO
libgenders(3), genders_handle_create(3), genders_load_data(3), genders_getmaxvallen(3), genders_errnum(3), genders_strerror(3) LLNL
August 2003 GENDERS_TESTATTR(3)
Man Page