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]
cc [ flag].\|.\|. file.\|.\|. -lpool [ library.\|.\|. ] #include <pool.h> pool_t *pool_get_pool(pool_conf_t *conf, const char *name);
pool_resource_t *pool_get_resource(pool_conf_t *conf const char *type, const char *name);
pool_component_t **pool_query_components(pool_conf_t *conf, uint_t *nelem, pool_value_t **props);
pool_t **pool_query_pools(pool_conf_t *conf, uint_t *nelem, pool_value_t **props);
pool_component_t **pool_query_resources(pool_conf_t *conf, uint_t *nelem, pool_value_t **props);
The pool_get_pool() function returns the pool with the given name from the provided configuration.
The pool_get_resource() function returns the resource with the given name and type from the provided configuration.
The pool_query_components() function retrieves all resource components that match the given list of properties. If the list of properties is NULL, all components are returned. The number of elements returned is stored in the location pointed to by nelem. The value returned by pool_query_components() is allocated with malloc(3C) and must be explicitly freed.
The pool_query_pools() function behaves similarly to pool_query_components() and returns the list of pools that match the given list of properties. The value returned must be freed by the caller.
The pool_query_resources() function similarly returns the list of resources that match the given list of properties. The return value must be freed by the caller.
The pool_query_components(), pool_query_pools(), and pool_query_resources() functions return a null-terminated array of components, pools, and resources, respectively. If the query was unsuccessful or there were no matches, NULL is returned and pool_error() returns the pool-specific error value.
The supplied configuration's status is not POF_VALID.
The pool_get_resource() function will fail if: POE_BADPARAM
The supplied configuration's status is not POF_VALID.
There is not enough memory available to allocate working buffers. Check errno for the specific system error code.
The pool_query_components(), pool_query_pools(), and pool_query_resources() functions will fail if: POE_BADPARAM
The supplied configuration's status is not POF_VALID.
The query generated results that were not of the correct type. The configuration is invalid.
There is not enough memory available to allocate working buffers. Check errno for the specific system error code.
#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'\\n"); ... }
ATTRIBUTE TYPE ATTRIBUTE VALUE |
CSI Enabled |
Interface Stability Unstable |
MT-Level Safe |