svcadm(1M)을 검색하려면 섹션에서 1M 을 선택하고, 맨 페이지 이름에 svcadm을 입력하고 검색을 누른다.
pool_resource_create(3pool)
Pool Configuration Manipulation Library Functions
pool_resource_create(3POOL)
NAME
pool_resource_create, pool_resource_destroy, pool_resource_info,
pool_query_resource_components, pool_resource_transfer,
pool_resource_xtransfer - resource pool resource manipulation functions
SYNOPSIS
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);
DESCRIPTION
The pool_resource_create() function creates and returns a new resource
of the given name and type in the provided configuration. If there is
already a resource of the given name, the operation will fail. The only
resource type is pset.
The pool_resource_destroy() function removes the specified resource
from its configuration file. pset resources created by the pset_cre‐
ate() system call cannot be destroyed by this API. See pset_create(2)
for destroying such resources.
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. Com‐
ponents represent CPUs.
The pool_resource_transfer() function transfers size CPUs from the
source pset to the target. Both psets must have property pset.restype
equal to cpu. Transferring CPUs is always performed as series of
pool_resource_xtransfer() operations, since discrete CPUs must be iden‐
tified for transfer.
The pool_resource_xtransfer() function transfers the specific CPUs from
the source pset to the target. Both psets must be have property
pset.restype equal to cpu. The components argument is a null-terminated
list of values of type pool_component_t.
The transfer functions cannot transfer components between pset
resources created by the pset_create() system call. Use pset_assign(2)
to manipulate such psets and CPUs.
The conf argument for each function refers to the target configuration
to which the operation applies.
RETURN VALUES
Upon successful completion, pool_resource_create() returns a new
pool_resource_t with default properties initialized. Otherwise, NULL is
returned and pool_error(3POOL) returns the pool-specific error value.
Upon successful completion, pool_resource_destroy() returns 0. Other‐
wise, -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). Other‐
wise, 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.
ERRORS
The pool_resource_create() function will fail if:
POE_BADPARAM The supplied configuration's status is not
POF_VALID or name is in use for this resource type.
The name of the resource starts with "SYS", which
is a reserved namespace.
POE_INVALID_CONF The resource element could not be created because
the configuration conf would be invalid.
POE_PUTPROP One of the supplied properties could not be set.
POE_SYSTEM A system error has occurred. Check the system error
code for more details.
The pool_resource_destroy() function will fail if:
POE_BADPARAM The supplied configuration's status is not POF_VALID.
POE_SYSTEM A system error has occurred. Check the system error
code for more details.
The target resource is a pset created by the pset_cre‐
ate() system call. Errno will be set to ENOTSUP.
The pool_resource_info() function will fail if:
POE_BADPARAM The supplied configuration's status is not
POF_VALID or the flags parameter is neither 0 nor
1.
POE_INVALID_CONF The configuration conf is invalid.
POE_SYSTEM A system error has occurred. Check the system error
code for more details.
The pool_query_resource_components() function will fail if:
POE_BADPARAM The supplied configuration's status is not
POF_VALID.
POE_INVALID_CONF The configuration conf is invalid.
POE_SYSTEM A system error has occurred. Check the system error
code for more details.
The pool_resource_transfer() function will fail if:
POE_BADPARAM The supplied configuration's status is not POF_VALID,
the two resources are not of the same type, or the
transfer would cause either of the resources to exceed
their min and max properties.
POE_SYSTEM A system error has occurred. Check the system error
code for more details.
Errno will be set to ENOTSUP if the source or target
pset is a pset created by the pset_create() system
call.
The pool_resource_xtransfer() function will fail if:
POE_BADPARAM The supplied configuration's status is not
POF_VALID, the two resources are not of the same
type, or the supplied components do not belong to
the source.
POE_INVALID_CONF The transfer operation failed and the configuration
may be invalid.
POE_SYSTEM A system error has occurred. Check the system error
code for more details.
Errno will be set to ENOTSUP if the source or tar‐
get pset is a pset created by the pset_create()
system call.
EXAMPLES
Example 1 Create a new resource of type pset named foo.
#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");
...
}
ATTRIBUTES
See attributes(7) for descriptions of the following attributes:
tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) ATTRIBUTE TYPEAT‐
TRIBUTE VALUE _ CSIEnabled _ Interface StabilityUncommitted _ MT-Level‐
Safe
SEE ALSO
libpool(3LIB), pool_error(3POOL), attributes(7)
Oracle Solaris 11.4 22 Feb 2021
pool_resource_create(3POOL)