CVS commit: src/sys/external/bsd/libnv/dist
Module Name:src Committed By: rmind Date: Fri Feb 15 22:49:24 UTC 2019 Modified Files: src/sys/external/bsd/libnv/dist: nvpair.c Log Message: nvpair_remove_nvlist_array: revert part of the rev 1.4 change (it was applied by mistake because the libnv upsteam code on Github has deviated from FreeBSD, i.e. it has a different nvlist_set_array_next() logic). To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/libnv/dist/nvpair.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/libnv/dist/nvpair.c diff -u src/sys/external/bsd/libnv/dist/nvpair.c:1.5 src/sys/external/bsd/libnv/dist/nvpair.c:1.6 --- src/sys/external/bsd/libnv/dist/nvpair.c:1.5 Tue Feb 12 12:52:49 2019 +++ src/sys/external/bsd/libnv/dist/nvpair.c Fri Feb 15 22:49:24 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: nvpair.c,v 1.5 2019/02/12 12:52:49 rmind Exp $ */ +/* $NetBSD: nvpair.c,v 1.6 2019/02/15 22:49:24 rmind Exp $ */ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD @@ -36,7 +36,7 @@ #ifdef __FreeBSD__ __FBSDID("$FreeBSD: head/sys/contrib/libnv/nvpair.c 335382 2018-06-19 18:43:02Z lwhsu $"); #else -__RCSID("$NetBSD: nvpair.c,v 1.5 2019/02/12 12:52:49 rmind Exp $"); +__RCSID("$NetBSD: nvpair.c,v 1.6 2019/02/15 22:49:24 rmind Exp $"); #endif #include @@ -251,16 +251,8 @@ nvpair_remove_nvlist_array(nvpair_t *nvp nvlarray = __DECONST(nvlist_t **, nvpair_get_nvlist_array(nvp, )); for (i = 0; i < count; i++) { - nvlist_t *nvl; - nvpair_t *nnvp; - - nvl = nvlarray[i]; - nnvp = nvlist_get_array_next_nvpair(nvl); - if (nnvp != NULL) { - nvpair_free_structure(nnvp); - } - nvlist_set_array_next(nvl, NULL); - nvlist_set_parent(nvl, NULL); + nvlist_set_array_next(nvlarray[i], NULL); + nvlist_set_parent(nvlarray[i], NULL); } }
CVS commit: src/sys/external/bsd/libnv/dist
Module Name:src Committed By: rmind Date: Tue Feb 12 12:52:49 UTC 2019 Modified Files: src/sys/external/bsd/libnv/dist: nvpair.c Log Message: libnv: Free the data array for NV_TYPE_DESCRIPTOR_ARRAY case. Obtained from FreeBSD rev 343987 by oshogbo@. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/libnv/dist/nvpair.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/libnv/dist/nvpair.c diff -u src/sys/external/bsd/libnv/dist/nvpair.c:1.4 src/sys/external/bsd/libnv/dist/nvpair.c:1.5 --- src/sys/external/bsd/libnv/dist/nvpair.c:1.4 Tue Feb 12 12:49:23 2019 +++ src/sys/external/bsd/libnv/dist/nvpair.c Tue Feb 12 12:52:49 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: nvpair.c,v 1.4 2019/02/12 12:49:23 rmind Exp $ */ +/* $NetBSD: nvpair.c,v 1.5 2019/02/12 12:52:49 rmind Exp $ */ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD @@ -36,7 +36,7 @@ #ifdef __FreeBSD__ __FBSDID("$FreeBSD: head/sys/contrib/libnv/nvpair.c 335382 2018-06-19 18:43:02Z lwhsu $"); #else -__RCSID("$NetBSD: nvpair.c,v 1.4 2019/02/12 12:49:23 rmind Exp $"); +__RCSID("$NetBSD: nvpair.c,v 1.5 2019/02/12 12:52:49 rmind Exp $"); #endif #include @@ -2099,6 +2099,7 @@ nvpair_free(nvpair_t *nvp) case NV_TYPE_DESCRIPTOR_ARRAY: for (i = 0; i < nvp->nvp_nitems; i++) close(((int *)(intptr_t)nvp->nvp_data)[i]); + nv_free((int *)(intptr_t)nvp->nvp_data); break; #endif case NV_TYPE_NVLIST:
CVS commit: src/sys/external/bsd/libnv/dist
Module Name:src Committed By: rmind Date: Tue Feb 12 12:49:23 UTC 2019 Modified Files: src/sys/external/bsd/libnv/dist: nv_impl.h nvlist.c nvpair.c Log Message: libnv: fix multiple memory leaks. - nvpair_create_stringv: free the temporary string; this fix affects nvlist_add_stringf() and nvlist_add_stringv(). - nvpair_remove_nvlist_array (NV_TYPE_NVLIST_ARRAY case): free the chain of nvpairs (as resetting it prevents nvlist_destroy() from freeing it). Note: freeing the chain in nvlist_destroy() is not sufficient, because it would still leak through nvlist_take_nvlist_array(). This affects all nvlist_*_nvlist_array() users. Found by clang/gcc ASAN. These fixes have been contributed to the upstream (FreeBSD) repository. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/libnv/dist/nv_impl.h cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/libnv/dist/nvlist.c cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/libnv/dist/nvpair.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/libnv/dist/nv_impl.h diff -u src/sys/external/bsd/libnv/dist/nv_impl.h:1.5 src/sys/external/bsd/libnv/dist/nv_impl.h:1.6 --- src/sys/external/bsd/libnv/dist/nv_impl.h:1.5 Sun Sep 23 19:07:10 2018 +++ src/sys/external/bsd/libnv/dist/nv_impl.h Tue Feb 12 12:49:23 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: nv_impl.h,v 1.5 2018/09/23 19:07:10 rmind Exp $ */ +/* $NetBSD: nv_impl.h,v 1.6 2019/02/12 12:49:23 rmind Exp $ */ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD @@ -125,6 +125,7 @@ bool nvlist_move_nvpair(nvlist_t *nvl, n void nvlist_set_parent(nvlist_t *nvl, nvpair_t *parent); void nvlist_set_array_next(nvlist_t *nvl, nvpair_t *ele); +nvpair_t *nvlist_get_array_next_nvpair(nvlist_t *nvl); const nvpair_t *nvlist_get_nvpair(const nvlist_t *nvl, const char *name); Index: src/sys/external/bsd/libnv/dist/nvlist.c diff -u src/sys/external/bsd/libnv/dist/nvlist.c:1.6 src/sys/external/bsd/libnv/dist/nvlist.c:1.7 --- src/sys/external/bsd/libnv/dist/nvlist.c:1.6 Sat Sep 22 17:13:30 2018 +++ src/sys/external/bsd/libnv/dist/nvlist.c Tue Feb 12 12:49:23 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: nvlist.c,v 1.6 2018/09/22 17:13:30 rmind Exp $ */ +/* $NetBSD: nvlist.c,v 1.7 2019/02/12 12:49:23 rmind Exp $ */ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD @@ -36,7 +36,7 @@ #ifdef __FreeBSD__ __FBSDID("$FreeBSD: head/sys/contrib/libnv/nvlist.c 335347 2018-06-18 22:57:32Z oshogbo $"); #else -__RCSID("$NetBSD: nvlist.c,v 1.6 2018/09/22 17:13:30 rmind Exp $"); +__RCSID("$NetBSD: nvlist.c,v 1.7 2019/02/12 12:49:23 rmind Exp $"); #endif #include @@ -269,6 +269,15 @@ nvlist_set_array_next(nvlist_t *nvl, nvp nvl->nvl_array_next = ele; } +nvpair_t * +nvlist_get_array_next_nvpair(nvlist_t *nvl) +{ + + NVLIST_ASSERT(nvl); + + return (nvl->nvl_array_next); +} + bool nvlist_in_array(const nvlist_t *nvl) { Index: src/sys/external/bsd/libnv/dist/nvpair.c diff -u src/sys/external/bsd/libnv/dist/nvpair.c:1.3 src/sys/external/bsd/libnv/dist/nvpair.c:1.4 --- src/sys/external/bsd/libnv/dist/nvpair.c:1.3 Sat Sep 8 14:32:25 2018 +++ src/sys/external/bsd/libnv/dist/nvpair.c Tue Feb 12 12:49:23 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: nvpair.c,v 1.3 2018/09/08 14:32:25 christos Exp $ */ +/* $NetBSD: nvpair.c,v 1.4 2019/02/12 12:49:23 rmind Exp $ */ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD @@ -36,7 +36,7 @@ #ifdef __FreeBSD__ __FBSDID("$FreeBSD: head/sys/contrib/libnv/nvpair.c 335382 2018-06-19 18:43:02Z lwhsu $"); #else -__RCSID("$NetBSD: nvpair.c,v 1.3 2018/09/08 14:32:25 christos Exp $"); +__RCSID("$NetBSD: nvpair.c,v 1.4 2019/02/12 12:49:23 rmind Exp $"); #endif #include @@ -251,8 +251,16 @@ nvpair_remove_nvlist_array(nvpair_t *nvp nvlarray = __DECONST(nvlist_t **, nvpair_get_nvlist_array(nvp, )); for (i = 0; i < count; i++) { - nvlist_set_array_next(nvlarray[i], NULL); - nvlist_set_parent(nvlarray[i], NULL); + nvlist_t *nvl; + nvpair_t *nnvp; + + nvl = nvlarray[i]; + nnvp = nvlist_get_array_next_nvpair(nvl); + if (nnvp != NULL) { + nvpair_free_structure(nnvp); + } + nvlist_set_array_next(nvl, NULL); + nvlist_set_parent(nvl, NULL); } } @@ -1216,8 +1224,7 @@ nvpair_create_stringv(const char *name, if (len < 0) return (NULL); nvp = nvpair_create_string(name, str); - if (nvp == NULL) - nv_free(str); + nv_free(str); return (nvp); } #endif
CVS commit: src/sys/external/bsd/libnv/dist
Module Name:src Committed By: maxv Date: Tue Oct 16 13:18:25 UTC 2018 Modified Files: src/sys/external/bsd/libnv/dist: nv_kern_netbsd.c Log Message: fix the shit, as usual To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/libnv/dist/nv_kern_netbsd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/libnv/dist/nv_kern_netbsd.c diff -u src/sys/external/bsd/libnv/dist/nv_kern_netbsd.c:1.5 src/sys/external/bsd/libnv/dist/nv_kern_netbsd.c:1.6 --- src/sys/external/bsd/libnv/dist/nv_kern_netbsd.c:1.5 Sun Sep 23 21:35:26 2018 +++ src/sys/external/bsd/libnv/dist/nv_kern_netbsd.c Tue Oct 16 13:18:25 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: nv_kern_netbsd.c,v 1.5 2018/09/23 21:35:26 rmind Exp $ */ +/* $NetBSD: nv_kern_netbsd.c,v 1.6 2018/10/16 13:18:25 maxv Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__RCSID("$NetBSD: nv_kern_netbsd.c,v 1.5 2018/09/23 21:35:26 rmind Exp $"); +__RCSID("$NetBSD: nv_kern_netbsd.c,v 1.6 2018/10/16 13:18:25 maxv Exp $"); #if !defined(_KERNEL) && !defined(_STANDALONE) #include @@ -78,6 +78,9 @@ nvlist_copyin(const nvlist_ref_t *nref, nvlist_t *nvl; void *buf; + if (len == 0) { + return EINVAL; + } if (len >= lim) { return E2BIG; } @@ -124,7 +127,7 @@ nvlist_copyout(nvlist_ref_t *nref, const error = copyout(buf, uaddr, len); if (error) { uvm_unmap(>p_vmspace->vm_map, (vaddr_t)uaddr, - (vaddr_t)uaddr + len); + (vaddr_t)uaddr + rlen); goto err; } nref->flags = nvlist_flags(nvl); @@ -225,7 +228,7 @@ nv_strdup(const char *s1) s2 = nv_malloc(len); if (s2) { memcpy(s2, s1, len); - s2[len] = '\0'; + s2[len-1] = '\0'; } return s2; }
CVS commit: src/sys/external/bsd/libnv/dist
Module Name:src Committed By: rmind Date: Sun Sep 23 21:35:26 UTC 2018 Modified Files: src/sys/external/bsd/libnv/dist: nv_kern_netbsd.c Log Message: nvlist_copyin: fix the flag handling. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/libnv/dist/nv_kern_netbsd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/libnv/dist/nv_kern_netbsd.c diff -u src/sys/external/bsd/libnv/dist/nv_kern_netbsd.c:1.4 src/sys/external/bsd/libnv/dist/nv_kern_netbsd.c:1.5 --- src/sys/external/bsd/libnv/dist/nv_kern_netbsd.c:1.4 Sun Sep 23 19:07:10 2018 +++ src/sys/external/bsd/libnv/dist/nv_kern_netbsd.c Sun Sep 23 21:35:26 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: nv_kern_netbsd.c,v 1.4 2018/09/23 19:07:10 rmind Exp $ */ +/* $NetBSD: nv_kern_netbsd.c,v 1.5 2018/09/23 21:35:26 rmind Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__RCSID("$NetBSD: nv_kern_netbsd.c,v 1.4 2018/09/23 19:07:10 rmind Exp $"); +__RCSID("$NetBSD: nv_kern_netbsd.c,v 1.5 2018/09/23 21:35:26 rmind Exp $"); #if !defined(_KERNEL) && !defined(_STANDALONE) #include @@ -74,9 +74,9 @@ int nvlist_copyin(const nvlist_ref_t *nref, nvlist_t **nvlp, size_t lim) { const size_t len = nref->len; + int flags, error; nvlist_t *nvl; void *buf; - int error; if (len >= lim) { return E2BIG; @@ -87,7 +87,8 @@ nvlist_copyin(const nvlist_ref_t *nref, kmem_free(buf, len); return error; } - nvl = nvlist_unpack(buf, len, nref->flags); + flags = nref->flags & (NV_FLAG_IGNORE_CASE | NV_FLAG_NO_UNIQUE); + nvl = nvlist_unpack(buf, len, flags); kmem_free(buf, len); if (nvl == NULL) { return EINVAL; @@ -126,7 +127,7 @@ nvlist_copyout(nvlist_ref_t *nref, const (vaddr_t)uaddr + len); goto err; } - nref->flags = nvlist_error(nvl); + nref->flags = nvlist_flags(nvl); nref->buf = uaddr; nref->len = len; err:
CVS commit: src/sys/external/bsd/libnv/dist
Module Name:src Committed By: rmind Date: Sun Sep 23 19:07:10 UTC 2018 Modified Files: src/sys/external/bsd/libnv/dist: nv_impl.h nv_kern_netbsd.c Log Message: libnv: add a wrapper around free(9) since in FreeBSD it can take NULL. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/libnv/dist/nv_impl.h cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/libnv/dist/nv_kern_netbsd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/libnv/dist/nv_impl.h diff -u src/sys/external/bsd/libnv/dist/nv_impl.h:1.4 src/sys/external/bsd/libnv/dist/nv_impl.h:1.5 --- src/sys/external/bsd/libnv/dist/nv_impl.h:1.4 Sat Sep 22 17:13:30 2018 +++ src/sys/external/bsd/libnv/dist/nv_impl.h Sun Sep 23 19:07:10 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: nv_impl.h,v 1.4 2018/09/22 17:13:30 rmind Exp $ */ +/* $NetBSD: nv_impl.h,v 1.5 2018/09/23 19:07:10 rmind Exp $ */ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD @@ -65,10 +65,11 @@ extern void *nv_calloc(size_t, size_t); # endif # define nv_realloc(buf, size) realloc((buf), (size), M_NVLIST, \ M_WAITOK) -# define nv_free(buf) free((buf), M_NVLIST) # ifdef __FreeBSD__ +# define nv_free(buf) free((buf), M_NVLIST) # define nv_strdup(buf) strdup((buf), M_NVLIST) # else +extern void nv_free(void *); extern char *nv_strdup(const char *); # endif # define nv_vasprintf(ptr, ...) vasprintf(ptr, M_NVLIST, __VA_ARGS__) Index: src/sys/external/bsd/libnv/dist/nv_kern_netbsd.c diff -u src/sys/external/bsd/libnv/dist/nv_kern_netbsd.c:1.3 src/sys/external/bsd/libnv/dist/nv_kern_netbsd.c:1.4 --- src/sys/external/bsd/libnv/dist/nv_kern_netbsd.c:1.3 Sat Sep 22 17:13:30 2018 +++ src/sys/external/bsd/libnv/dist/nv_kern_netbsd.c Sun Sep 23 19:07:10 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: nv_kern_netbsd.c,v 1.3 2018/09/22 17:13:30 rmind Exp $ */ +/* $NetBSD: nv_kern_netbsd.c,v 1.4 2018/09/23 19:07:10 rmind Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__RCSID("$NetBSD: nv_kern_netbsd.c,v 1.3 2018/09/22 17:13:30 rmind Exp $"); +__RCSID("$NetBSD: nv_kern_netbsd.c,v 1.4 2018/09/23 19:07:10 rmind Exp $"); #if !defined(_KERNEL) && !defined(_STANDALONE) #include @@ -61,6 +61,15 @@ extern void dealloc(void *, unsigned int #ifndef _STANDALONE #ifdef _KERNEL +void +nv_free(void *buf) +{ + if (!buf) { + return; + } + free(buf, M_NVLIST); +} + int nvlist_copyin(const nvlist_ref_t *nref, nvlist_t **nvlp, size_t lim) {
CVS commit: src/sys/external/bsd/libnv/dist
Module Name:src Committed By: rmind Date: Sat Sep 22 17:13:30 UTC 2018 Modified Files: src/sys/external/bsd/libnv/dist: nv_impl.h nv_kern_netbsd.c nvlist.c Log Message: libnv: fix some NetBSD wrappers. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/libnv/dist/nv_impl.h cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/libnv/dist/nv_kern_netbsd.c cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/libnv/dist/nvlist.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/libnv/dist/nv_impl.h diff -u src/sys/external/bsd/libnv/dist/nv_impl.h:1.3 src/sys/external/bsd/libnv/dist/nv_impl.h:1.4 --- src/sys/external/bsd/libnv/dist/nv_impl.h:1.3 Sat Sep 8 14:12:53 2018 +++ src/sys/external/bsd/libnv/dist/nv_impl.h Sat Sep 22 17:13:30 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: nv_impl.h,v 1.3 2018/09/08 14:12:53 christos Exp $ */ +/* $NetBSD: nv_impl.h,v 1.4 2018/09/22 17:13:30 rmind Exp $ */ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD @@ -82,11 +82,11 @@ extern char *nv_strdup(const char *); #else /* USERLAND */ # define nv_malloc(size) malloc((size)) -# define nv_calloc(n, size) calloc(n, size) # define nv_realloc(buf, size) realloc((buf), (size)) # define nv_free(buf) free((buf)) -# define nv_strdup(buf) strdup(buf) # define nv_vasprintf(ptr, ...) vasprintf(ptr, __VA_ARGS__) +void *nv_calloc(size_t, size_t); +char *nv_strdup(const char *); # define ERRNO_SET(var) do {\ errno = (var); \ Index: src/sys/external/bsd/libnv/dist/nv_kern_netbsd.c diff -u src/sys/external/bsd/libnv/dist/nv_kern_netbsd.c:1.2 src/sys/external/bsd/libnv/dist/nv_kern_netbsd.c:1.3 --- src/sys/external/bsd/libnv/dist/nv_kern_netbsd.c:1.2 Sat Sep 8 14:12:53 2018 +++ src/sys/external/bsd/libnv/dist/nv_kern_netbsd.c Sat Sep 22 17:13:30 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: nv_kern_netbsd.c,v 1.2 2018/09/08 14:12:53 christos Exp $ */ +/* $NetBSD: nv_kern_netbsd.c,v 1.3 2018/09/22 17:13:30 rmind Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__RCSID("$NetBSD: nv_kern_netbsd.c,v 1.2 2018/09/08 14:12:53 christos Exp $"); +__RCSID("$NetBSD: nv_kern_netbsd.c,v 1.3 2018/09/22 17:13:30 rmind Exp $"); #if !defined(_KERNEL) && !defined(_STANDALONE) #include @@ -198,11 +198,11 @@ nvlist_recv_ioctl(int fd, unsigned long void * nv_calloc(size_t n, size_t s) { - n *= s; - void *buf = nv_malloc(n); + const size_t len = n * s; + void *buf = nv_malloc(len); if (buf == NULL) return NULL; - memset(buf, 0, n); + memset(buf, 0, len); return buf; } Index: src/sys/external/bsd/libnv/dist/nvlist.c diff -u src/sys/external/bsd/libnv/dist/nvlist.c:1.5 src/sys/external/bsd/libnv/dist/nvlist.c:1.6 --- src/sys/external/bsd/libnv/dist/nvlist.c:1.5 Tue Sep 11 02:20:31 2018 +++ src/sys/external/bsd/libnv/dist/nvlist.c Sat Sep 22 17:13:30 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: nvlist.c,v 1.5 2018/09/11 02:20:31 christos Exp $ */ +/* $NetBSD: nvlist.c,v 1.6 2018/09/22 17:13:30 rmind Exp $ */ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD @@ -36,7 +36,7 @@ #ifdef __FreeBSD__ __FBSDID("$FreeBSD: head/sys/contrib/libnv/nvlist.c 335347 2018-06-18 22:57:32Z oshogbo $"); #else -__RCSID("$NetBSD: nvlist.c,v 1.5 2018/09/11 02:20:31 christos Exp $"); +__RCSID("$NetBSD: nvlist.c,v 1.6 2018/09/22 17:13:30 rmind Exp $"); #endif #include @@ -1180,7 +1180,7 @@ nvlist_xunpack(const void *buf, size_t s goto fail; nvlist_set_parent(tmpnvl, nvp); break; -#if !defined(_KERNEL) && !defined(_STANDALONE) +#if !defined(_KERNEL) && !defined(_STANDALONE) && !defined(__NetBSD__) case NV_TYPE_DESCRIPTOR: ptr = nvpair_unpack_descriptor(isbe, nvp, ptr, , fds, nfds);
CVS commit: src/sys/external/bsd/libnv/dist
Module Name:src Committed By: christos Date: Tue Sep 11 02:20:31 UTC 2018 Modified Files: src/sys/external/bsd/libnv/dist: nvlist.c nvlist_impl.h Log Message: add dead... To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/libnv/dist/nvlist.c cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/libnv/dist/nvlist_impl.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/libnv/dist/nvlist.c diff -u src/sys/external/bsd/libnv/dist/nvlist.c:1.4 src/sys/external/bsd/libnv/dist/nvlist.c:1.5 --- src/sys/external/bsd/libnv/dist/nvlist.c:1.4 Sat Sep 8 10:32:25 2018 +++ src/sys/external/bsd/libnv/dist/nvlist.c Mon Sep 10 22:20:31 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: nvlist.c,v 1.4 2018/09/08 14:32:25 christos Exp $ */ +/* $NetBSD: nvlist.c,v 1.5 2018/09/11 02:20:31 christos Exp $ */ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD @@ -36,7 +36,7 @@ #ifdef __FreeBSD__ __FBSDID("$FreeBSD: head/sys/contrib/libnv/nvlist.c 335347 2018-06-18 22:57:32Z oshogbo $"); #else -__RCSID("$NetBSD: nvlist.c,v 1.4 2018/09/08 14:32:25 christos Exp $"); +__RCSID("$NetBSD: nvlist.c,v 1.5 2018/09/11 02:20:31 christos Exp $"); #endif #include @@ -337,7 +337,7 @@ nvlist_set_flags(nvlist_t *nvl, int flag nvl->nvl_flags = flags; } -void +__dead void nvlist_report_missing(int type, const char *name) { Index: src/sys/external/bsd/libnv/dist/nvlist_impl.h diff -u src/sys/external/bsd/libnv/dist/nvlist_impl.h:1.2 src/sys/external/bsd/libnv/dist/nvlist_impl.h:1.3 --- src/sys/external/bsd/libnv/dist/nvlist_impl.h:1.2 Sat Sep 8 10:02:15 2018 +++ src/sys/external/bsd/libnv/dist/nvlist_impl.h Mon Sep 10 22:20:31 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: nvlist_impl.h,v 1.2 2018/09/08 14:02:15 christos Exp $ */ +/* $NetBSD: nvlist_impl.h,v 1.3 2018/09/11 02:20:31 christos Exp $ */ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD @@ -47,7 +47,7 @@ #include #endif -void nvlist_report_missing(int type, const char *name); +__dead void nvlist_report_missing(int type, const char *name); nvpair_t *nvlist_get_nvpair_parent(const nvlist_t *nvl); const unsigned char *nvlist_unpack_header(nvlist_t *nvl, const unsigned char *ptr, size_t nfds, bool *isbep, size_t *leftp);
CVS commit: src/sys/external/bsd/libnv/dist
Module Name:src Committed By: christos Date: Sat Sep 8 14:32:25 UTC 2018 Modified Files: src/sys/external/bsd/libnv/dist: dnvlist.c nvlist.c nvpair.c Log Message: fix kernel build. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/libnv/dist/dnvlist.c \ src/sys/external/bsd/libnv/dist/nvlist.c cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/libnv/dist/nvpair.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/libnv/dist/dnvlist.c diff -u src/sys/external/bsd/libnv/dist/dnvlist.c:1.3 src/sys/external/bsd/libnv/dist/dnvlist.c:1.4 --- src/sys/external/bsd/libnv/dist/dnvlist.c:1.3 Sat Sep 8 10:12:53 2018 +++ src/sys/external/bsd/libnv/dist/dnvlist.c Sat Sep 8 10:32:25 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: dnvlist.c,v 1.3 2018/09/08 14:12:53 christos Exp $ */ +/* $NetBSD: dnvlist.c,v 1.4 2018/09/08 14:32:25 christos Exp $ */ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD @@ -35,7 +35,7 @@ #ifdef __FreeBSD__ __FBSDID("$FreeBSD: head/sys/contrib/libnv/dnvlist.c 328474 2018-01-27 12:58:21Z oshogbo $"); #else -__RCSID("$NetBSD: dnvlist.c,v 1.3 2018/09/08 14:12:53 christos Exp $"); +__RCSID("$NetBSD: dnvlist.c,v 1.4 2018/09/08 14:32:25 christos Exp $"); #endif #if defined(_KERNEL) || defined(_STANDALONE) @@ -46,7 +46,7 @@ __RCSID("$NetBSD: dnvlist.c,v 1.3 2018/0 #include #include -#ifndef __FreeBSD__ +#ifdef __FreeBSD__ #include #endif Index: src/sys/external/bsd/libnv/dist/nvlist.c diff -u src/sys/external/bsd/libnv/dist/nvlist.c:1.3 src/sys/external/bsd/libnv/dist/nvlist.c:1.4 --- src/sys/external/bsd/libnv/dist/nvlist.c:1.3 Sat Sep 8 10:12:53 2018 +++ src/sys/external/bsd/libnv/dist/nvlist.c Sat Sep 8 10:32:25 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: nvlist.c,v 1.3 2018/09/08 14:12:53 christos Exp $ */ +/* $NetBSD: nvlist.c,v 1.4 2018/09/08 14:32:25 christos Exp $ */ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD @@ -36,7 +36,7 @@ #ifdef __FreeBSD__ __FBSDID("$FreeBSD: head/sys/contrib/libnv/nvlist.c 335347 2018-06-18 22:57:32Z oshogbo $"); #else -__RCSID("$NetBSD: nvlist.c,v 1.3 2018/09/08 14:12:53 christos Exp $"); +__RCSID("$NetBSD: nvlist.c,v 1.4 2018/09/08 14:32:25 christos Exp $"); #endif #include @@ -1508,7 +1508,6 @@ nvlist_add_stringf(nvlist_t *nvl, const nvlist_add_stringv(nvl, name, valuefmt, valueap); va_end(valueap); } -#endif void nvlist_add_stringv(nvlist_t *nvl, const char *name, const char *valuefmt, @@ -1529,6 +1528,7 @@ nvlist_add_stringv(nvlist_t *nvl, const (void)nvlist_move_nvpair(nvl, nvp); } } +#endif void nvlist_add_null(nvlist_t *nvl, const char *name) Index: src/sys/external/bsd/libnv/dist/nvpair.c diff -u src/sys/external/bsd/libnv/dist/nvpair.c:1.2 src/sys/external/bsd/libnv/dist/nvpair.c:1.3 --- src/sys/external/bsd/libnv/dist/nvpair.c:1.2 Sat Sep 8 10:02:15 2018 +++ src/sys/external/bsd/libnv/dist/nvpair.c Sat Sep 8 10:32:25 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: nvpair.c,v 1.2 2018/09/08 14:02:15 christos Exp $ */ +/* $NetBSD: nvpair.c,v 1.3 2018/09/08 14:32:25 christos Exp $ */ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD @@ -36,7 +36,7 @@ #ifdef __FreeBSD__ __FBSDID("$FreeBSD: head/sys/contrib/libnv/nvpair.c 335382 2018-06-19 18:43:02Z lwhsu $"); #else -__RCSID("$NetBSD: nvpair.c,v 1.2 2018/09/08 14:02:15 christos Exp $"); +__RCSID("$NetBSD: nvpair.c,v 1.3 2018/09/08 14:32:25 christos Exp $"); #endif #include @@ -1191,6 +1191,7 @@ nvpair_name(const nvpair_t *nvp) return (nvp->nvp_name); } +#if !defined(_KERNEL) && !defined(_STANDALONE) && !defined(__NetBSD__) nvpair_t * nvpair_create_stringf(const char *name, const char *valuefmt, ...) { @@ -1219,6 +1220,7 @@ nvpair_create_stringv(const char *name, nv_free(str); return (nvp); } +#endif nvpair_t * nvpair_create_null(const char *name)
CVS commit: src/sys/external/bsd/libnv/dist
Module Name:src Committed By: christos Date: Sat Sep 8 14:12:53 UTC 2018 Modified Files: src/sys/external/bsd/libnv/dist: dnvlist.c nv_impl.h nv_kern_netbsd.c nvlist.c Log Message: FIx userland build To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/libnv/dist/dnvlist.c \ src/sys/external/bsd/libnv/dist/nv_impl.h \ src/sys/external/bsd/libnv/dist/nvlist.c cvs rdiff -u -r1.1 -r1.2 src/sys/external/bsd/libnv/dist/nv_kern_netbsd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/libnv/dist/dnvlist.c diff -u src/sys/external/bsd/libnv/dist/dnvlist.c:1.2 src/sys/external/bsd/libnv/dist/dnvlist.c:1.3 --- src/sys/external/bsd/libnv/dist/dnvlist.c:1.2 Sat Sep 8 10:02:15 2018 +++ src/sys/external/bsd/libnv/dist/dnvlist.c Sat Sep 8 10:12:53 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: dnvlist.c,v 1.2 2018/09/08 14:02:15 christos Exp $ */ +/* $NetBSD: dnvlist.c,v 1.3 2018/09/08 14:12:53 christos Exp $ */ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD @@ -35,7 +35,7 @@ #ifdef __FreeBSD__ __FBSDID("$FreeBSD: head/sys/contrib/libnv/dnvlist.c 328474 2018-01-27 12:58:21Z oshogbo $"); #else -__RCSID("$NetBSD: dnvlist.c,v 1.2 2018/09/08 14:02:15 christos Exp $"); +__RCSID("$NetBSD: dnvlist.c,v 1.3 2018/09/08 14:12:53 christos Exp $"); #endif #if defined(_KERNEL) || defined(_STANDALONE) @@ -57,7 +57,7 @@ __RCSID("$NetBSD: dnvlist.c,v 1.2 2018/0 #include #endif -#ifndef __FreeBSD__ +#ifdef __FreeBSD__ #include #include #else Index: src/sys/external/bsd/libnv/dist/nv_impl.h diff -u src/sys/external/bsd/libnv/dist/nv_impl.h:1.2 src/sys/external/bsd/libnv/dist/nv_impl.h:1.3 --- src/sys/external/bsd/libnv/dist/nv_impl.h:1.2 Sat Sep 8 10:02:15 2018 +++ src/sys/external/bsd/libnv/dist/nv_impl.h Sat Sep 8 10:12:53 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: nv_impl.h,v 1.2 2018/09/08 14:02:15 christos Exp $ */ +/* $NetBSD: nv_impl.h,v 1.3 2018/09/08 14:12:53 christos Exp $ */ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD @@ -56,58 +56,58 @@ typedef struct nvpair nvpair_t; #define NV_FLAG_IN_ARRAY 0x100 #if defined(_KERNEL) -#define nv_malloc(size) malloc((size), M_NVLIST, M_WAITOK) -#ifdef __FreeBSD__ -#define nv_calloc(n, size) mallocarray((n), (size), M_NVLIST, \ +# define nv_malloc(size) malloc((size), M_NVLIST, M_WAITOK) +# ifdef __FreeBSD__ +# define nv_calloc(n, size) mallocarray((n), (size), M_NVLIST, \ M_WAITOK | M_ZERO) -#else +# else extern void *nv_calloc(size_t, size_t); -#endif -#define nv_realloc(buf, size) realloc((buf), (size), M_NVLIST, \ +# endif +# define nv_realloc(buf, size) realloc((buf), (size), M_NVLIST, \ M_WAITOK) -#define nv_free(buf) free((buf), M_NVLIST) -#ifdef __FreeBSD__ -#define nv_strdup(buf) strdup((buf), M_NVLIST) -#else +# define nv_free(buf) free((buf), M_NVLIST) +# ifdef __FreeBSD__ +# define nv_strdup(buf) strdup((buf), M_NVLIST) +# else extern char *nv_strdup(const char *); -#endif -#define nv_vasprintf(ptr, ...) vasprintf(ptr, M_NVLIST, __VA_ARGS__) -#endif +# endif +# define nv_vasprintf(ptr, ...) vasprintf(ptr, M_NVLIST, __VA_ARGS__) #elif defined(_STANDALONE) extern void *nv_malloc(size_t); extern void *nv_calloc(size_t, size_t); extern void *nv_realloc(void *, size_t); extern void nv_free(void *); extern char *nv_strdup(const char *); -#define nv_vasprintf(ptr, ...) vasprintf(ptr, M_NVLIST, __VA_ARGS__) -#else +# define nv_vasprintf(ptr, ...) vasprintf(ptr, M_NVLIST, __VA_ARGS__) +#else /* USERLAND */ -#define nv_malloc(size) malloc((size)) -#define nv_calloc(n, size) calloc((n), (size)) -#define nv_realloc(buf, size) realloc((buf), (size)) -#define nv_free(buf) free((buf)) -#define nv_strdup(buf) strdup((buf)) -#define nv_vasprintf(ptr, ...) vasprintf(ptr, __VA_ARGS__) - -#define ERRNO_SET(var) do { errno = (var); } while (0) -#define ERRNO_SAVE() do {\ +# define nv_malloc(size) malloc((size)) +# define nv_calloc(n, size) calloc(n, size) +# define nv_realloc(buf, size) realloc((buf), (size)) +# define nv_free(buf) free((buf)) +# define nv_strdup(buf) strdup(buf) +# define nv_vasprintf(ptr, ...) vasprintf(ptr, __VA_ARGS__) + +# define ERRNO_SET(var) do {\ + errno = (var); \ + } while (/*CONSTCOND*/0) +# define ERRNO_SAVE() do {\ int _serrno; \ - \ _serrno = errno -#define ERRNO_RESTORE()errno = _serrno; \ - } while (0) +# define ERRNO_RESTORE() errno = _serrno; \ + } while (/*CONSTCOND*/0) -#define ERRNO_OR_DEFAULT(default) (errno == 0 ? (default) : errno) +# define ERRNO_OR_DEFAULT(default) (errno == 0 ? (default) : errno) #endif #ifndef ERRNO_SET -#define ERRNO_SET(var) do { } while (/*CONSTCOND*/0) -#define ERRNO_SAVE() do { do { } while(/*CONSTCOND*/0) -#define ERRNO_RESTORE() } while (/*CONSTCOND*/0) - -#define
CVS commit: src/sys/external/bsd/libnv/dist
Module Name:src Committed By: christos Date: Sat Sep 8 14:02:15 UTC 2018 Modified Files: src/sys/external/bsd/libnv/dist: cnv.9 cnv.h cnvlist.c common_impl.h dnv.9 dnv.h dnvlist.c msgio.c msgio.h nv.9 nv.h nv_impl.h nvlist.c nvlist_impl.h nvpair.c nvpair_impl.h Added Files: src/sys/external/bsd/libnv/dist: nv_compat.h nv_kern_netbsd.c Log Message: Add NetBSD stuff. To generate a diff of this commit: cvs rdiff -u -r1.1.1.1 -r1.2 src/sys/external/bsd/libnv/dist/cnv.9 \ src/sys/external/bsd/libnv/dist/cnv.h \ src/sys/external/bsd/libnv/dist/cnvlist.c \ src/sys/external/bsd/libnv/dist/common_impl.h \ src/sys/external/bsd/libnv/dist/dnv.9 \ src/sys/external/bsd/libnv/dist/dnv.h \ src/sys/external/bsd/libnv/dist/dnvlist.c \ src/sys/external/bsd/libnv/dist/msgio.c \ src/sys/external/bsd/libnv/dist/msgio.h \ src/sys/external/bsd/libnv/dist/nv.9 src/sys/external/bsd/libnv/dist/nv.h \ src/sys/external/bsd/libnv/dist/nv_impl.h \ src/sys/external/bsd/libnv/dist/nvlist.c \ src/sys/external/bsd/libnv/dist/nvlist_impl.h \ src/sys/external/bsd/libnv/dist/nvpair.c \ src/sys/external/bsd/libnv/dist/nvpair_impl.h cvs rdiff -u -r0 -r1.1 src/sys/external/bsd/libnv/dist/nv_compat.h \ src/sys/external/bsd/libnv/dist/nv_kern_netbsd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/libnv/dist/cnv.9 diff -u src/sys/external/bsd/libnv/dist/cnv.9:1.1.1.1 src/sys/external/bsd/libnv/dist/cnv.9:1.2 --- src/sys/external/bsd/libnv/dist/cnv.9:1.1.1.1 Sat Sep 8 09:27:48 2018 +++ src/sys/external/bsd/libnv/dist/cnv.9 Sat Sep 8 10:02:15 2018 @@ -1,3 +1,4 @@ +.\" $NetBSD: cnv.9,v 1.2 2018/09/08 14:02:15 christos Exp $ .\" .\" Copyright (c) 2016 Adam Starak .\" All rights reserved. Index: src/sys/external/bsd/libnv/dist/cnv.h diff -u src/sys/external/bsd/libnv/dist/cnv.h:1.1.1.1 src/sys/external/bsd/libnv/dist/cnv.h:1.2 --- src/sys/external/bsd/libnv/dist/cnv.h:1.1.1.1 Sat Sep 8 09:27:48 2018 +++ src/sys/external/bsd/libnv/dist/cnv.h Sat Sep 8 10:02:15 2018 @@ -1,3 +1,5 @@ +/* $NetBSD: cnv.h,v 1.2 2018/09/08 14:02:15 christos Exp $ */ + /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * @@ -33,7 +35,7 @@ #include -#ifndef _KERNEL +#if !defined(_KERNEL) && !defined(_STANDALONE) #include #include #include @@ -70,7 +72,7 @@ const bool *cnvlist_get_bool_array(cons const uint64_t *cnvlist_get_number_array(const void *cookie, size_t *nitemsp); const char * const *cnvlist_get_string_array(const void *cookie, size_t *nitemsp); const nvlist_t * const *cnvlist_get_nvlist_array(const void *cookie, size_t *nitemsp); -#ifndef _KERNEL +#if !defined(_KERNEL) && !defined(_STANDALONE) int cnvlist_get_descriptor(const void *cookie); const int *cnvlist_get_descriptor_array(const void *cookie, size_t *nitemsp); #endif @@ -91,7 +93,7 @@ bool *cnvlist_take_bool_array(void *c uint64_t *cnvlist_take_number_array(void *cookie, size_t *nitemsp); char **cnvlist_take_string_array(void *cookie, size_t *nitemsp); nvlist_t **cnvlist_take_nvlist_array(void *cookie, size_t *nitemsp); -#ifndef _KERNEL +#if !defined(_KERNEL) && !defined(_STANDALONE) int cnvlist_take_descriptor(void *cookie); int *cnvlist_take_descriptor_array(void *cookie, size_t *nitemsp); #endif @@ -110,7 +112,7 @@ void cnvlist_free_bool_array(void *cooki void cnvlist_free_number_array(void *cookie); void cnvlist_free_string_array(void *cookie); void cnvlist_free_nvlist_array(void *cookie); -#ifndef _KERNEL +#if !defined(_KERNEL) && !defined(_STANDALONE) void cnvlist_free_descriptor(void *cookie); void cnvlist_free_descriptor_array(void *cookie); #endif Index: src/sys/external/bsd/libnv/dist/cnvlist.c diff -u src/sys/external/bsd/libnv/dist/cnvlist.c:1.1.1.1 src/sys/external/bsd/libnv/dist/cnvlist.c:1.2 --- src/sys/external/bsd/libnv/dist/cnvlist.c:1.1.1.1 Sat Sep 8 09:27:47 2018 +++ src/sys/external/bsd/libnv/dist/cnvlist.c Sat Sep 8 10:02:15 2018 @@ -1,3 +1,5 @@ +/* $NetBSD: cnvlist.c,v 1.2 2018/09/08 14:02:15 christos Exp $ */ + /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * @@ -29,9 +31,13 @@ */ #include +#ifdef __FreeBSD__ __FBSDID("$FreeBSD: head/sys/contrib/libnv/cnvlist.c 335343 2018-06-18 21:26:58Z oshogbo $"); +#else +__RCSID("$NetBSD: cnvlist.c,v 1.2 2018/09/08 14:02:15 christos Exp $"); +#endif -#ifdef _KERNEL +#if defined(_KERNEL) || defined(_STANDALONE) #include #include @@ -39,7 +45,9 @@ __FBSDID("$FreeBSD: head/sys/contrib/lib #include #include +#ifdef __FreeBSD__ #include +#endif #else #include @@ -48,8 +56,13 @@ __FBSDID("$FreeBSD: head/sys/contrib/lib #include #endif -#include +#ifdef __FreeBSD__ #include +#include +#else +#include "nv.h" +#include "cnv.h" +#endif #include "nv_impl.h" #include "nvlist_impl.h" @@ -85,7 +98,7 @@ CNVLIST_GET(bool,