NAME | SYNOPSIS | API RESTRICTIONS | PARAMETERS | DESCRIPTION | RETURN VALUE | ERRORS | ATTRIBUTES
$(OS_DIR)/lib/libnvpair.a #include <libnvpair.h> #include <sys/nvpair.h>int nvlist_alloc(nvlist_t ** nvlp, uint_t nvflag, int kmflag);
The function or functions documented here may not be used safely in all application contexts with all APIs provided in the ChorusOS 5.0 product.
See API(5FEA) for details.
Address of a pointer to nvlist_t .
Attribute replacing policy, can be set to NV_UNIQUE_NAME or NV_UNIQUE_NAME_TYPE ;
Microkernel memory allocation policy, either KM_SLEEP or KM_NOSLEEP . Not used in userland
nvlist_t to be processed
Pointer to buffer to contain the encoded size
Address of buffer to pack nvlist into, must be 8-byte aligned. If NULL , the library will allocate memory
Size of buffer bufp points to
Buffer containing packed nvlist
Encoding method for packing
The nvlist_alloc() function allocates a name-value pair list and updates nvlp so that it points to the handle.
If nvflag is set to NV_UNIQUE_NAME , attributes' names are kept unique: when a name is added to the attribute list, any attribute previously added with the same name is removed. If nvflag is set to NV_UNIQUE_NAME_TYPE , the name-type pair is kept unique: when a name is added to the attribute list, any attribute with the same name and type is removed.
The nvlist_free() function frees a name-value pair list.
The nvlist_size() function returns the minimum size of a contiguous buffer large enough to pack nvl . The encoding parameter specifies the method of encoding when packing nvl .
Supported encoding methods are:
Straight copy
Use XDR encoding, suitable for sending to another host.
The nvlist_pack() function packs nvl into contiguous memory starting at *bufp . The encoding parameter specifies the method of encoding.
If *bufp is not NULL , *bufp is expected to be a caller-allocated buffer of size *buflen . The kmflag argument is ignored;
If *bufp is NULL , the library will allocate memory and update *bufp to point to the memory, and update *buflen to contain the size of the allocated memory. If the call is made in the microkernel, kmflag indicates the memory allocation policy.
The nvlist_unpack() function takes buffer with a packed nvlist_t and unpacks them into a searchable nvlist_t . The library will manage the memory allocation.
These functions return 0 on success. Otherwise, they return one of the following error codes.
nvlist_alloc() - nvlist_dup()
Some of the arguments are null pointers
Insufficient memory
nvlist_pack() - nvlist_unpack()
Invalid argument
Insuffcient memory
Encode/decode error
Encode/decode method not supported
nvlist_size()
Invalid argument
See attributes(5) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
---|---|
Interface Stability | Evolving |
NAME | SYNOPSIS | API RESTRICTIONS | PARAMETERS | DESCRIPTION | RETURN VALUE | ERRORS | ATTRIBUTES