summaryrefslogtreecommitdiff
path: root/usr/src/man/man3perl/Exacct::Catalog.3perl
blob: be7a09cbe977f744d649b9a8e70ff07a3a64b2f3 (plain)
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
'\" 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::Catalog 3PERL "1 Dec 2002" "SunOS 5.11" "Perl Library Functions"
.SH NAME
Exacct::Catalog \- exacct catalog tag manipulation
.SH SYNOPSIS
.LP
.nf
use Sun::Solaris::Exacct::Catalog qw(:ALL);
my $ea_cat = Sun::Solaris::Exacct::Catalog->new(
    &EXT_UINT64 | &EXC_DEFAULT | &EXD_PROC_PID);
.fi

.SH DESCRIPTION
.sp
.LP
This class provides a wrapper around the 32-bit integer used as a catalog tag.
The catalog tag is represented as a Perl object blessed into the
\fBSun::Solaris::Exacct::Catalog\fR class so that methods can be used to
manipulate fields in a catalog tag.
.SS "Constants"
.sp
.LP
All the \fBEXT_\fR*, \fBEXC_\fR*, and \fBEXD_\fR* macros are provided as
constants.  Constants passed to the methods below can either be the integer
value such as \fBEXT_UINT8\fR or the string representation such as
"\fBEXT_UINT8\fR".
.SS "Functions"
.sp
.LP
None.
.SS "Class methods"
.sp
.ne 2
.mk
.na
\fB\fBregister($cat_pfx, $catalog_id, $export, @idlist)\fR\fR
.ad
.sp .6
.RS 4n
This method is used to register application-defined \fBlibexacct\fR(3LIB)
catalogs with the exacct Perl library. See
<\fB/usr/include/sys/exacct_catalog.h\fR> for details of the catalog tag
format.  This method allows symbolic names and strings to be used for
manipulating application-defined catalogs. The first two parameters define the
catalog prefix and associated numeric catalog ID. If the \fB$export\fR
parameter is true, the constants are exported into the caller's package. The
final parameter is a list of (\fBid\fR, \fBname\fR) pairs that identify the
required constants. The constants created by this method are formed by
appending \fB$cat_pfx\fR and "_" to each name in the list, replacing any spaces
with underscore characters and converting the resulting string to uppercase
characters. The \fB$catalog_name\fR value is also created as a constant by
prefixing it with\fB EXC_\fR and converting it to uppercase characters. Its
value becomes that of \fB$catalog_id\fR shifted left by 24 bits. For example,
the following call:
.sp
.in +2
.nf
Sun::Solaris::Exacct::Catalog->ea_register("MYCAT", 0x01, 1,
   FIRST => 0x00000001, SECOND => 0x00000010);
.fi
.in -2

results in the definition of the following constants:
.sp
.in +2
.nf
EXC_MYCAT    0x01 << 24
MYCAT_FIRST  0x00000001
MYCAT_SECOND 0x00000010 
.fi
.in -2

Only the catalog ID value of 0x01 is available for application use
(\fBEXC_LOCAL\fR). All other values are reserved.  While it is possible to use
values other than 0x01, they might conflict with future extensions to the
\fBlibexacct\fR file format.
.sp
If any errors are detected during this method, a string is returned containing
the appropriate error message. If the call is sucessful, \fBundef\fR is
returned.
.RE

.sp
.ne 2
.mk
.na
\fB\fBnew($integer)\fR\fR
.ad
.br
.na
\fB\fBnew($cat_obj)\fR\fR
.ad
.br
.na
\fB\fBnew($type, $catalog, $id)\fR\fR
.ad
.sp .6
.RS 4n
This method creates and returns a new Catalog object, which is a wrapper around
a 32-bit integer catalog tag. Three possible argument lists can be given. The
first variant is to pass an integer formed by bitwise-inclusive OR of the
appropriate \fBEX[TCD]_\fR* constants. The second variant is to pass an
existing Catalog object that will be copied. The final variant is to pass in
the type, catalog and ID fields as separate values. Each of these values can be
either an appropriate integer constant or the string representation of the
constant.
.RE

.SS "Object methods"
.sp
.ne 2
.mk
.na
\fB\fBvalue()\fR\fR
.ad
.RS 17n
.rt  
This method allows the value of the catalog tag to be queried. In a scalar
context it returns the 32-bit integer representing the tag. In a list context
it returns a (\fBtype\fR, \fBcatalog\fR, \fBid\fR) triplet, where each member
of the triplet is a dual-typed scalar.
.RE

.sp
.ne 2
.mk
.na
\fB\fBtype()\fR\fR
.ad
.RS 17n
.rt  
This method returns the type field of the catalog tag as a dual-typed scalar.
.RE

.sp
.ne 2
.mk
.na
\fB\fBcatalog()\fR\fR
.ad
.RS 17n
.rt  
This method returns the catalog field of the catalog tag as a dual-typed
scalar.
.RE

.sp
.ne 2
.mk
.na
\fB\fBid()\fR\fR
.ad
.RS 17n
.rt  
This method returns the id field of the catalog tag as a dual-typed scalar.
.RE

.sp
.ne 2
.mk
.na
\fB\fBtype_str()\fR\fR
.ad
.br
.na
\fB\fBcatalog_str()\fR\fR
.ad
.br
.na
\fB\fBid_str()\fR\fR
.ad
.RS 17n
.rt  
These methods return string representations of the appropriate value. These
methods can be used for textual output of the various catalog fields. The
string representations of the constants are formed by removing the \fBEXT_\fR,
\fBEXC_\fR, or \fBEXD_\fR prefix, replacing any underscore characters with
spaces, and converting the remaining string to lowercase characters.
.RE

.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:CONSTANTS\fR\fR
.ad
.RS 14n
.rt  
\fBEXT_\fR*, \fBEXC_\fR*, and \fBEXD_\fR*
.RE

.sp
.ne 2
.mk
.na
\fB\fB:ALL\fR\fR
.ad
.RS 14n
.rt  
\fB:CONSTANTS\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
\fBExacct\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)