POOL_CONF_ALLOC(3POOL) | Pool Configuration Manipulation Library Functions | POOL_CONF_ALLOC(3POOL) |
pool_conf_alloc, pool_conf_close, pool_conf_commit, pool_conf_export, pool_conf_free, pool_conf_info, pool_conf_location, pool_conf_open, pool_conf_remove, pool_conf_rollback, pool_conf_status, pool_conf_update, pool_conf_validate - manipulate resource pool configurations
cc [ flag... ] file... -lpool [ library... ] #include <pool.h> pool_conf_t *pool_conf_alloc(void);
int pool_conf_close(pool_conf_t *conf);
int pool_conf_commit(pool_conf_t *conf, int active);
int pool_conf_export(pool_conf_t *conf, const char *location,
pool_export_format_t format);
void pool_conf_free(pool_conf_t *conf);
char *pool_conf_info(const pool_conf_t *conf, int flags);
const char *pool_conf_location(pool_conf_t *conf);
int pool_conf_open(pool_conf_t *conf, const char *location,
int flags);
int pool_conf_remove(pool_conf_t *conf);
int pool_conf_rollback(pool_conf_t *conf);
pool_conf_state_t pool_conf_status(const pool_conf_t *conf);
int pool_conf_update(const pool_conf_t *conf, int *changed);
int pool_conf_validate(pool_conf_t *conf,
pool_valid_level_t level);
These functions enable the access and creation of configuration files associated with the pools facility. Since the pool configuration is an opaque type, an initial configuration is obtained with pool_conf_alloc() and released with pool_conf_free() when the configuration is no longer of interest. The conf argument for each function refers to the target configuration to which the operation applies.
The pool_conf_close() function closes the given configuration, releasing associated resources.
The pool_conf_commit() function commits changes made to the given pool_conf_t to permanent storage. If the active flag is non-zero, the state of the system will be configured to match that described in the supplied pool_conf_t. If configuring the system fails, pool_conf_commit() will attempt to restore the system to its previous state.
The pool_conf_export() function saves the given configuration to the specified location. The only currently supported value of format is POX_NATIVE, which is the format native to libpool, the output of which can be used as input to pool_conf_open().
The pool_conf_info() function returns a string describing the entire configuration. The string is allocated with malloc(3C). The caller is responsible for freeing the returned string. If the flags option is non-zero, the string returned also describes the sub-elements (if any) contained in the configuration.
The pool_conf_location() function returns the location string provided to pool_conf_open() for the given pool_conf_t.
The pool_conf_open() function creates a pool_conf_t given a location at which the configuration is stored. The valid flags are a bitmap of the following:
PO_RDONLY
PO_RDWR
PO_CREAT
PO_DISCO
The use of this flag is deprecated. PO_CREAT always performs discovery. If supplied, this flag is ignored.
PO_UPDATE
The use of this flag is deprecated. The dynamic state is always current and does not require updating. If supplied, this flag is ignored.
A call to pool_conf_open() with the pool dynamic location and write permission will hang if the dynamic location has already been opened for writing.
The pool_conf_remove() function removes the configuration's permanent storage. If the configuration is still open, it is first closed.
The pool_conf_rollback() function restores the configuration state to that held in the configuration's permanent storage. This will either be the state last successfully committed (using pool_conf_commit()) or the state when the configuration was opened if there have been no successfully committed changes since then.
The pool_conf_status() function returns the status of a configuration, which can be one of the following values:
POF_INVALID
POF_VALID
The pool_conf_update() function updates the library snapshot of kernel state. If changed is non-null, it is updated to identify which types of configuration elements changed during the update. To check for change, treat the changed value as a bitmap of possible element types.
A change is defined for the different element classes as follows:
POU_SYSTEM
POU_POOL
POU_PSET
POU_CPU
The pool_conf_validate() function checks the validity of the contents of the given configuration. The validation can be at several (increasing) levels of strictness:
POV_LOOSE
POV_STRICT
POV_RUNTIME
Upon successful completion, pool_conf_alloc() returns an initialized pool_conf_t pointer. Otherwise it returns NULL and pool_error(3POOL) returns the pool-specific error value.
Upon successful completion, pool_conf_close(), pool_conf_commit(), pool_conf_export(), pool_conf_open(), pool_conf_remove(), pool_conf_rollback(), pool_conf_update(), and pool_conf_validate() return 0. Otherwise they return -1 and pool_error() returns the pool-specific error value.
The pool_conf_status() function returns either POF_INVALID or POF_VALID.
The pool_conf_alloc() function will fail if:
POE_SYSTEM
POE_INVALID_CONF
The pool_conf_close() function will fail if:
POE_BADPARAM
POE_SYSTEM
The pool_conf_commit() function will fail if:
POE_BADPARAM
POE_SYSTEM
POE_INVALID_CONF
POE_ACCESS
POE_DATASTORE
The pool_conf_export() function will fail if:
POE_BADPARAM
POE_DATASTORE
The pool_conf_info() function will fail if:
POE_BADPARAM
POE_SYSTEM
POE_INVALID_CONF
The pool_conf_location() function will fail if:
POE_BADPARAM
The pool_conf_open() function will fail if:
POE_BADPARAM
POE_SYSTEM
POE_INVALID_CONF
The pool_conf_remove() function will fail if:
POE_BADPARAM
POE_SYSTEM
The pool_conf_rollback() function will fail if:
POE_BADPARAM
POE_SYSTEM
The pool_conf_update() function will fail if:
POE_BADPARAM
POE_DATASTORE
POE_INVALID_CONF
POE_SYSTEM
The pool_conf_validate() function will fail if:
POE_BADPARAM
POE_INVALID_CONF
Example 1 Create the configuration at the specified location.
#include <pool.h> #include <stdio.h> ... pool_conf_t *pool_conf; pool_conf = pool_conf_alloc(); char *input_location = "/tmp/poolconf.example"; if (pool_conf_open(pool_conf, input_location,
PO_RDONLY) < 0) {
fprintf(stderr, "Opening pool configuration %s
failed\n", input_location); }
See attributes(7) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
CSI | Enabled |
Interface Stability | Uncommitted |
MT-Level | Safe |
August 3, 2009 | OmniOS |