Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

cfg_subsys_state(3) [osf1 man page]

cfg_subsys_state(3)					     Library Functions Manual					       cfg_subsys_state(3)

NAME
cfg_subsys_state - Determine the state of the named subsystem LIBRARY
Configuration Management Library (libcfg.a) SYNOPSIS
#include <cfg.h> cfg_status_t cfg_subsys_state( cfg_handle_t *handle, caddr_t subsys, unsigned int *state); PARAMETERS
Structure identifying the means of communication between your application and the configuration management server. For local requests, pass NULL in this parameter. For remote requests, pass the value you receive when you call the cfg_connect() routine. Specifies the name of the subsystem for which you are requesting state information. Returns a collection of bit flags representing the state of the subsys- tem. The bit flags are defined in the <sys/sysconfig.h> header file. The following flags are currently defined: CFG_STATE_CONFIGURED, CFG_STATE_DYNAMIC, and CFG_STATE_LOADED. DESCRIPTION
Use the cfg_subsys_state() routine to determine the state of a particular subsystem. Subsystems can be loaded, loaded and configured, or unloaded. (Subsystems must be loaded to be configured.) In addition, a subsystem can be either static (the CFG_STATE_DYNAMIC bit flag is not set) or dynamic (the CFG_STATE_DYNAMIC bit flag is set). Static subsystems are linked into the kernel at build time and the only way to add or remove them from the kernel is to rebuild the kernel. Dynamic subsystems are loadable, meaning that they can be added and removed from the kernel while the system is running. The value returned in the state parameter is an integer representation of a binary value. The bits in the value designate the state of the subsystem. For example, the least significant bit designates whether or not the subsystem is loaded. If this bit is set, the subsystem is loaded. If the next higher order bit is set, the subsystem is configured. You can determine the state of a subsystem by using the value returned in the state parameter in a bitwise AND operation. The <sys/sysconfig.h> header file defines constants for this purpose. See the EXAMPLES section for more information about using these constants. EXAMPLES
The following example illustrates the use of the cfg_subsys_state() library routine: cfg_status_t retval; cfg_handle_t handle; unsigned int state; retval = cfg_subsys_state(&handle, "vfs", &state); if (retval != CFG_SUCCESS) print_error(retval); else { /* Determine whether or not the subsystem is loaded */ /* and configured. Display a message describing the */ /* subsystem state. */ if (state & CFG_STATE_LOADED) { if (state & CFG_STATE_CONFIGURED) printf("The subsystem is loaded and configured. "); else printf("The subsystem is loaded but not configured. "); else printf("The subsystem is unloaded. "); } } In this example, the cfg_subsys_state() routine returns a value representing the state of the vfs subsystem. The application determines whether the call to the routine was successful and, if it was, displays a message describing the state of the subsystem. RETURN VALUES
Upon successful completion, cfg_subsys_state() returns CFG_SUCCESS. Other return values indicate that an error has occurred. For informa- tion about handling return values from routines in the configuration management library, see libcfg(3). RELATED INFORMATION
Commands: cfgmgr(8), sysconfig(8) Routines: cfg_subsys_list(3), libcfg(3) delim off cfg_subsys_state(3)

Check Out this Related Man Page

cfg_subsys_reconfig(3)					     Library Functions Manual					    cfg_subsys_reconfig(3)

NAME
cfg_subsys_reconfig - Reconfigure attribute values for a subsystem LIBRARY
Configuration Management Library (libcfg.a) SYNOPSIS
#include <cfg.h> cfg_status_t cfg_subsys_reconfig( cfg_handle_t *handle, caddr_t subsys, cfg_attr_t *attributes, int nattributes); PARAMETERS
Structure identifying the means of communication between your application and the configuration management server. For local requests, pass NULL in this parameter. For remote requests, pass the value returned from the cfg_connect() routine. Specifies the name of the sub- system for which you are modifying attribute values. On input, contains a list of attributes whose value you want to modify. For each attribute, the list includes the attribute name, data type, and the new value. On return, contains a status for each attribute. The status indicates whether the system was able to make the modification and, if not, what problem caused the error. The number of attributes whose values you are changing. DESCRIPTION
Use the cfg_subsys_reconfig() routine to modify attribute values for a subsystem. The modifications made by this routine take effect imme- diately because they are made to the in-memory copy of the subsystem. Neither the kernel nor the subsystem stores a copy of the modifica- tions, so if the system is rebooted or the subsystem is unconfigured the modifications are lost. When the subsystem is once again config- ured into the kernel, the value of its attributes are retrieved from the /etc/sysconfigtab database and the subsystem code. To reconfigure an individual array element, on input the index field of the cfg_attr_t structure must be set to the index value of the array element. To make permanent changes to attribute values, store the new attribute values in the /etc/sysconfigtab database. See sysconfigtab(4) for information about that database. When your application calls the cfg_subsys_reconfig() routine, it passes a list of attribute names and values. The application passes this information in an array of structures of type cfg_attr_t. For information about this structure, see libcfg(3). The following list describes the information that is passed to the system by your application: Attributes can be integer, string, or binary data. To specify the data type of your attribute you pass one of these attribute data types: CFG_ATTR_STRTYPE, CFG_ATTR_INTTYPE, CFG_ATTR_UNITTYPE, CFG_ATTR_LONGTYPE, CFG_ATTR_ULONGTYPE, CFG_ATTR_BINTYPE For attributes that are themselves a structure, your application must pass the index for the attribute whose value you want to modify. The attribute value specifies the new value for the attribute. Be aware that the system updates attributes in the order in which you specify them in the attribute list. This order can be important when one attribute is validated based on another attribute's current setting. On return, the system supplies the status for each attribute. The status is returned in the attribute parameter, which is normally an array of structures of the type cfg_attr_t. For information about this structure, see libcfg(3). The following table describes the status values your application might receive from the cfg_subsys_recon- fig() routine: --------------------------------------------------------------------- Status Code Meaning --------------------------------------------------------------------- CFG_ATTR_SUCCESS Successful operation CFG_ATTR_EEXISTS No attribute by that name exists CFG_ATTR_EOP Attribute does not support the reconfigure opera- tion CFG_ATTR_ESUBSYS Subsystem failure (code within the subsystem returned an error) CFG_ATTR_EINDEX The index for an indexed attribute is out of range CFG_ATTR_ELARGE The new attribute value or length is too large CFG_ATTR_ESMALL The new attribute value or length is too small --------------------------------------------------------------------- EXAMPLES
The following example illustrates the use of the cfg_subsys_reconfig() routine: cfg_attr_t attributes[1]; cfg_status_t retval; cfg_handle_t handle; int i; int nattributes; /*****************************************************/ /* Initialize attribute names for the request */ strcpy (attributes[0].name, "max-vnodes"); attributes[0].type = CFG_ATTR_INTTYPE; attributes[0].attr.num.val = 20000; nattributes = 1; /***************************************************/ /* Call the cfg_subsys_reconfig() routine */ retval = cfg_subsys_reconfig(&handle, "vfs", attributes, nattributes); if (retval != CFG_SUCCESS) print_error (retval); else { for (i=0; i<1; i++) { if (attributes[i].status != CFG_ATTR_SUCCESS) { printf("%s:", attributes[i].name); switch (attributes[i].status){ case CFG_ATTR_EEXISTS: printf("unknown attribute "); break; case CFG_ATTR_EOP: printf("attribute does not allow this operation "); break; . . . default: printf("unknown error "); break; } } } } In this example, the application attempts to modify the value of the max-vnodes attribute. This attribute, which is part of the vfs sub- system is being set to the value 20000. On return the application checks the status of the request as a whole and of the attribute itself. If the request and attribute status both indicate success, the application continues. Otherwise, an error is displayed. RETURN VALUES
Upon successful completion, cfg_subsys_reconfig() returns CFG_SUCCESS. Other return values indicate that an error has occurred. For information about handling return values from routines in the configuration management library, see libcfg(3). RELATED INFORMATION
Commands: cfgmgr(8), sysconfig(8) Routines: libcfg(3) delim off cfg_subsys_reconfig(3)
Man Page