POOL_RESOURCE_CREATE(3POOL) | Pool Configuration Manipulation Library Functions | POOL_RESOURCE_CREATE(3POOL) |
cc [ flag... ] file... -lpool [ library... ] #include <pool.h> pool_resource_t *pool_resource_create(pool_conf_t *conf, const char *type, const char *name);
int pool_resource_destroy(pool_conf_t *conf, pool_resource_t *resource);
const char *pool_resource_info(pool_conf_t *conf pool_resource_t *resource, int flags);
pool_component_t **pool_query_resource_components( pool_conf_t *conf, pool_resource_t *resource, uint_t *nelem, pool_value_t **props);
int pool_resource_transfer(pool_conf_t *conf, pool_resource_t *source, pool_resource_t *target, uint64_t size);
int pool_resource_xtransfer(pool_conf_t *conf, pool_resource_t *source, pool_resource_t *target, pool_component_t **components);
The pool_resource_destroy() function removes the specified resource from its configuration file.
The pool_resource_info() function returns a string describing the given resource. The string is allocated with malloc(3C). The caller is responsible for freeing the returned string. If the flags argument is non-zero, the string returned also describes the components (if any) contained in the resource.
The pool_query_resource_components() function returns a null-terminated array of the components (if any) that comprise the given resource.
The pool_resource_transfer() function transfers size basic units from the source resource to the target. Both resources must be of the same type for the operation to succeed. Transferring component resources, such as processors, is always performed as series of pool_resource_xtransfer() operations, since discrete resources must be identified for transfer.
The pool_resource_xtransfer() function transfers the specific components from the source resource to the target. Both resources must be of the same type, and of a type that contains components (such as processor sets). The components argument is a null-terminated list of pool_component_t.
The conf argument for each function refers to the target configuration to which the operation applies.
Upon successful completion, pool_resource_destroy() returns 0. Otherwise, -1 is returned and pool_error() returns the pool-specific error value.
Upon successful completion, pool_resource_info() returns a string describing the given resource (and optionally its components). Otherwise, NULL is returned and pool_error() returns the pool-specific error value.
Upon successful completion, pool_query_resource_components() returns a null-terminated array of pool_component_t * that match the provided null-terminated property list and are contained in the given resource. Otherwise, NULL is returned and pool_error() returns the pool-specific error value.
Upon successful completion, pool_resource_transfer() and pool_resource_xtransfer() return 0. Otherwise -1 is returned and pool_error() returns the pool-specific error value.
POE_BADPARAM
POE_INVALID_CONF
POE_PUTPROP
POE_SYSTEM
The pool_resource_destroy() function will fail if:
POE_BADPARAM
The pool_resource_info() function will fail if:
POE_BADPARAM
POE_INVALID_CONF
POE_SYSTEM
The pool_query_resource_components() function will fail if:
POE_BADPARAM
POE_INVALID_CONF
POE_SYSTEM
The pool_resource_transfer() function will fail if:
POE_BADPARAM
POE_SYSTEM
The pool_resource_xtransfer() function will fail if:
POE_BADPARAM
POE_INVALID_CONF
POE_SYSTEM
#include <pool.h> #include <stdio.h> ... pool_conf_t *conf; pool_resource_t *resource; ... if ((resource = pool_resource_create(conf, "pset", "foo")) == NULL) { (void) fprintf(stderr, "Cannot create resource\n"); ... }
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
CSI | Enabled |
Interface Stability | Unstable |
MT-Level | Safe |
January 18, 2020 |