Go to main content

man pages section 3: Extended Library Functions, Volume 3

Exit Print View

Updated: Wednesday, July 27, 2022
 
 

pool_get_resource_binding(3POOL)

Name

pool_get_binding, pool_set_binding, pool_get_resource_binding - set and query process to resource pool bindings

Synopsis

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);

Description

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:

P_PID

The id parameter is a pid.

P_TASKID

The id parameter is a taskid. Bind the running processes of a given task ID.

P_PROJID

The id parameter is a project ID. Bind or query the running processes of a given project ID.

P_CTID

The id parameter is a contract ID. Bind the running processes of a given contract ID.

P_ZONEID

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().

Return Values

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.

Errors

The pool_get_binding() function will fail if:

POE_INVALID_CONF

The configuration is invalid.

POE_SYSTEM

A system error has occurred. Check the system error code for more details.

The pool_set_binding() function will fail if:

POE_INVALID_SEARCH

The pool could not be found.

POE_INVALID_CONF

The configuration is invalid.

POE_SYSTEM

A system error has occurred. Check the system error code for more details.

The pool_get_resource_binding() function will fail if:

POE_INVALID_CONF

The configuration is invalid.

POE_SYSTEM

A system error has occurred. Check the system error code for more details.

Examples

Example 1 Bind the current process to the pool named “target”.
#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());
}

Attributes

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

ATTRIBUTE TYPE
ATTRIBUTE VALUE
CSI
Enabled
Interface Stability
Uncommitted
MT-Level
Safe

See Also

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