1pool_value_allocP(o3oPlOOCLo)nfiguration Manipulation Library Fpuonoclt_ivoanlsue_alloc(3POOL)
2
3
4
6 pool_value_alloc, pool_value_free, pool_value_get_bool,
7 pool_value_get_double, pool_value_get_int64, pool_value_get_name,
8 pool_value_get_string, pool_value_get_type, pool_value_get_uint64,
9 pool_value_set_bool, pool_value_set_double, pool_value_set_int64,
10 pool_value_set_name, pool_value_set_string, pool_value_set_uint64 -
11 resource pool property value manipulation functions
12
14 cc [ flag... ] file... -lpool [ library... ]
15 #include <pool.h>
16
17 pool_value_t *pool_value_alloc(void);
18
19
20 void pool_value_free(pool_value_t *value);
21
22
23 pool_value_class_t pool_value_get_type(
24 const pool_value_t *value);
25
26
27 int pool_value_get_bool(const pool_value_t *value,
28 uchar_t *bool);
29
30
31 int pool_value_get_double(const pool_value_t *value,
32 double *d);
33
34
35 int pool_value_get_int64(const pool_value_t *value,
36 int64_t *i64);
37
38
39 int pool_value_get_string(const pool_value_t *value,
40 const char **strp);
41
42
43 int pool_value_get_uint64(const pool_value_t *value,
44 uint64_t *ui64);
45
46
47 void pool_value_set_bool(const pool_value_t *value,
48 uchar_t bool);
49
50
51 void pool_value_set_double(const pool_value_t *value,
52 double d);
53
54
55 void pool_value_set_int64(const pool_value_t *value,
56 int64_t i64);
57
58
59 int pool_value_set_string(const pool_value_t *value,
60 const char *strp);
61
62
63 void pool_value_set_uint64(const pool_value_t *value,
64 uint64_t ui64);
65
66
67 const char *pool_value_get_name(const pool_value_t *value);
68
69
70 int pool_value_set_name(const pool_value_t *value,
71 const char *name);
72
73
75 A pool_value_t is an opaque type representing the typed value portion
76 of a pool property. For a list of the types supported by a
77 pool_value_t, see pool_get_property(3POOL).
78
79
80 The pool_value_alloc() function allocates and returns an opaque con‐
81 tainer for a pool property value. The pool_value_free() function must
82 be called explicitly for allocated property values.
83
84
85 The pool_value_get_bool(), pool_value_get_double(),
86 pool_value_get_int64(), pool_value_get_string(), and
87 pool_value_get_uint64() functions retrieve the value contained in the
88 pool_value_t pointed to by value to the location pointed to by the sec‐
89 ond argument. If the type of the value does not match that expected by
90 the function, an error value is returned. The string retrieved by
91 pool_value_get_string() is freed by the library when the value is over‐
92 written or pool_value_free() is called on the pool property value.
93
94
95 The pool_value_get_type() function returns the type of the data con‐
96 tained by a pool_value_t. If the value is unused then a type of
97 POC_INVAL is returned.
98
99
100 The pool_value_set_bool(), pool_value_set_double(),
101 pool_value_set_int64(), pool_value_set_string(), and
102 pool_value_set_uint64() functions set the value and type of the prop‐
103 erty value to the provided values. The pool_value_set_string() function
104 copies the string passed in and returns -1 if the memory allocation
105 fails.
106
107
108 Property values can optionally have names. These names are used to
109 describe properties as name=value pairs in the various query functions
110 (see pool_query_resources(3POOL)). A copy of the string passed to
111 pool_value_set_name() is made by the library, and the value returned by
112 pool_value_get_name() is freed when the pool_value_t is deallocated or
113 overwritten.
114
116 Upon successful completion, pool_value_alloc() returns a pool property
117 value with type initialized to PVC_INVAL. Otherwise, NULL is returned
118 and pool_error() returns the pool-specific error value.
119
120
121 Upon successful completion, pool_value_get_type() returns the type con‐
122 tained in the property value passed in as an argument. Otherwise,
123 POC_INVAL is returned and pool_error() returns the pool-specific error
124 value.
125
126
127 Upon successful completion, pool_value_get_bool(), pool_value_get_dou‐
128 ble(), pool_value_get_int64(), pool_value_get_string(), and
129 pool_value_get_uint64() return 0. Otherwise -1 is returned and
130 pool_error(3POOL) returns the pool-specific error value.
131
132
133 Upon successful completion, pool_value_set_string() and
134 pool_value_set_name() return 0. If the memory allocation failed, -1 is
135 returned and pool_error() returns the pool-specific error value.
136
138 The pool_value_alloc() function will fail if:
139
140 POE_SYSTEM A system error has occurred. Check the system error code
141 for more details.
142
143
144
145 The pool_value_get_bool(), pool_value_get_double(),
146 pool_value_get_int64(), pool_value_get_string(), and
147 pool_value_get_uint64() functions will fail if:
148
149 POE_BADPARAM The supplied value does not match the type of the
150 requested operation.
151
152
153
154 The pool_value_set_string() function will fail if:
155
156 POE_SYSTEM A system error has occurred. Check the system error code
157 for more details.
158
159
160
161 The pool_value_set_name() function will fail if:
162
163 POE_SYSTEM A system error has occurred. Check the system error code
164 for more details.
165
166
168 See attributes(5) for descriptions of the following attributes:
169
170
171
172
173 ┌─────────────────────────────┬─────────────────────────────┐
174 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
175 ├─────────────────────────────┼─────────────────────────────┤
176 │CSI │Enabled │
177 ├─────────────────────────────┼─────────────────────────────┤
178 │Interface Stability │Unstable │
179 ├─────────────────────────────┼─────────────────────────────┤
180 │MT-Level │Safe │
181 └─────────────────────────────┴─────────────────────────────┘
182
184 libpool(3LIB), pool_error(3POOL), attributes(5)
185
186
187
188SunOS 5.11 23 Sep 2003 pool_value_alloc(3POOL)