Name-value Pair Library Functions nvlistlookupboolean(3NVPAIR)
NAME
nvlistlookupboolean, nvlistlookupbooleanvalue,
nvlistlookupbyte, nvlistlookupint8, nvlistlookupuint8,
nvlistlookupint16, nvlistlookupuint16,
nvlistlookupint32, nvlistlookupuint32,
nvlistlookupint64, nvlistlookupuint64,
nvlistlookupdouble, nvlistlookupstring,
nvlistlookupnvlist, nvlistlookupbooleanarray,
nvlistlookupbytearray, nvlistlookupint8array,
nvlistlookupuint8array, nvlistlookupint16array,
nvlistlookupuint16array, nvlistlookupint32array,
nvlistlookupuint32array, nvlistlookupint64array,
nvlistlookupuint64array, nvlistlookupnvlistarray,
nvlistlookupstringarray, nvlistlookuppairs - match name
and type indicated by the interface name and retrieve data
value
SYNOPSIS
cc [ flag... ] file... -lnvpair [ library... ]
#include
int nvlistlookupboolean(nvlistt *nvl, const char *name);
int nvlistlookupbooleanvalue(nvlistt *nvl,
const char *name, booleant *val);
int nvlistlookupbyte(nvlistt *nvl, const char *name,
uchart *val);
int nvlistlookupint8(nvlistt *nvl, const char *name,
int8t *val);
int nvlistlookupuint8(nvlistt *nvl, const char *name,
uint8t *val);
int nvlistlookupint16(nvlistt *nvl, const char *name,
int16t *val);
int nvlistlookupuint16(nvlistt *nvl, const char *name,
uint16t *val);
int nvlistlookupint32(nvlistt *nvl, const char *name,
int32t *val);
SunOS 5.11 Last change: 1 Aug 2008 1
Name-value Pair Library Functions nvlistlookupboolean(3NVPAIR)
int nvlistlookupuint32(nvlistt *nvl, const char *name,
uint32t *val);
int nvlistlookupint64(nvlistt *nvl, const char *name,
int64t *val);
int nvlistlookupuint64(nvlistt *nvl, const char *name,
uint64t *val);
int nvlistlookupdouble(nvlistt *nvl, const char *name,
double *val);
int nvlistlookupstring(nvlistt *nvl, const char *name,
char **val);
int nvlistlookupnvlist(nvlistt *nvl, const char *name,
nvlistt **val);
int nvlistlookupbooleanarray(nvlistt *nvl, const char *name,
booleant **val, uintt *nelem);
int nvlistlookupbytearray(nvlistt *nvl, const char *name,
uchart **val, uintt *nelem);
int nvlistlookupint8array(nvlistt *nvl, const char *name,
int8t **val, uintt *nelem);
int nvlistlookupuint8array(nvlistt *nvl, const char *name,
uint8t **val, uintt *nelem);
int nvlistlookupint16array(nvlistt *nvl, const char *name,
int16t **val, uintt *nelem);
int nvlistlookupuint16array(nvlistt *nvl, const char *name,
uint16t **val, uintt *nelem);
int nvlistlookupint32array(nvlistt *nvl, const char *name,
int32t **val, uintt *nelem);
SunOS 5.11 Last change: 1 Aug 2008 2
Name-value Pair Library Functions nvlistlookupboolean(3NVPAIR)
int nvlistlookupuint32array(nvlistt *nvl, const char *name,
uint32t **val, uintt *nelem);
int nvlistlookupint64array(nvlistt *nvl, const char *name,
int64t **val, uintt *nelem);
int nvlistlookupuint64array(nvlistt *nvl, const char *name,
uint64t **val, uintt *nelem);
int nvlistlookupstringarray(nvlistt *nvl, const char *name,
char ***val, uintt *nelem);
int nvlistlookupnvlistarray(nvlistt *nvl, const char *name,
nvlistt ***val, uintt *nelem);
int nvlistlookuppairs(nvlistt *nvl, int flag...);
PARAMETERS
nvl The nvlistt to be processed.
name Name of the name-value pair to search.
nelem Address to store the number of elements in value.
val Address to store the starting address of the value.
flag Specify bit fields defining lookup behavior:
NVFLAGNOENTOK The retrival function will not
fail if no matching name-value
pair is found.
DESCRIPTION
These functions find the nvpair (name-value pair) that
matches the name and type as indicated by the interface
name. If one is found, nelem and val are modified to contain
the number of elements in value and the starting address of
data, respectively.
SunOS 5.11 Last change: 1 Aug 2008 3
Name-value Pair Library Functions nvlistlookupboolean(3NVPAIR)
These functions work for nvlists (lists of name-value pairs)
allocated with NVUNIQUENAME or NVUNIQUENAMETYPE speci-
fied in nvlistalloc(3NVPAIR). If this is not the case, the
function returns ENOTSUP because the list potentially con-
tains multiple nvpairs with the same name and type.
Multiple threads can simultaneously read the same nvlistt
but only one thread can actively change a given nvlistt at
a time. The caller is responsible for the synchronization.
All memory required for storing the array elements, includ-
ing string value, are managed by the library. References to
such data remain valid until nvlistfree() is called on nvl.
The nvlistlookuppairs() function retrieves a set of
nvpairs. The arguments are a null-terminated list of pairs
(data type DATATYPEBOLEAN), triples (non-array data
types) or quads (array data types). The interpretation of
the arguments depends on the value of type (see
nvpairtype(3NVPAIR)) as follows:
name Name of the name-value pair to search.
type Data type (see nvpairtype(3NVPAIR)).
val Address to store the starting address of the value.
When using data type DATATYPEBOLEAN, the val
argument is omitted.
nelem Address to store the number of elements in value.
Non-array data types have only one argument and
nelem is omitted.
The order of the arguments is name, type, [val], [nelem].
When using NVFLAGNOENTOK and no matching name-value pair
is found, the memory pointed to by val and nelem is left
untouched.
RETURN VALUES
These functions return 0 on success and an error value on
failure.
SunOS 5.11 Last change: 1 Aug 2008 4
Name-value Pair Library Functions nvlistlookupboolean(3NVPAIR)
ERORS
These functions will fail if:
EINVAL There is an invalid argument.
ENOENT No matching name-value pair is found
ENOTSUP An encode/decode method is not supported.
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
ATRIBUTE TYPE ATRIBUTE VALUE
Interface Stability Committed
MT-Level MT-Safe
SEE ALSO
libnvpair(3LIB), nvlistalloc(3NVPAIR),
nvpairtype(3NVPAIR), attributes(5)
SunOS 5.11 Last change: 1 Aug 2008 5
|