1 POOL_GET_BINDING(3POOL)      Pool Configuration Manipulation Library Functions
   2 
   3 
   4 
   5 NAME
   6        pool_get_binding, pool_set_binding, pool_get_resource_binding - set and
   7        query process to resource pool bindings
   8 
   9 SYNOPSIS
  10        cc [ flag... ] file... -lpool [ library... ]
  11        #include <pool.h>
  12 
  13        char *pool_get_binding(pid_t pid);
  14 
  15 
  16        int pool_set_binding(const char *pool, idtype_t idtype,
  17             id_t id);
  18 
  19 
  20        char *pool_get_resource_binding(const char *type, pid_t pid);
  21 
  22 
  23 DESCRIPTION
  24        The pool_get_binding() function returns the name of the pool on the
  25        running system that contains the set of resources to which the given
  26        process is bound. If no such pool exists on the system or the search
  27        returns more than one pool (since the set of resources is referred to
  28        by more than one pool), NULL is  returned and the pool error value is
  29        set to POE_INVALID_SEARCH.
  30 
  31 
  32        It is possible that one of the resources to which the given process is
  33        bound is not associated with a pool. This could occur if a processor
  34        set was created with one of the pset_() functions and the process was
  35        then bound to that set. It could also occur if the process was bound to
  36        a resource set not currently associated with a pool, since resources
  37        can exist that are not associated with a pool.
  38 
  39 
  40        The pool_set_binding() function binds the processes matching idtype and
  41        id to the resources associated with pool on the running system.  This
  42        function requires the privilege required by the underlying resource
  43        types referenced by the pool; generally, this requirement is equivalent
  44        to requiring superuser privilege.
  45 
  46 
  47        The idtype parameter can be one of the following types:
  48 
  49        P_PID
  50                    The id parameter is a pid.
  51 
  52 
  53        P_TASKID
  54                    The id parameter is a taskid.
  55 
  56 
  57        P_PROJID
  58                    The id parameter is a project ID. All currently running
  59                    processes belonging to the given project will be bound to
  60                    the pool's resources.
  61 
  62 
  63 
  64        The pool_get_resource_binding() function returns the name of the
  65        resource of the supplied type to which the supplied process is bound.
  66 
  67 
  68        The application must explicitly free the memory allocated for the
  69        return values for pool_get_binding() and pool_get_resource_binding().
  70 
  71 RETURN VALUES
  72        Upon successful completion, pool_get_binding() returns the name of the
  73        pool to which the process is bound. Otherwise it returns NULL and
  74        pool_error(3POOL) returns the pool-specific error value.
  75 
  76 
  77        Upon successful completion, pool_set_binding() returns PO_SUCCESS.
  78        Otherwise, it returns PO_FAIL and pool_error() returns the pool-
  79        specific error value.
  80 
  81 
  82        Upon successful completion, pool_get_resource_binding() returns the
  83        name of the resource of the specified type to which the process is
  84        bound. Otherwise it returns NULL and pool_error() returns the pool-
  85        specific error value.
  86 
  87 ERRORS
  88        The pool_get_binding() function will fail if:
  89 
  90        POE_INVALID_CONF
  91                              The configuration is invalid.
  92 
  93 
  94        POE_INVALID_SEARCH
  95                              It is not possible to determine the binding for
  96                              this target due to the overlapping nature of the
  97                              pools configured for this system, or the pool
  98                              could not be located.
  99 
 100 
 101        POE_SYSTEM
 102                              A system error has occurred. Check the system
 103                              error code for more details.
 104 
 105 
 106 
 107        The pool_set_binding() function will fail if:
 108 
 109        POE_INVALID_SEARCH
 110                              The pool could not be found.
 111 
 112 
 113        POE_INVALID_CONF
 114                              The configuration is invalid.
 115 
 116 
 117        POE_SYSTEM
 118                              A system error has occurred. Check the system
 119                              error code for more details.
 120 
 121 
 122 
 123        The pool_get_resource_binding() function will fail if:
 124 
 125        POE_INVALID_CONF
 126                              The configuration is invalid.
 127 
 128 
 129        POE_INVALID_SEARCH
 130                              The target is not bound to a resource of the
 131                              specified type.
 132 
 133 
 134        POE_SYSTEM
 135                              A system error has occurred. Check the system
 136                              error code for more details.
 137 
 138 
 139 EXAMPLES
 140        Example 1 Bind the current process to the pool named "target".
 141 
 142          #include <sys/types.h>
 143          #include <pool.h>
 144          #include <unistd.h>
 145 
 146          ...
 147 
 148          id_t pid = getpid();
 149 
 150          ...
 151 
 152          if (pool_set_binding("target", P_PID, pid) == PO_FAIL)
 153                  (void) fprintf(stderr, "pool binding failed (%d)\n",
 154                           pool_error());
 155 
 156 
 157 
 158 ATTRIBUTES
 159        See attributes(5) for descriptions of the following attributes:
 160 
 161 
 162 
 163 
 164        +--------------------+-----------------+
 165        |  ATTRIBUTE TYPE    | ATTRIBUTE VALUE |
 166        +--------------------+-----------------+
 167        |CSI                 | Enabled         |
 168        +--------------------+-----------------+
 169        |Interface Stability | Unstable        |
 170        +--------------------+-----------------+
 171        |MT-Level            | Safe            |
 172        +--------------------+-----------------+
 173 
 174 SEE ALSO
 175        libpool(3LIB), pool_error(3POOL), attributes(5)
 176 
 177 
 178 
 179                                January 18, 2020        POOL_GET_BINDING(3POOL)