pool_get_binding, pool_set_binding, pool_get_resource_binding - set and query process to resource pool bindings
cc [ flag… ] file … –lpool [ library… ] #include <pool.h> char *pool_get_binding(pid_t pid);
int pool_set_binding( const char *pool, idtype_t idtype, id_t id);
char *pool_get_resource_binding( const char *type, pid_t pid);
The pool_get_binding() function returns the name of the pool on the running system to which the given process is bound.
The pool_set_binding() function binds a zone or processes matching idtype and id to the pset associated with pool on the running system. This function requires the privilege PRIV_SYS_RES_BIND or PRIV_SYS_RES_CONFIG.
The idtype parameter can be one of the following types:
The id parameter is a pid.
The id parameter is a taskid. Bind the running processes of a given task ID.
The id parameter is a project ID. Bind or query the running processes of a given project ID.
The id parameter is a contract ID. Bind the running processes of a given contract ID.
The id parameter is a zone ID. Bind the running processes of a given zone ID.
The pool_get_resource_binding() function returns the name of the resource of the supplied type to which the supplied process is bound. The only currently supported type is "pset".
The application must explicitly free the memory allocated for the return values for pool_get_binding() and pool_get_resource_binding().
Upon successful completion, pool_get_binding() returns the name of the pool to which the process is bound. Otherwise it returns NULL and pool_error(3POOL) returns the pool-specific error value.
Upon successful completion, pool_set_binding() returns PO_SUCCESS. Otherwise, it returns PO_FAIL and pool_error() returns the pool-specific error value.
Upon successful completion, pool_get_resource_binding() returns the name of the resource of the specified type to which the process is bound. Otherwise it returns NULL and pool_error() returns the pool-specific error value.
The pool_get_binding() function will fail if:
The configuration is invalid.
A system error has occurred. Check the system error code for more details.
The pool_set_binding() function will fail if:
The pool could not be found.
The configuration is invalid.
A system error has occurred. Check the system error code for more details.
The pool_get_resource_binding() function will fail if:
The configuration is invalid.
A system error has occurred. Check the system error code for more details.
#include <sys/types.h> #include <pool.h> #include <unistd.h> ... id_t pid = getpid(); ... if (pool_set_binding("target", P_PID, pid) == PO_FAIL) { (void) fprintf(stderr, "pool binding failed (%d)\n", pool_error()); }
See attributes(7) for descriptions of the following attributes:
|