1pool_get_bindingP(o3oPlOOCLo)nfiguration Manipulation Library Fpuonoclt_igoents_binding(3POOL)
2
3
4
6 pool_get_binding, pool_set_binding, pool_get_resource_binding - set and
7 query process to resource pool bindings
8
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
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 of the following types:
48
49 P_PID The id parameter is a pid.
50
51
52 P_TASKID The id parameter is a taskid.
53
54
55 P_PROJID The id parameter is a project ID. All currently running
56 processes belonging to the given project will be bound to
57 the pool's resources.
58
59
60
61 The pool_get_resource_binding() function returns the name of the
62 resource of the supplied type to which the supplied process is bound.
63
64
65 The application must explicity free the memory allocated for the return
66 values for pool_get_binding() and pool_get_resource_binding().
67
69 Upon successful completion, pool_get_binding() returns the name of the
70 pool to which the process is bound. Otherwise it returns NULL and
71 pool_error(3POOL) returns the pool-specific error value.
72
73
74 Upon successful completion, pool_set_binding() returns PO_SUCCESS. Oth‐
75 erwise, it returns PO_FAIL and pool_error() returns the pool-specific
76 error value.
77
78
79 Upon successful completion, pool_get_resource_binding() returns the
80 name of the resource of the specified type to which the process is
81 bound. Otherwise it returns NULL and pool_error() returns the pool-spe‐
82 cific error value.
83
85 The pool_get_binding() function will fail if:
86
87 POE_INVALID_CONF The configuration is invalid.
88
89
90 POE_INVALID_SEARCH It is not possible to determine the binding for
91 this target due to the overlapping nature of the
92 pools configured for this system, or the pool
93 could not be located.
94
95
96 POE_SYSTEM A system error has occurred. Check the system
97 error code for more details.
98
99
100
101 The pool_set_binding() function will fail if:
102
103 POE_INVALID_SEARCH The pool could not be found.
104
105
106 POE_INVALID_CONF The configuration is invalid.
107
108
109 POE_SYSTEM A system error has occurred. Check the system
110 error code for more details.
111
112
113
114 The pool_get_resource_binding() function will fail if:
115
116 POE_INVALID_CONF The configuration is invalid.
117
118
119 POE_INVALID_SEARCH The target is not bound to a resource of the
120 specified type.
121
122
123 POE_SYSTEM A system error has occurred. Check the system
124 error code for more details.
125
126
128 Example 1 Bind the current process to the pool named "target".
129
130 #include <sys/types.h>
131 #include <pool.h>
132 #include <unistd.h>
133
134 ...
135
136 id_t pid = getpid();
137
138 ...
139
140 if (pool_set_binding("target", P_PID, pid) == PO_FAIL)
141 (void) fprintf(stderr, "pool binding failed (d)0
142 pool_error());
143
144
146 See attributes(5) for descriptions of the following attributes:
147
148
149
150
151 ┌─────────────────────────────┬─────────────────────────────┐
152 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
153 ├─────────────────────────────┼─────────────────────────────┤
154 │CSI │Enabled │
155 ├─────────────────────────────┼─────────────────────────────┤
156 │Interface Stability │Unstable │
157 ├─────────────────────────────┼─────────────────────────────┤
158 │MT-Level │Safe │
159 └─────────────────────────────┴─────────────────────────────┘
160
162 libpool(3LIB), pool_error(3POOL), attributes(5)
163
164
165
166SunOS 5.11 27 Mar 2007 pool_get_binding(3POOL)