Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 17 Feb 2018 12:22:29 +0000 (UTC)
From:      Mariusz Zaborski <oshogbo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r329452 - in head/lib/libcasper: libcasper services/cap_dns services/cap_grp services/cap_pwd services/cap_random services/cap_sysctl services/cap_syslog
Message-ID:  <201802171222.w1HCMTMQ097032@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: oshogbo
Date: Sat Feb 17 12:22:29 2018
New Revision: 329452
URL: https://svnweb.freebsd.org/changeset/base/329452

Log:
  Introduce channel flags in libcasper.
  
  Instead of passing flags (which describe a type of nvlist)
  every send/recv we remember them in channel.
  It's enough for use to extract them only during unwrap.
  This simplify use of Casper.
  
  Reviewed by:	bruffer@, bcr@ (both man page)
  Differential Revision:	https://reviews.freebsd.org/D14196 (man page)

Modified:
  head/lib/libcasper/libcasper/Makefile
  head/lib/libcasper/libcasper/libcasper.3
  head/lib/libcasper/libcasper/libcasper.c
  head/lib/libcasper/libcasper/libcasper.h
  head/lib/libcasper/libcasper/libcasper_impl.h
  head/lib/libcasper/libcasper/libcasper_service.c
  head/lib/libcasper/libcasper/libcasper_service.h
  head/lib/libcasper/libcasper/service.c
  head/lib/libcasper/services/cap_dns/Makefile
  head/lib/libcasper/services/cap_dns/cap_dns.c
  head/lib/libcasper/services/cap_grp/Makefile
  head/lib/libcasper/services/cap_grp/cap_grp.c
  head/lib/libcasper/services/cap_pwd/Makefile
  head/lib/libcasper/services/cap_pwd/cap_pwd.c
  head/lib/libcasper/services/cap_random/Makefile
  head/lib/libcasper/services/cap_random/cap_random.c
  head/lib/libcasper/services/cap_sysctl/Makefile
  head/lib/libcasper/services/cap_sysctl/cap_sysctl.c
  head/lib/libcasper/services/cap_syslog/Makefile
  head/lib/libcasper/services/cap_syslog/cap_syslog.c

Modified: head/lib/libcasper/libcasper/Makefile
==============================================================================
--- head/lib/libcasper/libcasper/Makefile	Sat Feb 17 12:07:09 2018	(r329451)
+++ head/lib/libcasper/libcasper/Makefile	Sat Feb 17 12:22:29 2018	(r329452)
@@ -8,7 +8,7 @@ PACKAGE=casper
 
 .if ${MK_CASPER} != "no"
 SHLIB=	casper
-SHLIB_MAJOR=	0
+SHLIB_MAJOR=	1
 
 SRCS=	libcasper.c
 SRCS+=	libcasper_impl.c

Modified: head/lib/libcasper/libcasper/libcasper.3
==============================================================================
--- head/lib/libcasper/libcasper/libcasper.3	Sat Feb 17 12:07:09 2018	(r329451)
+++ head/lib/libcasper/libcasper/libcasper.3	Sat Feb 17 12:22:29 2018	(r329452)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd February 5, 2018
+.Dd February 17, 2018
 .Dt LIBCASPER 3
 .Os
 .Sh NAME
@@ -53,9 +53,9 @@
 .Ft "cap_channel_t *"
 .Fn cap_init "void"
 .Ft "cap_channel_t *"
-.Fn cap_wrap "int sock"
+.Fn cap_wrap "int sock" "int flags"
 .Ft "int"
-.Fn cap_unwrap "cap_channel_t *chan"
+.Fn cap_unwrap "cap_channel_t *chan" "int *flags"
 .Ft "int"
 .Fn cap_sock "const cap_channel_t *chan"
 .Ft "cap_channel_t *"
@@ -69,9 +69,9 @@
 .Ft "int"
 .Fn cap_send_nvlist "const cap_channel_t *chan" "const nvlist_t *nvl"
 .Ft "nvlist_t *"
-.Fn cap_recv_nvlist "const cap_channel_t *chan" "int flags"
+.Fn cap_recv_nvlist "const cap_channel_t *chan"
 .Ft "nvlist_t *"
-.Fn cap_xfer_nvlist "const cap_channel_t *chan" "nvlist_t *nvl" "int flags"
+.Fn cap_xfer_nvlist "const cap_channel_t *chan" "nvlist_t *nvl"
 .Ft "cap_channel_t *"
 .Fn cap_service_open "const cap_channel_t *chan" "const char *name"
 .Sh DESCRIPTION
@@ -105,6 +105,14 @@ or send over
 domain socket as a regular file descriptor and has to be represented as
 .Vt cap_channel_t
 again.
+The
+.Fa flags
+argument defines the channel behavior.
+The supported flags are:
+.Bl -ohang -offset indent
+.It CASPER_NO_UNIQ
+The communication between process and casper uses no unique version of nvlist.
+.El
 .Pp
 The
 .Fn cap_unwrap
@@ -164,23 +172,11 @@ Most services should provide higher level API.
 The
 .Fn cap_recv_nvlist
 function receives the given nvlist over the given capability.
-The
-.Fa flags
-argument defines what type the top nvlist is expected to be.
-If the nvlist flags do not match the flags passed to
-.Fn cap_recv_nvlist ,
-the nvlist will not be returned.
 .Pp
 The
 .Fn cap_xfer_nvlist
 function sends the given nvlist, destroys it and receives new nvlist in
 response over the given capability.
-The
-.Fa flags
-argument defines what type the top nvlist is expected to be.
-If the nvlist flags do not match the flags passed to
-.Fn cap_xfer_nvlist ,
-the nvlist will not be returned.
 It does not matter if the function succeeds or fails, the nvlist given
 for sending will always be destroyed once the function returns.
 .Pp

Modified: head/lib/libcasper/libcasper/libcasper.c
==============================================================================
--- head/lib/libcasper/libcasper/libcasper.c	Sat Feb 17 12:07:09 2018	(r329451)
+++ head/lib/libcasper/libcasper/libcasper.c	Sat Feb 17 12:22:29 2018	(r329452)
@@ -48,6 +48,8 @@ __FBSDID("$FreeBSD$");
 #include "libcasper.h"
 #include "libcasper_impl.h"
 
+#define	CASPER_VALID_FLAGS	(CASPER_NO_UNIQ)
+
 /*
  * Structure describing communication channel between two separated processes.
  */
@@ -62,6 +64,8 @@ struct cap_channel {
 	int	cch_sock;
 	/* Process descriptor for casper. */
 	int	cch_pd;
+	/* Flags to communicate with casper. */
+	int	cch_flags;
 };
 
 static bool
@@ -74,6 +78,13 @@ cap_add_pd(cap_channel_t *chan, int pd)
 	return (true);
 }
 
+int
+cap_channel_flags(const cap_channel_t *chan)
+{
+
+	return (chan->cch_flags);
+}
+
 cap_channel_t *
 cap_init(void)
 {
@@ -96,7 +107,7 @@ cap_init(void)
 	} else if (pid > 0) {
 		/* Child. */
 		close(sock[1]);
-		chan = cap_wrap(sock[0]);
+		chan = cap_wrap(sock[0], 0);
 		if (chan == NULL) {
 			serrno = errno;
 			close(sock[0]);
@@ -118,17 +129,21 @@ cap_init(void)
 }
 
 cap_channel_t *
-cap_wrap(int sock)
+cap_wrap(int sock, int flags)
 {
 	cap_channel_t *chan;
 
 	if (!fd_is_valid(sock))
 		return (NULL);
 
+	if ((flags & CASPER_VALID_FLAGS) != flags)
+		return (NULL);
+
 	chan = malloc(sizeof(*chan));
 	if (chan != NULL) {
 		chan->cch_sock = sock;
 		chan->cch_pd = -1;
+		chan->cch_flags = flags;
 		chan->cch_magic = CAP_CHANNEL_MAGIC;
 	}
 
@@ -136,7 +151,7 @@ cap_wrap(int sock)
 }
 
 int
-cap_unwrap(cap_channel_t *chan)
+cap_unwrap(cap_channel_t *chan, int *flags)
 {
 	int sock;
 
@@ -146,6 +161,8 @@ cap_unwrap(cap_channel_t *chan)
 	sock = chan->cch_sock;
 	if (chan->cch_pd != -1)
 		close(chan->cch_pd);
+	if (flags != NULL)
+		*flags = chan->cch_flags;
 	chan->cch_magic = 0;
 	free(chan);
 
@@ -162,9 +179,9 @@ cap_clone(const cap_channel_t *chan)
 	assert(chan != NULL);
 	assert(chan->cch_magic == CAP_CHANNEL_MAGIC);
 
-	nvl = nvlist_create(0);
+	nvl = nvlist_create(channel_nvlist_flags(chan));
 	nvlist_add_string(nvl, "cmd", "clone");
-	nvl = cap_xfer_nvlist(chan, nvl, 0);
+	nvl = cap_xfer_nvlist(chan, nvl);
 	if (nvl == NULL)
 		return (NULL);
 	if (nvlist_get_number(nvl, "error") != 0) {
@@ -174,7 +191,7 @@ cap_clone(const cap_channel_t *chan)
 	}
 	newsock = nvlist_take_descriptor(nvl, "sock");
 	nvlist_destroy(nvl);
-	newchan = cap_wrap(newsock);
+	newchan = cap_wrap(newsock, chan->cch_flags);
 	if (newchan == NULL) {
 		int serrno;
 
@@ -216,10 +233,10 @@ cap_limit_set(const cap_channel_t *chan, nvlist_t *lim
 	nvlist_t *nvlmsg;
 	int error;
 
-	nvlmsg = nvlist_create(0);
+	nvlmsg = nvlist_create(channel_nvlist_flags(chan));
 	nvlist_add_string(nvlmsg, "cmd", "limit_set");
 	nvlist_add_nvlist(nvlmsg, "limits", limits);
-	nvlmsg = cap_xfer_nvlist(chan, nvlmsg, 0);
+	nvlmsg = cap_xfer_nvlist(chan, nvlmsg);
 	if (nvlmsg == NULL) {
 		nvlist_destroy(limits);
 		return (-1);
@@ -240,9 +257,9 @@ cap_limit_get(const cap_channel_t *chan, nvlist_t **li
 	nvlist_t *nvlmsg;
 	int error;
 
-	nvlmsg = nvlist_create(0);
+	nvlmsg = nvlist_create(channel_nvlist_flags(chan));
 	nvlist_add_string(nvlmsg, "cmd", "limit_get");
-	nvlmsg = cap_xfer_nvlist(chan, nvlmsg, 0);
+	nvlmsg = cap_xfer_nvlist(chan, nvlmsg);
 	if (nvlmsg == NULL)
 		return (-1);
 	error = (int)nvlist_get_number(nvlmsg, "error");
@@ -270,23 +287,25 @@ cap_send_nvlist(const cap_channel_t *chan, const nvlis
 }
 
 nvlist_t *
-cap_recv_nvlist(const cap_channel_t *chan, int flags)
+cap_recv_nvlist(const cap_channel_t *chan)
 {
 
 	assert(chan != NULL);
 	assert(chan->cch_magic == CAP_CHANNEL_MAGIC);
 
-	return (nvlist_recv(chan->cch_sock, flags));
+	return (nvlist_recv(chan->cch_sock,
+	    channel_nvlist_flags(chan)));
 }
 
 nvlist_t *
-cap_xfer_nvlist(const cap_channel_t *chan, nvlist_t *nvl, int flags)
+cap_xfer_nvlist(const cap_channel_t *chan, nvlist_t *nvl)
 {
 
 	assert(chan != NULL);
 	assert(chan->cch_magic == CAP_CHANNEL_MAGIC);
 
-	return (nvlist_xfer(chan->cch_sock, nvl, flags));
+	return (nvlist_xfer(chan->cch_sock, nvl,
+	    channel_nvlist_flags(chan)));
 }
 
 cap_channel_t *
@@ -295,13 +314,14 @@ cap_service_open(const cap_channel_t *chan, const char
 	cap_channel_t *newchan;
 	nvlist_t *nvl;
 	int sock, error;
+	int flags;
 
 	sock = -1;
 
-	nvl = nvlist_create(0);
+	nvl = nvlist_create(channel_nvlist_flags(chan));
 	nvlist_add_string(nvl, "cmd", "open");
 	nvlist_add_string(nvl, "service", name);
-	nvl = cap_xfer_nvlist(chan, nvl, 0);
+	nvl = cap_xfer_nvlist(chan, nvl);
 	if (nvl == NULL)
 		return (NULL);
 	error = (int)nvlist_get_number(nvl, "error");
@@ -311,10 +331,11 @@ cap_service_open(const cap_channel_t *chan, const char
 		return (NULL);
 	}
 	sock = nvlist_take_descriptor(nvl, "chanfd");
+	flags = nvlist_take_number(nvl, "chanflags");
 	assert(sock >= 0);
 	nvlist_destroy(nvl);
 	nvl = NULL;
-	newchan = cap_wrap(sock);
+	newchan = cap_wrap(sock, flags);
 	if (newchan == NULL)
 		goto fail;
 	return (newchan);
@@ -332,7 +353,7 @@ cap_service_limit(const cap_channel_t *chan, const cha
 	nvlist_t *limits;
 	unsigned int i;
 
-	limits = nvlist_create(0);
+	limits = nvlist_create(channel_nvlist_flags(chan));
 	for (i = 0; i < nnames; i++)
 		nvlist_add_null(limits, names[i]);
 	return (cap_limit_set(chan, limits));

Modified: head/lib/libcasper/libcasper/libcasper.h
==============================================================================
--- head/lib/libcasper/libcasper/libcasper.h	Sat Feb 17 12:07:09 2018	(r329451)
+++ head/lib/libcasper/libcasper/libcasper.h	Sat Feb 17 12:22:29 2018	(r329452)
@@ -45,6 +45,8 @@
 #include <stdlib.h>
 #include <unistd.h>
 
+#define	CASPER_NO_UNIQ	0x00000001
+
 #ifndef	_NVLIST_T_DECLARED
 #define	_NVLIST_T_DECLARED
 struct nvlist;
@@ -62,12 +64,36 @@ typedef struct cap_channel cap_channel_t;
 #else
 struct cap_channel {
 	int cch_fd;
+	int cch_flags;
 };
 typedef struct cap_channel cap_channel_t;
 #define	CASPER_SUPPORT	(0)
 #endif /* ! WITH_CASPER */
 #endif /* ! _CAP_CHANNEL_T_DECLARED */
 
+#ifdef WITH_CASPER
+int cap_channel_flags(const cap_channel_t *chan);
+#else
+static inline int
+cap_channel_flags(const cap_channel_t *chan)
+{
+
+	return (chan->cch_flags);
+}
+#endif
+
+static inline int
+channel_nvlist_flags(const cap_channel_t *chan)
+{
+	int flags;
+
+	flags = 0;
+	if ((cap_channel_flags(chan) & CASPER_NO_UNIQ) != 0)
+		flags |= NV_FLAG_NO_UNIQUE;
+
+	return (flags);
+}
+
 /*
  * The functions opens unrestricted communication channel to Casper.
  */
@@ -103,16 +129,17 @@ int		 cap_service_limit(const cap_channel_t *chan,
  * The function creates cap_channel_t based on the given socket.
  */
 #ifdef WITH_CASPER
-cap_channel_t *cap_wrap(int sock);
+cap_channel_t *cap_wrap(int sock, int flags);
 #else
 static inline cap_channel_t *
-cap_wrap(int sock)
+cap_wrap(int sock, int flags)
 {
 	cap_channel_t *chan;
 
 	chan = cap_init();
 	if (chan != NULL) {
 		chan->cch_fd = sock;
+		chan->cch_flags = flags;
 	}
 	return (chan);
 }
@@ -122,7 +149,7 @@ cap_wrap(int sock)
  * The function returns communication socket and frees cap_channel_t.
  */
 #ifdef WITH_CASPER
-int	cap_unwrap(cap_channel_t *chan);
+int	cap_unwrap(cap_channel_t *chan, int *flags);
 #else
 static inline int
 cap_unwrap(cap_channel_t *chan)
@@ -160,6 +187,7 @@ cap_clone(const cap_channel_t *chan)
 			newchan = NULL;
 		}
 	}
+	newchan->cch_flags = chan->cch_flags;
 
 	return (newchan);
 }
@@ -212,7 +240,7 @@ static inline int
 cap_limit_get(const cap_channel_t *chan __unused, nvlist_t **limitsp)
 {
 
-	*limitsp = nvlist_create(0);
+	*limitsp = nvlist_create(channel_nvlist_flags(chan));
 	return (0);
 }
 #endif
@@ -230,9 +258,9 @@ int	cap_send_nvlist(const cap_channel_t *chan, const n
  * Function receives nvlist over the given capability.
  */
 #ifdef WITH_CASPER
-nvlist_t *cap_recv_nvlist(const cap_channel_t *chan, int flags);
+nvlist_t *cap_recv_nvlist(const cap_channel_t *chan);
 #else
-#define	cap_recv_nvlist(chan, flags)	(nvlist_create(flags))
+#define	cap_recv_nvlist(chan)		(nvlist_create(chan->cch_flags))
 #endif
 
 /*
@@ -240,14 +268,14 @@ nvlist_t *cap_recv_nvlist(const cap_channel_t *chan, i
  * response over the given capability.
  */
 #ifdef WITH_CASPER
-nvlist_t *cap_xfer_nvlist(const cap_channel_t *chan, nvlist_t *nvl, int flags);
+nvlist_t *cap_xfer_nvlist(const cap_channel_t *chan, nvlist_t *nvl);
 #else
 static inline nvlist_t *
-cap_xfer_nvlist(const cap_channel_t *chan __unused, nvlist_t *nvl, int flags)
+cap_xfer_nvlist(const cap_channel_t *chan, nvlist_t *nvl)
 {
 
 	nvlist_destroy(nvl);
-	return (nvlist_create(flags));
+	return (nvlist_create(channel_nvlist_flags(chan)));
 }
 #endif
 

Modified: head/lib/libcasper/libcasper/libcasper_impl.h
==============================================================================
--- head/lib/libcasper/libcasper/libcasper_impl.h	Sat Feb 17 12:07:09 2018	(r329451)
+++ head/lib/libcasper/libcasper/libcasper_impl.h	Sat Feb 17 12:22:29 2018	(r329452)
@@ -54,6 +54,7 @@ void		 service_message(struct service *service,
 		    struct service_connection *sconn);
 void		 service_start(struct service *service, int sock, int procfd);
 const char	*service_name(struct service *service);
+int		 service_get_channel_flags(struct service *service);
 
 /* Private service connection functions. */
 struct service_connection	*service_connection_add(struct service *service,

Modified: head/lib/libcasper/libcasper/libcasper_service.c
==============================================================================
--- head/lib/libcasper/libcasper/libcasper_service.c	Sat Feb 17 12:07:09 2018	(r329451)
+++ head/lib/libcasper/libcasper/libcasper_service.c	Sat Feb 17 12:22:29 2018	(r329452)
@@ -201,6 +201,8 @@ casper_command(const char *cmd, const nvlist_t *limits
 	nvlist_destroy(nvl);
 
 	nvlist_move_descriptor(nvlout, "chanfd", chanfd);
+	nvlist_add_number(nvlout, "chanflags",
+	    service_get_channel_flags(casserv->cs_service));
 
 	return (0);
 }

Modified: head/lib/libcasper/libcasper/libcasper_service.h
==============================================================================
--- head/lib/libcasper/libcasper/libcasper_service.h	Sat Feb 17 12:07:09 2018	(r329451)
+++ head/lib/libcasper/libcasper/libcasper_service.h	Sat Feb 17 12:22:29 2018	(r329452)
@@ -42,8 +42,9 @@ struct nvlist;
 typedef struct nvlist nvlist_t;
 #endif
 
-#define	CASPER_SERVICE_STDIO		0x00000001
-#define	CASPER_SERVICE_FD		0x00000002
+#define	CASPER_SERVICE_STDIO			0x00000001
+#define	CASPER_SERVICE_FD			0x00000002
+#define	CASPER_SERVICE_NO_UNIQ_LIMITS		0x00000004
 
 typedef int service_limit_func_t(const nvlist_t *, const nvlist_t *);
 typedef int service_command_func_t(const char *cmd, const nvlist_t *,

Modified: head/lib/libcasper/libcasper/service.c
==============================================================================
--- head/lib/libcasper/libcasper/service.c	Sat Feb 17 12:07:09 2018	(r329451)
+++ head/lib/libcasper/libcasper/service.c	Sat Feb 17 12:22:29 2018	(r329452)
@@ -136,7 +136,8 @@ service_connection_add(struct service *service, int so
 	sconn = malloc(sizeof(*sconn));
 	if (sconn == NULL)
 		return (NULL);
-	sconn->sc_chan = cap_wrap(sock);
+	sconn->sc_chan = cap_wrap(sock,
+	    service_get_channel_flags(service));
 	if (sconn->sc_chan == NULL) {
 		serrno = errno;
 		free(sconn);
@@ -149,7 +150,7 @@ service_connection_add(struct service *service, int so
 		sconn->sc_limits = nvlist_clone(limits);
 		if (sconn->sc_limits == NULL) {
 			serrno = errno;
-			(void)cap_unwrap(sconn->sc_chan);
+			(void)cap_unwrap(sconn->sc_chan, NULL);
 			free(sconn);
 			errno = serrno;
 			return (NULL);
@@ -266,16 +267,20 @@ service_message(struct service *service, struct servic
 {
 	nvlist_t *nvlin, *nvlout;
 	const char *cmd;
-	int error;
+	int error, flags;
 
-	nvlin = cap_recv_nvlist(service_connection_get_chan(sconn), 0);
+	flags = 0;
+	if ((service->s_flags & CASPER_SERVICE_NO_UNIQ_LIMITS) != 0)
+		flags = NV_FLAG_NO_UNIQUE;
+
+	nvlin = cap_recv_nvlist(service_connection_get_chan(sconn));
 	if (nvlin == NULL) {
 		service_connection_remove(service, sconn);
 		return;
 	}
 
 	error = EDOOFUS;
-	nvlout = nvlist_create(0);
+	nvlout = nvlist_create(flags);
 
 	cmd = nvlist_get_string(nvlin, "cmd");
 	if (strcmp(cmd, "limit_set") == 0) {
@@ -341,6 +346,20 @@ service_name(struct service *service)
 
 	assert(service->s_magic == SERVICE_MAGIC);
 	return (service->s_name);
+}
+
+int
+service_get_channel_flags(struct service *service)
+{
+	int flags;
+
+	assert(service->s_magic == SERVICE_MAGIC);
+	flags = 0;
+
+	if ((service->s_flags & CASPER_SERVICE_NO_UNIQ_LIMITS) != 0)
+		flags |= CASPER_NO_UNIQ;
+
+	return (flags);
 }
 
 static void

Modified: head/lib/libcasper/services/cap_dns/Makefile
==============================================================================
--- head/lib/libcasper/services/cap_dns/Makefile	Sat Feb 17 12:07:09 2018	(r329451)
+++ head/lib/libcasper/services/cap_dns/Makefile	Sat Feb 17 12:22:29 2018	(r329452)
@@ -6,7 +6,7 @@ SHLIBDIR?=	/lib/casper
 
 PACKAGE=libcasper
 
-SHLIB_MAJOR=	0
+SHLIB_MAJOR=	1
 INCSDIR?=	${INCLUDEDIR}/casper
 
 .if ${MK_CASPER} != "no"

Modified: head/lib/libcasper/services/cap_dns/cap_dns.c
==============================================================================
--- head/lib/libcasper/services/cap_dns/cap_dns.c	Sat Feb 17 12:07:09 2018	(r329451)
+++ head/lib/libcasper/services/cap_dns/cap_dns.c	Sat Feb 17 12:22:29 2018	(r329452)
@@ -139,7 +139,7 @@ cap_gethostbyname2(cap_channel_t *chan, const char *na
 	nvlist_add_string(nvl, "cmd", "gethostbyname");
 	nvlist_add_number(nvl, "family", (uint64_t)type);
 	nvlist_add_string(nvl, "name", name);
-	nvl = cap_xfer_nvlist(chan, nvl, 0);
+	nvl = cap_xfer_nvlist(chan, nvl);
 	if (nvl == NULL) {
 		h_errno = NO_RECOVERY;
 		return (NULL);
@@ -166,7 +166,7 @@ cap_gethostbyaddr(cap_channel_t *chan, const void *add
 	nvlist_add_string(nvl, "cmd", "gethostbyaddr");
 	nvlist_add_binary(nvl, "addr", addr, (size_t)len);
 	nvlist_add_number(nvl, "family", (uint64_t)type);
-	nvl = cap_xfer_nvlist(chan, nvl, 0);
+	nvl = cap_xfer_nvlist(chan, nvl);
 	if (nvl == NULL) {
 		h_errno = NO_RECOVERY;
 		return (NULL);
@@ -242,7 +242,7 @@ cap_getaddrinfo(cap_channel_t *chan, const char *hostn
 		nvlist_add_number(nvl, "hints.ai_protocol",
 		    (uint64_t)hints->ai_protocol);
 	}
-	nvl = cap_xfer_nvlist(chan, nvl, 0);
+	nvl = cap_xfer_nvlist(chan, nvl);
 	if (nvl == NULL)
 		return (EAI_MEMORY);
 	if (nvlist_get_number(nvl, "error") != 0) {
@@ -292,7 +292,7 @@ cap_getnameinfo(cap_channel_t *chan, const struct sock
 	nvlist_add_number(nvl, "servlen", (uint64_t)servlen);
 	nvlist_add_binary(nvl, "sa", sa, (size_t)salen);
 	nvlist_add_number(nvl, "flags", (uint64_t)flags);
-	nvl = cap_xfer_nvlist(chan, nvl, 0);
+	nvl = cap_xfer_nvlist(chan, nvl);
 	if (nvl == NULL)
 		return (EAI_MEMORY);
 	if (nvlist_get_number(nvl, "error") != 0) {

Modified: head/lib/libcasper/services/cap_grp/Makefile
==============================================================================
--- head/lib/libcasper/services/cap_grp/Makefile	Sat Feb 17 12:07:09 2018	(r329451)
+++ head/lib/libcasper/services/cap_grp/Makefile	Sat Feb 17 12:22:29 2018	(r329452)
@@ -6,7 +6,7 @@ SHLIBDIR?=	/lib/casper
 
 PACKAGE=libcasper
 
-SHLIB_MAJOR=	0
+SHLIB_MAJOR=	1
 INCSDIR?=	${INCLUDEDIR}/casper
 
 .if ${MK_CASPER} != "no"

Modified: head/lib/libcasper/services/cap_grp/cap_grp.c
==============================================================================
--- head/lib/libcasper/services/cap_grp/cap_grp.c	Sat Feb 17 12:07:09 2018	(r329451)
+++ head/lib/libcasper/services/cap_grp/cap_grp.c	Sat Feb 17 12:22:29 2018	(r329452)
@@ -197,7 +197,7 @@ cap_getgrcommon_r(cap_channel_t *chan, const char *cmd
 	} else {
 		abort();
 	}
-	nvl = cap_xfer_nvlist(chan, nvl, 0);
+	nvl = cap_xfer_nvlist(chan, nvl);
 	if (nvl == NULL) {
 		assert(errno != 0);
 		*result = NULL;
@@ -321,7 +321,7 @@ cap_setgroupent(cap_channel_t *chan, int stayopen)
 	nvl = nvlist_create(0);
 	nvlist_add_string(nvl, "cmd", "setgroupent");
 	nvlist_add_bool(nvl, "stayopen", stayopen != 0);
-	nvl = cap_xfer_nvlist(chan, nvl, 0);
+	nvl = cap_xfer_nvlist(chan, nvl);
 	if (nvl == NULL)
 		return (0);
 	if (nvlist_get_number(nvl, "error") != 0) {
@@ -341,7 +341,7 @@ cap_setgrent(cap_channel_t *chan)
 
 	nvl = nvlist_create(0);
 	nvlist_add_string(nvl, "cmd", "setgrent");
-	nvl = cap_xfer_nvlist(chan, nvl, 0);
+	nvl = cap_xfer_nvlist(chan, nvl);
 	if (nvl == NULL)
 		return (0);
 	if (nvlist_get_number(nvl, "error") != 0) {
@@ -362,7 +362,7 @@ cap_endgrent(cap_channel_t *chan)
 	nvl = nvlist_create(0);
 	nvlist_add_string(nvl, "cmd", "endgrent");
 	/* Ignore any errors, we have no way to report them. */
-	nvlist_destroy(cap_xfer_nvlist(chan, nvl, 0));
+	nvlist_destroy(cap_xfer_nvlist(chan, nvl));
 }
 
 int

Modified: head/lib/libcasper/services/cap_pwd/Makefile
==============================================================================
--- head/lib/libcasper/services/cap_pwd/Makefile	Sat Feb 17 12:07:09 2018	(r329451)
+++ head/lib/libcasper/services/cap_pwd/Makefile	Sat Feb 17 12:22:29 2018	(r329452)
@@ -6,7 +6,7 @@ SHLIBDIR?=	/lib/casper
 
 PACKAGE=libcasper
 
-SHLIB_MAJOR=	0
+SHLIB_MAJOR=	1
 INCSDIR?=	${INCLUDEDIR}/casper
 
 .if ${MK_CASPER} != "no"

Modified: head/lib/libcasper/services/cap_pwd/cap_pwd.c
==============================================================================
--- head/lib/libcasper/services/cap_pwd/cap_pwd.c	Sat Feb 17 12:07:09 2018	(r329451)
+++ head/lib/libcasper/services/cap_pwd/cap_pwd.c	Sat Feb 17 12:22:29 2018	(r329452)
@@ -157,7 +157,7 @@ cap_getpwcommon_r(cap_channel_t *chan, const char *cmd
 	} else {
 		abort();
 	}
-	nvl = cap_xfer_nvlist(chan, nvl, 0);
+	nvl = cap_xfer_nvlist(chan, nvl);
 	if (nvl == NULL) {
 		assert(errno != 0);
 		*result = NULL;
@@ -281,7 +281,7 @@ cap_setpassent(cap_channel_t *chan, int stayopen)
 	nvl = nvlist_create(0);
 	nvlist_add_string(nvl, "cmd", "setpassent");
 	nvlist_add_bool(nvl, "stayopen", stayopen != 0);
-	nvl = cap_xfer_nvlist(chan, nvl, 0);
+	nvl = cap_xfer_nvlist(chan, nvl);
 	if (nvl == NULL)
 		return (0);
 	if (nvlist_get_number(nvl, "error") != 0) {
@@ -302,7 +302,7 @@ cap_set_end_pwent(cap_channel_t *chan, const char *cmd
 	nvl = nvlist_create(0);
 	nvlist_add_string(nvl, "cmd", cmd);
 	/* Ignore any errors, we have no way to report them. */
-	nvlist_destroy(cap_xfer_nvlist(chan, nvl, 0));
+	nvlist_destroy(cap_xfer_nvlist(chan, nvl));
 }
 
 void

Modified: head/lib/libcasper/services/cap_random/Makefile
==============================================================================
--- head/lib/libcasper/services/cap_random/Makefile	Sat Feb 17 12:07:09 2018	(r329451)
+++ head/lib/libcasper/services/cap_random/Makefile	Sat Feb 17 12:22:29 2018	(r329452)
@@ -6,7 +6,7 @@ SHLIBDIR?=	/lib/casper
 
 PACKAGE=libcasper
 
-SHLIB_MAJOR=	0
+SHLIB_MAJOR=	1
 INCSDIR?=	${INCLUDEDIR}/casper
 
 .if ${MK_CASPER} != "no"

Modified: head/lib/libcasper/services/cap_random/cap_random.c
==============================================================================
--- head/lib/libcasper/services/cap_random/cap_random.c	Sat Feb 17 12:07:09 2018	(r329451)
+++ head/lib/libcasper/services/cap_random/cap_random.c	Sat Feb 17 12:22:29 2018	(r329452)
@@ -63,7 +63,7 @@ cap_random_buf(cap_channel_t *chan, void *buf, size_t 
 		nvlist_add_string(nvl, "cmd", "generate");
 		nvlist_add_number(nvl, "size",
 		    (uint64_t)(left > MAXSIZE ? MAXSIZE : left));
-		nvl = cap_xfer_nvlist(chan, nvl, 0);
+		nvl = cap_xfer_nvlist(chan, nvl);
 		if (nvl == NULL)
 			return (-1);
 		if (nvlist_get_number(nvl, "error") != 0) {

Modified: head/lib/libcasper/services/cap_sysctl/Makefile
==============================================================================
--- head/lib/libcasper/services/cap_sysctl/Makefile	Sat Feb 17 12:07:09 2018	(r329451)
+++ head/lib/libcasper/services/cap_sysctl/Makefile	Sat Feb 17 12:22:29 2018	(r329452)
@@ -6,7 +6,7 @@ SHLIBDIR?=	/lib/casper
 
 PACKAGE=libcasper
 
-SHLIB_MAJOR=	0
+SHLIB_MAJOR=	1
 INCSDIR?=	${INCLUDEDIR}/casper
 
 .if ${MK_CASPER} != "no"

Modified: head/lib/libcasper/services/cap_sysctl/cap_sysctl.c
==============================================================================
--- head/lib/libcasper/services/cap_sysctl/cap_sysctl.c	Sat Feb 17 12:07:09 2018	(r329451)
+++ head/lib/libcasper/services/cap_sysctl/cap_sysctl.c	Sat Feb 17 12:22:29 2018	(r329452)
@@ -71,7 +71,7 @@ cap_sysctlbyname(cap_channel_t *chan, const char *name
 		nvlist_add_number(nvl, "oldlen", (uint64_t)*oldlenp);
 	if (newp != NULL)
 		nvlist_add_binary(nvl, "newp", newp, newlen);
-	nvl = cap_xfer_nvlist(chan, nvl, 0);
+	nvl = cap_xfer_nvlist(chan, nvl);
 	if (nvl == NULL)
 		return (-1);
 	if (nvlist_get_number(nvl, "error") != 0) {

Modified: head/lib/libcasper/services/cap_syslog/Makefile
==============================================================================
--- head/lib/libcasper/services/cap_syslog/Makefile	Sat Feb 17 12:07:09 2018	(r329451)
+++ head/lib/libcasper/services/cap_syslog/Makefile	Sat Feb 17 12:22:29 2018	(r329452)
@@ -6,7 +6,7 @@ SHLIBDIR?=	/lib/casper
 
 PACKAGE=libcasper
 
-SHLIB_MAJOR=	0
+SHLIB_MAJOR=	1
 INCSDIR?=	${INCLUDEDIR}/casper
 
 .if ${MK_CASPER} != "no"

Modified: head/lib/libcasper/services/cap_syslog/cap_syslog.c
==============================================================================
--- head/lib/libcasper/services/cap_syslog/cap_syslog.c	Sat Feb 17 12:07:09 2018	(r329451)
+++ head/lib/libcasper/services/cap_syslog/cap_syslog.c	Sat Feb 17 12:22:29 2018	(r329452)
@@ -69,7 +69,7 @@ cap_vsyslog(cap_channel_t *chan, int priority, const c
 	nvlist_add_string(nvl, "cmd", "vsyslog");
 	nvlist_add_number(nvl, "priority", priority);
 	nvlist_add_string(nvl, "message", message);
-	nvl = cap_xfer_nvlist(chan, nvl, 0);
+	nvl = cap_xfer_nvlist(chan, nvl);
 	if (nvl == NULL) {
 		return;
 	}
@@ -88,7 +88,7 @@ cap_openlog(cap_channel_t *chan, const char *ident, in
 	}
 	nvlist_add_number(nvl, "logopt", logopt);
 	nvlist_add_number(nvl, "facility", facility);
-	nvl = cap_xfer_nvlist(chan, nvl, 0);
+	nvl = cap_xfer_nvlist(chan, nvl);
 	if (nvl == NULL) {
 		return;
 	}
@@ -102,7 +102,7 @@ cap_closelog(cap_channel_t *chan)
 
 	nvl = nvlist_create(0);
 	nvlist_add_string(nvl, "cmd", "closelog");
-	nvl = cap_xfer_nvlist(chan, nvl, 0);
+	nvl = cap_xfer_nvlist(chan, nvl);
 	if (nvl == NULL) {
 		return;
 	}
@@ -118,7 +118,7 @@ cap_setlogmask(cap_channel_t *chan, int maskpri)
 	nvl = nvlist_create(0);
 	nvlist_add_string(nvl, "cmd", "setlogmask");
 	nvlist_add_number(nvl, "maskpri", maskpri);
-	nvl = cap_xfer_nvlist(chan, nvl, 0);
+	nvl = cap_xfer_nvlist(chan, nvl);
 	omask = nvlist_get_number(nvl, "omask");
 
 	nvlist_destroy(nvl);



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