xref: /titanic_44/usr/src/man/man3pool/pool_dynamic_location.3pool (revision f38cb554a534c6df738be3f4d23327e69888e634)
te
Copyright (c) 2003, 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]
POOL_DYNAMIC_LOCATION 3POOL "Sep 23, 2003"
NAME
pool_dynamic_location, pool_static_location, pool_version, pool_get_status, pool_set_status, pool_resource_type_list - resource pool framework functions
SYNOPSIS

cc [ flag.\|.\|. ] file.\|.\|. -lpool [ library.\|.\|. ]
#include <pool.h>

const char *pool_dynamic_location(void);

const char *pool_static_location(void);

uint_t pool_version(uint_t ver);

int pool_get_status(int *state);

int pool_set_status(int state);

int pool_resource_type_list(const char **reslist,
 uint_t *numres);
DESCRIPTION

The pool_dynamic_location() function returns the location used by the pools framework to store the dynamic configuration.

The pool_static_location() function returns the location used by the pools framework to store the default configuration used for pools framework instantiation.

The pool_version() function can be used to inquire about the version number of the library by specifying POOL_VER_NONE. The current (most capable) version is POOL_VER_CURRENT. The user can set the version used by the library by specifying the required version number. If this is not possible, the version returned will be POOL_VER_NONE.

The pool_get_status() function retrieves the current state of the pools facility. If state is non-null, then on successful completion the state of the pools facility is stored in the location pointed to by state.

The pool_set_status() function modifies the current state of the pools facility. On successful completion the state of the pools facility is changed to match the value supplied in state. Only two values are valid for state, POOL_DISABLED and POOL_ENABLED, both of which are defined in <pool.h>.

The pool_resource_type_list() function enumerates the resource types supported by the pools framework on this platform. If numres and reslist are both non-null, reslist points to a buffer where a list of resource types in the system is to be stored, and numres points to the maximum number of resource types the buffer can hold. On successful completion, the list of resource types up to the maximum buffer size is stored in the buffer pointed to by reslist.

RETURN VALUES

The pool_dynamic_location() function returns the location used by the pools framework to store the dynamic configuration.

The pool_static_location() function returns the location used by the pools framework to store the default configuration used for pools framework instantiation.

The pool_version() function returns the version number of the library or POOL_VER_NONE.

Upon successful completion, pool_get_status(), pool_set_status(), and pool_resource_type_list() all return 0. Otherwise, -1 is returned and pool_error(3POOL) returns the pool specific error.

ERRORS

No errors are defined for pool_dynamic_location(), pool_static_location(), and pool_version().

The pool_get_status() function will fail if: POE_SYSTEM

A system error occurred when accessing the kernel pool state.

The pool_set_status() function will fail if: POE_SYSTEM

A system error occurred when modifying the kernel pool state.

The pool_resource_type_list() function will fail if: POE_BADPARAM

The numres parameter was NULL.

EXAMPLES

Example 1 Get the static location used by the pools framework.

#include sys/types.h>
#include <unistd.h>
#include <pool.h>

...

const char *location = pool_dynamic_location();

...

 (void) fprintf(stderr, "pool dynamic location is %s\en",
 location);

Example 2 Enable the pools facility.

#include <stdio.h>
#include <pool.h>

...

 if (pool_set_status(POOL_ENABLED) != 0) {
 (void) fprintf(stderr, "pools could not be enabled %s\en",
 pool_strerror(pool_error()));
 exit(2);
 }
...
ATTRIBUTES

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPE ATTRIBUTE VALUE
CSI Enabled
Interface Stability Unstable
MT-Level Safe
SEE ALSO

libpool(3LIB), pool_error(3POOL), attributes(5)