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

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