Exacct - exacct system calls and error handling
use Sun::Solaris::Exacct qw(:EXACCT_ALL); my $ea_rec = getacct(P_PID, $$);
This module provides access to the ea_error(3EXACCT) function and for all the extended accounting system calls. Constants from the various libexacct(3LIB) header files are also provided.
The P_PID, P_TASKID, P_PROJID and all the EW_*, EP_*, EXR_* macros are provided as Perl constants.
The $idtype parameter must be either P_TASKID or P_PID and $id must be a corresponding task or process ID. This function returns an object of type Sun::Solaris::Exacct::Object, representing the unpacked accounting buffer returned by the underlying getacct(2) system call. In the event of error, undef is returned.
The $idtype parameter must be either P_TASKID or P_PID and $id must be a corresponding task or process ID. If $record is of type Sun::Solaris::Exacct::Object, it is converted to the corresponding packed libexacct object and passed to the putacct(2) system call. If $record is not of type Sun::Solaris::Exacct::Object it is converted to a string using the normal Perl conversion rules and stored as a raw buffer. For predictable and endian-independent results, any raw buffers should be constructed using the Perl pack() function. This function returns true on success and false on failure.
The $idtype parameter must be either P_TASKID or P_PID and $id must be a corresponding task or process ID. The $flags parameter must be either EW_INTERVAL or EW_PARTIAL . The parameters are passed directly to the underlying wracct(2) system call. This function returns true on success and false on failure.
This function provides access to the ea_error(3EXACCT) function. It returns a double-typed scalar that becomes one of the EXR_* constants. In a string context it becomes a descriptive error message. This is the exacct equivalent to the $!(errno) Perl variable.
This function returns a double-typed scalar that in a numeric context will be one of the EXR_* constants as returned by ea_error. In a string context it describes the value returned by ea_error. If ea_error returns EXR_SYSCALL_FAIL, the string value returned is the value returned by strerror(3C). This function 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"); }
This convenience function is a wrapper around the Sun::Solaris::Exacct::Catalog->register() method.
These convenience functions are wrappers around the Sun::Solaris::Exacct::Catalog->new() method. See Exacct::Catalog(3PERL).
This convenience function is a wrapper around the Sun::Solaris::Exacct::File->new() method. See Exacct::File(3PERL).
This convenience function is a wrapper around the Sun::Solaris::Exacct::Object::Item->new() method. See Exacct::Object::Item(3PERL).
This convenience function is a wrapper around the Sun::Solaris::Exacct::Object::Group->new() method. See Exacct::Object::Group(3PERL).
This convenience function is a wrapper around the Sun::Solaris::Exacct::Object->dump() method. See Exacct::Object(3PERL).
None.
None.
By default nothing is exported from this module. The following tags can be used to selectively import constants and functions defined in this module:
getacct(), putacct(), and wracct()
ea_error() and ea_error_str()
P_PID, P_TASKID, P_PROJID, EW_*, EP_*, and EXR_*
ea_register_catalog(), ea_new_catalog(), ea_new_file(), ea_new_item(), and ea_new_group()
:SYSCALLS, :LIBCALLS, :CONSTANTS, and :SHORTHAND
:CONSTANTS, plus the :CONSTANTS tags for Sun::Solaris::Catalog, Sun::Solaris::File, and Sun::Solaris::Object
:ALL, plus the :ALL tags for Sun::Solaris::Catalog, Sun::Solaris::File, and Sun::Solaris::Object
See attributes(5) for descriptions of the following attributes:
|
getacct(2), putacct(2), wracct(2), ea_error(3EXACCT), Exacct::Catalog(3PERL), Exacct::File(3PERL), Exacct::Object(3PERL), Exacct::Object::Group(3PERL), Exacct::Object::Item(3PERL), libexacct(3LIB), attributes(5)
The modules described in the section 3PERL manual pages make extensive use of the Perl "double-typed scalar" facility. This facility allows a scalar value to behave either as an integer or as a string, depending upon context. It is the same behavior as exhibited by the $! Perl variable (errno). It is useful because it avoids the need to map from an integer value to the corresponding string to display a value. Some examples are provided below:
# Assume $obj is a Sun::Solaris::Item my $type = $obj->type(); # Print "2 EO_ITEM" printf("%d %s\n", $type, $type); # Behave as an integer, $i == 2 my $i = 0 + $type; # Behave as a string, $s = "abc EO_ITEM xyx" my $s = "abc $type xyz";
Wherever a function or method is documented as returning a double-typed scalar, the returned value exhibits this type of behavior.