svn commit: r303206 - in user/alc/PQ_LAUNDRY: . cddl/contrib/opensolaris/cmd/zdb contrib/binutils/bfd contrib/libcxxrt contrib/llvm/projects/libunwind/include contrib/openresolv crypto/heimdal/lib/...

Mark Johnston markj at FreeBSD.org
Fri Jul 22 23:05:19 UTC 2016


Author: markj
Date: Fri Jul 22 23:05:16 2016
New Revision: 303206
URL: https://svnweb.freebsd.org/changeset/base/303206

Log:
  MFH r303204

Added:
  user/alc/PQ_LAUNDRY/sys/dev/hyperv/utilities/hv_utilreg.h
     - copied unchanged from r303204, head/sys/dev/hyperv/utilities/hv_utilreg.h
  user/alc/PQ_LAUNDRY/sys/dev/hyperv/vmbus/vmbus_chanvar.h
     - copied unchanged from r303204, head/sys/dev/hyperv/vmbus/vmbus_chanvar.h
  user/alc/PQ_LAUNDRY/sys/dev/nvme/nvme_sim.c
     - copied unchanged from r303204, head/sys/dev/nvme/nvme_sim.c
  user/alc/PQ_LAUNDRY/sys/dev/uart/uart_cpu_acpi.h
     - copied unchanged from r303204, head/sys/dev/uart/uart_cpu_acpi.h
Modified:
  user/alc/PQ_LAUNDRY/MAINTAINERS   (contents, props changed)
  user/alc/PQ_LAUNDRY/Makefile.inc1
  user/alc/PQ_LAUNDRY/UPDATING
  user/alc/PQ_LAUNDRY/cddl/contrib/opensolaris/cmd/zdb/zdb.8
  user/alc/PQ_LAUNDRY/cddl/contrib/opensolaris/cmd/zdb/zdb.c
  user/alc/PQ_LAUNDRY/contrib/binutils/bfd/elfxx-mips.c
  user/alc/PQ_LAUNDRY/contrib/libcxxrt/exception.cc
  user/alc/PQ_LAUNDRY/contrib/llvm/projects/libunwind/include/__libunwind_config.h
  user/alc/PQ_LAUNDRY/contrib/llvm/projects/libunwind/include/unwind.h
  user/alc/PQ_LAUNDRY/contrib/openresolv/Makefile
  user/alc/PQ_LAUNDRY/contrib/openresolv/configure
  user/alc/PQ_LAUNDRY/contrib/openresolv/dnsmasq.in
  user/alc/PQ_LAUNDRY/contrib/openresolv/libc.in
  user/alc/PQ_LAUNDRY/contrib/openresolv/named.in
  user/alc/PQ_LAUNDRY/contrib/openresolv/resolvconf.8.in
  user/alc/PQ_LAUNDRY/contrib/openresolv/resolvconf.conf.5.in
  user/alc/PQ_LAUNDRY/contrib/openresolv/resolvconf.in
  user/alc/PQ_LAUNDRY/contrib/openresolv/unbound.in
  user/alc/PQ_LAUNDRY/crypto/heimdal/lib/roken/version-script.map
  user/alc/PQ_LAUNDRY/etc/ntp/leap-seconds
  user/alc/PQ_LAUNDRY/lib/libc/gen/glob.c
  user/alc/PQ_LAUNDRY/lib/libc/sys/aio_fsync.2
  user/alc/PQ_LAUNDRY/lib/libc/sys/aio_mlock.2
  user/alc/PQ_LAUNDRY/lib/libc/sys/aio_read.2
  user/alc/PQ_LAUNDRY/lib/libc/sys/aio_write.2
  user/alc/PQ_LAUNDRY/lib/libc/sys/pipe.2
  user/alc/PQ_LAUNDRY/lib/libmd/Makefile
  user/alc/PQ_LAUNDRY/release/tools/arm.subr
  user/alc/PQ_LAUNDRY/share/man/man4/aio.4
  user/alc/PQ_LAUNDRY/share/man/man4/amdpm.4
  user/alc/PQ_LAUNDRY/share/man/man4/amdsmb.4
  user/alc/PQ_LAUNDRY/share/man/man4/ichsmb.4
  user/alc/PQ_LAUNDRY/share/man/man4/intpm.4
  user/alc/PQ_LAUNDRY/share/man/man4/ismt.4
  user/alc/PQ_LAUNDRY/share/man/man7/arch.7
  user/alc/PQ_LAUNDRY/share/man/man7/build.7
  user/alc/PQ_LAUNDRY/share/misc/committers-src.dot
  user/alc/PQ_LAUNDRY/share/mk/bsd.cpu.mk
  user/alc/PQ_LAUNDRY/share/mk/bsd.sys.mk
  user/alc/PQ_LAUNDRY/sys/arm/allwinner/a10_gpio.c
  user/alc/PQ_LAUNDRY/sys/arm/allwinner/a20/a20_padconf.c
  user/alc/PQ_LAUNDRY/sys/arm/allwinner/aw_nmi.c
  user/alc/PQ_LAUNDRY/sys/arm/allwinner/aw_sid.c
  user/alc/PQ_LAUNDRY/sys/arm/allwinner/aw_sid.h
  user/alc/PQ_LAUNDRY/sys/cam/cam_ccb.h
  user/alc/PQ_LAUNDRY/sys/cam/cam_xpt.c
  user/alc/PQ_LAUNDRY/sys/cam/nvme/nvme_xpt.c
  user/alc/PQ_LAUNDRY/sys/conf/config.mk
  user/alc/PQ_LAUNDRY/sys/conf/files
  user/alc/PQ_LAUNDRY/sys/conf/files.arm64
  user/alc/PQ_LAUNDRY/sys/conf/kern.mk
  user/alc/PQ_LAUNDRY/sys/conf/kern.pre.mk
  user/alc/PQ_LAUNDRY/sys/dev/cxgbe/t4_sge.c
  user/alc/PQ_LAUNDRY/sys/dev/e1000/if_igb.c
  user/alc/PQ_LAUNDRY/sys/dev/e1000/if_lem.c
  user/alc/PQ_LAUNDRY/sys/dev/fb/vesa.c
  user/alc/PQ_LAUNDRY/sys/dev/flash/mx25l.c
  user/alc/PQ_LAUNDRY/sys/dev/hyperv/include/hyperv.h
  user/alc/PQ_LAUNDRY/sys/dev/hyperv/include/vmbus.h
  user/alc/PQ_LAUNDRY/sys/dev/hyperv/netvsc/hv_net_vsc.c
  user/alc/PQ_LAUNDRY/sys/dev/hyperv/netvsc/hv_net_vsc.h
  user/alc/PQ_LAUNDRY/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
  user/alc/PQ_LAUNDRY/sys/dev/hyperv/netvsc/hv_rndis.h
  user/alc/PQ_LAUNDRY/sys/dev/hyperv/netvsc/hv_rndis_filter.c
  user/alc/PQ_LAUNDRY/sys/dev/hyperv/netvsc/hv_rndis_filter.h
  user/alc/PQ_LAUNDRY/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
  user/alc/PQ_LAUNDRY/sys/dev/hyperv/utilities/hv_heartbeat.c
  user/alc/PQ_LAUNDRY/sys/dev/hyperv/utilities/hv_kvp.c
  user/alc/PQ_LAUNDRY/sys/dev/hyperv/utilities/hv_shutdown.c
  user/alc/PQ_LAUNDRY/sys/dev/hyperv/utilities/hv_timesync.c
  user/alc/PQ_LAUNDRY/sys/dev/hyperv/utilities/hv_util.c
  user/alc/PQ_LAUNDRY/sys/dev/hyperv/utilities/hv_util.h
  user/alc/PQ_LAUNDRY/sys/dev/hyperv/vmbus/hv_ring_buffer.c
  user/alc/PQ_LAUNDRY/sys/dev/hyperv/vmbus/hv_vmbus_priv.h
  user/alc/PQ_LAUNDRY/sys/dev/hyperv/vmbus/vmbus.c
  user/alc/PQ_LAUNDRY/sys/dev/hyperv/vmbus/vmbus_chan.c
  user/alc/PQ_LAUNDRY/sys/dev/hyperv/vmbus/vmbus_reg.h
  user/alc/PQ_LAUNDRY/sys/dev/hyperv/vmbus/vmbus_var.h
  user/alc/PQ_LAUNDRY/sys/dev/nvme/nvme_private.h
  user/alc/PQ_LAUNDRY/sys/dev/pty/pty.c
  user/alc/PQ_LAUNDRY/sys/dev/uart/uart_bus_acpi.c
  user/alc/PQ_LAUNDRY/sys/dev/uart/uart_bus_fdt.c
  user/alc/PQ_LAUNDRY/sys/dev/uart/uart_cpu_fdt.c
  user/alc/PQ_LAUNDRY/sys/dev/uart/uart_cpu_fdt.h
  user/alc/PQ_LAUNDRY/sys/dev/uart/uart_dev_pl011.c
  user/alc/PQ_LAUNDRY/sys/dev/urtwn/if_urtwn.c
  user/alc/PQ_LAUNDRY/sys/dev/urtwn/if_urtwnreg.h
  user/alc/PQ_LAUNDRY/sys/kern/imgact_elf.c
  user/alc/PQ_LAUNDRY/sys/kern/kern_timeout.c
  user/alc/PQ_LAUNDRY/sys/kern/subr_prf.c
  user/alc/PQ_LAUNDRY/sys/kern/vfs_aio.c
  user/alc/PQ_LAUNDRY/sys/modules/cam/Makefile
  user/alc/PQ_LAUNDRY/sys/modules/uart/Makefile
  user/alc/PQ_LAUNDRY/sys/netinet/if_ether.c
  user/alc/PQ_LAUNDRY/sys/netinet/sctp_output.c
  user/alc/PQ_LAUNDRY/sys/netinet6/nd6.c
  user/alc/PQ_LAUNDRY/sys/sys/systm.h
  user/alc/PQ_LAUNDRY/sys/ufs/ufs/ufs_lookup.c
  user/alc/PQ_LAUNDRY/sys/ufs/ufs/ufs_vnops.c
  user/alc/PQ_LAUNDRY/sys/vm/uma_core.c
  user/alc/PQ_LAUNDRY/sys/vm/vm_fault.c
  user/alc/PQ_LAUNDRY/usr.bin/Makefile
  user/alc/PQ_LAUNDRY/usr.bin/gcore/elfcore.c
  user/alc/PQ_LAUNDRY/usr.bin/sed/process.c
  user/alc/PQ_LAUNDRY/usr.sbin/camdd/camdd.c
  user/alc/PQ_LAUNDRY/usr.sbin/crashinfo/crashinfo.sh
  user/alc/PQ_LAUNDRY/usr.sbin/ctld/ctl.conf.5
  user/alc/PQ_LAUNDRY/usr.sbin/ctld/ctld.8
  user/alc/PQ_LAUNDRY/usr.sbin/ctld/login.c
Directory Properties:
  user/alc/PQ_LAUNDRY/   (props changed)
  user/alc/PQ_LAUNDRY/cddl/   (props changed)
  user/alc/PQ_LAUNDRY/cddl/contrib/opensolaris/   (props changed)
  user/alc/PQ_LAUNDRY/cddl/contrib/opensolaris/cmd/zdb/   (props changed)
  user/alc/PQ_LAUNDRY/contrib/binutils/   (props changed)
  user/alc/PQ_LAUNDRY/contrib/libcxxrt/   (props changed)
  user/alc/PQ_LAUNDRY/contrib/llvm/   (props changed)
  user/alc/PQ_LAUNDRY/contrib/llvm/projects/libunwind/   (props changed)
  user/alc/PQ_LAUNDRY/contrib/openresolv/   (props changed)
  user/alc/PQ_LAUNDRY/crypto/heimdal/   (props changed)
  user/alc/PQ_LAUNDRY/crypto/openssh/   (props changed)
  user/alc/PQ_LAUNDRY/gnu/usr.bin/binutils/   (props changed)
  user/alc/PQ_LAUNDRY/gnu/usr.bin/gdb/   (props changed)

Modified: user/alc/PQ_LAUNDRY/MAINTAINERS
==============================================================================
--- user/alc/PQ_LAUNDRY/MAINTAINERS	Fri Jul 22 22:46:41 2016	(r303205)
+++ user/alc/PQ_LAUNDRY/MAINTAINERS	Fri Jul 22 23:05:16 2016	(r303206)
@@ -105,3 +105,4 @@ vmm(4)		neel,grehan	Pre-commit review re
 autofs(5)	trasz	Pre-commit review recommended.
 iscsi(4)	trasz	Pre-commit review recommended.
 rctl(8)		trasz	Pre-commit review recommended.
+sys/dev/ofw	nwhitehorn	Pre-commit review recommended.

Modified: user/alc/PQ_LAUNDRY/Makefile.inc1
==============================================================================
--- user/alc/PQ_LAUNDRY/Makefile.inc1	Fri Jul 22 22:46:41 2016	(r303205)
+++ user/alc/PQ_LAUNDRY/Makefile.inc1	Fri Jul 22 23:05:16 2016	(r303206)
@@ -22,6 +22,8 @@
 #	    to be created before files are installed
 #	LOCAL_TOOL_DIRS="list of dirs" to add additional dirs to the build-tools
 #	    list
+#	LOCAL_XTOOL_DIRS="list of dirs" to add additional dirs to the
+#	    cross-tools target
 #	METALOG="path to metadata log" to write permission and ownership
 #	    when NO_ROOT is set.  (default: ${DESTDIR}/METALOG)
 #	TARGET="machine" to crossbuild world for a different machine type
@@ -1815,6 +1817,7 @@ _usb_tools=	sys/boot/usb/tools
 
 cross-tools: .MAKE .PHONY
 .for _tool in \
+    ${LOCAL_XTOOL_DIRS} \
     ${_clang_libs} \
     ${_clang} \
     ${_binutils} \

Modified: user/alc/PQ_LAUNDRY/UPDATING
==============================================================================
--- user/alc/PQ_LAUNDRY/UPDATING	Fri Jul 22 22:46:41 2016	(r303205)
+++ user/alc/PQ_LAUNDRY/UPDATING	Fri Jul 22 23:05:16 2016	(r303206)
@@ -33,11 +33,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12
 
 20160622:
 	The libc stub for the pipe(2) system call has been replaced with
-	a wrapper which calls the pipe2(2) system call and the pipe(2) is now
-	only implemented by the kernels which include "options
-	COMPAT_FREEBSD10" in their config file (this is the default).
-	Users should ensure that this option is enabled in their kernel
-	or upgrade userspace to r302092 before upgrading their kernel.
+	a wrapper that calls the pipe2(2) system call and the pipe(2)
+	system call is now only implemented by the kernels that include
+	"options COMPAT_FREEBSD10" in their config file (this is the
+	default).  Users should ensure that this option is enabled in
+	their kernel or upgrade userspace to r302092 before upgrading their
+	kernel.
 
 20160527:
 	CAM will now strip leading spaces from SCSI disks' serial numbers.

Modified: user/alc/PQ_LAUNDRY/cddl/contrib/opensolaris/cmd/zdb/zdb.8
==============================================================================
--- user/alc/PQ_LAUNDRY/cddl/contrib/opensolaris/cmd/zdb/zdb.8	Fri Jul 22 22:46:41 2016	(r303205)
+++ user/alc/PQ_LAUNDRY/cddl/contrib/opensolaris/cmd/zdb/zdb.8	Fri Jul 22 23:05:16 2016	(r303206)
@@ -86,6 +86,17 @@ pool, and is inherently unstable.
 The precise output of most invocations is not documented, a knowledge of ZFS
 internals is assumed.
 .Pp
+If the
+.Ar dataset
+argument does not contain any
+.Sy /
+or
+.Sy @
+characters, it is interpreted as a pool name.
+The root dataset can be specified as
+.Pa pool Ns Sy /
+(pool name followed by a slash).
+.Pp
 When operating on an imported and active pool it is possible, though unlikely,
 that zdb may interpret inconsistent pool data and behave erratically.
 .Sh OPTIONS

Modified: user/alc/PQ_LAUNDRY/cddl/contrib/opensolaris/cmd/zdb/zdb.c
==============================================================================
--- user/alc/PQ_LAUNDRY/cddl/contrib/opensolaris/cmd/zdb/zdb.c	Fri Jul 22 22:46:41 2016	(r303205)
+++ user/alc/PQ_LAUNDRY/cddl/contrib/opensolaris/cmd/zdb/zdb.c	Fri Jul 22 23:05:16 2016	(r303206)
@@ -3558,12 +3558,23 @@ main(int argc, char **argv)
 	nvlist_t *policy = NULL;
 	uint64_t max_txg = UINT64_MAX;
 	int rewind = ZPOOL_NEVER_REWIND;
+	char *spa_config_path_env;
+	boolean_t target_is_spa = B_TRUE;
 
 	(void) setrlimit(RLIMIT_NOFILE, &rl);
 	(void) enable_extended_FILE_stdio(-1, -1);
 
 	dprintf_setup(&argc, argv);
 
+	/*
+	 * If there is an environment variable SPA_CONFIG_PATH it overrides
+	 * default spa_config_path setting. If -U flag is specified it will
+	 * override this environment variable settings once again.
+	 */
+	spa_config_path_env = getenv("SPA_CONFIG_PATH");
+	if (spa_config_path_env != NULL)
+		spa_config_path = spa_config_path_env;
+
 	while ((c = getopt(argc, argv,
 	    "bcdhilmMI:suCDRSAFLXx:evp:t:U:P")) != -1) {
 		switch (c) {
@@ -3728,8 +3739,23 @@ main(int argc, char **argv)
 		}
 	}
 
+	if (strpbrk(target, "/@") != NULL) {
+		size_t targetlen;
+
+		target_is_spa = B_FALSE;
+		/*
+		 * Remove any trailing slash.  Later code would get confused
+		 * by it, but we want to allow it so that "pool/" can
+		 * indicate that we want to dump the topmost filesystem,
+		 * rather than the whole pool.
+		 */
+		targetlen = strlen(target);
+		if (targetlen != 0 && target[targetlen - 1] == '/')
+			target[targetlen - 1] = '\0';
+	}
+
 	if (error == 0) {
-		if (strpbrk(target, "/@") == NULL || dump_opt['R']) {
+		if (target_is_spa || dump_opt['R']) {
 			error = spa_open_rewind(target, &spa, FTAG, policy,
 			    NULL);
 			if (error) {

Modified: user/alc/PQ_LAUNDRY/contrib/binutils/bfd/elfxx-mips.c
==============================================================================
--- user/alc/PQ_LAUNDRY/contrib/binutils/bfd/elfxx-mips.c	Fri Jul 22 22:46:41 2016	(r303205)
+++ user/alc/PQ_LAUNDRY/contrib/binutils/bfd/elfxx-mips.c	Fri Jul 22 23:05:16 2016	(r303206)
@@ -4801,7 +4801,7 @@ mips_elf_create_dynamic_relocation (bfd 
   /* We must now calculate the dynamic symbol table index to use
      in the relocation.  */
   if (h != NULL
-      && (!h->root.def_regular
+      && (sec == NULL || !h->root.def_regular
 	  || (info->shared && !info->symbolic && !h->root.forced_local)))
     {
       indx = h->root.dynindx;

Modified: user/alc/PQ_LAUNDRY/contrib/libcxxrt/exception.cc
==============================================================================
--- user/alc/PQ_LAUNDRY/contrib/libcxxrt/exception.cc	Fri Jul 22 22:46:41 2016	(r303205)
+++ user/alc/PQ_LAUNDRY/contrib/libcxxrt/exception.cc	Fri Jul 22 23:05:16 2016	(r303206)
@@ -572,6 +572,19 @@ static void free_exception(char *e)
 	}
 }
 
+#ifdef __LP64__
+/**
+ * There's an ABI bug in __cxa_exception: unwindHeader requires 16-byte
+ * alignment but it was broken by the addition of the referenceCount.
+ * The unwindHeader is at offset 0x58 in __cxa_exception.  In order to keep
+ * compatibility with consumers of the broken __cxa_exception, explicitly add
+ * padding on allocation (and account for it on free).
+ */
+static const int exception_alignment_padding = 8;
+#else
+static const int exception_alignment_padding = 0;
+#endif
+
 /**
  * Allocates an exception structure.  Returns a pointer to the space that can
  * be used to store an object of thrown_size bytes.  This function will use an
@@ -580,16 +593,19 @@ static void free_exception(char *e)
  */
 extern "C" void *__cxa_allocate_exception(size_t thrown_size)
 {
-	size_t size = thrown_size + sizeof(__cxa_exception);
+	size_t size = exception_alignment_padding + sizeof(__cxa_exception) +
+	    thrown_size;
 	char *buffer = alloc_or_die(size);
-	return buffer+sizeof(__cxa_exception);
+	return buffer + exception_alignment_padding + sizeof(__cxa_exception);
 }
 
 extern "C" void *__cxa_allocate_dependent_exception(void)
 {
-	size_t size = sizeof(__cxa_dependent_exception);
+	size_t size = exception_alignment_padding +
+	    sizeof(__cxa_dependent_exception);
 	char *buffer = alloc_or_die(size);
-	return buffer+sizeof(__cxa_dependent_exception);
+	return buffer + exception_alignment_padding +
+	    sizeof(__cxa_dependent_exception);
 }
 
 /**
@@ -617,7 +633,8 @@ extern "C" void __cxa_free_exception(voi
 		}
 	}
 
-	free_exception(reinterpret_cast<char*>(ex));
+	free_exception(reinterpret_cast<char*>(ex) -
+	    exception_alignment_padding);
 }
 
 static void releaseException(__cxa_exception *exception)
@@ -644,7 +661,8 @@ void __cxa_free_dependent_exception(void
 	{
 		releaseException(realExceptionFromException(reinterpret_cast<__cxa_exception*>(ex)));
 	}
-	free_exception(reinterpret_cast<char*>(ex));
+	free_exception(reinterpret_cast<char*>(ex) -
+	    exception_alignment_padding);
 }
 
 /**

Modified: user/alc/PQ_LAUNDRY/contrib/llvm/projects/libunwind/include/__libunwind_config.h
==============================================================================
--- user/alc/PQ_LAUNDRY/contrib/llvm/projects/libunwind/include/__libunwind_config.h	Fri Jul 22 22:46:41 2016	(r303205)
+++ user/alc/PQ_LAUNDRY/contrib/llvm/projects/libunwind/include/__libunwind_config.h	Fri Jul 22 23:05:16 2016	(r303206)
@@ -50,8 +50,8 @@
 #  define _LIBUNWIND_MAX_REGISTER 32
 # elif defined(__riscv__)
 #  define _LIBUNWIND_TARGET_RISCV 1
-#  define _LIBUNWIND_CONTEXT_SIZE 128 /* XXX */
-#  define _LIBUNWIND_CURSOR_SIZE 140 /* XXX */
+#  define _LIBUNWIND_CONTEXT_SIZE 64
+#  define _LIBUNWIND_CURSOR_SIZE 76
 #  define _LIBUNWIND_MAX_REGISTER 96
 # else
 #  error "Unsupported architecture."

Modified: user/alc/PQ_LAUNDRY/contrib/llvm/projects/libunwind/include/unwind.h
==============================================================================
--- user/alc/PQ_LAUNDRY/contrib/llvm/projects/libunwind/include/unwind.h	Fri Jul 22 22:46:41 2016	(r303205)
+++ user/alc/PQ_LAUNDRY/contrib/llvm/projects/libunwind/include/unwind.h	Fri Jul 22 23:05:16 2016	(r303206)
@@ -128,7 +128,7 @@ struct _Unwind_Exception {
   // added for binary compatibility.
   uint32_t reserved[3];
 #endif
-};
+} __attribute__((__aligned__));
 
 typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn)
     (int version,

Modified: user/alc/PQ_LAUNDRY/contrib/openresolv/Makefile
==============================================================================
--- user/alc/PQ_LAUNDRY/contrib/openresolv/Makefile	Fri Jul 22 22:46:41 2016	(r303205)
+++ user/alc/PQ_LAUNDRY/contrib/openresolv/Makefile	Fri Jul 22 23:05:16 2016	(r303206)
@@ -1,5 +1,4 @@
 PKG=		openresolv
-VERSION=	3.7.3
 
 # Nasty hack so that make clean works without configure being run
 _CONFIG_MK!=	test -e config.mk && echo config.mk || echo config-null.mk
@@ -10,14 +9,12 @@ SBINDIR?=	/sbin
 SYSCONFDIR?=	/etc
 LIBEXECDIR?=	/libexec/resolvconf
 VARDIR?=	/var/run/resolvconf
-RCDIR?=		/etc/rc.d
-RESTARTCMD?=	if ${RCDIR}/\1 status >/dev/null 2>\&1; then \
-			${RCDIR}/\1 restart; \
-		fi
 
 INSTALL?=	install
 SED?=		sed
 
+VERSION!=	${SED} -n 's/OPENRESOLV_VERSION="\(.*\)".*/\1/p' resolvconf.in
+
 BINMODE?=	0755
 DOCMODE?=	0644
 MANMODE?=	0444
@@ -33,7 +30,9 @@ SED_SYSCONFDIR=		-e 's:@SYSCONFDIR@:${SY
 SED_LIBEXECDIR=		-e 's:@LIBEXECDIR@:${LIBEXECDIR}:g'
 SED_VARDIR=		-e 's:@VARDIR@:${VARDIR}:g'
 SED_RCDIR=		-e 's:@RCDIR@:${RCDIR}:g'
-SED_RESTARTCMD=		-e 's:@RESTARTCMD \(.*\)@:${RESTARTCMD}:g'
+SED_RESTARTCMD=		-e 's:@RESTARTCMD@:${RESTARTCMD}:g'
+SED_RCDIR=		-e 's:@RCDIR@:${RCDIR}:g'
+SED_STATUSARG=		-e 's:@STATUSARG@:${STATUSARG}:g'
 
 DISTPREFIX?=	${PKG}-${VERSION}
 DISTFILEGZ?=	${DISTPREFIX}.tar.gz
@@ -44,9 +43,10 @@ FOSSILID?=	current
 
 all: ${TARGET}
 
-.in:
+.in: Makefile ${CONFIG_MK}
 	${SED}	${SED_SBINDIR} ${SED_SYSCONFDIR} ${SED_LIBEXECDIR} \
-		${SED_VARDIR} ${SED_RCDIR} ${SED_RESTARTCMD} \
+		${SED_VARDIR} \
+		${SED_RCDIR} ${SED_RESTARTCMD} ${SED_RCDIR} ${SED_STATUSARG} \
 		$< > $@
 
 clean:

Modified: user/alc/PQ_LAUNDRY/contrib/openresolv/configure
==============================================================================
--- user/alc/PQ_LAUNDRY/contrib/openresolv/configure	Fri Jul 22 22:46:41 2016	(r303205)
+++ user/alc/PQ_LAUNDRY/contrib/openresolv/configure	Fri Jul 22 23:05:16 2016	(r303206)
@@ -8,6 +8,7 @@ HOST=
 TARGET=
 RESTARTCMD=
 RCDIR=
+STATUSARG=
 
 for x do
 	opt=${x%%=*}
@@ -33,6 +34,8 @@ for x do
 	--target) TARGET=$var;;
 	--libdir) LIBDIR=$var;;
 	--restartcmd) RESTARTCMD=$var;;
+	--rcdir) RCDIR=$var;;
+	--statusarg) STATUSARG=$var;;
 	--includedir) eval INCLUDEDIR="$INCLUDEDIR${INCLUDEDIR:+ }$var";;
 	--datadir|--infodir) ;; # ignore autotools
 	--disable-maintainer-mode|--disable-dependency-tracking) ;;
@@ -117,7 +120,17 @@ echo "Configuring openresolv for ... $OS
 rm -rf $CONFIG_MK
 echo "# $OS" >$CONFIG_MK
 
-for x in SYSCONFDIR SBINDIR LIBEXECDIR VARDIR MANDIR; do
+# On FreeBSD, /etc/init.d/foo status returns 0 if foo is not enabled
+# regardless of if it's not running.
+# So we force onestatus to work around this silly bug.
+if [ -z "$STATUSARG" ]; then
+	case "$OS" in
+	freebsd*)	STATUSARG="onestatus";;
+	esac
+fi
+
+for x in SYSCONFDIR SBINDIR LIBEXECDIR VARDIR MANDIR RESTARTCMD RCDIR STATUSARG
+do
 	eval v=\$$x
 	# Make files look nice for import
 	l=$((10 - ${#x}))
@@ -126,96 +139,6 @@ for x in SYSCONFDIR SBINDIR LIBEXECDIR V
 	echo "$x=$t	$v" >>$CONFIG_MK
 done
 
-if [ -z "$RESTARTCMD" ]; then
-	printf "Checking for systemd ... "
-	if [ -x /bin/systemctl ]; then
-		RESTARTCMD="/bin/systemctl try-restart \1"
-		echo "yes"
-	elif [ -x /usr/bin/systemctl ]; then
-		RESTARTCMD="/usr/bin/systemctl try-restart \1"
-		echo "yes"
-	else
-		echo "no"
-	fi
-fi
-
-# Arch upgraded to systemd, so this check has to be just after systemd
-# but higher than the others
-if [ -z "$RESTARTCMD" ]; then
-	printf "Checking for Arch ... "
-	if [ -e /etc/arch-release -a -d /etc/rc.d ]; then
-		RCDIR=/etc/rc.d
-		RESTARTCMD="[ -e /var/run/daemons/\1 ] \&\& /etc/rc.d/\1 restart"
-		echo "yes"
-	else
-		echo "no"
-	fi
-fi
-
-if [ -z "$RESTARTCMD" ]; then
-	printf "Checking for OpenRC ... "
-	if [ -x /sbin/rc-service ]; then
-		RESTARTCMD="if /sbin/rc-service -e \1; then /sbin/rc-service \1 -- -Ds restart; fi"
-		echo "yes"
-	else
-		echo "no"
-	fi
-fi
-if [ -z "$RESTARTCMD" ]; then
-	printf "Checking for invoke-rc.d ... "
-	if [ -x /usr/sbin/invoke-rc.d ]; then
-		RCDIR=/etc/init.d
-		RESTARTCMD="if /usr/sbin/invoke-rc.d --quiet \1 status >/dev/null 2>\&1; then /usr/sbin/invoke-rc.d \1 restart; fi"
-		echo "yes"
-	else
-		echo "no"
-	fi
-fi
-if [ -z "$RESTARTCMD" ]; then
-	printf "Checking for service ... "
-	if [ -x /sbin/service ]; then
-		RCDIR=/etc/init.d
-		RESTARTCMD="if /sbin/service \1; then /sbin/service \1 restart; fi"
-		echo "yes"
-	else
-		echo "no"
-	fi
-fi
-if [ -z "$RESTARTCMD" ]; then
-	printf "Checking for runit... "
-	if [ -x /bin/sv ]; then
-		RESTARTCMD="/bin/sv try-restart \1"
-		echo "yes"
-	elif [ -x /usr/bin/sv ]; then
-		RESTARTCMD="/usr/bin/sv try-restart \1"
-		echo "yes"
-	else
-		echo "no"
-	fi
-fi
-if [ -z "$RESTARTCMD" ]; then
-	for x in /etc/init.d/rc.d /etc/rc.d /etc/init.d; do
-		printf "Checking for $x ... "
-		if [ -d $x ]; then
-			RCDIR=$x
-			RESTARTCMD="if $x/\1 status >/dev/null 2>\&1; then $x/\1 restart; fi"
-			echo "yes"
-			break
-		else
-			echo "no"
-		fi
-	done
-fi
-
-if [ -z "$RESTARTCMD" ]; then
-	echo "$0: WARNING: No means of interacting with system services detected!"
-	exit 1
-fi
-
-echo "RCDIR=		$RCDIR" >>$CONFIG_MK
-# Work around bug in the dash shell as "echo 'foo \1'" does bad things
-printf "%s\n" "RESTARTCMD=	$RESTARTCMD" >>$CONFIG_MK
-
 echo
 echo "   SYSCONFDIR =		$SYSCONFDIR"
 echo "   SBINDIR =		$SBINDIR"
@@ -223,3 +146,7 @@ echo "   LIBEXECDIR =		$LIBEXECDIR"
 echo "   VARDIR =		$RUNDIR"
 echo "   MANDIR =		$MANDIR"
 echo
+echo "   RESTARTCMD =		$RESTARTCMD"
+echo "   RCDIR =		$RCDIR"
+echo "   STATUSARG =		$STATUSARG"
+echo

Modified: user/alc/PQ_LAUNDRY/contrib/openresolv/dnsmasq.in
==============================================================================
--- user/alc/PQ_LAUNDRY/contrib/openresolv/dnsmasq.in	Fri Jul 22 22:46:41 2016	(r303205)
+++ user/alc/PQ_LAUNDRY/contrib/openresolv/dnsmasq.in	Fri Jul 22 23:05:16 2016	(r303206)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (c) 2007-2012 Roy Marples
+# Copyright (c) 2007-2016 Roy Marples
 # All rights reserved
 
 # dnsmasq subscriber for resolvconf
@@ -37,7 +37,6 @@ NL="
 [ -s "$dnsmasq_pid" ] || dnsmasq_pid=/var/run/dnsmasq/dnsmasq.pid
 [ -s "$dnsmasq_pid" ] || unset dnsmasq_pid
 : ${dnsmasq_service:=dnsmasq}
-: ${dnsmasq_restart:=@RESTARTCMD ${dnsmasq_service}@}
 newconf="# Generated by resolvconf$NL"
 newresolv="$newconf"
 
@@ -180,7 +179,15 @@ if [ -n "$dnsmasq_resolv" ]; then
 fi
 
 if $changed; then
-	eval $dnsmasq_restart
+	# dnsmasq does not re-read the configuration file on SIGHUP
+	if [ -n "$dnsmasq_restart" ]; then
+		eval $dnsmasq_restart
+	elif [ -n "$RESTARTCMD" ]; then
+		set -- ${dnsmasq_service}
+		eval $RESTARTCMD
+	else
+		@SBINDIR@/resolvconf -r ${dnsmasq_service}
+	fi
 fi
 if $dbus; then
 	if [ -s "$dnsmasq_pid" ]; then

Modified: user/alc/PQ_LAUNDRY/contrib/openresolv/libc.in
==============================================================================
--- user/alc/PQ_LAUNDRY/contrib/openresolv/libc.in	Fri Jul 22 22:46:41 2016	(r303205)
+++ user/alc/PQ_LAUNDRY/contrib/openresolv/libc.in	Fri Jul 22 23:05:16 2016	(r303206)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (c) 2007-2014 Roy Marples
+# Copyright (c) 2007-2016 Roy Marples
 # All rights reserved
 
 # libc subscriber for resolvconf
@@ -97,7 +97,6 @@ elif [ -d "$SYSCONFDIR"/resolvconf ]; th
 fi
 : ${resolv_conf:=/etc/resolv.conf}
 : ${libc_service:=nscd}
-: ${libc_restart:=@RESTARTCMD ${libc_service}@}
 : ${list_resolv:=@SBINDIR@/resolvconf -l}
 if [ "${resolv_conf_head-x}" = x -a -f "$SYSCONFDIR"/resolv.conf.head ]; then
 	resolv_conf_head="$(cat "${SYSCONFDIR}"/resolv.conf.head)"
@@ -229,7 +228,14 @@ fi
 
 # Create our resolv.conf now
 (umask 022; echo "$newconf" >"$resolv_conf")
-eval $libc_restart
+if [ -n "$libc_restart" ]; then
+	eval $libc_restart
+elif [ -n "$RESTARTCMD" ]; then
+	set -- ${libc_service}
+	eval $RESTARTCMD
+else
+	@SBINDIR@/resolvconf -r ${libc_service}
+fi
 
 retval=0
 # Notify users of the resolver

Modified: user/alc/PQ_LAUNDRY/contrib/openresolv/named.in
==============================================================================
--- user/alc/PQ_LAUNDRY/contrib/openresolv/named.in	Fri Jul 22 22:46:41 2016	(r303205)
+++ user/alc/PQ_LAUNDRY/contrib/openresolv/named.in	Fri Jul 22 23:05:16 2016	(r303206)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (c) 2007-2012 Roy Marples
+# Copyright (c) 2007-2016 Roy Marples
 # All rights reserved
 
 # named subscriber for resolvconf
@@ -35,18 +35,22 @@ NL="
 
 # Platform specific kludges
 if [ -z "$named_service" -a -z "$named_restart" -a \
-	-d "@RCDIR@" -a ! -x "@RCDIR@"/named ]
+	-d "$RCDIR" -a ! -x "$RCDIR"/named ]
 then
-	if [ -x "@RCDIR@"/bind9 ]; then
+	if [ -x "$RCDIR"/bind9 ]; then
 		# Debian and derivatives
 		named_service=bind9
-	elif [ -x "@RCDIR@"/rc.bind ]; then
+	elif [ -x "$RCDIR"/rc.bind ]; then
 		# Slackware
 		named_service=rc.bind
 	fi
 fi
 : ${named_service:=named}
-: ${named_restart:=@RESTARTCMD ${named_service}@}
+
+: ${named_pid:=/var/run/$named_service.pid}
+[ -s "$named_pid" ] || named_pid=/var/run/$named_service/$named_service.pid
+[ -s "$named_pid" ] || unset named_pid
+
 newoptions="# Generated by resolvconf$NL"
 newzones="$newoptions"
 
@@ -101,6 +105,14 @@ if [ -n "$named_zones" ]; then
 	fi
 fi
 
+# named does not seem to work with SIGHUP which is a same
 if $changed; then
-	eval $named_restart
+	if [ -n "$named_restart" ]; then
+		eval $named_restart
+	elif [ -n "$RESTARTCMD" ]; then
+		set -- ${named_service}
+		eval $RESTARTCMD
+	else
+		@SBINDIR@/resolvconf -r ${named_service}
+	fi
 fi

Modified: user/alc/PQ_LAUNDRY/contrib/openresolv/resolvconf.8.in
==============================================================================
--- user/alc/PQ_LAUNDRY/contrib/openresolv/resolvconf.8.in	Fri Jul 22 22:46:41 2016	(r303205)
+++ user/alc/PQ_LAUNDRY/contrib/openresolv/resolvconf.8.in	Fri Jul 22 23:05:16 2016	(r303206)
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2007-2015 Roy Marples
+.\" Copyright (c) 2007-2016 Roy Marples
 .\" All rights reserved
 .\"
 .\" Redistribution and use in source and binary forms, with or without
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd April 27, 2015
+.Dd May 7, 2016
 .Dt RESOLVCONF 8
 .Os
 .Sh NAME
@@ -64,7 +64,7 @@ solves this by letting the daemon send t
 file to
 .Nm
 via
-.Xr stdin 3
+.Xr stdin 4
 with the argument
 .Fl a Ar interface Ns Op Ar .protocol
 instead of the filesystem.
@@ -101,7 +101,7 @@ as private.
 This means that the name servers listed in that
 .Pa resolv.conf
 are only used for queries against the domain/search listed in the same file.
-This only works when a local resolver other than libc is installed. 
+This only works when a local resolver other than libc is installed.
 See
 .Xr resolvconf.conf 5
 for how to configure
@@ -125,24 +125,28 @@ file(s) for all the
 on the
 .Ar interface .
 .Pp
-Here are some more options that
-.Nm
-has:-
+Here are some options for the above commands:-
 .Bl -tag -width indent
-.It Fl I
-Initialise the state directory
-.Pa @VARDIR@ .
-This only needs to be called if the initial system boot sequence does not
-automatically clean it out; for example the state directory is moved
-somewhere other than
-.Pa /var/run .
-If used, it should only be called once as early in the system boot sequence
-as possible and before
-.Nm
-is used to add interfaces.
 .It Fl f
-Ignore non existant interfaces.
+Ignore non existent interfaces.
 Only really useful for deleting interfaces.
+.It Fl m Ar metric
+Set the metric of the interface when adding it, default of 0.
+Lower metrics take precedence.
+This affects the default order of interfaces when listed.
+.It Fl p
+Marks the interface
+.Pa resolv.conf
+as private.
+.It Fl x
+Mark the interface
+.Pa resolv.conf
+as exclusive when adding, otherwise only use the latest exclusive interface.
+.El
+.Pp
+.Nm
+has some more commands for general usage:-
+.Bl -tag -width indent
 .It Fl i Ar pattern
 List the interfaces and protocols, optionally matching
 .Ar pattern ,
@@ -157,14 +161,6 @@ If
 .Ar pattern
 is specified then we list the files for the interfaces and protocols
 that match it.
-.It Fl m Ar metric
-Set the metric of the interface when adding it, default of 0.
-Lower metrics take precedence.
-This affects the default order of interfaces when listed.
-.It Fl p
-Marks the interface
-.Pa resolv.conf
-as private.
 .It Fl u
 Force
 .Nm
@@ -172,15 +168,31 @@ to update all its subscribers.
 .Nm
 does not update the subscribers when adding a resolv.conf that matches
 what it already has for that interface.
-.It Fl x
-Mark the interface
-.Pa resolv.conf
-as exclusive when adding, otherwise only use the latest exclusive interface.
 .El
 .Pp
 .Nm
-also has some options designed to be used by its subscribers:-
+also has some commands designed to be used by it's subscribers and
+system startup:-
 .Bl -tag -width indent
+.It Fl I
+Initialise the state directory
+.Pa @VARDIR@ .
+This only needs to be called if the initial system boot sequence does not
+automatically clean it out; for example the state directory is moved
+somewhere other than
+.Pa /var/run .
+If used, it should only be called once as early in the system boot sequence
+as possible and before
+.Nm
+is used to add interfaces.
+.It Fl R
+Echo the command used to restart a service.
+.It Fl r Ar service
+If the
+.Ar service
+is running then restart it.
+If the service does not exist or is not running then zero is returned,
+otherwise the result of restarting the service.
 .It Fl v
 Echo variables DOMAINS, SEARCH and NAMESERVERS so that the subscriber can
 configure the resolver easily.
@@ -278,16 +290,16 @@ Directory of subscribers which are run a
 State directory for
 .Nm .
 .El
+.Sh SEE ALSO
+.Xr resolver 3 ,
+.Xr stdin 4 ,
+.Xr resolv.conf 5 ,
+.Xr resolvconf.conf 5
 .Sh HISTORY
 This implementation of
 .Nm
 is called openresolv and is fully command line compatible with Debian's
 resolvconf, as written by Thomas Hood.
-.Sh SEE ALSO
-.Xr resolv.conf 5 ,
-.Xr resolvconf.conf 5 ,
-.Xr resolver 3 ,
-.Xr stdin 3
 .Sh AUTHORS
 .An Roy Marples Aq Mt roy at marples.name
 .Sh BUGS

Modified: user/alc/PQ_LAUNDRY/contrib/openresolv/resolvconf.conf.5.in
==============================================================================
--- user/alc/PQ_LAUNDRY/contrib/openresolv/resolvconf.conf.5.in	Fri Jul 22 22:46:41 2016	(r303205)
+++ user/alc/PQ_LAUNDRY/contrib/openresolv/resolvconf.conf.5.in	Fri Jul 22 23:05:16 2016	(r303206)
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd February 21, 2016
+.Dd April 28, 2016
 .Dt RESOLVCONF.CONF 5
 .Os
 .Sh NAME
@@ -103,7 +103,8 @@ This is equivalent to the
 .Nm resolvconf -p
 option.
 .It Sy replace
-Is a space separated list of replacement keywords. The syntax is this:
+Is a space separated list of replacement keywords.
+The syntax is this:
 .Va $keyword Ns / Ns Va $match Ns / Ns Va $replacement
 .Pp
 Example, given this resolv.conf:
@@ -284,33 +285,32 @@ variables, documented below.
 .Pp
 .Bl -tag -width indent
 .It Sy dnsmasq_service
-Location of the dnsmasq service.
+Name of the dnsmasq service.
 .It Sy dnsmasq_restart
 Command to restart the dnsmasq service.
 .It Sy dnsmasq_pid
 Location of the dnsmasq pidfile.
 .It Sy libc_service
-Location of the libc service.
+Name of the libc service.
 .It Sy libc_restart
 Command to restart the libc service.
 .It Sy named_service
-Location of the named service.
+Name of the named service.
 .It Sy named_restart
 Command to restart the named service.
 .It Sy pdnsd_restart
 Command to restart the pdnsd service.
 .It Sy unbound_service
-Location of the unbound service.
+Name of the unbound service.
 .It Sy unbound_restart
 Command to restart the unbound service.
 .It Sy unbound_pid
 Location of the unbound pidfile.
 .El
 .Sh SEE ALSO
+.Xr sh 1 ,
 .Xr resolv.conf 5 ,
 .Xr resolvconf 8
-and
-.Xr sh 1 .
 .Sh AUTHORS
 .An Roy Marples Aq Mt roy at marples.name
 .Sh BUGS

Modified: user/alc/PQ_LAUNDRY/contrib/openresolv/resolvconf.in
==============================================================================
--- user/alc/PQ_LAUNDRY/contrib/openresolv/resolvconf.in	Fri Jul 22 22:46:41 2016	(r303205)
+++ user/alc/PQ_LAUNDRY/contrib/openresolv/resolvconf.in	Fri Jul 22 23:05:16 2016	(r303206)
@@ -25,9 +25,12 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 RESOLVCONF="$0"
+OPENRESOLV_VERSION="3.8.1"
 SYSCONFDIR=@SYSCONFDIR@
 LIBEXECDIR=@LIBEXECDIR@
 VARDIR=@VARDIR@
+RCDIR=@RCDIR@
+RESTARTCMD=@RESTARTCMD@
 
 # Disregard dhcpcd setting
 unset interface_order state_dir
@@ -71,55 +74,45 @@ error_exit()
 usage()
 {
 	cat <<-EOF
-	Usage: ${RESOLVCONF##*/} [options]
+	Usage: ${RESOLVCONF##*/} [options] command [argument]
 
 	Inform the system about any DNS updates.
 
-	Options:
+	Commands:
 	  -a \$INTERFACE    Add DNS information to the specified interface
 	                   (DNS supplied via stdin in resolv.conf format)
-	  -m metric        Give the added DNS information a metric
-	  -p               Mark the interface as private
-	  -x               Mark the interface as exclusive
 	  -d \$INTERFACE    Delete DNS information from the specified interface
-	  -f               Ignore non existant interfaces
-	  -I               Init the state dir
-	  -u               Run updates from our current DNS information
-	  -l [\$PATTERN]    Show DNS information, optionally from interfaces
-	                   that match the specified pattern
+	  -h               Show this help cruft
 	  -i [\$PATTERN]    Show interfaces that have supplied DNS information
                    optionally from interfaces that match the specified
                    pattern
+	  -l [\$PATTERN]    Show DNS information, optionally from interfaces
+	                   that match the specified pattern
+
+	  -u               Run updates from our current DNS information
+
+	Options:
+	  -f               Ignore non existent interfaces
+	  -m metric        Give the added DNS information a metric
+	  -p               Mark the interface as private
+	  -x               Mark the interface as exclusive
+
+	Subscriber and System Init Commands:
+	  -I               Init the state dir
+	  -r \$SERVICE      Restart the system service
+	                   (restarting a non-existent or non-running service
+	                    should have no output and return 0)
+	  -R               Show the system service restart command
 	  -v [\$PATTERN]    echo NEWDOMAIN, NEWSEARCH and NEWNS variables to
 	  		   the console
-	  -h               Show this help cruft
+	  -V [\$PATTERN]    Same as -v, but only uses configuration in
+	                   $SYSCONFDIR/resolvconf.conf
 	EOF
 	[ -z "$1" ] && exit 0
 	echo
 	error_exit "$*"
 }
 
-echo_resolv()
-{
-	local line= OIFS="$IFS"
-
-	[ -n "$1" -a -f "$IFACEDIR/$1" ] || return 1
-	echo "# resolv.conf from $1"
-	# Our variable maker works of the fact each resolv.conf per interface
-	# is separated by blank lines.
-	# So we remove them when echoing them.
-	while read -r line; do
-		IFS="$OIFS"
-		if [ -n "$line" ]; then
-			# We need to set IFS here to preserve any whitespace
-			IFS=''
-			printf "%s\n" "$line"
-		fi
-	done < "$IFACEDIR/$1"
-	echo
-	IFS="$OIFS"
-}
-
 # Strip any trailing dot from each name as a FQDN does not belong
 # in resolv.conf(5)
 # If you think otherwise, capture a DNS trace and you'll see libc
@@ -159,7 +152,10 @@ parse_resolv()
 					private=false
 					for p in $private_interfaces; do
 						case "$iface" in
-						"$p"|"$p":*) private=true; break;;
+						"$p"|"$p":*)
+							private=true
+							break
+							;;
 						esac
 					done
 				fi
@@ -261,6 +257,108 @@ config_mkdirs()
 	return $e
 }
 
+# With the advent of alternative init systems, it's possible to have
+# more than one installed. So we need to try and guess what one we're
+# using unless overriden by configure.
+# Note that restarting a service is a last resort - the subscribers
+# should make a reasonable attempt to reconfigre the service via some
+# method, normally SIGHUP.
+detect_init()
+{
+	[ -n "$RESTARTCMD" ] && return 0
+
+	# Detect the running init system.
+	# As systemd and OpenRC can be installed on top of legacy init
+	# systems we try to detect them first.
+	local status="@STATUSARG@"
+	: ${status:=status}
+	if [ -x /bin/systemctl -a -S /run/systemd/private ]; then
+		RESTARTCMD="if /bin/systemctl --quiet is-active \$1.service; then
+	/bin/systemctl restart \$1.service;
+fi"
+	elif [ -x /usr/bin/systemctl -a -S /run/systemd/private ]; then
+		RESTARTCMD="if /usr/bin/systemctl --quiet is-active \$1.service; then
+	/usr/bin/systemctl restart \$1.service;
+fi"
+	elif [ -x /sbin/rc-service -a \
+	    -s /libexec/rc/init.d/softlevel -o -s /run/openrc/softlevel ]
+	then
+		RESTARTCMD="/sbin/rc-service -i \$1 -- -Ds restart"
+	elif [ -x /usr/sbin/invoke-rc.d ]; then
+		RCDIR=/etc/init.d
+		RESTARTCMD="if /usr/sbin/invoke-rc.d --quiet \$1 status 1>/dev/null 2>&1; then
+	/usr/sbin/invoke-rc.d \$1 restart;
+fi"
+	elif [ -x /sbin/service ]; then
+		# Old RedHat
+		RCDIR=/etc/init.d
+		RESTARTCMD="if /sbin/service \$1; then
+	/sbin/service \$1 restart;
+fi"
+	elif [ -x /usr/sbin/service ]; then
+		# Could be FreeBSD
+		RESTARTCMD="if /usr/sbin/service \$1 $status 1>/dev/null 2>&1; then
+	/usr/sbin/service \$1 restart;
+fi"
+	elif [ -x /bin/sv ]; then
+		RESTARTCMD="/bin/sv try-restart \$1"
+	elif [ -x /usr/bin/sv ]; then
+		RESTARTCMD="/usr/bin/sv try-restart \$1"
+	elif [ -e /etc/arch-release -a -d /etc/rc.d ]; then
+		RCDIR=/etc/rc.d
+		RESTARTCMD="if [ -e /var/run/daemons/\$1 ]; then
+	/etc/rc.d/\$1 restart;
+fi"
+	elif [ -e /etc/slackware-version -a -d /etc/rc.d ]; then
+		RESTARTCMD="if /etc/rc.d/rc.\$1 status 1>/dev/null 2>&1; then
+	/etc/rc.d/rc.\$1 restart;
+fi"
+	elif [ -e /etc/rc.d/rc.subr -a -d /etc/rc.d ]; then
+		# OpenBSD
+		RESTARTCMD="if /etc/rc.d/\$1 check 1>/dev/null 2>&1; then
+	/etc/rc.d/\$1 restart;
+fi"
+	else
+		for x in /etc/init.d/rc.d /etc/rc.d /etc/init.d; do
+			[ -d $x ] || continue
+			RESTARTCMD="if $x/\$1 $status 1>/dev/null 2>&1; then
+	$x/\$1 restart;
+fi"
+			break
+		done
+	fi
+
+	if [ -z "$RESTARTCMD" ]; then
+		if [ "$NOINIT_WARNED" != true ]; then
+			warn "could not detect a useable init system"
+			_NOINIT_WARNED=true
+		fi
+		return 1
+	fi
+	_NOINIT_WARNED=
+	return 0
+}
+
+echo_resolv()
+{
+	local line= OIFS="$IFS"
+
+	[ -n "$1" -a -f "$IFACEDIR/$1" ] || return 1
+	echo "# resolv.conf from $1"
+	# Our variable maker works of the fact each resolv.conf per interface
+	# is separated by blank lines.
+	# So we remove them when echoing them.
+	while read -r line; do
+		IFS="$OIFS"
+		if [ -n "$line" ]; then
+			# We need to set IFS here to preserve any whitespace
+			IFS=''
+			printf "%s\n" "$line"
+		fi
+	done < "$IFACEDIR/$1"
+	IFS="$OIFS"
+}
+
 list_resolv()
 {
 	[ -d "$IFACEDIR" ] || return 0
@@ -320,6 +418,7 @@ list_resolv()
 
 	cd "$IFACEDIR"
 	retval=1
+	excl=true
 	for i in $(uniqify $list); do
 		# Only list interfaces which we really have
 		if ! [ -f "$i" ]; then
@@ -334,6 +433,7 @@ list_resolv()
 			printf %s "$i "
 		else
 			echo_resolv "$i"
+			echo
 		fi
 		[ $? = 0 -a "$retval" = 1 ] && retval=0
 	done
@@ -499,7 +599,7 @@ make_vars()
 
 force=false
 VFLAG=
-while getopts a:Dd:fhIilm:puvVx OPT; do
+while getopts a:Dd:fhIilm:pRruvVx OPT; do
 	case "$OPT" in
 	f) force=true;;
 	h) usage;;
@@ -541,6 +641,18 @@ if [ "$cmd" = l -o "$cmd" = i ]; then
 	exit $?
 fi
 
+# Restart a service or echo the command to restart a service
+if [ "$cmd" = r -o "$cmd" = R ]; then
+	detect_init || exit 1
+	if [ "$cmd" = r ]; then
+		set -- $args
+		eval $RESTARTCMD
+	else
+		echo "$RESTARTCMD"
+	fi
+	exit $?
+fi
+
 # Not normally needed, but subscribers should be able to run independently
 if [ "$cmd" = v -o -n "$VFLAG" ]; then
 	make_vars "$iface"

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


More information about the svn-src-user mailing list