Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 28 Aug 2016 11:58:15 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r304955 - in projects/clang390-import: contrib/ncurses/ncurses/tinfo lib/libc/amd64/sys lib/libc/i386/sys lib/libc/net lib/libc/sys lib/libnv lib/libnv/tests share/man/man9 sys/arm64/ar...
Message-ID:  <201608281158.u7SBwFaL054719@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Sun Aug 28 11:58:15 2016
New Revision: 304955
URL: https://svnweb.freebsd.org/changeset/base/304955

Log:
  Merge ^/head r304885 through r304954.

Added:
  projects/clang390-import/lib/libnv/tests/cnv_tests.cc
     - copied unchanged from r304954, head/lib/libnv/tests/cnv_tests.cc
  projects/clang390-import/share/man/man9/cnv.9
     - copied unchanged from r304954, head/share/man/man9/cnv.9
  projects/clang390-import/sys/contrib/libnv/cnvlist.c
     - copied unchanged from r304954, head/sys/contrib/libnv/cnvlist.c
  projects/clang390-import/sys/mips/conf/std.AR91XX
     - copied unchanged from r304954, head/sys/mips/conf/std.AR91XX
  projects/clang390-import/sys/mips/conf/std.QCA955X
     - copied unchanged from r304954, head/sys/mips/conf/std.QCA955X
  projects/clang390-import/sys/sys/cnv.h
     - copied unchanged from r304954, head/sys/sys/cnv.h
Deleted:
  projects/clang390-import/sys/mips/conf/AR91XX_BASE
  projects/clang390-import/sys/mips/conf/QCA955X_BASE
Modified:
  projects/clang390-import/contrib/ncurses/ncurses/tinfo/lib_baudrate.c
  projects/clang390-import/lib/libc/amd64/sys/ptrace.S
  projects/clang390-import/lib/libc/i386/sys/ptrace.S
  projects/clang390-import/lib/libc/net/getaddrinfo.c
  projects/clang390-import/lib/libc/sys/ptrace.2
  projects/clang390-import/lib/libnv/Makefile
  projects/clang390-import/lib/libnv/tests/Makefile
  projects/clang390-import/share/man/man9/Makefile
  projects/clang390-import/sys/arm64/arm64/machdep.c
  projects/clang390-import/sys/cam/ata/ata_all.c
  projects/clang390-import/sys/conf/files
  projects/clang390-import/sys/contrib/dev/ath/ath_hal/ar9300/ar9300phy.h
  projects/clang390-import/sys/contrib/ipfilter/netinet/ip_compat.h
  projects/clang390-import/sys/contrib/libnv/nvlist.c
  projects/clang390-import/sys/contrib/libnv/nvlist_impl.h
  projects/clang390-import/sys/dev/iwm/if_iwmreg.h
  projects/clang390-import/sys/dev/uart/uart_core.c
  projects/clang390-import/sys/kern/vfs_lookup.c
  projects/clang390-import/sys/kern/vnode_if.src
  projects/clang390-import/sys/mips/conf/AP135
  projects/clang390-import/sys/mips/conf/CARAMBOLA2
  projects/clang390-import/sys/mips/conf/DIR-655A1
  projects/clang390-import/sys/mips/conf/TL-ARCHERC7V2
  projects/clang390-import/sys/mips/conf/TL-WDR4300
  projects/clang390-import/sys/mips/conf/TL-WR1043NDv2
  projects/clang390-import/sys/mips/conf/TP-WN1043ND
  projects/clang390-import/sys/mips/conf/std.AR933X
  projects/clang390-import/sys/mips/conf/std.AR934X
  projects/clang390-import/sys/modules/Makefile
  projects/clang390-import/sys/modules/cloudabi32/Makefile
  projects/clang390-import/sys/modules/cloudabi64/Makefile
  projects/clang390-import/tools/tools/net80211/wlanwds/wlanwds.c
  projects/clang390-import/usr.bin/netstat/route.c
Directory Properties:
  projects/clang390-import/   (props changed)
  projects/clang390-import/contrib/ncurses/   (props changed)
  projects/clang390-import/sys/contrib/ipfilter/   (props changed)

Modified: projects/clang390-import/contrib/ncurses/ncurses/tinfo/lib_baudrate.c
==============================================================================
--- projects/clang390-import/contrib/ncurses/ncurses/tinfo/lib_baudrate.c	Sun Aug 28 11:54:45 2016	(r304954)
+++ projects/clang390-import/contrib/ncurses/ncurses/tinfo/lib_baudrate.c	Sun Aug 28 11:58:15 2016	(r304955)
@@ -94,7 +94,7 @@ struct speed {
     int sp;			/* the actual speed */
 };
 
-#define DATA(number) { B##number, number }
+#define DATA(number) { (NCURSES_OSPEED)B##number, number }
 
 static struct speed const speeds[] =
 {

Modified: projects/clang390-import/lib/libc/amd64/sys/ptrace.S
==============================================================================
--- projects/clang390-import/lib/libc/amd64/sys/ptrace.S	Sun Aug 28 11:54:45 2016	(r304954)
+++ projects/clang390-import/lib/libc/amd64/sys/ptrace.S	Sun Aug 28 11:58:15 2016	(r304955)
@@ -38,14 +38,26 @@ __FBSDID("$FreeBSD$");
 
 #include "SYS.h"
 
+	.globl	CNAME(__error)
+	.type	CNAME(__error),@function
+
 ENTRY(ptrace)
-	xorl	%eax,%eax
+	pushq	%rdi	/* align stack */
+	pushq	%rdi
+	pushq	%rsi
+	pushq	%rdx
+	pushq	%rcx
 #ifdef PIC
-	movq	PIC_GOT(CNAME(errno)),%r8
-	movl	%eax,(%r8)
+	callq	PIC_PLT(CNAME(__error))
 #else
-	movl	%eax,CNAME(errno)(%rip)
+	callq	CNAME(__error)
 #endif
+	popq	%rcx
+	popq	%rdx
+	popq	%rsi
+	popq	%rdi
+	popq	%rdi
+	movl	$0,(%rax)
 	mov	$SYS_ptrace,%eax
 	KERNCALL
 	jb	HIDENAME(cerror)

Modified: projects/clang390-import/lib/libc/i386/sys/ptrace.S
==============================================================================
--- projects/clang390-import/lib/libc/i386/sys/ptrace.S	Sun Aug 28 11:54:45 2016	(r304954)
+++ projects/clang390-import/lib/libc/i386/sys/ptrace.S	Sun Aug 28 11:58:15 2016	(r304955)
@@ -38,16 +38,18 @@ __FBSDID("$FreeBSD$");
 
 #include "SYS.h"
 
+	.globl	CNAME(__error)
+	.type	CNAME(__error),@function
+
 ENTRY(ptrace)
-	xorl	%eax,%eax
 #ifdef PIC
-        PIC_PROLOGUE
-        movl    PIC_GOT(CNAME(errno)),%edx
-        movl    %eax,(%edx)
-        PIC_EPILOGUE
+	PIC_PROLOGUE
+	call	PIC_PLT(CNAME(__error))
+	PIC_EPILOGUE
 #else
-        movl    %eax,CNAME(errno)
+	call	CNAME(__error)
 #endif
+	movl	$0,(%eax)
 	mov	$SYS_ptrace,%eax
 	KERNCALL
 	jb	HIDENAME(cerror)

Modified: projects/clang390-import/lib/libc/net/getaddrinfo.c
==============================================================================
--- projects/clang390-import/lib/libc/net/getaddrinfo.c	Sun Aug 28 11:54:45 2016	(r304954)
+++ projects/clang390-import/lib/libc/net/getaddrinfo.c	Sun Aug 28 11:58:15 2016	(r304955)
@@ -224,6 +224,7 @@ struct ai_order {
 	struct policyqueue *aio_dstpolicy;
 	struct addrinfo *aio_ai;
 	int aio_matchlen;
+	int aio_initial_sequence;
 };
 
 static const ns_src default_dns_files[] = {
@@ -708,6 +709,7 @@ reorder(struct addrinfo *sentinel)
 		aio[i].aio_dstpolicy = match_addrselectpolicy(ai->ai_addr,
 							      &policyhead);
 		set_source(&aio[i], &policyhead);
+		aio[i].aio_initial_sequence = i;
 	}
 
 	/* perform sorting. */
@@ -1066,6 +1068,23 @@ comp_dst(const void *arg1, const void *a
 	}
 
 	/* Rule 10: Otherwise, leave the order unchanged. */
+
+	/* 
+	 * Note that qsort is unstable; so, we can't return zero and 
+	 * expect the order to be unchanged.
+	 * That also means we can't depend on the current position of
+	 * dst2 being after dst1.  We must enforce the initial order
+	 * with an explicit compare on the original position.
+	 * The qsort specification requires that "When the same objects 
+	 * (consisting of width bytes, irrespective of their current 
+	 * positions in the array) are passed more than once to the 
+	 * comparison function, the results shall be consistent with one 
+	 * another."  
+	 * In other words, If A < B, then we must also return B > A.
+	 */
+	if (dst2->aio_initial_sequence < dst1->aio_initial_sequence)
+		return(1);
+
 	return(-1);
 }
 

Modified: projects/clang390-import/lib/libc/sys/ptrace.2
==============================================================================
--- projects/clang390-import/lib/libc/sys/ptrace.2	Sun Aug 28 11:54:45 2016	(r304954)
+++ projects/clang390-import/lib/libc/sys/ptrace.2	Sun Aug 28 11:58:15 2016	(r304955)
@@ -2,7 +2,7 @@
 .\"	$NetBSD: ptrace.2,v 1.2 1995/02/27 12:35:37 cgd Exp $
 .\"
 .\" This file is in the public domain.
-.Dd July 28, 2016
+.Dd August 28, 2016
 .Dt PTRACE 2
 .Os
 .Sh NAME
@@ -906,7 +906,13 @@ to return
 \-1
 as a non-error value; to disambiguate,
 .Va errno
-can be set to 0 before the call and checked afterwards.
+is set to 0 in the libc wrapper for the
+.Fn ptrace
+system call and
+.Fn ptrace
+callers can reliably check
+.Va errno
+for non-zero value afterwards.
 .Sh ERRORS
 The
 .Fn ptrace

Modified: projects/clang390-import/lib/libnv/Makefile
==============================================================================
--- projects/clang390-import/lib/libnv/Makefile	Sun Aug 28 11:54:45 2016	(r304954)
+++ projects/clang390-import/lib/libnv/Makefile	Sun Aug 28 11:58:15 2016	(r304955)
@@ -11,7 +11,8 @@ SHLIB_MAJOR= 0
 .PATH: ${.CURDIR}/../../sys/contrib/libnv ${.CURDIR}/../../sys/sys
 CFLAGS+=-I${.CURDIR}/../../sys -I${.CURDIR}
 
-SRCS=	dnvlist.c
+SRCS=	cnvlist.c
+SRCS+=	dnvlist.c
 SRCS+=	msgio.c
 SRCS+=	nvlist.c
 SRCS+=	nvpair.c

Modified: projects/clang390-import/lib/libnv/tests/Makefile
==============================================================================
--- projects/clang390-import/lib/libnv/tests/Makefile	Sun Aug 28 11:54:45 2016	(r304954)
+++ projects/clang390-import/lib/libnv/tests/Makefile	Sun Aug 28 11:58:15 2016	(r304955)
@@ -1,6 +1,7 @@
 # $FreeBSD$
 
 ATF_TESTS_CXX=	\
+	cnv_tests \
 	dnv_tests \
 	nv_array_tests \
 	nv_tests \

Copied: projects/clang390-import/lib/libnv/tests/cnv_tests.cc (from r304954, head/lib/libnv/tests/cnv_tests.cc)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/clang390-import/lib/libnv/tests/cnv_tests.cc	Sun Aug 28 11:58:15 2016	(r304955, copy of r304954, head/lib/libnv/tests/cnv_tests.cc)
@@ -0,0 +1,1508 @@
+/*-
+ * Copyright (c) 2016 Adam Starak <starak.adam@gmail.com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/cnv.h>
+#include <sys/nv.h>
+#include <sys/types.h>
+
+#include <atf-c++.hpp>
+#include <fcntl.h>
+#include <errno.h>
+
+#define	fd_is_valid(fd)	(fcntl((fd), F_GETFL) != -1 || errno != EBADF)
+
+/* ATF cnvlist_get tests. */
+
+ATF_TEST_CASE_WITHOUT_HEAD(cnvlist_get_bool);
+ATF_TEST_CASE_BODY(cnvlist_get_bool)
+{
+	nvlist_t *nvl;
+	const char *key;
+	bool value;
+	void *cookie;
+	int type;
+
+	nvl = nvlist_create(0);
+	ATF_REQUIRE(nvl != NULL);
+	ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+	ATF_REQUIRE(nvlist_empty(nvl));
+
+	cookie = NULL;
+	key = "name";
+	value = true;
+
+	nvlist_add_bool(nvl, key, value);
+	ATF_REQUIRE_EQ(strcmp(key, nvlist_next(nvl, &type, &cookie)), 0);
+	ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+	ATF_REQUIRE_EQ(type, NV_TYPE_BOOL);
+	ATF_REQUIRE(!nvlist_empty(nvl));
+	ATF_REQUIRE(nvlist_exists(nvl, key));
+	ATF_REQUIRE(nvlist_exists_bool(nvl, key));
+
+	ATF_REQUIRE_EQ(cnvlist_get_bool(cookie), value);
+
+	ATF_REQUIRE_EQ(nvlist_next(nvl, &type, &cookie),
+	    static_cast<const char *>(NULL));
+
+	nvlist_destroy(nvl);
+}
+
+ATF_TEST_CASE_WITHOUT_HEAD(cnvlist_get_number);
+ATF_TEST_CASE_BODY(cnvlist_get_number)
+{
+	nvlist_t *nvl;
+	const char *key;
+	uint64_t value;
+	void *cookie;
+	int type;
+
+	nvl = nvlist_create(0);
+	ATF_REQUIRE(nvl != NULL);
+	ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+	ATF_REQUIRE(nvlist_empty(nvl));
+
+	cookie = NULL;
+	key = "name";
+	value = 420;
+
+	nvlist_add_number(nvl, key, value);
+	ATF_REQUIRE_EQ(strcmp(key, nvlist_next(nvl, &type, &cookie)), 0);
+	ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+	ATF_REQUIRE_EQ(type, NV_TYPE_NUMBER);
+	ATF_REQUIRE(!nvlist_empty(nvl));
+	ATF_REQUIRE(nvlist_exists(nvl, key));
+	ATF_REQUIRE(nvlist_exists_number(nvl, key));
+
+	ATF_REQUIRE_EQ(cnvlist_get_number(cookie), value);
+
+	ATF_REQUIRE_EQ(nvlist_next(nvl, &type, &cookie),
+	    static_cast<const char *>(NULL));
+
+	nvlist_destroy(nvl);
+}
+
+
+ATF_TEST_CASE_WITHOUT_HEAD(cnvlist_get_string);
+ATF_TEST_CASE_BODY(cnvlist_get_string)
+{
+	nvlist_t *nvl;
+	const char *key;
+	const char *value;
+	void *cookie;
+	int type;
+
+	nvl = nvlist_create(0);
+	ATF_REQUIRE(nvl != NULL);
+	ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+	ATF_REQUIRE(nvlist_empty(nvl));
+
+	cookie = NULL;
+	key = "name";
+	value = "text";
+
+	nvlist_add_string(nvl, key, value);
+	ATF_REQUIRE_EQ(strcmp(key, nvlist_next(nvl, &type, &cookie)), 0);
+	ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+	ATF_REQUIRE_EQ(type, NV_TYPE_STRING);
+	ATF_REQUIRE(!nvlist_empty(nvl));
+	ATF_REQUIRE(nvlist_exists(nvl, key));
+	ATF_REQUIRE(nvlist_exists_string(nvl, key));
+
+	ATF_REQUIRE_EQ(strcmp(cnvlist_get_string(cookie), value), 0);
+
+	ATF_REQUIRE_EQ(nvlist_next(nvl, &type, &cookie),
+	    static_cast<const char *>(NULL));
+
+	nvlist_destroy(nvl);
+}
+
+ATF_TEST_CASE_WITHOUT_HEAD(cnvlist_get_nvlist);
+ATF_TEST_CASE_BODY(cnvlist_get_nvlist)
+{
+	nvlist_t *nvl, *value;
+	const nvlist_t *result;
+	const char *key, *subkey;
+	void *cookie;
+	int type;
+
+	nvl = nvlist_create(0);
+	ATF_REQUIRE(nvl != NULL);
+	ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+	ATF_REQUIRE(nvlist_empty(nvl));
+
+	value = nvlist_create(0);
+	ATF_REQUIRE(nvl != NULL);
+	ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+	ATF_REQUIRE(nvlist_empty(nvl));
+
+	key = "name";
+	subkey = "subname";
+	cookie = NULL;
+
+	/* Add null to 'value' nvlist. */
+	nvlist_add_null(value, subkey);
+	ATF_REQUIRE_EQ(strcmp(subkey, nvlist_next(value, &type, &cookie)), 0);
+	ATF_REQUIRE_EQ(nvlist_error(value), 0);
+	ATF_REQUIRE_EQ(type, NV_TYPE_NULL);
+	ATF_REQUIRE(!nvlist_empty(value));
+	ATF_REQUIRE(nvlist_exists(value, subkey));
+	ATF_REQUIRE(nvlist_exists_null(value, subkey));
+	ATF_REQUIRE_EQ(nvlist_next(value, &type, &cookie),
+		       static_cast<const char *>(NULL));
+
+	/* Add 'value' nvlist. */
+	cookie = NULL;
+	nvlist_add_nvlist(nvl, key, value);
+	ATF_REQUIRE_EQ(strcmp(key, nvlist_next(nvl, &type, &cookie)), 0);
+	ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+	ATF_REQUIRE_EQ(type, NV_TYPE_NVLIST);
+	ATF_REQUIRE(!nvlist_empty(nvl));
+	ATF_REQUIRE(nvlist_exists(nvl, key));
+	ATF_REQUIRE(nvlist_exists_nvlist(nvl, key));
+
+	/*
+	 * Assuming nvlist_get_nvlist() is correct check if cnvlist returns
+	 * the same pointer.
+	 */
+	result = cnvlist_get_nvlist(cookie);
+	ATF_REQUIRE_EQ(result, nvlist_get_nvlist(nvl, key));
+	ATF_REQUIRE(result != value);
+	ATF_REQUIRE_EQ(nvlist_next(nvl, &type, &cookie),
+		       static_cast<const char *>(NULL));
+
+	/* Validate data inside nvlist. */
+	cookie = NULL;
+	ATF_REQUIRE_EQ(strcmp(subkey, nvlist_next(result, &type, &cookie)), 0);
+	ATF_REQUIRE_EQ(nvlist_error(result), 0);
+	ATF_REQUIRE_EQ(type, NV_TYPE_NULL);
+	ATF_REQUIRE(!nvlist_empty(result));
+	ATF_REQUIRE(nvlist_exists(result, subkey));
+	ATF_REQUIRE(nvlist_exists_null(result, subkey));
+	ATF_REQUIRE_EQ(nvlist_next(result, &type, &cookie),
+		       static_cast<const char *>(NULL));
+
+	nvlist_destroy(nvl);
+	nvlist_destroy(value);
+}
+
+ATF_TEST_CASE_WITHOUT_HEAD(cnvlist_get_descriptor);
+ATF_TEST_CASE_BODY(cnvlist_get_descriptor)
+{
+	nvlist_t *nvl;
+	const char *key;
+	void *cookie;
+	int type;
+
+	nvl = nvlist_create(0);
+	ATF_REQUIRE(nvl != NULL);
+	ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+	ATF_REQUIRE(nvlist_empty(nvl));
+
+	cookie = NULL;
+	key = "name";
+
+	nvlist_add_descriptor(nvl, key, STDERR_FILENO);
+	ATF_REQUIRE_EQ(strcmp(key, nvlist_next(nvl, &type, &cookie)), 0);
+	ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+	ATF_REQUIRE_EQ(type, NV_TYPE_DESCRIPTOR);
+	ATF_REQUIRE(!nvlist_empty(nvl));
+	ATF_REQUIRE(nvlist_exists(nvl, key));
+	ATF_REQUIRE(nvlist_exists_descriptor(nvl, key));
+
+	ATF_REQUIRE_EQ(fd_is_valid(cnvlist_get_descriptor(cookie)), 1);
+
+	ATF_REQUIRE_EQ(nvlist_next(nvl, &type, &cookie),
+	    static_cast<const char *>(NULL));
+
+	nvlist_destroy(nvl);
+}
+
+ATF_TEST_CASE_WITHOUT_HEAD(cnvlist_get_binary);
+ATF_TEST_CASE_BODY(cnvlist_get_binary)
+{
+	nvlist_t *nvl;
+	const char *key;
+	void *in_binary;
+	const void *out_binary;
+	void *cookie;
+	int type;
+	size_t in_size, out_size;
+
+	nvl = nvlist_create(0);
+	ATF_REQUIRE(nvl != NULL);
+	ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+	ATF_REQUIRE(nvlist_empty(nvl));
+
+	cookie = NULL;
+	key = "name";
+	in_size = 13;
+
+	in_binary = malloc(in_size);
+	ATF_REQUIRE(in_binary != NULL);
+	memset(in_binary, 0xa5, in_size);
+
+	nvlist_add_binary(nvl, key, in_binary, in_size);
+	ATF_REQUIRE_EQ(strcmp(key, nvlist_next(nvl, &type, &cookie)), 0);
+	ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+	ATF_REQUIRE_EQ(type, NV_TYPE_BINARY);
+	ATF_REQUIRE(!nvlist_empty(nvl));
+	ATF_REQUIRE(nvlist_exists(nvl, key));
+	ATF_REQUIRE(nvlist_exists_binary(nvl, key));
+
+	out_binary = cnvlist_get_binary(cookie, &out_size);
+	ATF_REQUIRE_EQ(out_size, in_size);
+	ATF_REQUIRE_EQ(memcmp(in_binary, out_binary, out_size), 0);
+
+	ATF_REQUIRE_EQ(nvlist_next(nvl, &type, &cookie),
+	    static_cast<const char *>(NULL));
+
+	nvlist_destroy(nvl);
+}
+
+/* ATF cnvlist_get array tests. */
+
+ATF_TEST_CASE_WITHOUT_HEAD(cnvlist_get_bool_array);
+ATF_TEST_CASE_BODY(cnvlist_get_bool_array)
+{
+	nvlist_t *nvl;
+	bool in_array[16];
+	const bool *out_array;
+	const char *key;
+	void *cookie;
+	int type, i;
+	size_t nitems;
+
+	for (i = 0; i < 16; i++)
+		in_array[i] = (i % 2 == 0);
+
+	nvl = nvlist_create(0);
+	ATF_REQUIRE(nvl != NULL);
+	ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+	ATF_REQUIRE(nvlist_empty(nvl));
+
+	cookie = NULL;
+	key = "name";
+
+	nvlist_add_bool_array(nvl, key, in_array, 16);
+	ATF_REQUIRE_EQ(strcmp(key, nvlist_next(nvl, &type, &cookie)), 0);
+	ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+	ATF_REQUIRE_EQ(type, NV_TYPE_BOOL_ARRAY);
+	ATF_REQUIRE(!nvlist_empty(nvl));
+	ATF_REQUIRE(nvlist_exists(nvl, key));
+	ATF_REQUIRE(nvlist_exists_bool_array(nvl, key));
+
+	out_array = cnvlist_get_bool_array(cookie, &nitems);
+	ATF_REQUIRE_EQ(nitems, 16);
+	ATF_REQUIRE(out_array != NULL);
+	for (i = 0; i < 16; i++)
+		ATF_REQUIRE_EQ(out_array[i], in_array[i]);
+
+	ATF_REQUIRE_EQ(nvlist_next(nvl, &type, &cookie),
+	    static_cast<const char *>(NULL));
+
+	nvlist_destroy(nvl);
+}
+
+ATF_TEST_CASE_WITHOUT_HEAD(cnvlist_get_number_array);
+ATF_TEST_CASE_BODY(cnvlist_get_number_array)
+{
+	nvlist_t *nvl;
+	uint64_t in_array[16];
+	const uint64_t *out_array;
+	const char *key;
+	void *cookie;
+	int type, i;
+	size_t nitems;
+
+	for (i = 0; i < 16; i++)
+		in_array[i] = i;
+
+	nvl = nvlist_create(0);
+	ATF_REQUIRE(nvl != NULL);
+	ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+	ATF_REQUIRE(nvlist_empty(nvl));
+
+	cookie = NULL;
+	key = "name";
+
+	nvlist_add_number_array(nvl, key, in_array, 16);
+	ATF_REQUIRE_EQ(strcmp(key, nvlist_next(nvl, &type, &cookie)), 0);
+	ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+	ATF_REQUIRE_EQ(type, NV_TYPE_NUMBER_ARRAY);
+	ATF_REQUIRE(!nvlist_empty(nvl));
+	ATF_REQUIRE(nvlist_exists(nvl, key));
+	ATF_REQUIRE(nvlist_exists_number_array(nvl, key));
+
+	out_array = cnvlist_get_number_array(cookie, &nitems);
+	ATF_REQUIRE(out_array != NULL);
+	ATF_REQUIRE_EQ(nitems, 16);
+	for (i = 0; i < 16; i++)
+		ATF_REQUIRE_EQ(out_array[i], in_array[i]);
+
+	ATF_REQUIRE_EQ(nvlist_next(nvl, &type, &cookie),
+	    static_cast<const char *>(NULL));
+
+	nvlist_destroy(nvl);
+}
+
+ATF_TEST_CASE_WITHOUT_HEAD(cnvlist_get_string_array);
+ATF_TEST_CASE_BODY(cnvlist_get_string_array)
+{
+	nvlist_t *nvl;
+	const char *in_array[4] = {"inequality", "sucks", ".", ""};
+	const char * const *out_array;
+	const char *key;
+	void *cookie;
+	int type, i;
+	size_t nitems;
+
+	nvl = nvlist_create(0);
+	ATF_REQUIRE(nvl != NULL);
+	ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+	ATF_REQUIRE(nvlist_empty(nvl));
+
+	cookie = NULL;
+	key = "name";
+
+	nvlist_add_string_array(nvl, key, in_array, 4);
+	ATF_REQUIRE_EQ(strcmp(key, nvlist_next(nvl, &type, &cookie)), 0);
+	ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+	ATF_REQUIRE_EQ(type, NV_TYPE_STRING_ARRAY);
+	ATF_REQUIRE(!nvlist_empty(nvl));
+	ATF_REQUIRE(nvlist_exists(nvl, key));
+	ATF_REQUIRE(nvlist_exists_string_array(nvl, key));
+
+	out_array = cnvlist_get_string_array(cookie, &nitems);
+	ATF_REQUIRE_EQ(nitems, 4);
+	ATF_REQUIRE(out_array != NULL);
+	for (i = 0; i < 4; i++) {
+		ATF_REQUIRE(out_array[i] != NULL);
+		ATF_REQUIRE_EQ(strcmp(out_array[i], in_array[i]), 0);
+	}
+
+	ATF_REQUIRE_EQ(nvlist_next(nvl, &type, &cookie),
+	    static_cast<const char *>(NULL));
+
+	nvlist_destroy(nvl);
+}
+
+ATF_TEST_CASE_WITHOUT_HEAD(cnvlist_get_nvlist_array);
+ATF_TEST_CASE_BODY(cnvlist_get_nvlist_array)
+{
+	nvlist_t *nvl;
+	nvlist_t *in_array[6];
+	const nvlist_t * const *out_array;
+	const nvlist_t * const *out_result;
+	void *cookie;
+	const char *key;
+	const char *subkeys;
+	int type, i;
+	size_t nitems;
+
+	nvl = nvlist_create(0);
+	ATF_REQUIRE(nvl != NULL);
+	ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+	ATF_REQUIRE(nvlist_empty(nvl));
+
+	subkeys = "123456";
+	for (i = 0; i < 6; i++) {
+		in_array[i] = nvlist_create(0);
+		ATF_REQUIRE(in_array[i] != NULL);
+		ATF_REQUIRE_EQ(nvlist_error(in_array[i]), 0);
+		ATF_REQUIRE(nvlist_empty(in_array[i]));
+
+		cookie = NULL;
+
+		nvlist_add_null(in_array[i], subkeys+i);
+		ATF_REQUIRE_EQ(strcmp(subkeys+i, nvlist_next(in_array[i],
+		    &type, &cookie)),0);
+		ATF_REQUIRE_EQ(nvlist_error(in_array[i]), 0);
+		ATF_REQUIRE_EQ(type, NV_TYPE_NULL);
+		ATF_REQUIRE(!nvlist_empty(in_array[i]));
+		ATF_REQUIRE(nvlist_exists(in_array[i], subkeys+i));
+		ATF_REQUIRE(nvlist_exists_null(in_array[i], subkeys+i));
+		ATF_REQUIRE_EQ(nvlist_next(in_array[i], &type, &cookie),
+		    static_cast<const char *>(NULL));
+	}
+
+	cookie = NULL;
+	key = "name";
+
+	nvlist_add_nvlist_array(nvl, key, in_array, 6);
+	ATF_REQUIRE_EQ(strcmp(key, nvlist_next(nvl, &type, &cookie)), 0);
+	ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+	ATF_REQUIRE_EQ(type, NV_TYPE_NVLIST_ARRAY);
+	ATF_REQUIRE(!nvlist_empty(nvl));
+	ATF_REQUIRE(nvlist_exists(nvl, key));
+	ATF_REQUIRE(nvlist_exists_nvlist_array(nvl, key));
+
+	/* Get nvlist array by cnvlist function. */
+	out_array = cnvlist_get_nvlist_array(cookie, &nitems);
+	ATF_REQUIRE(out_array != NULL);
+	ATF_REQUIRE_EQ(nitems, 6);
+	ATF_REQUIRE_EQ(nvlist_next(nvl, &type, &cookie),
+	    static_cast<const char *>(NULL));
+
+	/* Get nvlist array by nvlist function. */
+	out_result = nvlist_get_nvlist_array(nvl, key, &nitems);
+	ATF_REQUIRE(out_result != NULL);
+	ATF_REQUIRE_EQ(nitems, 6);
+
+	/* Validate assuming that nvlist returned a proper pointer */
+	for (i = 0; i < 6; i++) {
+		ATF_REQUIRE_EQ(out_result[i], out_array[i]);
+		ATF_REQUIRE(out_array[i] != in_array[i]);
+
+		/* Validate data inside nvlist. */
+		cookie = NULL;
+		ATF_REQUIRE_EQ(strcmp(subkeys+i, nvlist_next(out_array[i],
+		    &type, &cookie)), 0);
+		ATF_REQUIRE_EQ(nvlist_error(out_array[i]), 0);
+		ATF_REQUIRE_EQ(type, NV_TYPE_NULL);
+		ATF_REQUIRE(!nvlist_empty(out_array[i]));
+		ATF_REQUIRE(nvlist_exists(out_array[i], subkeys+i));
+		ATF_REQUIRE(nvlist_exists_null(out_array[i], subkeys+i));
+		ATF_REQUIRE_EQ(nvlist_next(out_array[i], &type, &cookie),
+		    static_cast<const char *>(NULL));
+	}
+
+	nvlist_destroy(nvl);
+}
+
+ATF_TEST_CASE_WITHOUT_HEAD(cnvlist_get_descriptor_array);
+ATF_TEST_CASE_BODY(cnvlist_get_descriptor_array)
+{
+	nvlist_t *nvl;
+	size_t count, i, nitems;
+	const int *out_array;
+	int *in_array, type;
+	const char *key;
+	void *cookie;
+
+	nvl = nvlist_create(0);
+	ATF_REQUIRE(nvl != NULL);
+	ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+	ATF_REQUIRE(nvlist_empty(nvl));
+
+	cookie = NULL;
+	key = "name";
+	count = 50;
+
+	in_array = static_cast<int *>(malloc(sizeof(*in_array)*count));
+	ATF_REQUIRE(in_array != NULL);
+	for (i = 0; i < count; i++) {
+		in_array[i] = dup(STDERR_FILENO);
+		ATF_REQUIRE(fd_is_valid(in_array[i]));
+	}
+
+	nvlist_add_descriptor_array(nvl, key, in_array, count);
+	ATF_REQUIRE_EQ(strcmp(key, nvlist_next(nvl, &type, &cookie)), 0);
+	ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+	ATF_REQUIRE_EQ(type, NV_TYPE_DESCRIPTOR_ARRAY);
+	ATF_REQUIRE(!nvlist_empty(nvl));
+	ATF_REQUIRE(nvlist_exists(nvl, key));
+	ATF_REQUIRE(nvlist_exists_descriptor_array(nvl, key));
+
+	out_array = cnvlist_get_descriptor_array(cookie, &nitems);
+	ATF_REQUIRE_EQ(nitems, count);
+	ATF_REQUIRE(out_array != NULL);
+	for (i = 0; i < count; i++)
+		ATF_REQUIRE_EQ(fd_is_valid(out_array[i]), 1);
+
+	ATF_REQUIRE_EQ(nvlist_next(nvl, &type, &cookie),
+	    static_cast<const char *>(NULL));
+
+	nvlist_destroy(nvl);
+}
+
+/* ATF cnvlist_take tests. */
+
+ATF_TEST_CASE_WITHOUT_HEAD(cnvlist_take_bool);
+ATF_TEST_CASE_BODY(cnvlist_take_bool)
+{
+	nvlist_t *nvl;
+	const char *key;
+	bool value;
+	void *cookie;
+	int type;
+
+	nvl = nvlist_create(0);
+	ATF_REQUIRE(nvl != NULL);
+	ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+	ATF_REQUIRE(nvlist_empty(nvl));
+
+	cookie = NULL;
+	key = "name";
+	value = true;
+
+	nvlist_add_bool(nvl, key, value);
+	ATF_REQUIRE_EQ(strcmp(key, nvlist_next(nvl, &type, &cookie)), 0);
+	ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+	ATF_REQUIRE_EQ(type, NV_TYPE_BOOL);
+	ATF_REQUIRE(!nvlist_empty(nvl));
+	ATF_REQUIRE(nvlist_exists(nvl, key));
+	ATF_REQUIRE(nvlist_exists_bool(nvl, key));
+	ATF_REQUIRE_EQ(nvlist_next(nvl, &type, &cookie),
+	    static_cast<const char *>(NULL));
+
+	cookie = NULL;
+	ATF_REQUIRE_EQ(strcmp(key, nvlist_next(nvl, &type, &cookie)), 0);
+	ATF_REQUIRE_EQ(cnvlist_take_bool(nvl, cookie), value);
+
+	cookie = NULL;
+	ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+	ATF_REQUIRE(nvlist_empty(nvl));
+	ATF_REQUIRE(!nvlist_exists(nvl, key));
+	ATF_REQUIRE(!nvlist_exists_bool(nvl, key));
+	ATF_REQUIRE_EQ(nvlist_next(nvl, &type, &cookie),
+	    static_cast<const char *>(NULL));
+
+	nvlist_destroy(nvl);
+}
+
+ATF_TEST_CASE_WITHOUT_HEAD(cnvlist_take_number);
+ATF_TEST_CASE_BODY(cnvlist_take_number)
+{
+	nvlist_t *nvl;
+	const char *key;
+	uint64_t value;
+	void *cookie;
+	int type;
+
+	nvl = nvlist_create(0);
+	ATF_REQUIRE(nvl != NULL);
+	ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+	ATF_REQUIRE(nvlist_empty(nvl));
+
+	cookie = NULL;
+	key = "name";
+	value = 69;
+
+	nvlist_add_number(nvl, key, value);
+	ATF_REQUIRE_EQ(strcmp(key, nvlist_next(nvl, &type, &cookie)), 0);
+	ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+	ATF_REQUIRE_EQ(type, NV_TYPE_NUMBER);
+	ATF_REQUIRE(!nvlist_empty(nvl));
+	ATF_REQUIRE(nvlist_exists(nvl, key));
+	ATF_REQUIRE(nvlist_exists_number(nvl, key));
+	ATF_REQUIRE_EQ(nvlist_next(nvl, &type, &cookie),
+	    static_cast<const char *>(NULL));
+
+	cookie = NULL;
+	ATF_REQUIRE_EQ(strcmp(key, nvlist_next(nvl, &type, &cookie)), 0);
+	ATF_REQUIRE_EQ(cnvlist_take_number(nvl, cookie), value);
+
+	cookie = NULL;
+	ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+	ATF_REQUIRE(nvlist_empty(nvl));
+	ATF_REQUIRE(!nvlist_exists(nvl, key));
+	ATF_REQUIRE(!nvlist_exists_number(nvl, key));
+	ATF_REQUIRE_EQ(nvlist_next(nvl, &type, &cookie),
+	    static_cast<const char *>(NULL));
+
+	nvlist_destroy(nvl);
+}
+
+ATF_TEST_CASE_WITHOUT_HEAD(cnvlist_take_string);
+ATF_TEST_CASE_BODY(cnvlist_take_string)
+{
+	nvlist_t *nvl;
+	const char *key;
+	const char *value;
+	char *out_string;
+	void *cookie;
+	int type;
+
+	nvl = nvlist_create(0);
+	ATF_REQUIRE(nvl != NULL);
+	ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+	ATF_REQUIRE(nvlist_empty(nvl));
+
+	cookie = NULL;
+	key = "name";
+	value = "text";
+
+	nvlist_add_string(nvl, key, value);
+	ATF_REQUIRE_EQ(strcmp(key, nvlist_next(nvl, &type, &cookie)), 0);
+	ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+	ATF_REQUIRE_EQ(type, NV_TYPE_STRING);
+	ATF_REQUIRE(!nvlist_empty(nvl));
+	ATF_REQUIRE(nvlist_exists(nvl, key));
+	ATF_REQUIRE(nvlist_exists_string(nvl, key));
+	ATF_REQUIRE_EQ(nvlist_next(nvl, &type, &cookie),
+	    static_cast<const char *>(NULL));
+
+	cookie = NULL;
+	ATF_REQUIRE_EQ(strcmp(key, nvlist_next(nvl, &type, &cookie)), 0);
+	out_string = cnvlist_take_string(nvl, cookie);
+	ATF_REQUIRE(out_string != NULL);
+	ATF_REQUIRE_EQ(strcmp(out_string, value), 0);
+
+	cookie = NULL;
+	ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+	ATF_REQUIRE(nvlist_empty(nvl));
+	ATF_REQUIRE(!nvlist_exists(nvl, key));
+	ATF_REQUIRE(!nvlist_exists_string(nvl, key));
+	ATF_REQUIRE_EQ(nvlist_next(nvl, &type, &cookie),
+	    static_cast<const char *>(NULL));
+
+	free(out_string);
+	nvlist_destroy(nvl);
+}
+
+ATF_TEST_CASE_WITHOUT_HEAD(cnvlist_take_nvlist);
+ATF_TEST_CASE_BODY(cnvlist_take_nvlist)
+{
+	nvlist_t *nvl, *value, *result;
+	const char *key, *subkey;
+	void *cookie;
+	int type;
+
+	nvl = nvlist_create(0);
+	ATF_REQUIRE(nvl != NULL);
+	ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+	ATF_REQUIRE(nvlist_empty(nvl));
+
+	value = nvlist_create(0);
+	ATF_REQUIRE(value != NULL);
+	ATF_REQUIRE_EQ(nvlist_error(value), 0);
+	ATF_REQUIRE(nvlist_empty(value));
+
+	key = "name";
+	subkey = "subname";
+	cookie = NULL;
+
+	/* Add null to 'value' nvlist. */
+	nvlist_add_null(value, subkey);
+	ATF_REQUIRE_EQ(strcmp(subkey, nvlist_next(value, &type, &cookie)), 0);
+	ATF_REQUIRE_EQ(nvlist_error(value), 0);
+	ATF_REQUIRE_EQ(type, NV_TYPE_NULL);
+	ATF_REQUIRE(!nvlist_empty(value));
+	ATF_REQUIRE(nvlist_exists(value, subkey));
+	ATF_REQUIRE(nvlist_exists_null(value, subkey));
+	ATF_REQUIRE_EQ(nvlist_next(value, &type, &cookie),
+	    static_cast<const char *>(NULL));
+
+	/* Add 'value' nvlist. */
+	cookie = NULL;
+	nvlist_move_nvlist(nvl, key, value);
+	ATF_REQUIRE_EQ(strcmp(key, nvlist_next(nvl, &type, &cookie)), 0);
+	ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+	ATF_REQUIRE_EQ(type, NV_TYPE_NVLIST);
+	ATF_REQUIRE(!nvlist_empty(nvl));
+	ATF_REQUIRE(nvlist_exists(nvl, key));
+	ATF_REQUIRE(nvlist_exists_nvlist(nvl, key));
+	ATF_REQUIRE_EQ(nvlist_next(nvl, &type, &cookie),
+	    static_cast<const char *>(NULL));
+
+	cookie = NULL;
+	ATF_REQUIRE_EQ(strcmp(key, nvlist_next(nvl, &type, &cookie)), 0);
+	result = cnvlist_take_nvlist(nvl, cookie);
+	ATF_REQUIRE(!nvlist_exists_nvlist(nvl, key));
+	ATF_REQUIRE(result == value);
+
+	/* Validate data inside nvlist. */
+	cookie = NULL;
+	ATF_REQUIRE_EQ(strcmp(subkey, nvlist_next(result, &type, &cookie)), 0);
+	ATF_REQUIRE_EQ(nvlist_error(value), 0);
+	ATF_REQUIRE_EQ(type, NV_TYPE_NULL);
+	ATF_REQUIRE(!nvlist_empty(value));
+	ATF_REQUIRE(nvlist_exists(value, subkey));
+	ATF_REQUIRE(nvlist_exists_null(value, subkey));
+	ATF_REQUIRE_EQ(nvlist_next(value, &type, &cookie),
+	    static_cast<const char *>(NULL));
+
+	cookie = NULL;
+	ATF_REQUIRE_EQ(nvlist_next(nvl, &type, &cookie),
+	    static_cast<const char *>(NULL));
+
+	nvlist_destroy(nvl);
+	nvlist_destroy(value);
+}
+
+/* ATF cnvlist_take array tests */
+
+ATF_TEST_CASE_WITHOUT_HEAD(cnvlist_take_bool_array);
+ATF_TEST_CASE_BODY(cnvlist_take_bool_array)
+{
+	nvlist_t *nvl;
+	bool in_array[16];
+	const bool *out_array;
+	const char *key;
+	void *cookie;
+	int type, i;
+	size_t nitems;
+
+	for (i = 0; i < 16; i++)
+		in_array[i] = (i % 2 == 0);
+
+	nvl = nvlist_create(0);
+	ATF_REQUIRE(nvl != NULL);
+	ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+	ATF_REQUIRE(nvlist_empty(nvl));
+
+	cookie = NULL;
+	key = "name";
+
+	nvlist_add_bool_array(nvl, key, in_array, 16);
+	ATF_REQUIRE_EQ(strcmp(key, nvlist_next(nvl, &type, &cookie)), 0);
+	ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+	ATF_REQUIRE_EQ(type, NV_TYPE_BOOL_ARRAY);
+	ATF_REQUIRE(!nvlist_empty(nvl));
+	ATF_REQUIRE(nvlist_exists(nvl, key));
+	ATF_REQUIRE(nvlist_exists_bool_array(nvl, key));
+	ATF_REQUIRE_EQ(nvlist_next(nvl, &type, &cookie),
+	    static_cast<const char *>(NULL));
+
+	cookie = NULL;
+	ATF_REQUIRE_EQ(strcmp(key, nvlist_next(nvl, &type, &cookie)), 0);
+	out_array = cnvlist_take_bool_array(nvl, cookie, &nitems);
+	ATF_REQUIRE_EQ(nitems, 16);
+	ATF_REQUIRE(out_array != NULL);
+	for (i = 0; i < 16; i++)
+		ATF_REQUIRE_EQ(out_array[i], in_array[i]);
+
+	cookie = NULL;
+	ATF_REQUIRE(!nvlist_exists_bool_array(nvl, key));
+	ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+	ATF_REQUIRE(nvlist_empty(nvl));
+	ATF_REQUIRE(!nvlist_exists(nvl, key));
+	ATF_REQUIRE_EQ(nvlist_next(nvl, &type, &cookie),
+	    static_cast<const char *>(NULL));
+
+
+	nvlist_destroy(nvl);
+}
+
+ATF_TEST_CASE_WITHOUT_HEAD(cnvlist_take_number_array);
+ATF_TEST_CASE_BODY(cnvlist_take_number_array)
+{
+	nvlist_t *nvl;
+	uint64_t in_array[16];
+	const uint64_t *out_array;
+	const char *key;
+	void *cookie;
+	int type, i;
+	size_t nitems;
+
+	for (i = 0; i < 16; i++)
+		in_array[i] = i;
+
+	nvl = nvlist_create(0);
+	ATF_REQUIRE(nvl != NULL);
+	ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+	ATF_REQUIRE(nvlist_empty(nvl));
+
+	cookie = NULL;
+	key = "name";
+
+	nvlist_add_number_array(nvl, key, in_array, 16);
+	ATF_REQUIRE_EQ(strcmp(key, nvlist_next(nvl, &type, &cookie)), 0);
+	ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+	ATF_REQUIRE_EQ(type, NV_TYPE_NUMBER_ARRAY);
+	ATF_REQUIRE(!nvlist_empty(nvl));
+	ATF_REQUIRE(nvlist_exists(nvl, key));
+	ATF_REQUIRE(nvlist_exists_number_array(nvl, key));
+	ATF_REQUIRE_EQ(nvlist_next(nvl, &type, &cookie),
+	    static_cast<const char *>(NULL));
+

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201608281158.u7SBwFaL054719>