Print this page
patch more-manpage
patch cleanup
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/man/man3nvpair/nvlist_alloc.3nvpair
+++ new/usr/src/man/man3nvpair/nvlist_alloc.3nvpair
1 1 '\" te
2 2 .\" Copyright (c) 2004, Sun Microsystems, Inc. All Rights Reserved.
3 3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
4 4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
5 5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 -.TH NVLIST_ALLOC 3NVPAIR "Feb 2, 2004"
6 +.TH NVLIST_ALLOC 3NVPAIR "Feb 15, 2016"
7 7 .SH NAME
8 8 nvlist_alloc, nvlist_free, nvlist_size, nvlist_pack, nvlist_unpack, nvlist_dup,
9 9 nvlist_merge, nvlist_xalloc, nvlist_xpack, nvlist_xunpack, nvlist_xdup,
10 10 nvlist_lookup_nv_alloc, nv_alloc_init, nv_alloc_reset, nv_alloc_fini \- manage
11 11 a name-value pair list
12 12 .SH SYNOPSIS
13 13 .LP
14 14 .nf
15 15 \fBcc\fR [ \fIflag\fR... ] \fIfile\fR... \fB-lnvpair\fR [ \fIlibrary\fR... ]
16 16 #include <libnvpair.h>
17 17
18 18 \fBint\fR \fBnvlist_alloc\fR(\fBnvlist_t **\fR\fInvlp\fR, \fBuint_t\fR \fInvflag\fR, \fBint\fR \fIflag\fR);
19 19 .fi
20 20
21 21 .LP
22 22 .nf
23 23 \fBint\fR \fBnvlist_xalloc\fR(\fBnvlist_t **\fR\fInvlp\fR, \fBuint_t\fR \fInvflag\fR,
24 24 \fBnv_alloc_t *\fR \fInva\fR);
25 25 .fi
26 26
27 27 .LP
28 28 .nf
29 29 \fBvoid\fR \fBnvlist_free\fR(\fBnvlist_t *\fR\fInvl\fR);
30 30 .fi
31 31
32 32 .LP
33 33 .nf
34 34 \fBint\fR \fBnvlist_size\fR(\fBnvlist_t *\fR\fInvl\fR, \fBsize_t *\fR\fIsize\fR, \fBint\fR \fIencoding\fR);
35 35 .fi
36 36
37 37 .LP
38 38 .nf
39 39 \fBint\fR \fBnvlist_pack\fR(\fBnvlist_t *\fR\fInvl\fR, \fBchar **\fR\fIbufp\fR, \fBsize_t *\fR\fIbuflen\fR,
40 40 \fBint\fR \fIencoding\fR, \fBint\fR \fIflag\fR);
41 41 .fi
42 42
43 43 .LP
44 44 .nf
45 45 \fBint\fR \fBnvlist_xpack\fR(\fBnvlist_t *\fR\fInvl\fR, \fBchar **\fR\fIbufp\fR, \fBsize_t *\fR\fIbuflen\fR,
46 46 \fBint\fR \fIencoding\fR, \fBnv_alloc_t *\fR \fInva\fR);
47 47 .fi
48 48
49 49 .LP
50 50 .nf
51 51 \fBint\fR \fBnvlist_unpack\fR(\fBchar *\fR\fIbuf\fR, \fBsize_t\fR \fIbuflen\fR, \fBnvlist_t **\fR\fInvlp\fR,
52 52 \fBint\fR \fIflag\fR);
53 53 .fi
54 54
55 55 .LP
56 56 .nf
57 57 \fBint\fR \fBnvlist_xunpack\fR(\fBchar *\fR\fIbuf\fR, \fBsize_t\fR \fIbuflen\fR, \fBnvlist_t **\fR\fInvlp\fR,
58 58 \fBnv_alloc_t *\fR \fInva\fR);
59 59 .fi
60 60
61 61 .LP
62 62 .nf
63 63 \fBint\fR \fBnvlist_dup\fR(\fBnvlist_t *\fR\fInvl\fR, \fBnvlist_t **\fR\fInvlp\fR, \fBint\fR \fIflag\fR);
64 64 .fi
65 65
66 66 .LP
67 67 .nf
68 68 \fBint\fR \fBnvlist_xdup\fR(\fBnvlist_t *\fR\fInvl\fR, \fBnvlist_t **\fR\fInvlp\fR,
69 69 \fBnv_alloc_t *\fR \fInva\fR);
70 70 .fi
71 71
72 72 .LP
73 73 .nf
74 74 \fBint\fR \fBnvlist_merge\fR(\fBnvlist_t *\fR\fIdst\fR, \fBnvlist_t *\fR\fInvl\fR, \fBint\fR \fIflag\fR);
75 75 .fi
76 76
77 77 .LP
78 78 .nf
79 79 \fBnv_alloc_t *\fR \fBnvlist_lookup_nv_alloc\fR(\fBnvlist_t *\fR\fInvl\fR);
80 80 .fi
81 81
82 82 .LP
83 83 .nf
84 84 \fBint\fR \fBnv_alloc_init\fR(\fBnv_alloc_t *\fR\fInva\fR, \fBconst nv_alloc_ops_t *\fR\fInvo\fR,
85 85 \fB/*\fR \fIargs\fR */ ...);
86 86 .fi
87 87
88 88 .LP
89 89 .nf
90 90 \fBvoid\fR \fBnv_alloc_reset\fR(\fBnv_alloc_t *\fR\fInva\fR);
91 91 .fi
92 92
93 93 .LP
94 94 .nf
95 95 \fBvoid\fR \fBnv_alloc_fini\fR(\fBnv_alloc_t *\fR\fInva\fR);
96 96 .fi
97 97
98 98 .SH PARAMETERS
99 99 .sp
100 100 .ne 2
101 101 .na
102 102 \fB\fInvlp\fR\fR
103 103 .ad
104 104 .RS 12n
105 105 Address of a pointer to \fBnvlist_t\fR.
106 106 .RE
107 107
108 108 .sp
109 109 .ne 2
110 110 .na
111 111 \fB\fInvflag\fR\fR
112 112 .ad
113 113 .RS 12n
114 114 Specify bit fields defining \fBnvlist\fR properties:
115 115 .sp
116 116 .ne 2
117 117 .na
118 118 \fB\fBNV_UNIQUE_NAME\fR\fR
119 119 .ad
120 120 .RS 23n
121 121 The \fBnvpair\fR names are unique.
122 122 .RE
123 123
124 124 .sp
125 125 .ne 2
126 126 .na
127 127 \fB\fBNV_UNIQUE_NAME_TYPE\fR\fR
128 128 .ad
129 129 .RS 23n
130 130 Name-data type combination is unique.
131 131 .RE
132 132
133 133 .RE
134 134
135 135 .sp
136 136 .ne 2
137 137 .na
138 138 \fB\fIflag\fR\fR
139 139 .ad
140 140 .RS 12n
141 141 Specify 0. Reserved for future use.
142 142 .RE
143 143
144 144 .sp
145 145 .ne 2
146 146 .na
147 147 \fB\fInvl\fR\fR
148 148 .ad
149 149 .RS 12n
150 150 The \fBnvlist_t\fR to be processed.
151 151 .RE
152 152
153 153 .sp
154 154 .ne 2
155 155 .na
156 156 \fB\fIdst\fR\fR
157 157 .ad
158 158 .RS 12n
159 159 The destination \fBnvlist_t\fR.
160 160 .RE
161 161
162 162 .sp
163 163 .ne 2
164 164 .na
165 165 \fB\fIsize\fR\fR
166 166 .ad
167 167 .RS 12n
168 168 Pointer to buffer to contain the encoded size.
169 169 .RE
170 170
171 171 .sp
172 172 .ne 2
173 173 .na
174 174 \fB\fIbufp\fR\fR
175 175 .ad
176 176 .RS 12n
177 177 Address of buffer to pack \fBnvlist\fR into. Must be 8-byte aligned. If
178 178 \fINULL\fR, library will allocate memory.
179 179 .RE
180 180
181 181 .sp
182 182 .ne 2
183 183 .na
184 184 \fB\fIbuf\fR\fR
185 185 .ad
186 186 .RS 12n
187 187 Buffer containing packed \fBnvlist\fR.
188 188 .RE
189 189
190 190 .sp
191 191 .ne 2
192 192 .na
193 193 \fB\fIbuflen\fR\fR
194 194 .ad
195 195 .RS 12n
196 196 Size of buffer \fIbufp\fR or \fIbuf\fR points to.
197 197 .RE
198 198
199 199 .sp
200 200 .ne 2
201 201 .na
202 202 \fB\fIencoding\fR\fR
203 203 .ad
204 204 .RS 12n
205 205 Encoding method for packing.
206 206 .RE
207 207
208 208 .sp
209 209 .ne 2
210 210 .na
211 211 \fB\fInvo\fR\fR
212 212 .ad
213 213 .RS 12n
214 214 Pluggable allocator operations pointer (\fBnv_alloc_ops_t\fR).
215 215 .RE
216 216
217 217 .sp
218 218 .ne 2
219 219 .na
220 220 \fB\fInva\fR\fR
221 221 .ad
222 222 .RS 12n
223 223 A pointer to an \fBnv_alloc_t\fR structure to be used for the specified
224 224 \fBnvlist_t\fR.
225 225 .RE
226 226
227 227 .SH DESCRIPTION
228 228 .SS "List Manipulation"
229 229 .sp
230 230 .LP
231 231 The \fBnvlist_alloc()\fR function allocates a new name-value pair list and
232 232 updates \fInvlp\fR to point to the handle. The \fInvflag\fR argument specifies
233 233 \fBnvlist\fR properties to remain persistent across packing, unpacking, and
234 234 duplication. If \fBNV_UNIQUE_NAME\fR was specified for \fInvflag\fR, existing
235 235 nvpairs with matching names are removed before the new nvpair is added. If
↓ open down ↓ |
219 lines elided |
↑ open up ↑ |
236 236 \fBNV_UNIQUE_NAME_TYPE\fR was specified for \fInvflag\fR, existing nvpairs with
237 237 matching names and data types are removed before the new nvpair is added. See
238 238 \fBnvlist_add_byte\fR(3NVPAIR) for more information.
239 239 .sp
240 240 .LP
241 241 The \fBnvlist_xalloc()\fR function is identical to \fBnvlist_alloc()\fR except
242 242 that \fBnvlist_xalloc()\fR can use a different allocator, as described in the
243 243 Pluggable Allocators section.
244 244 .sp
245 245 .LP
246 -The \fBnvlist_free()\fR function frees a name-value pair list.
246 +The \fBnvlist_free()\fR function frees a name-value pair list. If \fInvl\fR
247 +is a null pointer, no action occurs.
247 248 .sp
248 249 .LP
249 250 The \fBnvlist_size()\fR function returns the minimum size of a contiguous
250 251 buffer large enough to pack \fInvl\fR. The \fIencoding\fR parameter specifies
251 252 the method of encoding when packing \fInvl\fR. Supported encoding methods are:
252 253 .sp
253 254 .ne 2
254 255 .na
255 256 \fB\fBNV_ENCODE_NATIVE\fR\fR
256 257 .ad
257 258 .RS 20n
258 259 Straight \fBbcopy()\fR as described in \fBbcopy\fR(3C).
259 260 .RE
260 261
261 262 .sp
262 263 .ne 2
263 264 .na
264 265 \fB\fBNV_ENCODE_XDR\fR\fR
265 266 .ad
266 267 .RS 20n
267 268 Use XDR encoding, suitable for sending to another host.
268 269 .RE
269 270
270 271 .sp
271 272 .LP
272 273 The \fBnvlist_pack()\fR function packs \fInvl\fR into contiguous memory
273 274 starting at *\fIbufp\fR. The \fIencoding\fR parameter specifies the method of
274 275 encoding (see above).
275 276 .RS +4
276 277 .TP
277 278 .ie t \(bu
278 279 .el o
279 280 If *\fIbufp\fR is not \fINULL\fR, *\fIbufp\fR is expected to be a
280 281 caller-allocated buffer of size *\fIbuflen\fR.
281 282 .RE
282 283 .RS +4
283 284 .TP
284 285 .ie t \(bu
285 286 .el o
286 287 If *\fIbufp\fR is \fINULL\fR, the library will allocate memory and update
287 288 *\fIbufp\fR to point to the memory and update *\fIbuflen\fR to contain the size
288 289 of the allocated memory.
289 290 .RE
290 291 .sp
291 292 .LP
292 293 The \fBnvlist_xpack()\fR function is identical to \fBnvlist_pack()\fR except
293 294 that \fBnvlist_xpack()\fR can use a different allocator.
294 295 .sp
295 296 .LP
296 297 The \fBnvlist_unpack()\fR function takes a buffer with a packed \fBnvlist_t\fR
297 298 and unpacks it into a searchable \fBnvlist_t\fR. The library allocates memory
298 299 for \fBnvlist_t\fR. The caller is responsible for freeing the memory by calling
299 300 \fBnvlist_free()\fR.
300 301 .sp
301 302 .LP
302 303 The \fBnvlist_xunpack()\fR function is identical to \fBnvlist_unpack()\fR
303 304 except that \fBnvlist_xunpack()\fR can use a different allocator.
304 305 .sp
305 306 .LP
306 307 The \fBnvlist_dup()\fR function makes a copy of \fInvl\fR and updates
307 308 \fInvlp\fR to point to the copy.
308 309 .sp
309 310 .LP
310 311 The \fBnvlist_xdup()\fR function is identical to \fBnvlist_dup()\fR except that
311 312 \fBnvlist_xdup()\fR can use a different allocator.
312 313 .sp
313 314 .LP
314 315 The \fBnvlist_merge()\fR function adds copies of all name-value pairs from
315 316 \fInvl\fR to \fIdst\fR. Name-value pairs in \fIdst\fR are replaced with
316 317 name-value pairs from \fInvl\fR that have identical names (if \fIdst\fR has the
317 318 type \fBNV_UNIQUE_NAME\fR) or identical names and types (if \fIdst\fR has the
318 319 type \fBNV_UNIQUE_NAME_TYPE\fR).
319 320 .sp
320 321 .LP
321 322 The \fBnvlist_lookup_nv_alloc()\fR function retrieves the pointer to the
322 323 allocator that was used when manipulating a name-value pair list.
323 324 .SS "Pluggable Allocators"
324 325 .SS "Using Pluggable Allocators"
325 326 .sp
326 327 .LP
327 328 The \fBnv_alloc_init()\fR, \fBnv_alloc_reset()\fR and \fBnv_alloc_fini()\fR
328 329 functions provide an interface to specify the allocator to be used when
329 330 manipulating a name-value pair list.
330 331 .sp
331 332 .LP
332 333 The \fBnv_alloc_init()\fR function determines the allocator properties and puts
333 334 them into the \fInva\fR argument. The application must specify the \fInv_arg\fR
334 335 and \fInvo\fR arguments and an optional variable argument list. The optional
335 336 arguments are passed to the (*\fBnv_ao_init()\fR) function.
336 337 .sp
337 338 .LP
338 339 The \fInva\fR argument must be passed to \fBnvlist_xalloc()\fR,
339 340 \fBnvlist_xpack()\fR, \fBnvlist_xunpack()\fR and \fBnvlist_xdup()\fR.
340 341 .sp
341 342 .LP
342 343 The \fBnv_alloc_reset()\fR function is responsible for resetting the allocator
343 344 properties to the data specified by \fBnv_alloc_init()\fR. When no
344 345 (*\fBnv_ao_reset()\fR) function is specified, \fBnv_alloc_reset()\fR has no
345 346 effect.
346 347 .sp
347 348 .LP
348 349 The \fBnv_alloc_fini()\fR function destroys the allocator properties determined
349 350 by \fBnv_alloc_init()\fR. When a (*\fBnv_ao_fini()\fR) function is specified,
350 351 it is called from \fBnv_alloc_fini()\fR.
351 352 .sp
352 353 .LP
353 354 The disposition of the allocated objects and the memory used to store them is
354 355 left to the allocator implementation.
355 356 .sp
356 357 .LP
357 358 The \fBnv_alloc_nosleep\fR \fBnv_alloc_t\fR can be used with
358 359 \fBnvlist_xalloc()\fR to mimic the behavior of \fBnvlist_alloc()\fR.
359 360 .sp
360 361 .LP
361 362 The nvpair allocator framework provides a pointer to the operation structure of
362 363 a fixed buffer allocator. This allocator, \fBnv_fixed_ops\fR, uses a
363 364 pre-allocated buffer for memory allocations. It is intended primarily for
364 365 kernel use and is described on \fBnvlist_alloc\fR(9F).
365 366 .sp
366 367 .LP
367 368 An example program that uses the pluggable allocator functionality is provided
368 369 on \fBnvlist_alloc\fR(9F).
369 370 .SS "Creating Pluggable Allocators"
370 371 .sp
371 372 .LP
372 373 Any producer of name-value pairs can specify its own allocator functions. The
373 374 application must provide the following pluggable allocator operations:
374 375 .sp
375 376 .in +2
376 377 .nf
377 378 int (*nv_ao_init)(nv_alloc_t *nva, va_list nv_valist);
378 379 void (*nv_ao_fini)(nv_alloc_t *nva);
379 380 void *(*nv_ao_alloc)(nv_alloc_t *nva, size_t sz);
380 381 void (*nv_ao_reset)(nv_alloc_t *nva);
381 382 void (*nv_ao_free)(nv_alloc_t *nva, void *buf, size_t sz);
382 383 .fi
383 384 .in -2
384 385
385 386 .sp
386 387 .LP
387 388 The \fInva\fR argument of the allocator implementation is always the first
388 389 argument.
389 390 .sp
390 391 .LP
391 392 The optional (*\fBnv_ao_init()\fR) function is responsible for filling the data
392 393 specified by \fBnv_alloc_init()\fR into the \fInva_arg\fR argument. The
393 394 (*\fBnv_ao_init()\fR) function is only called when \fBnv_alloc_init()\fR is
394 395 executed.
395 396 .sp
396 397 .LP
397 398 The optional (*\fBnv_ao_fini()\fR) function is responsible for the cleanup of
398 399 the allocator implementation. It is called by \fBnv_alloc_fini()\fR.
399 400 .sp
400 401 .LP
401 402 The required (*\fBnv_ao_alloc()\fR) function is used in the nvpair allocation
402 403 framework for memory allocation. The \fIsz\fR argument specifies the size of
403 404 the requested buffer.
404 405 .sp
405 406 .LP
406 407 The optional (*\fBnv_ao_reset()\fR) function is responsible for resetting the
407 408 \fInva_arg\fR argument to the data specified by \fBnv_alloc_init()\fR.
408 409 .sp
409 410 .LP
410 411 The required (*\fBnv_ao_free()\fR) function is used in the nvpair allocator
411 412 framework for memory deallocation. The \fIbuf\fR argument is a pointer to a
412 413 block previously allocated by the (*\fBnv_ao_alloc()\fR) function. The size
413 414 argument \fIsz\fR must exactly match the original allocation.
414 415 .sp
415 416 .LP
416 417 The disposition of the allocated objects and the memory used to store them is
417 418 left to the allocator implementation.
418 419 .SH RETURN VALUES
419 420 .sp
420 421 .LP
421 422 These functions return 0 on success and an error value on failure.
422 423 .sp
423 424 .LP
424 425 The \fBnvlist_lookup_nv_alloc()\fR function returns a pointer to an allocator.
425 426 .SH ERRORS
426 427 .sp
427 428 .LP
428 429 These functions will fail if:
429 430 .sp
430 431 .ne 2
431 432 .na
432 433 \fB\fBEINVAL\fR\fR
433 434 .ad
434 435 .RS 10n
435 436 There is an invalid argument.
436 437 .RE
437 438
438 439 .sp
439 440 .LP
440 441 The \fBnvlist_alloc()\fR, \fBnvlist_dup()\fR, \fBnvlist_pack()\fR,
441 442 \fBnvlist_unpack()\fR, \fBnvlist_merge()\fR, \fBnvlist_xalloc()\fR,
442 443 \fBnvlist_xdup()\fR, \fBnvlist_xpack()\fR, and \fBnvlist_xunpack()\fR functions
443 444 will fail if:
444 445 .sp
445 446 .ne 2
446 447 .na
447 448 \fB\fBENOMEM\fR\fR
448 449 .ad
449 450 .RS 10n
450 451 There is insufficient memory.
451 452 .RE
452 453
453 454 .sp
454 455 .LP
455 456 The \fBnvlist_pack()\fR, \fBnvlist_unpack()\fR, \fBnvlist_xpack()\fR, and
456 457 \fBnvlist_xunpack()\fR functions will fail if:
457 458 .sp
458 459 .ne 2
459 460 .na
460 461 \fB\fBEFAULT\fR\fR
461 462 .ad
462 463 .RS 11n
463 464 An encode/decode error occurs.
464 465 .RE
465 466
466 467 .sp
467 468 .ne 2
468 469 .na
469 470 \fB\fBENOTSUP\fR\fR
470 471 .ad
471 472 .RS 11n
472 473 An encode/decode method is not supported.
473 474 .RE
474 475
475 476 .SH EXAMPLES
476 477 .sp
477 478 .in +2
478 479 .nf
479 480 /*
480 481 * Program to create an nvlist.
481 482 */
482 483 #include <stdio.h>
483 484 #include <sys/types.h>
484 485 #include <string.h>
485 486 #include <libnvpair.h>
486 487
487 488 /* generate a packed nvlist */
488 489 static int
489 490 create_packed_nvlist(char **buf, uint_t *buflen, int encode)
490 491 {
491 492 uchar_t bytes[] = {0xaa, 0xbb, 0xcc, 0xdd};
492 493 int32_t int32[] = {3, 4, 5};
493 494 char *strs[] = {"child0", "child1", "child2"};
494 495 int err;
495 496 nvlist_t *nvl;
496 497
497 498 err = nvlist_alloc(&nvl, NV_UNIQUE_NAME, 0); /* allocate list */
498 499 if (err) {
499 500 (void) printf("nvlist_alloc() failed\en");
500 501 return (err);
501 502 }
502 503
503 504 /* add a value of some types */
504 505 if ((nvlist_add_byte(nvl, "byte", bytes[0]) != 0) ||
505 506 (nvlist_add_int32(nvl, "int32", int32[0]) != 0) ||
506 507 (nvlist_add_int32_array(nvl, "int32_array", int32, 3) != 0) ||
507 508 (nvlist_add_string_array(nvl, "string_array", strs, 3) != 0)) {
508 509 nvlist_free(nvl);
509 510 return (-1);
510 511 }
511 512
512 513 err = nvlist_size(nvl, buflen, encode);
513 514 if (err) {
514 515 (void) printf("nvlist_size: %s\en", strerror(err));
515 516 nvlist_free(nvl);
516 517 return (err);
517 518 }
518 519
519 520 /* pack into contig. memory */
520 521 err = nvlist_pack(nvl, buf, buflen, encode, 0);
521 522 if (err)
522 523 (void) printf("nvlist_pack: %s\en", strerror(err));
523 524
524 525 /* free the original list */
525 526 nvlist_free(nvl);
526 527 return (err);
527 528 }
528 529
529 530 /* selectively print nvpairs */
530 531 static void
531 532 nvlist_lookup_and_print(nvlist_t *nvl)
532 533 {
533 534 char **str_val;
534 535 int i, int_val;
535 536 uint_t nval;
536 537
537 538 if (nvlist_lookup_int32(nvl, "int32", &int_val) == 0)
538 539 (void) printf("int32 = %d\en", int_val);
539 540 if (nvlist_lookup_string_array(nvl, "string_array", &str_val, &nval)
540 541 == 0) {
541 542 (void) printf("string_array =");
542 543 for (i = 0; i < nval; i++)
543 544 (void) printf(" %s", str_val[i]);
544 545 (void) printf("\en");
545 546 }
546 547 }
547 548
548 549 /*ARGSUSED*/
549 550 int
550 551 main(int argc, char *argv[])
551 552 {
552 553 int err;
553 554 char *buf = NULL;
554 555 size_t buflen;
555 556 nvlist_t *nvl = NULL;
556 557
557 558 if (create_packed_nvlist(&buf, &buflen, NV_ENCODE_XDR) != 0) {
558 559 (void) printf("cannot create packed nvlist buffer\en");
559 560 return(-1);
560 561 }
561 562
562 563 /* unpack into an nvlist_t */
563 564 err = nvlist_unpack(buf, buflen, &nvl, 0);
564 565 if (err) {
565 566 (void) printf("nvlist_unpack(): %s\en", strerror(err));
566 567 return(-1);
567 568 }
568 569
569 570 /* selectively print out attributes */
570 571 nvlist_lookup_and_print(nvl);
571 572 return(0);
572 573 }
573 574 .fi
574 575 .in -2
575 576
576 577 .SH ATTRIBUTES
577 578 .sp
578 579 .LP
579 580 See \fBattributes\fR(5) for descriptions of the following attributes:
580 581 .sp
581 582
582 583 .sp
583 584 .TS
584 585 box;
585 586 c | c
586 587 l | l .
587 588 ATTRIBUTE TYPE ATTRIBUTE VALUE
588 589 _
589 590 Interface Stability Evolving
590 591 _
591 592 MT-Level MT-Safe
592 593 .TE
593 594
594 595 .SH SEE ALSO
595 596 .sp
596 597 .LP
597 598 \fBlibnvpair\fR(3LIB), \fBattributes\fR(5), \fBnvlist_alloc\fR(9F)
↓ open down ↓ |
341 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX