summaryrefslogtreecommitdiff
path: root/usr/src/man/man3perl/Exacct.3perl
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/man/man3perl/Exacct.3perl')
-rw-r--r--usr/src/man/man3perl/Exacct.3perl351
1 files changed, 351 insertions, 0 deletions
diff --git a/usr/src/man/man3perl/Exacct.3perl b/usr/src/man/man3perl/Exacct.3perl
new file mode 100644
index 0000000000..c0fd1cb75b
--- /dev/null
+++ b/usr/src/man/man3perl/Exacct.3perl
@@ -0,0 +1,351 @@
+'\" te
+.\" Copyright (c) 2002, Sun Microsystems, Inc. All Rights Reserved.
+.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
+.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
+.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
+.TH Exacct 3PERL "1 Dec 2002" "SunOS 5.11" "Perl Library Functions"
+.SH NAME
+Exacct \- exacct system calls and error handling
+.SH SYNOPSIS
+.LP
+.nf
+use Sun::Solaris::Exacct qw(:EXACCT_ALL);
+my $ea_rec = getacct(P_PID, $$);
+.fi
+
+.SH DESCRIPTION
+.sp
+.LP
+This module provides access to the \fBea_error\fR(3EXACCT) function and for all
+the extended accounting system calls. Constants from the various
+\fBlibexacct\fR(3LIB) header files are also provided.
+.SS "Constants"
+.sp
+.LP
+The \fBP_PID\fR, \fBP_TASKID\fR, \fBP_PROJID\fR and all the \fBEW_*\fR,
+\fBEP_*\fR, \fBEXR_*\fR macros are provided as Perl constants.
+.SS "Functions"
+.sp
+.ne 2
+.mk
+.na
+\fB\fBgetacct($idtype, $id)\fR\fR
+.ad
+.sp .6
+.RS 4n
+The \fB$idtype\fR parameter must be either \fBP_TASKID\fR or \fBP_PID\fR and
+\fB$id\fR must be a corresponding task or process ID. This function returns an
+object of type \fBSun::Solaris::Exacct::Object\fR, representing the unpacked
+accounting buffer returned by the underlying \fBgetacct\fR(2) system call. In
+the event of error, \fBundef\fR is returned.
+.RE
+
+.sp
+.ne 2
+.mk
+.na
+\fB\fBputacct($idtype, $id, $record)\fR\fR
+.ad
+.sp .6
+.RS 4n
+The \fB$idtype\fR parameter must be either \fBP_TASKID\fR or \fBP_PID\fR and
+\fB$id\fR must be a corresponding task or process ID. If $record is of type
+Sun::Solaris::Exacct::Object, it is converted to the corresponding packed
+\fBlibexacct\fR object and passed to the \fBputacct\fR(2) system call. If
+\fB$record\fR is not of type \fBSun::Solaris::Exacct::Object\fR 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 \fBpack()\fR function. This function returns true on
+success and false on failure.
+.RE
+
+.sp
+.ne 2
+.mk
+.na
+\fB\fBwracct($idtype, $id, $flags)\fR\fR
+.ad
+.sp .6
+.RS 4n
+The \fB$idtype\fR parameter must be either \fBP_TASKID\fR or \fBP_PID\fR and
+\fB$id\fR must be a corresponding task or process ID. The \fB$flags\fR
+parameter must be either \fBEW_INTERVAL\fR or \fBEW_PARTIAL\fR. The parameters
+are passed directly to the underlying \fBwracct\fR(2) system call. This
+function returns true on success and false on failure.
+.RE
+
+.sp
+.ne 2
+.mk
+.na
+\fB\fBea_error()\fR\fR
+.ad
+.sp .6
+.RS 4n
+This function provides access to the \fBea_error\fR(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 \fB$!(errno)\fR Perl variable.
+.RE
+
+.sp
+.ne 2
+.mk
+.na
+\fB\fBea_error_str()\fR\fR
+.ad
+.sp .6
+.RS 4n
+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 \fBstrerror\fR(3C). This
+function is provided as a convenience so that repeated blocks of code like the
+following can be avoided:
+.sp
+.in +2
+.nf
+if (ea_error() == EXR_SYSCALL_FAIL) {
+ print("error: $!\en");
+} else {
+ print("error: ", ea_error(), "\en");
+}
+.fi
+.in -2
+
+.RE
+
+.sp
+.ne 2
+.mk
+.na
+\fB\fBea_register_catalog($cat_pfx, $catalog_id, $export, @idlist)\fR\fR
+.ad
+.sp .6
+.RS 4n
+This convenience function is a wrapper around the
+\fBSun::Solaris::Exacct::Catalog->register()\fR method.
+.RE
+
+.sp
+.ne 2
+.mk
+.na
+\fB\fBea_new_catalog($integer)\fR\fR
+.ad
+.br
+.na
+\fB\fBea_new_catalog($cat_obj)\fR\fR
+.ad
+.br
+.na
+\fB\fBea_new_catalog($type, $catalog, $id)\fR\fR
+.ad
+.sp .6
+.RS 4n
+These convenience functions are wrappers around the
+\fBSun::Solaris::Exacct::Catalog->new()\fR method. See
+\fBExacct::Catalog\fR(3PERL).
+.RE
+
+.sp
+.ne 2
+.mk
+.na
+\fB\fBea_new_file($name, $oflags, creator => $creator, aflags => $aflags, mode
+=> $mode)\fR\fR
+.ad
+.sp .6
+.RS 4n
+This convenience function is a wrapper around the
+\fBSun::Solaris::Exacct::File->new()\fR method. See \fBExacct::File\fR(3PERL).
+.RE
+
+.sp
+.ne 2
+.mk
+.na
+\fB\fBea_new_item($catalog, $value)\fR\fR
+.ad
+.sp .6
+.RS 4n
+This convenience function is a wrapper around the
+\fBSun::Solaris::Exacct::Object::Item->new()\fR method. See
+\fBExacct::Object::Item\fR(3PERL).
+.RE
+
+.sp
+.ne 2
+.mk
+.na
+\fB\fBea_new_group($catalog, @objects)\fR\fR
+.ad
+.sp .6
+.RS 4n
+This convenience function is a wrapper around the
+\fBSun::Solaris::Exacct::Object::Group->new()\fR method. See
+\fBExacct::Object::Group\fR(3PERL).
+.RE
+
+.sp
+.ne 2
+.mk
+.na
+\fB\fBea_dump_object($object, $filehandle)\fR\fR
+.ad
+.sp .6
+.RS 4n
+This convenience function is a wrapper around the
+\fBSun::Solaris::Exacct::Object->dump()\fR method. See
+\fBExacct::Object\fR(3PERL).
+.RE
+
+.SS "Class methods"
+.sp
+.LP
+None.
+.SS "Object methods"
+.sp
+.LP
+None.
+.SS "Exports"
+.sp
+.LP
+By default nothing is exported from this module. The following tags can be used
+to selectively import constants and functions defined in this module:
+.sp
+.ne 2
+.mk
+.na
+\fB\fB:SYSCALLS\fR\fR
+.ad
+.RS 21n
+.rt
+\fBgetacct()\fR, \fBputacct()\fR, and \fBwracct()\fR
+.RE
+
+.sp
+.ne 2
+.mk
+.na
+\fB\fB:LIBCALLS\fR\fR
+.ad
+.RS 21n
+.rt
+\fBea_error()\fR and \fBea_error_str()\fR
+.RE
+
+.sp
+.ne 2
+.mk
+.na
+\fB\fB:CONSTANTS\fR\fR
+.ad
+.RS 21n
+.rt
+\fBP_PID\fR, \fBP_TASKID\fR, \fBP_PROJID\fR, \fBEW_*\fR, \fBEP_*\fR, and
+\fBEXR_*\fR
+.RE
+
+.sp
+.ne 2
+.mk
+.na
+\fB\fB:SHORTHAND\fR\fR
+.ad
+.RS 21n
+.rt
+\fBea_register_catalog()\fR, \fBea_new_catalog()\fR, \fBea_new_file()\fR,
+\fBea_new_item()\fR, and \fBea_new_group()\fR
+.RE
+
+.sp
+.ne 2
+.mk
+.na
+\fB\fB:ALL\fR\fR
+.ad
+.RS 21n
+.rt
+\fB:SYSCALLS\fR, \fB:LIBCALLS\fR, \fB:CONSTANTS\fR, and \fB:SHORTHAND\fR
+.RE
+
+.sp
+.ne 2
+.mk
+.na
+\fB\fB:EXACCT_CONSTANTS\fR\fR
+.ad
+.RS 21n
+.rt
+\fB:CONSTANTS\fR, plus the \fB:CONSTANTS\fR tags for
+\fBSun::Solaris::Catalog\fR, \fBSun::Solaris::File\fR, and
+\fBSun::Solaris::Object\fR
+.RE
+
+.sp
+.ne 2
+.mk
+.na
+\fB\fB:EXACCT_ALL\fR\fR
+.ad
+.RS 21n
+.rt
+\fB:ALL\fR, plus the \fB:ALL\fR tags for \fBSun::Solaris::Catalog\fR,
+\fBSun::Solaris::File\fR, and \fBSun::Solaris::Object\fR
+.RE
+
+.SH ATTRIBUTES
+.sp
+.LP
+See \fBattributes\fR(5) for descriptions of the following attributes:
+.sp
+
+.sp
+.TS
+tab() box;
+cw(2.75i) |cw(2.75i)
+lw(2.75i) |lw(2.75i)
+.
+ATTRIBUTE TYPEATTRIBUTE VALUE
+_
+Interface StabilityEvolving
+.TE
+
+.SH SEE ALSO
+.sp
+.LP
+\fBgetacct\fR(2), \fBputacct\fR(2), \fBwracct\fR(2), \fBea_error\fR(3EXACCT),
+\fBExacct::Catalog\fR(3PERL), \fBExacct::File\fR(3PERL),
+\fBExacct::Object\fR(3PERL), \fBExacct::Object::Group\fR(3PERL),
+\fBExacct::Object::Item\fR(3PERL), \fBlibexacct\fR(3LIB), \fBattributes\fR(5)
+.SH NOTES
+.sp
+.LP
+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 \fB$!\fR Perl variable (\fBerrno\fR). 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:
+.sp
+.in +2
+.nf
+# Assume $obj is a Sun::Solaris::Item
+my $type = $obj->type();
+
+# Print "2 EO_ITEM"
+printf("%d %s\en", $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";
+.fi
+.in -2
+
+.sp
+.LP
+Wherever a function or method is documented as returning a double-typed scalar,
+the returned value exhibits this type of behavior.