Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Solaris Containers: Resource Management and Solaris Zones Developer's Guide
Previous Next

Perl Modules

The 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

Module

Description

Sun::Solaris::Project Module

Provides functions to access the project manipulation functions: getprojid(2), setproject(3PROJECT), project_walk(3PROJECT), getprojent(3PROJECT), getprojbyname(3PROJECT), getprojbyid(3PROJECT), getdefaultproj(3PROJECT), inproj(3PROJECT), getprojidbyname(3PROJECT), setprojent(3PROJECT), endprojent(3PROJECT), fgetprojent(3PROJECT).

Sun::Solaris::Task Module

Provides functions to access the task manipulation functions settaskid(2) and gettaskid(2).

Sun::Solaris::Exacct Module

Top-level exacct module. Functions in this module access both the exacct-related system calls getacct(2), putacct(2), and wracct(2) as well as the libexacct(3LIB) library function ea_error(3EXACCT). This module contains constants for all the various exacct EO_*, EW_*, EXR_*, P_* and TASK_* macros.

Sun::Solaris::Exacct::Catalog Module

Provides object-oriented methods to access the bitfields within an exacct catalog tag as well as the EXC_*, EXD_* and EXD_* macros.

Sun::Solaris::Exacct::File Module

Provides object-oriented methods to access the libexacct(3LIB) accounting file functions: ea_open(3EXACCT), ea_close(3EXACCT), ea_get_creator(3EXACCT), ea_get_hostname(3EXACCT), ea_next_object(3XACCT), ea_previous_object(3EXACCT), ea_write_object(3EXACCT).

Sun::Solaris::Exacct::Object Module

Provides object-oriented methods to access the individual exacct accounting file object. An exacct object is represented as an opaque reference that is blessed into the appropriate Sun::Solaris::Exacct::Object subclass. This module is further subdivided into the two types of possible object: Item and Group. Methods are also provided to access the ea_match_object_catalog(3EXACCT), ea_attach_to_object(3EXACCT) functions.

Sun::Solaris::Exacct::Object::Item Module

Provides object-oriented methods to access an individual exacct accounting file Item. Objects of this type inherit from Sun::Solaris::Exacct::Object.

Sun::Solaris::Exacct::Object::Group Module

Provides object-oriented methods to access an individual exacct accounting file Group. Objects of this type inherit from Sun::Solaris::Exacct::Object, and provide access to the ea_attach_to_group(3EXACCT) function. The Items contained within the Group are presented as a perl array.

Sun::Solaris::Exacct::Object::_Array Module

Private array type, used as the type of the array within a Sun::Solaris::Exacct::Object::Group.

Sun::Solaris::Project Module

The Sun::Solaris::Project module provides wrappers for the project-related system calls and the libproject(3LIB) library.

Sun::Solaris::Project Constants

The Sun::Solaris::Project module uses constants from the project-related header files.

MAXPROJID

PROJNAME_MAX

PROJF_PATH

PROJECT_BUFSZ

SETPROJ_ERR_TASK

SETPROJ_ERR_POOL

Sun::Solaris::Project Functions, Class Methods, and Object Methods

The perl extensions to the libexacct(3LIB) API provide the following functions for projects.

setproject(3PROJECT)

setprojent(3PROJECT)

getdefaultproj(3PROJECT)

inproj(3PROJECT)

getprojent(3PROJECT)

fgetprojent(3PROJECT)

getprojbyname(3PROJECT)

getprojbyid(3PROJECT)

getprojbyname(3PROJECT)

endprojent(3PROJECT)

The Sun::Solaris::Project module has no class methods.

The Sun::Solaris::Project module has no object methods.

Sun::Solaris::Project Exports

By default, nothing is exported from this module. The following tags can be used to selectively import constants and functions defined in this module.

Tag

Constant or Function

:SYSCALLS

getprojid()

:LIBCALLS

setproject(), activeprojects(), getprojent(), setprojent(), endprojent(), getprojbyname(), getprojbyid(), getdefaultproj(), fgetprojent(), inproj(), getprojidbyname()

:CONSTANTS

MAXPROJID_TASK, PROJNAME_MAX, PROJF_PATH, PROJECT_BUFSZ, SETPROJ_ERR, SETPROJ_ERR_POOL

:ALL

:SYSCALLS, :LIBCALLS, :CONSTANTS

Sun::Solaris::Task Module

The Sun::Solaris::Task module provides wrappers for the settaskid(2) and gettaskid(2) system calls.

Sun::Solaris::Task Constants

The Sun::Solaris::Task module uses the following constants.

TASK_NORMAL

TASK_FINAL

Sun::Solaris::Task Functions, Class Methods, and Object Methods

The perl extensions to the libexacct(3LIB) API provides the following functions for tasks.

settaskid(2)

gettaskid(2)

The Sun::Solaris::Task module has no class methods.

The Sun::Solaris::Task module has no object methods.

Sun::Solaris::Task Exports

By default, nothing is exported from this module. The following tags can be used to selectively import constants and functions defined in this module.

Tag

Constant or Function

:SYSCALLS

settaskid(), gettaskid()

:CONSTANTS

TASK_NORMAL and TASK_FINAL

:ALL

:SYSCALLS and :CONSTANTS

Sun::Solaris::Exacct Module

The Sun::Solaris::Exacct module provides wrappers for the ea_error(3EXACCT) function, and for all the exacct system calls.

Sun::Solaris::Exacct Constants

The 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 Methods

The perl extensions to the libexacct(3LIB) API provide the following functions for the Sun::Solaris::Exacct module.

getacct(2)

putacct(2)

wracct(2)

ea_error(3EXACCT)

ea_error_str

ea_register_catalog

ea_new_file

ea_new_item

ea_new_group

ea_dump_object


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 Exports

By default, nothing is exported from this module. The following tags can be used to selectively import constants and functions defined in this module.

Tag

Constant or Function

:SYSCALLS

getacct(), putacct(), wracct()

:LIBCALLS

ea_error(), ea_error_str()

:CONSTANTS

P_PID, P_TASKID, P_PROJID

, EW_*, EP_*, EXR_*

:SHORTAND

ea_register_catalog(), ea_new_catalog(), ea_new_file(), ea_new_item(), ea_new_group(), ea_dump_object()

:ALL

:SYSCALLS, :LIBCALLS, :CONSTANTS and :SHORTHAND

:EXACCT_CONSTANTS

:CONSTANTS, plus the :CONSTANTS tags for Sun::Solaris::Catalog, Sun::Solaris::File, Sun::Solaris::Object

:EXACCT_ALL

:ALL, plus the :ALL tags for Sun::Solaris::Catalog, Sun::Solaris::File, Sun::Solaris::Object

Sun::Solaris::Exacct::Catalog Module

The 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 Constants

All 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 Methods

The Perl extensions to the libexacct(3LIB) API provide the following class methods forSun::Solaris::Exacct::Catalog. Exacct(3PERL) andExacct::Catalog(3PERL)

register

new

The Perl extensions to the libexacct(3LIB) API provide the following object methods for Sun::Solaris::Exacct::Catalog.

value

type

catalog

id

type_str

catalog_str

id_str

Sun::Solaris::Exacct::Catalog Exports

By default, nothing is exported from this module. The following tags can be used to selectively import constants and functions defined in this module.

Tag

Constant or Function

:CONSTANTS

EXT_*, EXC_* and EXD_*.

:ALL

:CONSTANTS

Additionally, any constants defined with the register() function can optionally be exported into the caller's package.

Sun::Solaris::Exacct::File Module

The 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:

ea_open(3EXACCT)

ea_close(3EXACCT)

ea_next_object(3EXACCT)

ea_previous_object(3EXACCT)

ea_write_object(3EXACCT)

ea_get_object(3EXACCT)

ea_get_creator(3EXACCT)

ea_get_hostname(3EXACCT)

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 Constants

Sun::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 Methods

The 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.

new

The following table describes the new() action for combinations of the $oflags and $aflags parameters.

Table 4-2 $oflags and $aflags Parameters

$oflags

$aflags

Action

O_RDONLY

Absent or EO_HEAD

Open for reading at the start of the file.

O_RDONLY

EO_TAIL

Open for reading at the end of the file.

O_WRONLY

Ignored

File must exist, open for writing at the end of the file.

O_WRONLY | O_CREAT

Ignored

Create file if the file does not exist. Otherwise, truncate, and open for writing.

O_RDWR

Ignored

File must exist, open for reading or writing, at the end of the file.

O_RDWR | O_CREAT

Ignored

Create file if the file does not exist. Otherwise, truncate, and open for reading or writing.


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.

creator

hostname

next

previous

get

write


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 Exports

By default, nothing is exported from this module. The following tags can be used to selectively import constants that are defined in this module.

Tag

Constant or Function

:CONSTANTS

EO_HEAD, EO_TAIL, EO_NO_VALID_HDR, EO_POSN_MSK, EO_VALIDATE_MSK.

:ALL

:CONSTANTS and Fcntl(:DEFAULT).

Sun::Solaris::Exacct::Object Module

The 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 Constants

Sun::Solaris::Exacct::Object provides the EO_ERROR, EO_NONE, EO_ITEM and EO_GROUP constants.

Sun::Solaris::Exacct::Object Functions, Class Methods, and Object Methods

The 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.

dump

The Perl extensions to the libexacct(3LIB) API provide the following object methods forSun::Solaris::Exacct::Object.

type

catalog

match_catalog

value

Sun::Solaris::Exacct::Object Exports

By default, nothing is exported from this module. The following tags can be used to selectively import constants and functions defined in this module.

Tag

Constant or Function

:CONSTANTS

EO_ERROR, EO_NONE, EO_ITEM and EO_GROUP

:ALL

:CONSTANTS

Sun::Solaris::Exacct::Object::Item Module

The 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

exacct type

Perl internal type

EXT_UINT8

IV (integer)

EXT_UINT16

IV (integer)

EXT_UINT32

IV (integer)

EXT_UINT64

IV (integer)

EXT_DOUBLE

NV (double)

EXT_STRING

PV (string)

EXT_EXACCT_OBJECT

Sun::Solaris::Exacct::Object subclass

EXT_RAW

PV (string)

Sun::Solaris::Exacct::Object::Item Constants

Sun::Solaris::Exacct::Object::Item has no constants.

Sun::Solaris::Exacct::Object::Item Functions, Class Methods, and Object Methods

Sun::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.

new

Sun::Solaris::Exacct::Object::Item inherits all object methods from the Sun::Solaris::Exacct::Object base class.

Sun::Solaris::Exacct::Object::Item Exports

Sun::Solaris::Exacct::Object::Item has no exports.

Sun::Solaris::Exacct::Object::Group Module

The 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 Constants

Sun::Solaris::Exacct::Object::Group has no constants.

Sun::Solaris::Exacct::Object::Group Functions, Class Methods, and Object Methods

Sun::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.

new

Sun::Solaris::Exacct::Object::Group inherits all object methods from the Sun::Solaris::Exacct::Object base class, plus the new() class method.

as_hash

as_hashlist

Sun::Solaris::Exacct::Object::Group Exports

Sun::Solaris::Exacct::Object::Group has no exports.

Sun::Solaris::Exacct::Object::_Array Module

The 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 Constants

Sun::Solaris::Exacct::Object::_Array has no constants.

Sun::Solaris::Exacct::Object::_Array Functions, Class Methods, and Object Methods

Sun::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 Exports

Sun::Solaris::Exacct::Object::_Array has no exports.

Previous Next

 
 
  Published under the terms fo the Public Documentation License Version 1.01. Design by Interspire