Go to main content

Administering Resource Management in Oracle® Solaris 11.4

Exit Print View

Updated: August 2018
 
 

Perl Interface to the libexacct Library

The Perl interface allows you to create Perl scripts that can read the accounting files produced by the exacct framework. You can also create Perl scripts that write exacct files.

The interface is functionally equivalent to the underlying C API. When possible, the data obtained from the underlying C API is presented as Perl data types. This interface allows easier access to the data, and removes the need for buffer pack and unpack operations. Moreover, all memory management is performed by the Perl library.

The various project, task, and exacct-related functions are separated into groups. Each group of functions is located in a separate Perl module. Each module begins with Oracle Solaris standard Sun::Solaris:: Perl package prefix. All of the classes provided by the Perl exacct library are found under the Sun::Solaris::Exacct module.

The underlying libexacct library provides operations on exacct format files, catalog tags, and exacct objects. The exacct objects are subdivided into two types:

  • Items, which are single-data values (scalars)

  • Groups, which are lists of Items

The following table summarizes each of the modules.

Module Name (should not contain spaces)
Function Reference
For More Information
Sun::Solaris::Project
Sun::Solaris::Task
This module provides functions to access the task manipulation functions gettaskid(2) and settaskid(2).
Sun::Solaris::Exacct
This module is the top-level exacct module. This module provides functions to access the exacct-related system calls getacct(2), putacct(2), and wracct(2).
This module also provides functions to access the libexacct(3LIB) library function ea_error(3EXACCT). Constants for all of the exacct EO_*, EW_*, EXR_*, P_*, and TASK_* macros are also provided in this module.
Sun::Solaris::Exacct:: Catalog
This module provides object-oriented methods to access the bitfields in an exacct catalog tag.
This module also provides access to the constants for the EXC_*, EXD_*, and EXD_* macros.
Sun::Solaris::Exacct:: File
This module provides object-oriented methods to access the libexacct accounting file functions ea_open(3EXACCT), ea_close(3EXACCT), ea_get_creator(3EXACCT), ea_get_hostname(3EXACCT), ea_next_object(3EXACCT), ea_previous_object(3EXACCT), and ea_write_object(3EXACCT).
Sun::Solaris::Exacct:: Object
This module provides object-oriented methods to access an individual exacct accounting file object. An exacct object is represented as an opaque reference blessed into the appropriate Sun::Solaris::Exacct::Object subclass.
This module is further subdivided into the object types Item and Group. At this level, there are methods to access the ea_match_object_catalog(3EXACCT) and ea_attach_to_object(3EXACCT) functions.
Sun::Solaris::Exacct:: Object::Group
This module provides object-oriented methods to access an individual exacct accounting file Group. Objects of this type inherit from the Sun::Solaris::Exacct::Object module. These objects 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::Item
This module provides object-oriented methods to access an individual exacct accounting file Item. Objects of this type inherit from the Sun::Solaris::Exacct::Object module.
Sun::Solaris::Kstat
This module provides a Perl tied hash interface to the kstat facility. A usage example for this module can be found in the /bin/kstat file, which is written in Perl.

For examples that show how to use the modules described in the previous table, see Using the Perl Interface to libexacct.