xref: /illumos-gate/usr/src/man/man3nvpair/nvlist_lookup_nvpair.3nvpair (revision 66582b606a8194f7f3ba5b3a3a6dca5b0d346361)
te
Copyright (c) 2007, Sun Microsystems Inc. All Rights Reserved.
Copyright 2016 Joyent, Inc.
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.
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.
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]
NVLIST_LOOKUP_NVPAIR 3NVPAIR "Mar 13, 2016"
NAME
nvlist_lookup_nvpair, nvlist_exists, nvlist_empty - lookup named pairs
SYNOPSIS

cc [ flag... ] file... -lnvpair [ library... ]
#include <libnvpair.h>

int nvlist_lookup_nvpair(nvlist_t *nvl, const char *name,
 nvpair_t **nvp);

boolean_t nvlist_exists(nvlist_t *nvl, const char *name);

boolean_t nvlist_empty(nvlist_t *nvl);
DESCRIPTION

The nvlist_lookup_nvpair() function returns the nvpair with the matching name, regardless of type. It is valid only for lists allocated with NV_UNIQUE_NAME. See nvlist_alloc(3NVPAIR).

The nvlist_exists() function returns success if any nvpair exists with the given name. It is valid for all types of lists.

The nvlist_empty() function returns success if the list nvl contains no nvpairs. It is valid for all types of lists.

RETURN VALUES

The nvlist_lookup_nvpair() function returns 0 on success and an error value on failure.

The nvlist_exists() function returns B_TRUE if an nvpair with the given name exists and B_FALSE otherwise.

The nvlist_empty() function returns B_TRUE if the given list, nvl, contains no nvpairs and B_FALSE otherwise.

ERRORS

The nvlist_lookup_nvpair() function will fail if: EINVAL

There is an invalid argument.

ENOENT

No matching name-value pair is found.

ENOTSUP

The list was not allocated with NV_UNIQUE_NAME.

ATTRIBUTES

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPE ATTRIBUTE VALUE
Interface Stability Committed
MT-Level MT-Safe
SEE ALSO

libnvpair(3LIB), nvlist_alloc(3NVPAIR), attributes(5), nvlist_lookup_nvpair(9F)