Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/libnv/dist Add NetBSD stuff.



details:   https://anonhg.NetBSD.org/src/rev/74bd538fbc09
branches:  trunk
changeset: 433335:74bd538fbc09
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Sep 08 14:02:15 2018 +0000

description:
Add NetBSD stuff.

diffstat:

 sys/external/bsd/libnv/dist/cnv.9            |    1 +
 sys/external/bsd/libnv/dist/cnv.h            |   10 +-
 sys/external/bsd/libnv/dist/cnvlist.c        |   27 ++-
 sys/external/bsd/libnv/dist/common_impl.h    |    2 +
 sys/external/bsd/libnv/dist/dnv.9            |    1 +
 sys/external/bsd/libnv/dist/dnv.h            |    4 +-
 sys/external/bsd/libnv/dist/dnvlist.c        |   19 +-
 sys/external/bsd/libnv/dist/msgio.c          |   14 +
 sys/external/bsd/libnv/dist/msgio.h          |    2 +
 sys/external/bsd/libnv/dist/nv.9             |    1 +
 sys/external/bsd/libnv/dist/nv.h             |   44 +++-
 sys/external/bsd/libnv/dist/nv_compat.h      |   96 ++++++++++
 sys/external/bsd/libnv/dist/nv_impl.h        |   37 +++-
 sys/external/bsd/libnv/dist/nv_kern_netbsd.c |  255 +++++++++++++++++++++++++++
 sys/external/bsd/libnv/dist/nvlist.c         |   68 ++++--
 sys/external/bsd/libnv/dist/nvlist_impl.h    |    8 +-
 sys/external/bsd/libnv/dist/nvpair.c         |   54 ++++-
 sys/external/bsd/libnv/dist/nvpair_impl.h    |    8 +-
 18 files changed, 579 insertions(+), 72 deletions(-)

diffs (truncated from 1391 to 300 lines):

diff -r 85b4de19a3fd -r 74bd538fbc09 sys/external/bsd/libnv/dist/cnv.9
--- a/sys/external/bsd/libnv/dist/cnv.9 Sat Sep 08 13:27:47 2018 +0000
+++ b/sys/external/bsd/libnv/dist/cnv.9 Sat Sep 08 14:02:15 2018 +0000
@@ -1,3 +1,4 @@
+.\"    $NetBSD: cnv.9,v 1.2 2018/09/08 14:02:15 christos Exp $
 .\"
 .\" Copyright (c) 2016 Adam Starak <starak.adam%gmail.com@localhost>
 .\" All rights reserved.
diff -r 85b4de19a3fd -r 74bd538fbc09 sys/external/bsd/libnv/dist/cnv.h
--- a/sys/external/bsd/libnv/dist/cnv.h Sat Sep 08 13:27:47 2018 +0000
+++ b/sys/external/bsd/libnv/dist/cnv.h Sat Sep 08 14:02:15 2018 +0000
@@ -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 <sys/cdefs.h>
 
-#ifndef _KERNEL
+#if !defined(_KERNEL) && !defined(_STANDALONE)
 #include <stdarg.h>
 #include <stdbool.h>
 #include <stdint.h>
@@ -70,7 +72,7 @@
 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 @@
 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_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
diff -r 85b4de19a3fd -r 74bd538fbc09 sys/external/bsd/libnv/dist/cnvlist.c
--- a/sys/external/bsd/libnv/dist/cnvlist.c     Sat Sep 08 13:27:47 2018 +0000
+++ b/sys/external/bsd/libnv/dist/cnvlist.c     Sat Sep 08 14:02:15 2018 +0000
@@ -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 <sys/cdefs.h>
+#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 <sys/types.h>
 #include <sys/param.h>
@@ -39,7 +45,9 @@
 #include <sys/systm.h>
 #include <sys/malloc.h>
 
+#ifdef __FreeBSD__
 #include <machine/stdarg.h>
+#endif
 
 #else
 #include <stdarg.h>
@@ -48,8 +56,13 @@
 #include <stdlib.h>
 #endif
 
+#ifdef __FreeBSD__
+#include <sys/nv.h>
 #include <sys/cnv.h>
-#include <sys/nv.h>
+#else
+#include "nv.h"
+#include "cnv.h"
+#endif
 
 #include "nv_impl.h"
 #include "nvlist_impl.h"
@@ -85,7 +98,7 @@
 CNVLIST_GET(uint64_t, number, NUMBER)
 CNVLIST_GET(const char *, string, STRING)
 CNVLIST_GET(const nvlist_t *, nvlist, NVLIST)
-#ifndef _KERNEL
+#if !defined(_KERNEL) && !defined(_STANDALONE)
 CNVLIST_GET(int, descriptor, DESCRIPTOR)
 #endif
 
@@ -107,7 +120,7 @@
 CNVLIST_GET_ARRAY(const uint64_t *, number_array, NUMBER_ARRAY)
 CNVLIST_GET_ARRAY(const char * const *, string_array, STRING_ARRAY)
 CNVLIST_GET_ARRAY(const nvlist_t * const *, nvlist_array, NVLIST_ARRAY)
-#ifndef _KERNEL
+#if !defined(_KERNEL) && !defined(_STANDALONE)
 CNVLIST_GET_ARRAY(const int *, descriptor_array, DESCRIPTOR_ARRAY)
 #endif
 
@@ -144,7 +157,7 @@
 CNVLIST_TAKE(uint64_t, number, NUMBER)
 CNVLIST_TAKE(char *, string, STRING)
 CNVLIST_TAKE(nvlist_t *, nvlist, NVLIST)
-#ifndef _KERNEL
+#if !defined(_KERNEL) && !defined(_STANDALONE)
 CNVLIST_TAKE(int, descriptor, DESCRIPTOR)
 #endif
 
@@ -172,7 +185,7 @@
 CNVLIST_TAKE_ARRAY(uint64_t *, number_array, NUMBER_ARRAY)
 CNVLIST_TAKE_ARRAY(char **, string_array, STRING_ARRAY)
 CNVLIST_TAKE_ARRAY(nvlist_t **, nvlist_array, NVLIST_ARRAY)
-#ifndef _KERNEL
+#if !defined(_KERNEL) && !defined(_STANDALONE)
 CNVLIST_TAKE_ARRAY(int *, descriptor_array, DESCRIPTOR_ARRAY);
 #endif
 
@@ -211,7 +224,7 @@
 CNVLIST_FREE(number_array)
 CNVLIST_FREE(string_array)
 CNVLIST_FREE(nvlist_array)
-#ifndef _KERNEL
+#if !defined(_KERNEL) && !defined(_STANDALONE)
 CNVLIST_FREE(descriptor)
 CNVLIST_FREE(descriptor_array)
 #endif
diff -r 85b4de19a3fd -r 74bd538fbc09 sys/external/bsd/libnv/dist/common_impl.h
--- a/sys/external/bsd/libnv/dist/common_impl.h Sat Sep 08 13:27:47 2018 +0000
+++ b/sys/external/bsd/libnv/dist/common_impl.h Sat Sep 08 14:02:15 2018 +0000
@@ -1,3 +1,5 @@
+/*     $NetBSD: common_impl.h,v 1.2 2018/09/08 14:02:15 christos Exp $ */
+
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  *
diff -r 85b4de19a3fd -r 74bd538fbc09 sys/external/bsd/libnv/dist/dnv.9
--- a/sys/external/bsd/libnv/dist/dnv.9 Sat Sep 08 13:27:47 2018 +0000
+++ b/sys/external/bsd/libnv/dist/dnv.9 Sat Sep 08 14:02:15 2018 +0000
@@ -1,3 +1,4 @@
+.\"    $NetBSD: dnv.9,v 1.2 2018/09/08 14:02:15 christos Exp $
 .\"
 .\" Copyright (c) 2016 Adam Starak <starak.adam%gmail.com@localhost>
 .\" All rights reserved.
diff -r 85b4de19a3fd -r 74bd538fbc09 sys/external/bsd/libnv/dist/dnv.h
--- a/sys/external/bsd/libnv/dist/dnv.h Sat Sep 08 13:27:47 2018 +0000
+++ b/sys/external/bsd/libnv/dist/dnv.h Sat Sep 08 14:02:15 2018 +0000
@@ -1,3 +1,5 @@
+/*     $NetBSD: dnv.h,v 1.2 2018/09/08 14:02:15 christos Exp $ */
+
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  *
@@ -36,7 +38,7 @@
 
 #include <sys/cdefs.h>
 
-#ifndef _KERNEL
+#if !defined(_KERNEL) && !defined(_STANDALONE)
 #include <stdarg.h>
 #include <stdbool.h>
 #include <stddef.h>
diff -r 85b4de19a3fd -r 74bd538fbc09 sys/external/bsd/libnv/dist/dnvlist.c
--- a/sys/external/bsd/libnv/dist/dnvlist.c     Sat Sep 08 13:27:47 2018 +0000
+++ b/sys/external/bsd/libnv/dist/dnvlist.c     Sat Sep 08 14:02:15 2018 +0000
@@ -1,3 +1,5 @@
+/*     $NetBSD: dnvlist.c,v 1.2 2018/09/08 14:02:15 christos Exp $     */
+
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  *
@@ -30,9 +32,13 @@
  */
 
 #include <sys/cdefs.h>
+#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 $");
+#endif
 
-#ifdef _KERNEL
+#if defined(_KERNEL) || defined(_STANDALONE)
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -40,7 +46,9 @@
 #include <sys/systm.h>
 #include <sys/malloc.h>
 
+#ifndef __FreeBSD__
 #include <machine/stdarg.h>
+#endif
 
 #else
 #include <stdarg.h>
@@ -49,8 +57,13 @@
 #include <stdlib.h>
 #endif
 
+#ifndef __FreeBSD__
 #include <sys/dnv.h>
 #include <sys/nv.h>
+#else
+#include "dnv.h"
+#include "nv.h"
+#endif
 
 #include "nv_impl.h"
 
@@ -69,7 +82,7 @@
 DNVLIST_GET(uint64_t, number)
 DNVLIST_GET(const char *, string)
 DNVLIST_GET(const nvlist_t *, nvlist)
-#ifndef _KERNEL
+#if !defined(_KERNEL) && !defined(_STANDALONE)
 DNVLIST_GET(int, descriptor)
 #endif
 
@@ -106,7 +119,7 @@
 DNVLIST_TAKE(uint64_t, number)
 DNVLIST_TAKE(char *, string)
 DNVLIST_TAKE(nvlist_t *, nvlist)
-#ifndef _KERNEL
+#if !defined(_KERNEL) && !defined(_STANDALONE)
 DNVLIST_TAKE(int, descriptor)
 #endif
 
diff -r 85b4de19a3fd -r 74bd538fbc09 sys/external/bsd/libnv/dist/msgio.c
--- a/sys/external/bsd/libnv/dist/msgio.c       Sat Sep 08 13:27:47 2018 +0000
+++ b/sys/external/bsd/libnv/dist/msgio.c       Sat Sep 08 14:02:15 2018 +0000
@@ -1,3 +1,5 @@
+/*     $NetBSD: msgio.c,v 1.2 2018/09/08 14:02:15 christos Exp $       */
+
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  *
@@ -31,10 +33,15 @@
  */
 
 #include <sys/cdefs.h>
+#ifdef __FreeBSD__
 __FBSDID("$FreeBSD: head/lib/libnv/msgio.c 326219 2017-11-26 02:00:33Z pfg $");
+#else
+__RCSID("$NetBSD: msgio.c,v 1.2 2018/09/08 14:02:15 christos Exp $");
+#endif
 
 #include <sys/param.h>
 #include <sys/socket.h>
+#include <sys/select.h>
 
 #include <errno.h>
 #include <fcntl.h>
@@ -58,7 +65,12 @@
 #define        PJDLOG_ABORT(...)               abort()
 #endif
 
+#ifdef __linux__
+/* Linux: arbitrary size, but must be lower than SCM_MAX_FD. */
+#define        PKG_MAX_SIZE    ((64U - 1) * CMSG_SPACE(sizeof(int)))
+#else
 #define        PKG_MAX_SIZE    (MCLBYTES / CMSG_SPACE(sizeof(int)) - 1)
+#endif
 
 static int
 msghdr_add_fd(struct cmsghdr *cmsg, int fd)
@@ -162,6 +174,7 @@
        return (0);
 }
 
+#ifdef __FreeBSD__
 int
 cred_send(int sock)
 {
@@ -237,6 +250,7 @@
 
        return (0);
 }
+#endif
 



Home | Main Index | Thread Index | Old Index