|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1. Resource Management in the Solaris Operating System 3. Using the C Interface to Extended Accounting 4. Using the Perl Interface to Extended Accounting 7. Design Considerations for Resource Management Applications in Solaris Zones |
Perl ModulesThe various project, task and exacct-related functions have been separated into groups, and each group is placed in a separate Perl module. Each function has the Sun Microsystems standard Sun::Solaris:: Perl package prefix. Table 4-1 Perl Modules
Sun::Solaris::Project ModuleThe Sun::Solaris::Project module provides wrappers for the project-related system calls and the libproject(3LIB) library. Sun::Solaris::Project ConstantsThe Sun::Solaris::Project module uses constants from the project-related header files.
Sun::Solaris::Project Functions, Class Methods, and Object MethodsThe perl extensions to the libexacct(3LIB) API provide the following functions for projects. The Sun::Solaris::Project module has no class methods. The Sun::Solaris::Project module has no object methods. Sun::Solaris::Project ExportsBy default, nothing is exported from this module. The following tags can be used to selectively import constants and functions defined in this module.
Sun::Solaris::Task ModuleThe Sun::Solaris::Task module provides wrappers for the settaskid(2) and gettaskid(2) system calls. Sun::Solaris::Task ConstantsThe Sun::Solaris::Task module uses the following constants.
Sun::Solaris::Task Functions, Class Methods, and Object MethodsThe perl extensions to the libexacct(3LIB) API provides the following functions for tasks. The Sun::Solaris::Task module has no class methods. The Sun::Solaris::Task module has no object methods. Sun::Solaris::Task ExportsBy default, nothing is exported from this module. The following tags can be used to selectively import constants and functions defined in this module.
Sun::Solaris::Exacct ModuleThe Sun::Solaris::Exacct module provides wrappers for the ea_error(3EXACCT) function, and for all the exacct system calls. Sun::Solaris::Exacct ConstantsThe Sun::Solaris::Exacct module provides constants from the various exacct header files. The P_PID, P_TASKID, P_PROJID and all the EW_*, EP_*, EXR_* macros are extracted during the module build process. The macros are extracted from the exacct header files under /usr/include and provided as Perl constants. Constants passed to the Sun::Solaris::Exacct functions can either be an integer value such as. EW_FINAL or a string representation of the same variable such as. “EW_FINAL”. Sun::Solaris::Exacct Functions, Class Methods, and Object MethodsThe perl extensions to the libexacct(3LIB) API provide the following functions for the Sun::Solaris::Exacct module.
Note - ea_error_str() is provided as a convenience, so that repeated blocks of code like the following can be avoided: if (ea_error() == EXR_SYSCALL_FAIL) { print("error: $!\n"); } else { print("error: ", ea_error(), "\n"); } The Sun::Solaris::Exacct module has no class methods. The Sun::Solaris::Exacct module has no object methods. Sun::Solaris::Exacct ExportsBy default, nothing is exported from this module. The following tags can be used to selectively import constants and functions defined in this module.
Sun::Solaris::Exacct::Catalog ModuleThe Sun::Solaris::Exacct::Catalog module provides a wrapper around the 32-bit integer used as a catalog tag. The catalog tag is represented as a Perl object blessed into the Sun::Solaris::Exacct::Catalog class. Methods can be used to manipulate fields in a catalog tag. Sun::Solaris::Exacct::Catalog ConstantsAll the EXT_*, EXC_* and EXD_* macros are extracted during the module build process from the /usr/include/sys/exact_catalog.h file and are provided as constants. Constants passed to the Sun::Solaris::Exacct::Catalog methods can either be an integer value, such as EXT_UINT8, or the string representation of the same variable, such as “EXT_UINT8”. Sun::Solaris::Exacct::Catalog Functions, Class Methods, and Object MethodsThe Perl extensions to the libexacct(3LIB) API provide the following class methods forSun::Solaris::Exacct::Catalog. Exacct(3PERL) andExacct::Catalog(3PERL)
The Perl extensions to the libexacct(3LIB) API provide the following object methods for Sun::Solaris::Exacct::Catalog.
Sun::Solaris::Exacct::Catalog ExportsBy default, nothing is exported from this module. The following tags can be used to selectively import constants and functions defined in this module.
Additionally, any constants defined with the register() function can optionally be exported into the caller's package. Sun::Solaris::Exacct::File ModuleThe Sun::Solaris::Exacct::File module provides wrappers for the exacct functions that manipulate accounting files. The interface is object-oriented, and allows the creation and reading of exacct files. The C library calls that are wrapped by this module are: The file read and write methods operate on Sun::Solaris::Exacct::Object objects. These methods perform all the necessary memory management, packing, unpacking and structure conversions that are required. Sun::Solaris::Exacct::File ConstantsSun::Solaris::Exacct::File provides the EO_HEAD, EO_TAIL, EO_NO_VALID_HDR, EO_POSN_MSK and EO_VALIDATE_MSK constants. Other constants that are needed by the new() method are in the standard Perl Fcntl module. Table 4-2 describes the action of new() for various values of $oflags and $aflags. Sun::Solaris::Exacct::File Functions, Class Methods, and Object MethodsThe Sun::Solaris::Exacct::File module has no functions. The Perl extensions to the libexacct(3LIB) API provide the following class method forSun::Solaris::Exacct::File.
The following table describes the new() action for combinations of the $oflags and $aflags parameters. Table 4-2 $oflags and $aflags Parameters
Note - The only valid values for $oflags are the combinations of O_RDONLY, O_WRONLY, O_RDWR or O_CREAT. $aflags describes the required positioning in the file for O_RDONLY. Either EO_HEAD or EO_TAIL are allowed. If absent, EO_HEAD is assumed. The perl extensions to the libexacct(3LIB) API provide the following object methods forSun::Solaris::Exacct::File.
Note - Close a Sun::Solaris::Exacct::File. There is no explicit close() method for a Sun::Solaris::Exacct::File. The file is closed when the filehandle object is undefined or reassigned. Sun::Solaris::Exacct::File ExportsBy default, nothing is exported from this module. The following tags can be used to selectively import constants that are defined in this module.
Sun::Solaris::Exacct::Object ModuleThe Sun::Solaris::Exacct::Object module serves as a parent of the two possible types of exacct objects: Items and Groups. An exacct Item is a single data value, an embedded exacct object, or a block of raw data. An example of a single data value is the number of seconds of user CPU time consumed by a process. An exacct Group is an ordered collection of exacct Items such as all of the resource usage values for a particular process or task. If Groups need to be nested within each other, the inner Groups can be stored as embedded exacct objects inside the enclosing Group. The Sun::Solaris::Exacct::Object module contains methods that are common to both exacct Items and Groups. Note that the attributes of Sun::Solaris::Exacct::Object and all classes derived from it are read-only after initial creation via new(). The attributes made read-only prevents the inadvertent modification of the attributes which could give rise to inconsistent catalog tags and data values. The only exception to the read-only attributes is the array used to store the Items inside a Group object. This array can be modified using the normal perl array operators. Sun::Solaris::Exacct::Object ConstantsSun::Solaris::Exacct::Object provides the EO_ERROR, EO_NONE, EO_ITEM and EO_GROUP constants. Sun::Solaris::Exacct::Object Functions, Class Methods, and Object MethodsThe Sun::Solaris::Exacct::Object module has no functions. The Perl extensions to the libexacct(3LIB) API provide the following class method forSun::Solaris::Exacct::Object.
The Perl extensions to the libexacct(3LIB) API provide the following object methods forSun::Solaris::Exacct::Object.
Sun::Solaris::Exacct::Object ExportsBy default, nothing is exported from this module. The following tags can be used to selectively import constants and functions defined in this module.
Sun::Solaris::Exacct::Object::Item ModuleThe Sun::Solaris::Exacct::Object::Item module is used for exacct data Items. An exacct data Item is represented as an opaque reference, blessed into the Sun::Solaris::Exacct::Object::Item class, which is a subclass of the Sun::Solaris::Exacct::Object class. The underlying exacct data types are mapped onto Perl types as follows. Table 4-3 exacct Data Types Mapped to Perl Data Types
Sun::Solaris::Exacct::Object::Item ConstantsSun::Solaris::Exacct::Object::Item has no constants. Sun::Solaris::Exacct::Object::Item Functions, Class Methods, and Object MethodsSun::Solaris::Exacct::Object::Item has no functions. Sun::Solaris::Exacct::Object::Item inherits all class methods from the Sun::Solaris::Exacct::Object base class, plus the new() class method.
Sun::Solaris::Exacct::Object::Item inherits all object methods from the Sun::Solaris::Exacct::Object base class. Sun::Solaris::Exacct::Object::Item ExportsSun::Solaris::Exacct::Object::Item has no exports. Sun::Solaris::Exacct::Object::Group ModuleThe Sun::Solaris::Exacct::Object::Group module is used for exacct Group objects. An exacct Group object is represented as an opaque reference, blessed into the Sun::Solaris::Exacct::Object::Group class, which is a subclass of the Sun::Solaris::Exacct::Object class. The Items within a Group are stored inside a Perl array, and a reference to the array can be accessed via the inherited value() method. This means that the individual Items within a Group can be manipulated with the normal Perl array syntax and operators. All data elements of the array must be derived from the Sun::Solaris::Exacct::Object class. Group objects can also be nested inside each other merely by adding an existing Group as a data Item. Sun::Solaris::Exacct::Object::Group ConstantsSun::Solaris::Exacct::Object::Group has no constants. Sun::Solaris::Exacct::Object::Group Functions, Class Methods, and Object MethodsSun::Solaris::Exacct::Object::Group has no functions. Sun::Solaris::Exacct::Object::Group inherits all class methods from the Sun::Solaris::Exacct::Object base class, plus the new() class method.
Sun::Solaris::Exacct::Object::Group inherits all object methods from the Sun::Solaris::Exacct::Object base class, plus the new() class method.
Sun::Solaris::Exacct::Object::Group ExportsSun::Solaris::Exacct::Object::Group has no exports. Sun::Solaris::Exacct::Object::_Array ModuleThe Sun::Solaris::Exacct::Object::_Array class is used internally for enforcing type checking of the data Items that are placed in an exacct Group. Sun::Solaris::Exacct::Object::_Array should not be created directly by the user. Sun::Solaris::Exacct::Object::_Array ConstantsSun::Solaris::Exacct::Object::_Array has no constants. Sun::Solaris::Exacct::Object::_Array Functions, Class Methods, and Object MethodsSun::Solaris::Exacct::Object::_Array has no functions. Sun::Solaris::Exacct::Object::_Array has internal-use class methods. Sun::Solaris::Exacct::Object::_Array uses perl TIEARRAY methods. Sun::Solaris::Exacct::Object::_Array ExportsSun::Solaris::Exacct::Object::_Array has no exports. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|