2 .\" Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved.
3 .\" 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.
4 .\" 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
5 .\" the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH POOL_CONF_ALLOC 3POOL "Aug 3, 2009"
8 pool_conf_alloc, pool_conf_close, pool_conf_commit, pool_conf_export,
9 pool_conf_free, pool_conf_info, pool_conf_location, pool_conf_open,
10 pool_conf_remove, pool_conf_rollback, pool_conf_status, pool_conf_update,
11 pool_conf_validate \- manipulate resource pool configurations
15 cc [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-lpool\fR [ \fIlibrary\fR\&.\|.\|. ]
18 \fBpool_conf_t *\fR\fBpool_conf_alloc\fR(\fBvoid\fR);
23 \fBint\fR \fBpool_conf_close\fR(\fBpool_conf_t *\fR\fIconf\fR);
28 \fBint\fR \fBpool_conf_commit\fR(\fBpool_conf_t *\fR\fIconf\fR, \fBint\fR \fIactive\fR);
33 \fBint\fR \fBpool_conf_export\fR(\fBpool_conf_t *\fR\fIconf\fR, \fBconst char *\fR\fIlocation\fR,
34 \fBpool_export_format_t\fR \fIformat\fR);
39 \fBvoid\fR \fBpool_conf_free\fR(\fBpool_conf_t *\fR\fIconf\fR);
44 \fBchar *\fR\fBpool_conf_info\fR(\fBconst pool_conf_t *\fR\fIconf\fR, \fBint\fR \fIflags\fR);
49 \fBconst char *\fR\fBpool_conf_location\fR(\fBpool_conf_t *\fR\fIconf\fR);
54 \fBint\fR \fBpool_conf_open\fR(\fBpool_conf_t *\fR\fIconf\fR, \fBconst char *\fR\fIlocation\fR,
55 \fBint\fR \fIflags\fR);
60 \fBint\fR \fBpool_conf_remove\fR(\fBpool_conf_t *\fR\fIconf\fR);
65 \fBint\fR \fBpool_conf_rollback\fR(\fBpool_conf_t *\fR\fIconf\fR);
70 \fBpool_conf_state_t\fR \fBpool_conf_status\fR(\fBconst pool_conf_t *\fR\fIconf\fR);
75 \fBint\fR \fBpool_conf_update\fR(\fBconst pool_conf_t *\fR\fIconf\fR, \fBint *\fR\fIchanged\fR);
80 \fBint\fR \fBpool_conf_validate\fR(\fBpool_conf_t *\fR\fIconf\fR,
81 \fBpool_valid_level_t\fR \fIlevel\fR);
87 These functions enable the access and creation of configuration files
88 associated with the pools facility. Since the pool configuration is an opaque
89 type, an initial configuration is obtained with \fBpool_conf_alloc()\fR and
90 released with \fBpool_conf_free()\fR when the configuration is no longer of
91 interest. The \fIconf\fR argument for each function refers to the target
92 configuration to which the operation applies.
95 The \fBpool_conf_close()\fR function closes the given configuration, releasing
99 The \fBpool_conf_commit()\fR function commits changes made to the given
100 \fBpool_conf_t\fR to permanent storage. If the \fIactive\fR flag is non-zero,
101 the state of the system will be configured to match that described in the
102 supplied \fBpool_conf_t\fR. If configuring the system fails,
103 \fBpool_conf_commit()\fR will attempt to restore the system to its previous
107 The \fBpool_conf_export()\fR function saves the given configuration to the
108 specified location. The only currently supported value of \fIformat\fR is
109 \fBPOX_NATIVE\fR, which is the format native to \fBlibpool\fR, the output of
110 which can be used as input to \fBpool_conf_open()\fR.
113 The \fBpool_conf_info()\fR function returns a string describing the entire
114 configuration. The string is allocated with \fBmalloc\fR(3C). The caller is
115 responsible for freeing the returned string. If the flags option is non-zero,
116 the string returned also describes the sub-elements (if any) contained in the
120 The \fBpool_conf_location()\fR function returns the location string provided to
121 \fBpool_conf_open()\fR for the given \fBpool_conf_t\fR.
124 The \fBpool_conf_open()\fR function creates a \fBpool_conf_t\fR given a
125 location at which the configuration is stored. The valid flags are a bitmap of
130 \fB\fBPO_RDONLY\fR\fR
133 Open for reading only.
151 Create a configuration at the given location if it does not exist. If it does,
161 Perform `discovery'. This option only makes sense when used in conjunction with
162 \fBPO_CREAT\fR, and causes the returned \fBpool_conf_t\fR to contain the
163 resources and components currently active on the system.
165 The use of this flag is deprecated. \fBPO_CREAT\fR always performs discovery.
166 If supplied, this flag is ignored.
172 \fB\fBPO_UPDATE\fR\fR
175 Use when opening the dynamic state file, which is the configuration at
176 \fBpool_dynamic_location\fR(3POOL), to ensure that the contents of the dynamic
177 state file are updated to represent the current state of the system.
179 The use of this flag is deprecated. The dynamic state is always current and
180 does not require updating. If supplied, this flag is ignored.
185 A call to \fBpool_conf_open()\fR with the pool dynamic location and write
186 permission will hang if the dynamic location has already been opened for
190 The \fBpool_conf_remove()\fR function removes the configuration's permanent
191 storage. If the configuration is still open, it is first closed.
194 The \fBpool_conf_rollback()\fR function restores the configuration state to
195 that held in the configuration's permanent storage. This will either be the
196 state last successfully committed (using \fBpool_conf_commit()\fR) or the state
197 when the configuration was opened if there have been no successfully committed
201 The \fBpool_conf_status()\fR function returns the status of a configuration,
202 which can be one of the following values:
206 \fB\fBPOF_INVALID\fR\fR
209 The configuration is not in a suitable state for use.
215 \fB\fBPOF_VALID\fR\fR
218 The configuration is in a suitable state for use.
223 The \fBpool_conf_update()\fR function updates the library snapshot of kernel
224 state. If \fIchanged\fR is non-null, it is updated to identify which types of
225 configuration elements changed during the update. To check for change, treat
226 the \fIchanged\fR value as a bitmap of possible element types.
229 A change is defined for the different element classes as follows:
233 \fB\fBPOU_SYSTEM\fR\fR
236 A property on the system element has been created, modified, or removed.
245 A property on a pool element has been created, modified, or removed. A pool has
246 changed a resource association.
255 A property on a pset element has been created, modified, or removed. A pset's
256 resource composition has changed.
265 A property on a CPU element has been created, modified, or removed.
270 The \fBpool_conf_validate()\fR function checks the validity of the contents of
271 the given configuration. The validation can be at several (increasing) levels
276 \fB\fBPOV_LOOSE\fR\fR
279 Performs basic internal syntax validation.
285 \fB\fBPOV_STRICT\fR\fR
288 Performs a more thorough syntax validation and internal consistency checks.
294 \fB\fBPOV_RUNTIME\fR\fR
297 Performs an estimate of whether attempting to commit the given configuration on
298 the system would succeed or fail. It is optimistic in that a successful
299 validation does not guarantee a subsequent commit operation will be successful;
300 it is conservative in that a failed validation indicates that a subsequent
301 commit operation on the current system will always fail.
307 Upon successful completion, \fBpool_conf_alloc()\fR returns an initialized
308 \fBpool_conf_t\fR pointer. Otherwise it returns \fINULL\fR and
309 \fBpool_error\fR(3POOL) returns the pool-specific error value.
312 Upon successful completion, \fBpool_conf_close()\fR, \fBpool_conf_commit()\fR,
313 \fBpool_conf_export()\fR, \fBpool_conf_open()\fR, \fBpool_conf_remove()\fR,
314 \fBpool_conf_rollback()\fR, \fBpool_conf_update()\fR, and
315 \fBpool_conf_validate()\fR return 0. Otherwise they return -1 and
316 \fBpool_error()\fR returns the pool-specific error value.
319 The \fBpool_conf_status()\fR function returns either \fBPOF_INVALID\fR or
324 The \fBpool_conf_alloc()\fR function will fail if:
328 \fB\fBPOE_SYSTEM\fR\fR
331 There is not enough memory available to allocate the configuration. Check
332 \fBerrno\fR for the specific system error code.
338 \fB\fBPOE_INVALID_CONF\fR\fR
341 The configuration is invalid.
346 The \fBpool_conf_close()\fR function will fail if:
350 \fB\fBPOE_BADPARAM\fR\fR
353 The supplied configuration's status is not \fBPOF_VALID\fR.
359 \fB\fBPOE_SYSTEM\fR\fR
362 The configuration's permanent store cannot be closed. Check \fBerrno\fR for
363 the specific system error code.
368 The \fBpool_conf_commit()\fR function will fail if:
372 \fB\fBPOE_BADPARAM\fR\fR
375 The supplied configuration's status is not \fBPOF_VALID\fR or the active flag
376 is non-zero and the system could not be modified.
382 \fB\fBPOE_SYSTEM\fR\fR
385 The permanent store could not be updated. Check \fBerrno\fR for the specific
392 \fB\fBPOE_INVALID_CONF\fR\fR
395 The configuration is not valid for this system.
401 \fB\fBPOE_ACCESS\fR\fR
404 The configuration was not opened with the correct permissions.
410 \fB\fBPOE_DATASTORE\fR\fR
413 The update of the permanent store has failed and the contents could be
414 corrupted. Check for a \fB\&.bak\fR file at the datastore location if manual
415 recovery is required.
420 The \fBpool_conf_export()\fR function will fail if:
424 \fB\fBPOE_BADPARAM\fR\fR
427 The supplied configuration's status is not \fBPOF_VALID\fR or the requested
428 export format is not supported.
434 \fB\fBPOE_DATASTORE\fR\fR
437 The creation of the export file failed. A file might have been created at the
438 specified location but the contents of the file might not be correct.
443 The \fBpool_conf_info()\fR function will fail if:
447 \fB\fBPOE_BADPARAM\fR\fR
450 The supplied configuration's status is not \fBPOF_VALID\fR or \fIflags\fR is
457 \fB\fBPOE_SYSTEM\fR\fR
460 There is not enough memory available to allocate the buffer used to build the
461 information string. Check \fBerrno\fR for the specific system error code.
467 \fB\fBPOE_INVALID_CONF\fR\fR
470 The configuration is invalid.
475 The \fBpool_conf_location()\fR function will fail if:
479 \fB\fBPOE_BADPARAM\fR\fR
482 The supplied configuration's status is not \fBPOF_VALID\fR.
487 The \fBpool_conf_open()\fR function will fail if:
491 \fB\fBPOE_BADPARAM\fR\fR
494 The supplied configuration's status is already \fBPOF_VALID\fR.
500 \fB\fBPOE_SYSTEM\fR\fR
503 There is not enough memory available to store the supplied location, or the
504 pools facility is not active. Check \fBerrno\fR for the specific system error
511 \fB\fBPOE_INVALID_CONF\fR\fR
514 The configuration to be opened is at \fBpool_dynamic_location\fR(3POOL) and the
515 configuration is not valid for this system.
520 The \fBpool_conf_remove()\fR function will fail if:
524 \fB\fBPOE_BADPARAM\fR\fR
527 The supplied configuration's status is not \fBPOF_VALID\fR.
533 \fB\fBPOE_SYSTEM\fR\fR
536 The configuration's permanent storage could not be removed. Check \fBerrno\fR
537 for the specific system error code.
542 The \fBpool_conf_rollback()\fR function will fail if:
546 \fB\fBPOE_BADPARAM\fR\fR
549 The supplied configuration's status is not \fBPOF_VALID\fR.
555 \fB\fBPOE_SYSTEM\fR\fR
558 The permanent store could not be accessed. Check \fBerrno\fR for the specific
564 The \fBpool_conf_update()\fR function will fail if:
568 \fB\fBPOE_BADPARAM\fR\fR
571 The supplied configuration's status is not \fBPOF_VALID\fR or the configuration
572 is not the dynamic configuration.
578 \fB\fBPOE_DATASTORE\fR\fR
581 The kernel snapshot cannot be correctly unpacked.
587 \fB\fBPOE_INVALID_CONF\fR\fR
590 The configuration contains uncommitted transactions.
596 \fB\fBPOE_SYSTEM\fR\fR
599 A system error occurred during snapshot retrieval and update.
604 The \fBpool_conf_validate()\fR function will fail if:
608 \fB\fBPOE_BADPARAM\fR\fR
611 The supplied configuration's status is not \fBPOF_VALID\fR.
617 \fB\fBPOE_INVALID_CONF\fR\fR
620 The configuration is invalid.
625 \fBExample 1 \fRCreate the configuration at the specified location.
634 pool_conf_t *pool_conf;
635 pool_conf = pool_conf_alloc();
636 char *input_location = "/tmp/poolconf.example";
638 if (pool_conf_open(pool_conf, input_location,
640 fprintf(stderr, "Opening pool configuration %s
641 failed\en", input_location);
649 See \fBattributes\fR(5) for descriptions of the following attributes:
657 ATTRIBUTE TYPE ATTRIBUTE VALUE
661 Interface Stability Uncommitted
669 \fBlibpool\fR(3LIB), \fBpool_error\fR(3POOL), \fBattributes\fR(5)