summaryrefslogtreecommitdiff
path: root/usr/src/man/man3pool/pool_get_pool.3pool
blob: 591a40fd3e6591edf46d5f56c15ed51add446b08 (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
'\" te
.\" Copyright (c) 2005, 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 POOL_GET_POOL 3POOL "Jul 18, 2005"
.SH NAME
pool_get_pool, pool_get_resource, pool_query_components, pool_query_pools,
pool_query_resources \- retrieve resource pool configuration elements
.SH SYNOPSIS
.LP
.nf
cc [ \fIflag\fR]\&.\|.\|.  \fIfile\fR\&.\|.\|. \fB-lpool\fR [ \fIlibrary\fR\&.\|.\|. ]
#include <pool.h>

\fBpool_t *\fR\fBpool_get_pool\fR(\fBpool_conf_t *\fR\fIconf\fR, \fBconst char *\fR\fIname\fR);
.fi

.LP
.nf
\fBpool_resource_t *\fR\fBpool_get_resource\fR(\fBpool_conf_t *\fR\fIconf\fR
     \fBconst char *\fR\fItype\fR, \fBconst char *\fR\fIname\fR);
.fi

.LP
.nf
\fBpool_component_t **\fR\fBpool_query_components\fR(\fBpool_conf_t *\fR\fIconf\fR,
     \fBuint_t *\fR\fInelem\fR, \fBpool_value_t **\fR\fIprops\fR);
.fi

.LP
.nf
\fBpool_t **\fR\fBpool_query_pools\fR(\fBpool_conf_t *\fR\fIconf\fR, \fBuint_t *\fR\fInelem\fR,
     \fBpool_value_t **\fR\fIprops\fR);
.fi

.LP
.nf
\fBpool_component_t **\fR\fBpool_query_resources\fR(\fBpool_conf_t *\fR\fIconf\fR,
     \fBuint_t *\fR\fInelem\fR, \fBpool_value_t **\fR\fIprops\fR);
.fi

.SH DESCRIPTION
.sp
.LP
These functions provide a means for querying the contents of the specified
configuration. The \fIconf\fR argument for each function refers to the target
configuration to which the operation applies.
.sp
.LP
The \fBpool_get_pool()\fR function returns the pool with the given name from
the provided configuration.
.sp
.LP
The \fBpool_get_resource()\fR function returns the resource with the given name
and type from the provided configuration.
.sp
.LP
The \fBpool_query_components()\fR function retrieves all resource components
that match the given list of properties. If the list of properties is
\fINULL\fR, all components are returned. The number of elements returned is
stored in the location pointed to by \fInelem\fR. The value returned by
\fBpool_query_components()\fR is allocated with \fBmalloc\fR(3C) and must be
explicitly freed.
.sp
.LP
The \fBpool_query_pools()\fR function behaves similarly to
\fBpool_query_components()\fR and returns the list of pools that match the
given list of properties. The value returned must be freed by the caller.
.sp
.LP
The \fBpool_query_resources()\fR function similarly returns the list of
resources that match the given list of properties. The return value must be
freed by the caller.
.SH RETURN VALUES
.sp
.LP
The \fBpool_get_pool()\fR and \fBpool_get_resource()\fR functions return the
matching pool and resource, respectively. Otherwise, they return \fINULL\fR and
\fBpool_error\fR(3POOL) returns the pool-specific error value.
.sp
.LP
The \fBpool_query_components()\fR, \fBpool_query_pools()\fR, and
\fBpool_query_resources()\fR functions return a null-terminated array of
components, pools, and resources, respectively. If the query was unsuccessful
or there were no matches, \fINULL\fR is returned and \fBpool_error()\fR returns
the pool-specific error value.
.SH ERRORS
.sp
.LP
The \fBpool_get_pool()\fR will fail if:
.sp
.ne 2
.na
\fB\fBPOE_BADPARAM\fR\fR
.ad
.RS 16n
The supplied configuration's status is not \fBPOF_VALID\fR.
.RE

.sp
.LP
The \fBpool_get_resource()\fR will fail if:
.sp
.ne 2
.na
\fB\fBPOE_BADPARAM\fR\fR
.ad
.RS 16n
The supplied configuration's status is not \fBPOF_VALID\fR.
.RE

.sp
.ne 2
.na
\fB\fBPOE_SYSTEM\fR\fR
.ad
.RS 16n
There is not enough memory available to allocate working buffers. Check
\fBerrno\fR for the specific system error code.
.RE

.sp
.LP
The \fBpool_query_components()\fR, \fBpool_query_pools()\fR, and
\fBpool_query_resources()\fR will fail if:
.sp
.ne 2
.na
\fB\fBPOE_BADPARAM\fR\fR
.ad
.RS 20n
The supplied configuration's status is not \fBPOF_VALID\fR.
.RE

.sp
.ne 2
.na
\fB\fBPOE_INVALID_CONF\fR\fR
.ad
.RS 20n
The query generated results that were not of the correct type. The
configuration is invalid.
.RE

.sp
.ne 2
.na
\fB\fBPOE_SYSTEM\fR\fR
.ad
.RS 20n
There is not enough memory available to allocate working buffers. Check
\fBerrno\fR for the specific system error code.
.RE

.SH EXAMPLES
.LP
\fBExample 1 \fRRetrieve the pool named "foo" from a given configuration.
.sp
.in +2
.nf
#include <pool.h>
#include <stdio.h>

\&...

pool_conf_t *conf;
pool_t *pool;

\&...

if ((pool = pool_get_pool(conf, "foo")) == NULL) {
        (void) fprintf(stderr, "Cannot retrieve pool named
        'foo'\\B{}n");
        ...
}
.fi
.in -2

.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
CSI	Enabled
_
Interface Stability	Unstable
_
MT-Level	Safe
.TE

.SH SEE ALSO
.sp
.LP
\fBlibpool\fR(3LIB), \fBpool_error\fR(3POOL), \fBattributes\fR(5)