nvlist_add_boolean_array man page on SmartOS

Man page or keyword search:  
man Server   16655 pages
apropos Keyword Search (all sections)
Output format
SmartOS logo
[printable version]

NVLIST_ADD_BOOLEAN(3NVPAIR)			   NVLIST_ADD_BOOLEAN(3NVPAIR)

NAME
       nvlist_add_boolean,	nvlist_add_boolean_value,     nvlist_add_byte,
       nvlist_add_int8, nvlist_add_uint8, nvlist_add_int16, nvlist_add_uint16,
       nvlist_add_int32,	  nvlist_add_uint32,	     nvlist_add_int64,
       nvlist_add_uint64,	 nvlist_add_double,	    nvlist_add_string,
       nvlist_add_nvlist,     nvlist_add_nvpair,     nvlist_add_boolean_array,
       nvlist_add_byte_array,  nvlist_add_int8_array,  nvlist_add_uint8_array,
       nvlist_add_int16_array,			      nvlist_add_uint16_array,
       nvlist_add_int32_array,			      nvlist_add_uint32_array,
       nvlist_add_int64_array,			      nvlist_add_uint64_array,
       nvlist_add_string_array, nvlist_add_nvlist_array - add  new  name-value
       pair to nvlist_t

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

       int nvlist_add_boolean(nvlist_t *nvl, const char *name);

       int nvlist_add_boolean_value(nvlist_t *nvl,
	    const char *name, boolean_t val);

       int nvlist_add_byte(nvlist_t *nvl, const char *name,
	    uchar_t val);

       int nvlist_add_int8(nvlist_t *nvl, const char *name,
	    int8_t val);

       int nvlist_add_uint8(nvlist_t *nvl, const char *name,
	    uint8_t val);

       int nvlist_add_int16(nvlist_t *nvl, const char *name,
	    int16_t val);

       int nvlist_add_uint16(nvlist_t *nvl, const char *name,
	    uint16_t val);

       int nvlist_add_int32(nvlist_t *nvl, const char *name,
	    int32_t val);

       int nvlist_add_uint32(nvlist_t *nvl, const char *name,
	    uint32_t val);

       int nvlist_add_int64(nvlist_t *nvl, const char *name,
	    int64_t val);

       int nvlist_add_uint64(nvlist_t *nvl, const char *name,
	    uint64_t val);

       int nvlist_add_double(nvlist_t *nvl, const char *name,
	    double val);

       int nvlist_add_string(nvlist_t *nvl, const char *name,
	    const char *val);

       int nvlist_add_nvlist(nvlist_t *nvl, const char *name,
	    nvlist_t *val);

       int nvlist_add_nvpair(nvlist_t *nvl, nvpair_t *nvp);

       int nvlist_add_boolean_array(nvlist_t *nvl, const char *name,
	    boolean_t *val, uint_t nelem);

       int nvlist_add_byte_array(nvlist_t *nvl, const char *name,
	    uchar_t *val, uint_t nelem);

       int nvlist_add_int8_array(nvlist_t *nvl, const char *name,
	    int8_t *val, uint_t nelem);

       int nvlist_add_uint8_array(nvlist_t *nvl, const char *name,
	    uint8_t *val, uint_t nelem);

       int nvlist_add_int16_array(nvlist_t *nvl, const char *name,
	    int16_t *val, uint_t nelem);

       int nvlist_add_uint16_array(nvlist_t *nvl, const char *name,
	    uint16_t *val, uint_t nelem);

       int nvlist_add_int32_array(nvlist_t *nvl, const char *name,
	    int32_t *val, uint_t nelem);

       int nvlist_add_uint32_array(nvlist_t *nvl, const char *name,
	    uint32_t *val, uint_t nelem);

       int nvlist_add_int64_array(nvlist_t *nvl, const char *name,
	    int64_t *val, uint_t nelem);

       int nvlist_add_uint64_array(nvlist_t *nvl, const char *name,
	    uint64_t *val, uint_t nelem);

       int nvlist_add_string_array(nvlist_t *nvl, const char *name,
	    char *const *val, uint_t nelem);

       int nvlist_add_nvlist_array(nvlist_t *nvl, const char *name,
	    nvlist_t **val, uint_t nelem);

PARAMETERS
       nvl
		The nvlist_t (name-value pair list) to be processed.

       nvp
		The nvpair_t (name-value pair) to be processed.

       name
		Name of the nvpair (name-value pair).

       nelem
		Number of elements in value (that is, array size).

       val
		Value or starting address of the array value.

DESCRIPTION
       These  functions	 add a new name-value pair to an nvlist_t. The unique‐
       ness of nvpair name and data types follows the nvflag  argument	speci‐
       fied for nvlist_alloc(). See nvlist_alloc(3NVPAIR).

       If  NV_UNIQUE_NAME  was	specified  for	nvflag,	 existing nvpairs with
       matching names are removed before the new nvpair is added.

       If NV_UNIQUE_NAME_TYPE was specified for nvflag, existing nvpairs  with
       matching	 names	and  data  types  are removed before the new nvpair is
       added.

       If neither was specified for nvflag, the new nvpair is  unconditionally
       added  at  the  end of the list. The library preserves the order of the
       name-value pairs across packing, unpacking, and duplication.

       Multiple threads can simultaneously read the same  nvlist_t,  but  only
       one  thread  can actively change a given nvlist_t at a time. The caller
       is responsible for the synchronization.

       The  list  that	is  added  to	the   parent   nvlist_t	  by   calling
       nvlist_add_nvlist()  is copied and thus is not freed when nvlist_free()
       is called on the parent list. To prevent memory leaks, your code	 needs
       to look like the following (error handling elided for clarity):

	 nvlist_t *parent_nvl;
	 nvlist_t *child_nvl;

	 /* create parent list, add an entry */
	 (void) nvlist_alloc(&parent_nvl, NV_UNIQUE_NAME, KM_SLEEP);
	 (void) nvlist_add_boolean(parent_nvl, "parent_bool", 0);

	 /* create child list, add an entry */
	 (void) nvlist_alloc(&child_nvl, NV_UNIQUE_NAME, KM_SLEEP);
	 (void) nvlist_add_boolean(child_nvl, "child_bool", 0);

	 /* add the child to the parent */
	 (void) nvlist_add_nvlist(parent_nvl, "child_nvlist", child_nvl);

	 /* do stuff .. */

	 /* free nvlist(s) */
	 (void) nvlist_free(child_nvl); /* required, but not obvious */
	 (void) nvlist_free(parent_nvl);

       The  nvlist_add_boolean()  function is deprecated. The nvlist_add_bool‐
       ean_value() function should be used instead.

RETURN VALUES
       These functions return 0 on success and an error value on failure.

ERRORS
       These functions will fail if:

       EINVAL
		 There is an invalid argument.

       ENOMEM
		 There is insufficient memory.

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)

				 Sep 15, 2009	   NVLIST_ADD_BOOLEAN(3NVPAIR)
[top]

List of man pages available for SmartOS

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net