1pool_resource_crPeoaotle(C3oPnOfOiLg)uration Manipulation LibraproyolF_urnecstoiuorncse_create(3POOL)
2
3
4
6 pool_resource_create, pool_resource_destroy, pool_resource_info,
7 pool_query_resource_components, pool_resource_transfer,
8 pool_resource_xtransfer - resource pool resource manipulation functions
9
11 cc [ flag... ] file... -lpool [ library... ]
12 #include <pool.h>
13
14 pool_resource_t *pool_resource_create(pool_conf_t *conf,
15 const char *type, const char *name);
16
17
18 int pool_resource_destroy(pool_conf_t *conf,
19 pool_resource_t *resource);
20
21
22 const char *pool_resource_info(pool_conf_t *conf
23 pool_resource_t *resource, int flags);
24
25
26 pool_component_t **pool_query_resource_components(
27 pool_conf_t *conf, pool_resource_t *resource,
28 uint_t *nelem, pool_value_t **props);
29
30
31 int pool_resource_transfer(pool_conf_t *conf,
32 pool_resource_t *source, pool_resource_t *target,
33 uint64_t size);
34
35
36 int pool_resource_xtransfer(pool_conf_t *conf,
37 pool_resource_t *source, pool_resource_t *target,
38 pool_component_t **components);
39
40
42 The pool_resource_create() function creates and returns a new resource
43 of the given name and type in the provided configuration. If there is
44 already a resource of the given name, the operation will fail.
45
46
47 The pool_resource_destroy() function removes the specified resource
48 from its configuration file.
49
50
51 The pool_resource_info() function returns a string describing the given
52 resource. The string is allocated with malloc(3C). The caller is repon‐
53 sible for freeing the returned string. If the flags argument is non-
54 zero, the string returned also describes the components (if any) con‐
55 tained in the resource.
56
57
58 The pool_query_resource_components() function returns a null-terminated
59 array of the components (if any) that comprise the given resource.
60
61
62 The pool_resource_transfer() function transfers size basic units from
63 the source resource to the target. Both resources must be of the same
64 type for the operation to succeed. Transferring component resources,
65 such as processors, is always performed as series of
66 pool_resource_xtransfer() operations, since discrete resources must be
67 identified for transfer.
68
69
70 The pool_resource_xtransfer() function transfers the specific compo‐
71 nents from the source resource to the target. Both resources must be of
72 the same type, and of a type that contains components (such as proces‐
73 sor sets). The components argument is a null-terminated list of
74 pool_component_t.
75
76
77 The conf argument for each function refers to the target configuration
78 to which the operation applies.
79
81 Upon successful completion, pool_resource_create() returns a new
82 pool_resource_t with default properties initialized. Otherwise, NULL is
83 returned and pool_error(3POOL) returns the pool-specific error value.
84
85
86 Upon successful completion, pool_resource_destroy() returns 0. Other‐
87 wise, -1 is returned and pool_error() returns the pool-specific error
88 value.
89
90
91 Upon successful completion, pool_resource_info() returns a string
92 describing the given resource (and optionally its components). Other‐
93 wise, NULL is returned and pool_error() returns the pool-specific error
94 value.
95
96
97 Upon successful completion, pool_query_resource_components() returns a
98 null-terminated array of pool_component_t * that match the provided
99 null-terminated property list and are contained in the given resource.
100 Otherwise, NULL is returned and pool_error() returns the pool-specific
101 error value.
102
103
104 Upon successful completion, pool_resource_transfer() and
105 pool_resource_xtransfer() return 0. Otherwise -1 is returned and
106 pool_error() returns the pool-specific error value.
107
109 The pool_resource_create() function will fail if:
110
111 POE_BADPARAM The supplied configuration's status is not
112 POF_VALID or name is in use for this resource type.
113
114
115 POE_INVALID_CONF The resource element could not be created because
116 the configuration would be invalid.
117
118
119 POE_PUTPROP One of the supplied properties could not be set.
120
121
122 POE_SYSTEM A system error has occurred. Check the system
123 error code for more details.
124
125
126
127 The pool_resource_destroy() function will fail if:
128
129 POE_BADPARAM The supplied configuration's status is not POF_VALID.
130
131
132
133 The pool_resource_info() function will fail if:
134
135 POE_BADPARAM The supplied configuration's status is not
136 POF_VALID or the flags paramter is neither 0 nor 1.
137
138
139 POE_INVALID_CONF The configuration is invalid.
140
141
142 POE_SYSTEM A system error has occurred. Check the system error
143 code for more details.
144
145
146
147 The pool_query_resource_components() function will fail if:
148
149 POE_BADPARAM The supplied configuration's status is not
150 POF_VALID.
151
152
153 POE_INVALID_CONF The configuration is invalid.
154
155
156 POE_SYSTEM A system error has occurred. Check the system error
157 code for more details.
158
159
160
161 The pool_resource_transfer() function will fail if:
162
163 POE_BADPARAM The supplied configuration's status is not POF_VALID,
164 the two resources are not of the same type, or the
165 transfer would cause either of the resources to exceed
166 their min and max properties.
167
168
169 POE_SYSTEM A system error has occurred. Check the system error
170 code for more details.
171
172
173
174 The pool_resource_xtransfer() function will fail if:
175
176 POE_BADPARAM The supplied configuration's status is not
177 POF_VALID, the two resources are not of the same
178 type, or the supplied resources do not belong to
179 the source.
180
181
182 POE_INVALID_CONF The transfer operation failed and the configuration
183 may be invalid.
184
185
186 POE_SYSTEM A system error has occurred. Check the system error
187 code for more details.
188
189
191 Example 1 Create a new resource of type pset named foo.
192
193 #include <pool.h>
194 #include <stdio.h>
195
196 ...
197
198 pool_conf_t *conf;
199 pool_resource_t *resource;
200 ...
201
202 if ((resource = pool_resource_create(conf, "pset",
203 "foo")) == NULL) {
204 (void) fprintf(stderr, "Cannot create resource0
205 ...
206 }
207
208
210 See attributes(5) for descriptions of the following attributes:
211
212
213
214
215 ┌─────────────────────────────┬─────────────────────────────┐
216 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
217 ├─────────────────────────────┼─────────────────────────────┤
218 │CSI │Enabled │
219 ├─────────────────────────────┼─────────────────────────────┤
220 │Interface Stability │Unstable │
221 ├─────────────────────────────┼─────────────────────────────┤
222 │MT-Level │Safe │
223 └─────────────────────────────┴─────────────────────────────┘
224
226 libpool(3LIB), pool_error(3POOL), attributes(5)
227
228
229
230SunOS 5.11 23 Sep 2003 pool_resource_create(3POOL)