Pool Configuration Manipulation Library Functions
poolresourcecreate(3POL)
NAME
poolresourcecreate, poolresourcedestroy,
poolresourceinfo, poolqueryresourcecomponents,
poolresourcetransfer, poolresourcextransfer - resource
pool resource manipulation functions
SYNOPSIS
cc [ flag... ] file... -lpool [ library... ]
#include
poolresourcet *poolresourcecreate(poolconft *conf,
const char *type, const char *name);
int poolresourcedestroy(poolconft *conf,
poolresourcet *resource);
const char *poolresourceinfo(poolconft *conf
poolresourcet *resource, int flags);
poolcomponentt **poolqueryresourcecomponents(
poolconft *conf, poolresourcet *resource,
uintt *nelem, poolvaluet **props);
int poolresourcetransfer(poolconft *conf,
poolresourcet *source, poolresourcet *target,
uint64t size);
int poolresourcextransfer(poolconft *conf,
poolresourcet *source, poolresourcet *target,
poolcomponentt **components);
DESCRIPTION
The poolresourcecreate() function creates and returns a
new resource of the given name and type in the provided con-
figuration. If there is already a resource of the given
name, the operation will fail.
The poolresourcedestroy() function removes the specified
resource from its configuration file.
The poolresourceinfo() function returns a string describ-
ing the given resource. The string is allocated with
malloc(3C). The caller is reponsible for freeing the
SunOS 5.11 Last change: 23 Sep 2003 1
Pool Configuration Manipulation Library Functions
poolresourcecreate(3POL)
returned string. If the flags argument is non-zero, the
string returned also describes the components (if any) con-
tained in the resource.
The poolqueryresourcecomponents() function returns a
null-terminated array of the components (if any) that
comprise the given resource.
The poolresourcetransfer() 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 poolresourcextransfer()
operations, since discrete resources must be identified for
transfer.
The poolresourcextransfer() 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 poolcomponentt.
The conf argument for each function refers to the target
configuration to which the operation applies.
RETURN VALUES
Upon successful completion, poolresourcecreate() returns a
new poolresourcet with default properties initialized.
Otherwise, NUL is returned and poolerror(3POL) returns
the pool-specific error value.
Upon successful completion, poolresourcedestroy() returns
0. Otherwise, -1 is returned and poolerror() returns the
pool-specific error value.
Upon successful completion, poolresourceinfo() returns a
string describing the given resource (and optionally its
components). Otherwise, NUL is returned and poolerror()
returns the pool-specific error value.
Upon successful completion,
poolqueryresourcecomponents() returns a null-terminated
array of poolcomponentt * that match the provided null-
terminated property list and are contained in the given
SunOS 5.11 Last change: 23 Sep 2003 2
Pool Configuration Manipulation Library Functions
poolresourcecreate(3POL)
resource. Otherwise, NUL is returned and poolerror()
returns the pool-specific error value.
Upon successful completion, poolresourcetransfer() and
poolresourcextransfer() return 0. Otherwise -1 is returned
and poolerror() returns the pool-specific error value.
ERORS
The poolresourcecreate() function will fail if:
POEBADPARAM The supplied configuration's status is
not POFVALID or name is in use for this
resource type.
POEINVALIDCONF The resource element could not be
created because the configuration would
be invalid.
POEPUTPROP One of the supplied properties could not
be set.
POESYSTEM A system error has occurred. Check the
system error code for more details.
The poolresourcedestroy() function will fail if:
POEBADPARAM The supplied configuration's status is not
POFVALID.
The poolresourceinfo() function will fail if:
POEBADPARAM The supplied configuration's status is
not POFVALID or the flags paramter is
neither 0 nor 1.
POEINVALIDCONF The configuration is invalid.
POESYSTEM A system error has occurred. Check the
system error code for more details.
SunOS 5.11 Last change: 23 Sep 2003 3
Pool Configuration Manipulation Library Functions
poolresourcecreate(3POL)
The poolqueryresourcecomponents() function will fail if:
POEBADPARAM The supplied configuration's status is
not POFVALID.
POEINVALIDCONF The configuration is invalid.
POESYSTEM A system error has occurred. Check the
system error code for more details.
The poolresourcetransfer() function will fail if:
POEBADPARAM The supplied configuration's status is not
POFVALID, 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.
POESYSTEM A system error has occurred. Check the sys-
tem error code for more details.
The poolresourcextransfer() function will fail if:
POEBADPARAM The supplied configuration's status is
not POFVALID, the two resources are not
of the same type, or the supplied
resources do not belong to the source.
POEINVALIDCONF The transfer operation failed and the
configuration may be invalid.
POESYSTEM A system error has occurred. Check the
system error code for more details.
EXAMPLES
Example 1 Create a new resource of type pset named foo.
#include
#include
...
SunOS 5.11 Last change: 23 Sep 2003 4
Pool Configuration Manipulation Library Functions
poolresourcecreate(3POL)
poolconft *conf;
poolresourcet *resource;
...
if ((resource = poolresourcecreate(conf, "pset",
"foo")) == NUL) {
(void) fprintf(stderr, "Cannot create resourceB{}n");
...
}
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
ATRIBUTE TYPE ATRIBUTE VALUE
CSI Enabled
Interface Stability Unstable
MT-Level Safe
SEE ALSO
libpool(3LIB), poolerror(3POL), attributes(5)
SunOS 5.11 Last change: 23 Sep 2003 5
Pool Configuration Manipulation Library Functions
poolresourcecreate(3POL)
SunOS 5.11 Last change: 23 Sep 2003 6
|