Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

versw(3) [osf1 man page]

versw(3)						     Library Functions Manual							  versw(3)

NAME
versw, VERSW - Check the status of an operating system version switch on a single cluster member to determine whether the calling applica- tion can enable new features that are incompatible with the old version of the operating system LIBRARY
Standard C Library (libc.so, libc.a) SYNOPSIS
#include <sys/versw.h> #include <sys/clu.h> int VERSW(); int versw ( ulong high_vers, ulong low_vers ); PARAMETERS
Most significant ulong of new version ID. Least significant ulong of new version ID. DESCRIPTION
The VERSW() macro and versw() function check the status of a version switch on a single cluster member to determine whether the calling application can enable new features that are incompatible with the old version of the operating system. Applications can use the VERSW() macro to enable new features on cluster members participating in a rolling upgrade. The versw() function examines the versw_transition attribute of the generic subsystem of the member's /etc/sysconfigtab file and compares the specified high_vers and low_vers parameters to the new version of the running kernel. It then compares these parameters to the active version of the running kernel. The VERSW() macro provides a wrapper for the versw() function. Because the VERSW() macro automatically extracts the high and low version values from /usr/sys/conf/version.id, we recommend that you use it rather than call the versw() function directly. RETURN VALUES
Upon completion, the VERSW() macro and versw() function return one of the following values: A version switch is in progress and the speci- fied new version is greater than the active version of the running kernel. The calling application should disable new, incompatible fea- tures and respond to all requests for such features with an error condition. A version switch is in progess and the specified new version is less than or equal to new version of the running kernel, or a version switch is not in progress and the specified new version is less than or equal to the active version of the running kernel. The application can safely enable, and entertain requests for, all new features. A version switch is in progress and the specified new version is greater than the active version of the running kernel. The application should disable new, incompatible features. Although the application should respond to all requests for such features originating on the local member with an error condition, it should be prepared to handle requests for new, incompatible features originating from other clus- ter members with grace and elan. EXAMPLES
#include <stdio.h> #include <sys/versw.h> #include <sys/clu.h> main() { if(VERSW() == VERSW_ENABLE) printf("Enable new features "); else printf("Disable new features "); endif } FILES
Rolling upgrade blocking conditions directory. Version switch header file. High and low version values used by VERSW() macro. RELATED INFORMATION
Functions: clu_is_member(3), clu_get_info(3) Commands: versw(8) delim off versw(3)

Check Out this Related Man Page

clu_info(3)						     Library Functions Manual						       clu_info(3)

NAME
clu_info, clu_get_info, clu_free_info, clu_get_memb_by_name, clu_get_memb_by_id, clu_free_memb - Gets information about a cluster and its members LIBRARY
Cluster Library (libclu.so) SYNOPSIS
#include <sys/clu.h> clu_info int clu_info( int clu_info_type, ...); int clu_info( CLU_INFO_MEMBSTATE, size_t memb_array_size, char *member_array); int clu_info( CLU_INFO_LIMITS, struct clu_limits *limits); int clu_info( CLU_INFO_CLU_NAME, char *name, size_t size); int clu_info( CLU_INFO_INTERNAME_BY_ID, memberid_t memberid, char *intername, size_t size); int clu_info( CLU_INFO_INTERNAME_BY_NAME, char *hostname, char *intername, size_t size); int clu_info( CLU_INFO_HOSTNAME_BY_ID, memberid_t memberid, char *hostname_out, size_t size); int clu_info( CLU_INFO_NODENAME_BY_ID, memberid_t memberid, char *nodename, size_t size); int clu_info( CLU_INFO_NODENAME_BY_NAME, char *hostname, char *nodename, size_t size); int clu_info( CLU_INFO_MEMBERID_BY_NAME, char *hostname, memberid_t *memberid_out); int clu_info( CLU_INFO_MEMBLIST, char **namelist, size_t *array_size, size_t name_length); int clu_info( CLU_INFO_MY_ID, memberid_t *my_memberid); clu_get_info int clu_get_info ( struct clu_gen_info **clu_gen_ptr ); clu_free_info void clu_free_info ( struct clu_gen_info **clu_gen_ptr ); clu_get_memb_by_name int clu_get_memb_by_name ( char *hostname, struct clu_member_info **clu_memb_ptr ); clu_get_memb_by_id int clu_get_memb_by_id ( memberid_t memberid, struct clu_member_info **clu_memb_ptr ); clu_free_memb int clu_free_memb ( struct clu_member_info **clu_memb_ptr ); PARAMETERS
One of the information constants defined in <sys/clu.h>: CLU_INFO_MEMBSTATE, CLU_INFO_LIMITS, CLU_INFO_CLU_NAME, CLU_INFO_INTERNAME_BY_ID, CLU_INFO_INTERNAME_BY_NAME, CLU_INFO_HOSTNAME_BY_ID, CLU_INFO_NODENAME_BY_ID, CLU_INFO_NODENAME_BY_NAME, CLU_INFO_MEMBERID_BY_NAME, CLU_INFO_MEMBLIST, CLU_INFO_MY_ID. These constants specify the type of cluster query being made. Number of elements in the namelist array. String containing the host name used to specify the cluster member for which to retrieve information. Pointer to a caller-allo- cated buffer that holds a string, which clu_info() fills with the host name of the specified member. Pointer to a caller-allocated buffer that holds a string, which clu_info() fills with the interconnect name of the specified member. A caller-allocated structure of type struct clu_limits, which clu_info() will fill with the minimum supported member ID, the maximum supported member ID, and the maximum sup- ported number of members in a cluster. Number of elements in the member_array array. Pointer to a caller-allocated character array that will hold information about each member's state. The size of the array should be CLU_MAX_MEMBERID + 1. The element of the array that matches the member ID of a member will contain that member's current state: CLU_MEMB_NOT_CONF (-1), CLU_MEMB_CONF_DOWN (0), or CLU_MEMB_CONF_UP (1). For example, member_array[2] will contain the state of member 2. Member ID of the cluster member for which to retrieve information. Pointer to a variable of type memberid_t which will be set to the member ID of the specified member. Pointer to a variable of type memberid_t which will be set to the member ID of the running cluster member. Pointer to a caller-allocated buffer that holds a string, which clu_info will fill with the cluster name. Pointer to a caller-allocated array that will hold the host names of all members in the cluster. The caller-allocated size of each string element of namelist. Pointer to a caller-allocated buffer that holds a string, which clu_info() fills with the Connection Manager (CNX) node name of the specified member. The size of the member array, mem- ber_array. Address of a pointer to a structure of type struct clu_gen_info, which clu_get_info() will load with cluster information. (Use clu_free_info() to free the memory allocated for the structure.) Address of a pointer to a structure of type struct clu_member_info, which clu_get_memb_by_name() and clu_get_memb_by_id() will load with specific member information. (Use clu_free_memb() to free the memory allo- cated for the structure.) DESCRIPTION
When called from a member of a cluster, the clu_info() function returns specific cluster status information when the following options are specified: CLU_INFO_MEMBSTATE - returns the following information about each cluster member's state: up, down, or not configured. CLU_INFO_LIMITS - returns the following information on member IDs and supported members: Minimum supported member ID Maximum supported mem- ber ID Maximum supported number of members in a cluster CLU_INFO_CLU_NAME - returns the cluster name. CLU_INFO_INTERNAME_BY_ID - returns the cluster interconnect name given a specific member ID. CLU_INFO_INTERNAME_BY_NAME - returns the cluster interconnect name given a spe- cific member name. CLU_INFO_MEMBERID_BY_NAME - returns the member ID given a specific host name. CLU_INFO_HOSTNAME_BY_ID - returns the member host name given a specific member ID. CLU_INFO_NODENAME_BY_ID - returns the Connection Manager (CNX) node name given a specific member ID. CLU_INFO_NODENAME_BY_NAME - returns the CNX node name given a specific host name. CLU_INFO_MEMBLIST - returns a list of host names for all members in the cluster. CLU_INFO_MY_ID - returns the member ID for the member on which it is run. When called from a member of a cluster, the clu_get_info() function returns a structure containing general information about the cluster and its members. The information includes: The name of the cluster and the number of members configured in the cluster. The device name and number of votes of the quorum disk, if configured. For each member, its member ID, host name, cluster interconnect IP name, and cur- rent state (UP or DOWN). When called from a system that is not a cluster member, the clu_get_info() function returns -1 (CLU_NOT_CONFIGURED). If a member of the cluster is down, or a member's /etc/rc.config file contains illegal values, the values returned by string pointers can be NULL. Note that the clu_get_info function does not require allocated structures. While the clu_info function accepts pointers to caller-allocated structures, the clu_get_info function accepts a pointer to a structure. The clu_free_info() function frees the memory allocated for a clu_gen_info structure. The clu_gen_info structure is defined in <sys/clu.h>. Use the clu_get_memb_by_name() and clu_get_memb_by_id() functions to return information about a cluster member. The clu_get_memb_by_name() function returns a structure containing the host name of a cluster member, while the clu_get_memb_by_id() function returns a structure con- taining the member ID of a cluster member. The clu_free_memb() function frees the memory allocated for a clu_member_info structure. The clu_member_info structure is defined in <sys/clu.h>. EXAMPLES
The following code fragments show typical calling sequences for the clu_info() options: CLU_INFO_MEMBSTATE: size_t size = 256; char marray[256]; clu_info(CLU_INFO_MEMBSTATE, size, marray); CLU_INFO_LIMITS: struct clu_limits limits; clu_info(CLU_INFO_LIMITS, &limits); CLU_INFO_CLU_NAME: char name[MAXHOSTNAMELEN]; clu_info(CLU_INFO_CLU_NAME, name, sizeof(name)); CLU_INFO_INTERNAME_BY_ID: memberid_t memberid = 2; char intername[MAXHOSTNAMELEN]; clu_info(CLU_INFO_INTERNAME_BY_ID, memberid, intername, sizeof(intername)); CLU_INFO_INTERNAME_BY_NAME: char *hostname = "my_member"; char intername[MAXHOSTNAMELEN]; clu_info(CLU_INFO_INTERNAME_BY_NAME, hostname, intername, sizeof(intername)); CLU_INFO_MEMBERID_BY_NAME: char *hostname = "my_member"; memberid_t memberid_out; clu_info(CLU_INFO_MEMBERID_BY_NAME, hostname, &mem- berid_out); CLU_INFO_HOSTNAME_BY_ID: memberid_t memberid = 2; char hostname_out[MAXHOSTNAMELEN]; clu_info(CLU_INFO_HOSTNAME_BY_ID, memberid, host- name_out, sizeof(hostname_out)); CLU_INFO_NODENAME_BY_ID: memberid_t memberid = 2; char nodename[MAXHOSTNAMELEN]; clu_info(CLU_INFO_NODENAME_BY_ID, memberid, nodename, sizeof(nodename)); CLU_INFO_NODENAME_BY_NAME: char *hostname = "my_member"; char nodename[MAXHOSTNAMELEN]; clu_info(CLU_INFO_NODENAME_BY_NAME, hostname, node- name, sizeof(nodename)); CLU_INFO_MEMBLIST: struct clu_limits limits; char **namelist; size_t size; int i; clu_info(CLU_INFO_LIMITS, &limits); size = lim- its.max_membid; namelist = (char **)calloc(size,sizeof(char *)); for(i=0;i<size;i++) { namelist[i] = (char *)calloc(MAXHOSTNAMELEN,sizeof(char)); namelist[i][0] = ' '; } clu_info(CLU_INFO_MEMBLIST, namelist, &size, MAXHOSTNAMELEN); CLU_INFO_MY_ID: memberid_t my_memberid; clu_info(CLU_INFO_MY_ID, &my_memberid); The following code fragment shows a typical calling sequence for the clu_get_info() function: #include <sys/clu.h> int retval = 0; int i = 0; struct clu_gen_info *clugenptr; clugenptr = NULL; retval = clu_get_info(&clugenptr); switch (retval) { case 0: break; case CLU_NOT_MEMBER: case CLU_NO_CLUSTER_NAME: case CLU_NO_MEMBERID: case CLU_CNX_ERROR: fprintf(stderr, "clu_get_info() error0); exit(1); default: exit(1); } if (clugenptr == NULL) exit(1); for (i = 0; i <= clugenptr->clu_num_of_members -1; i++) { /* print or use the returned info; for example: */ printf("member hostname is %s0, clugenptr->memblist[i].hostname); } clu_free_info(&clugenptr); The following code fragment shows a typical calling sequence for the clu_get_memb_by_id() function (clu_get_memb_by_name() is similar): #include <sys/clu.h> #include <errno.h> memberid_t memberid = 2; struct clu_member_info *membinfo = NULL; if (clu_get_memb_by_id(2, &membinfo)) { fprintf(stderr, "Error! Return code of %d0, errno); exit(1); } printf("Member cluster version is %s0, membinfo->clu_version); clu_free_memb(&membinfo); RETURN VALUES
The clu_get_info() and clu_free_info() functions return one of the following values: Successful completion. System is not configured to be in a cluster. Called from a system that is not a cluster member. There is no mem- ory for the interface. Cannot determine the value of the sysconfigtab memberid attribute. Cannot query Connection Manager (CNX) subsys- tem. The input to member_array is not large enough. The clu_info(), clu_get_memb_by_name(), clu_get_memb_by_id(), and clu_free_memb() functions return one of the following values: Successful completion. The operation was unsuccessful. Check errno to determine the error. FILES
Run-time configuration file for each cluster member. RELATED INFORMATION
Commands: clu_get_info(8) Files: rc.config(8) delim off clu_info(3)
Man Page