1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
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.
|