# # Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. # # # Sun::Solaris::Exacct documentation. # =head1 NAME Sun::Solaris::Exacct - exacct system calls and error handling =head1 SYNOPSIS use Sun::Solaris::Exacct qw(:EXACCT_ALL); my $ea_rec = getacct(P_PID, $$); This module provides access to the C function and for all the extended accounting system calls. Constants from the various C header files are also provided. =head2 Constants The C, C, C and all the C, C, C macros are provided as Perl constants. =head2 Functions B> The C<$idtype> parameter must be either C or C and C<$id> must be a corresponding task or process ID. This function returns an object of type C, representing the unpacked accounting buffer returned by the underlying C system call. In the event of error, C is returned. B> The C<$idtype> parameter must be either C or C and C<$id> must be a corresponding task or process ID. If C<$record> is of type C, it is converted to the corresponding packed libexacct object and passed to the C system call. If C<$record> is not of type C 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 C function. This function returns C on success and C on failure. B> The C<$idtype> parameter must be either C or C and $id must be a corresponding task or process ID. The C<$flags> parameter must be either C or C. The parameters are passed directly to the underlying C system call. This function returns C on success and C on failure. B> This function provides access to the C function. It returns a double-typed scalar that in a numeric context will be one of the C constants. In a string context it will be a descriptive error message. This is the exacct equivalent to the C<$!> (C) Perl variable. B> This function returns a double-typed scalar that in a numeric context will be one of the C constants as returned by C. In a string context it describes the value returned by C. If C returns C, the string value returned is the value returned by C. 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"); } B> This convenience function is a wrapper around the C<< Sun::Solaris::Exacct::Catalog->register() >> method. B> B> B> These convenience functions are wrappers around the C<< Sun::Solaris::Exacct::Catalog->new() >> method. See C. B $creator, aflags => $aflags, mode => $mode) >>> This convenience function is a wrapper around the C<< Sun::Solaris::Exacct::File->new() >> method. See C. B> This convenience function is a wrapper around the C<< Sun::Solaris::Exacct::Object::Item->new() >> method. See C. B> This convenience function is a wrapper around the C<< Sun::Solaris::Exacct::Object::Group->new() >> method. See C. B> This convenience function is a wrapper around the C<< Sun::Solaris::Exacct::Object->dump() >> method. See C. =head2 Class methods None. =head2 Object methods None. =head2 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: :SYSCALLS getacct(), putacct(), and wracct() :LIBCALLS ea_error() and ea_error_str() :CONSTANTS P_PID, P_TASKID, P_PROJID, EW_*, EP_*, and EXR_* :SHORTHAND ea_register_catalog(), ea_new_catalog(), ea_new_file(), ea_new_item(), and ea_new_group() :ALL :SYSCALLS, :LIBCALLS, :CONSTANTS, and :SHORTHAND :EXACCT_CONSTANTS :CONSTANTS, plus the :CONSTANTS tags for Sun::Solaris::Catalog, Sun::Solaris::File, and Sun::Solaris::Object :EXACCT_ALL :ALL, plus the :ALL tags for Sun::Solaris::Catalog, Sun::Solaris::File, and Sun::Solaris::Object =head1 ATTRIBUTES See C for descriptions of the following attributes: ___________________________________________________________ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | |_____________________________|_____________________________| | Availability | CPAN (http://www.cpan.org) | |_____________________________|_____________________________| | Interface Stability | Evolving | |_____________________________|_____________________________| =head1 SEE ALSO C, C, C, C, C, C, C, C, C, C, C =head1 NOTES The modules described in the C 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 C<$!> Perl variable (C). 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::Exacct::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.