CVS commit: src/sys/netinet

2017-05-18 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Thu May 18 06:33:11 UTC 2017

Modified Files:
src/sys/netinet: if_arp.c

Log Message:
Lookup caches from a CARP interface if the packet is routed to the interface

This fixes CARP setups without carpdev (physical interface) having any IPs.


To generate a diff of this commit:
cvs rdiff -u -r1.249 -r1.250 src/sys/netinet/if_arp.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/netinet/if_arp.c
diff -u src/sys/netinet/if_arp.c:1.249 src/sys/netinet/if_arp.c:1.250
--- src/sys/netinet/if_arp.c:1.249	Fri May 12 17:53:53 2017
+++ src/sys/netinet/if_arp.c	Thu May 18 06:33:11 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_arp.c,v 1.249 2017/05/12 17:53:53 ryo Exp $	*/
+/*	$NetBSD: if_arp.c,v 1.250 2017/05/18 06:33:11 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.249 2017/05/12 17:53:53 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.250 2017/05/18 06:33:11 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -720,6 +720,11 @@ arpresolve(struct ifnet *ifp, const stru
 	const char *create_lookup;
 	bool renew;
 	int error;
+	struct ifnet *origifp = ifp;
+#if NCARP > 0
+	if (rt != NULL && rt->rt_ifp->if_type == IFT_CARP)
+		ifp = rt->rt_ifp;
+#endif
 
 	KASSERT(m != NULL);
 
@@ -796,12 +801,8 @@ notfound:
 
 		if (renew) {
 			const u_int8_t *enaddr =
-#if NCARP > 0
-			(ifp->if_type == IFT_CARP) ?
-			CLLADDR(ifp->if_sadl):
-#endif
 			CLLADDR(ifp->if_sadl);
-			arprequest(ifp,
+			arprequest(origifp,
 			(rt->rt_ifa->ifa_addr)->sin_addr,
 			(dst)->sin_addr, enaddr);
 		}
@@ -861,10 +862,6 @@ notfound:
 
 	if (renew) {
 		const u_int8_t *enaddr =
-#if NCARP > 0
-		(rt != NULL && rt->rt_ifp->if_type == IFT_CARP) ?
-		CLLADDR(rt->rt_ifp->if_sadl):
-#endif
 		CLLADDR(ifp->if_sadl);
 		la->la_expire = time_uptime;
 		arp_settimer(la, arpt_down);
@@ -872,7 +869,8 @@ notfound:
 		LLE_WUNLOCK(la);
 
 		if (rt != NULL) {
-			arprequest(ifp, (rt->rt_ifa->ifa_addr)->sin_addr,
+			arprequest(origifp,
+			(rt->rt_ifa->ifa_addr)->sin_addr,
 			(dst)->sin_addr, enaddr);
 		} else {
 			struct sockaddr_in sin;
@@ -884,7 +882,7 @@ notfound:
 			_rt = rtalloc1((struct sockaddr *), 0);
 			if (_rt == NULL)
 goto bad;
-			arprequest(ifp,
+			arprequest(origifp,
 			(_rt->rt_ifa->ifa_addr)->sin_addr,
 			(dst)->sin_addr, enaddr);
 			rt_unref(_rt);



CVS commit: src/sys/netinet

2017-05-18 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Thu May 18 06:33:11 UTC 2017

Modified Files:
src/sys/netinet: if_arp.c

Log Message:
Lookup caches from a CARP interface if the packet is routed to the interface

This fixes CARP setups without carpdev (physical interface) having any IPs.


To generate a diff of this commit:
cvs rdiff -u -r1.249 -r1.250 src/sys/netinet/if_arp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/net/carp

2017-05-18 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Thu May 18 06:33:49 UTC 2017

Modified Files:
src/tests/net/carp: t_basic.sh

Log Message:
Reduce duplicated codes (DRY)


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/net/carp/t_basic.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/carp/t_basic.sh
diff -u src/tests/net/carp/t_basic.sh:1.4 src/tests/net/carp/t_basic.sh:1.5
--- src/tests/net/carp/t_basic.sh:1.4	Mon Feb 27 08:26:53 2017
+++ src/tests/net/carp/t_basic.sh	Thu May 18 06:33:49 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_basic.sh,v 1.4 2017/02/27 08:26:53 ozaki-r Exp $
+#	$NetBSD: t_basic.sh,v 1.5 2017/05/18 06:33:49 ozaki-r Exp $
 #
 # Copyright (c) 2017 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -31,21 +31,7 @@ SOCK_BACKUP=unix://carp_backup
 BUS=bus_carp
 TIMEOUT=3
 
-atf_test_case carp_handover_halt cleanup
-carp_handover_head()
-{
-
-	atf_set "descr" "Tests for CARP handover on halt"
-	atf_set "require.progs" "rump_server"
-}
-
-atf_test_case carp_handover_ifdown cleanup
-carp_handover_head()
-{
-
-	atf_set "descr" "Tests for CARP handover on ifconfig down"
-	atf_set "require.progs" "rump_server"
-}
+DEBUG=${DEBUG:-false}
 
 IP_CLIENT=10.1.1.240
 IP_MASTER=10.1.1.1
@@ -103,7 +89,7 @@ wait_handover()
 	fi
 }
 
-test_carp_handover()
+test_carp_handover_ipv4()
 {
 	local op=$1
 
@@ -172,48 +158,6 @@ test_carp_handover()
 	fi
 }
 
-carp_handover_halt_body()
-{
-
-	test_carp_handover halt
-}
-
-carp_handover_ifdown_body()
-{
-
-	test_carp_handover ifdown
-}
-
-carp_handover_halt_cleanup()
-{
-
-	$DEBUG && dump
-	cleanup
-}
-
-carp_handover_ifdown_cleanup()
-{
-
-	$DEBUG && dump
-	cleanup
-}
-
-atf_test_case carp6_handover_halt cleanup
-carp6_handover_halt_head()
-{
-
-	atf_set "descr" "Tests for CARP handover on halt (IPv6)"
-	atf_set "require.progs" "rump_server"
-}
-
-atf_test_case carp6_handover_ifdown cleanup
-carp6_handover_ifdown_head()
-{
-
-	atf_set "descr" "Tests for CARP handover on ifconfig down (IPv6)"
-	atf_set "require.progs" "rump_server"
-}
-
 IP6_CLIENT=fd00:1::240
 IP6_MASTER=fd00:1::1
 IP6_BACKUP=fd00:1::2
@@ -269,7 +213,7 @@ wait_carp6_handover()
 	fi
 }
 
-test_carp6_handover()
+test_carp_handover_ipv6()
 {
 	local op=$1
 
@@ -338,37 +282,41 @@ test_carp6_handover()
 	fi
 }
 
-carp6_handover_halt_body()
+add_test_case()
 {
+	local ipproto=$1
+	local halt=$2
 
-	test_carp6_handover halt
-}
+	name="carp_handover_${ipproto}_${halt}"
+	desc="Tests for CARP (${ipproto}) handover on ${halt}"
 
-carp6_handover_ifdown_body()
-{
-
-	test_carp6_handover ifdown
-}
-
-carp6_handover_halt_cleanup()
-{
-
-	$DEBUG && dump
-	cleanup
-}
-
-carp6_handover_ifdown_cleanup()
-{
-
-	$DEBUG && dump
-	cleanup
+	atf_test_case ${name} cleanup
+	eval "			\
+	${name}_head() {	\
+	atf_set \"descr\" \"$desc\";			\
+	atf_set \"require.progs\" \"rump_server\";	\
+	};			\
+	${name}_body() {	\
+	test_carp_handover_${ipproto} $halt;		\
+	if [ $halt != halt ]; then			\
+	 rump_server_destroy_ifaces;		\
+	fi		\
+	};			\
+	${name}_cleanup() {	\
+	$DEBUG && dump;	\
+	cleanup;	\
+	}			\
+	"
+	atf_add_test_case ${name}
 }
 
 atf_init_test_cases()
 {
+	local proto= halt=
 
-	atf_add_test_case carp_handover_halt
-	atf_add_test_case carp_handover_ifdown
-	atf_add_test_case carp6_handover_halt
-	atf_add_test_case carp6_handover_ifdown
+	for proto in ipv4 ipv6; do
+		for halt in halt ifdown; do
+			add_test_case $proto $halt
+		done
+	done
 }



CVS commit: src/tests/net/carp

2017-05-18 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Thu May 18 06:33:49 UTC 2017

Modified Files:
src/tests/net/carp: t_basic.sh

Log Message:
Reduce duplicated codes (DRY)


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/net/carp/t_basic.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/net/carp

2017-05-18 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Thu May 18 06:34:48 UTC 2017

Modified Files:
src/tests/net/carp: t_basic.sh

Log Message:
Test CARP handover on setups without having IPs on carpdev (shmif)

Note that tests for IPv6 don't pass yet; nd6 needs to handle CARP
correctly like arp does.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/net/carp/t_basic.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/net/carp

2017-05-18 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Thu May 18 06:34:48 UTC 2017

Modified Files:
src/tests/net/carp: t_basic.sh

Log Message:
Test CARP handover on setups without having IPs on carpdev (shmif)

Note that tests for IPv6 don't pass yet; nd6 needs to handle CARP
correctly like arp does.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/net/carp/t_basic.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/carp/t_basic.sh
diff -u src/tests/net/carp/t_basic.sh:1.5 src/tests/net/carp/t_basic.sh:1.6
--- src/tests/net/carp/t_basic.sh:1.5	Thu May 18 06:33:49 2017
+++ src/tests/net/carp/t_basic.sh	Thu May 18 06:34:48 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_basic.sh,v 1.5 2017/05/18 06:33:49 ozaki-r Exp $
+#	$NetBSD: t_basic.sh,v 1.6 2017/05/18 06:34:48 ozaki-r Exp $
 #
 # Copyright (c) 2017 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -42,6 +42,7 @@ setup_carp()
 {
 	local sock=$1
 	local master=$2
+	local carpdevip=$3
 	local carpif= ip= advskew=
 
 	if $master; then
@@ -60,10 +61,17 @@ setup_carp()
 		rump.sysctl -w net.inet.carp.log=1
 	fi
 	atf_check -s exit:0 rump.ifconfig $carpif create
-	atf_check -s exit:0 rump.ifconfig shmif0 $ip/24 up
-	atf_check -s exit:0 rump.ifconfig $carpif \
-	vhid 175 advskew $advskew advbase 1 pass s3cret \
-	$IP_CARP netmask 255.255.255.0
+	if [ $carpdevip = yes ]; then
+		atf_check -s exit:0 rump.ifconfig shmif0 $ip/24 up
+		atf_check -s exit:0 rump.ifconfig $carpif \
+		vhid 175 advskew $advskew advbase 1 pass s3cret \
+		$IP_CARP netmask 255.255.255.0
+	else
+		atf_check -s exit:0 rump.ifconfig shmif0 up
+		atf_check -s exit:0 rump.ifconfig $carpif \
+		vhid 175 advskew $advskew advbase 1 pass s3cret \
+		carpdev shmif0 $IP_CARP netmask 255.255.255.0
+	fi
 	atf_check -s exit:0 rump.ifconfig -w 10
 }
 
@@ -92,6 +100,7 @@ wait_handover()
 test_carp_handover_ipv4()
 {
 	local op=$1
+	local carpdevip=$2
 
 	rump_server_start $SOCK_CLIENT
 	rump_server_start $SOCK_MASTER
@@ -101,18 +110,20 @@ test_carp_handover_ipv4()
 	rump_server_add_iface $SOCK_MASTER shmif0 $BUS
 	rump_server_add_iface $SOCK_BACKUP shmif0 $BUS
 
-	setup_carp $SOCK_MASTER true
-	setup_carp $SOCK_BACKUP false
+	setup_carp $SOCK_MASTER true $carpdevip
+	setup_carp $SOCK_BACKUP false $carpdevip
 
 	export RUMP_SERVER=$SOCK_CLIENT
 	atf_check -s exit:0 rump.ifconfig shmif0 $IP_CLIENT/24 up
 	atf_check -s exit:0 rump.ifconfig -w 10
 
-	# Check that the primary addresses are up
-	atf_check -s exit:0 -o ignore \
-	rump.ping -n -w $TIMEOUT -c 1 $IP_MASTER
-	atf_check -s exit:0 -o ignore \
-	rump.ping -n -w $TIMEOUT -c 1 $IP_BACKUP
+	if [ $carpdevip = yes ]; then
+		# Check that the primary addresses are up
+		atf_check -s exit:0 -o ignore \
+		rump.ping -n -w $TIMEOUT -c 1 $IP_MASTER
+		atf_check -s exit:0 -o ignore \
+		rump.ping -n -w $TIMEOUT -c 1 $IP_BACKUP
+	fi
 
 	# Give carp a while to croak
 	sleep 4
@@ -141,8 +152,12 @@ test_carp_handover_ipv4()
 	sleep 1
 
 	# Check that primary is now dead
-	atf_check -s not-exit:0 -o ignore \
-	rump.ping -n -w $TIMEOUT -c 1 $IP_MASTER
+	if [ $carpdevip = yes ]; then
+		atf_check -s not-exit:0 -o ignore \
+		rump.ping -n -w $TIMEOUT -c 1 $IP_MASTER
+	else
+		# XXX how to check?
+	fi
 
 	# Do it in installments. carp will cluck meanwhile
 	wait_handover
@@ -167,6 +182,7 @@ setup_carp6()
 {
 	local sock=$1
 	local master=$2
+	local carpdevip=$3
 	local carpif= ip= advskew=
 
 	if $master; then
@@ -185,9 +201,16 @@ setup_carp6()
 		rump.sysctl -w net.inet.carp.log=1
 	fi
 	atf_check -s exit:0 rump.ifconfig $carpif create
-	atf_check -s exit:0 rump.ifconfig shmif0 inet6 $ip up
-	atf_check -s exit:0 rump.ifconfig $carpif inet6 \
-	vhid 175 advskew $advskew advbase 1 pass s3cret $IP6_CARP
+	if [ $carpdevip = yes ]; then
+		atf_check -s exit:0 rump.ifconfig shmif0 inet6 $ip up
+		atf_check -s exit:0 rump.ifconfig $carpif inet6 \
+		vhid 175 advskew $advskew advbase 1 pass s3cret $IP6_CARP
+	else
+		atf_check -s exit:0 rump.ifconfig shmif0 up
+		atf_check -s exit:0 rump.ifconfig $carpif inet6 \
+		vhid 175 advskew $advskew advbase 1 pass s3cret \
+		carpdev shmif0 $IP6_CARP
+	fi
 	atf_check -s exit:0 rump.ifconfig -w 10
 }
 
@@ -216,6 +239,7 @@ wait_carp6_handover()
 test_carp_handover_ipv6()
 {
 	local op=$1
+	local carpdevip=$2
 
 	rump_server_start $SOCK_CLIENT netinet6
 	rump_server_start $SOCK_MASTER netinet6
@@ -225,18 +249,20 @@ test_carp_handover_ipv6()
 	rump_server_add_iface $SOCK_MASTER shmif0 $BUS
 	rump_server_add_iface $SOCK_BACKUP shmif0 $BUS
 
-	setup_carp6 $SOCK_MASTER true
-	setup_carp6 $SOCK_BACKUP false
+	setup_carp6 $SOCK_MASTER true $carpdevip
+	setup_carp6 $SOCK_BACKUP false $carpdevip
 
 	export RUMP_SERVER=$SOCK_CLIENT
 	atf_check -s exit:0 rump.ifconfig shmif0 inet6 $IP6_CLIENT up
 	atf_check -s exit:0 rump.ifconfig -w 10
 
-	# 

CVS commit: [prg-localcount2] src/sys/dev/mscp

2017-05-18 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu May 18 07:35:01 UTC 2017

Modified Files:
src/sys/dev/mscp [prg-localcount2]: mscp_disk.c

Log Message:
Fix previous, make it build again.


To generate a diff of this commit:
cvs rdiff -u -r1.89.8.4 -r1.89.8.5 src/sys/dev/mscp/mscp_disk.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/dev/mscp/mscp_disk.c
diff -u src/sys/dev/mscp/mscp_disk.c:1.89.8.4 src/sys/dev/mscp/mscp_disk.c:1.89.8.5
--- src/sys/dev/mscp/mscp_disk.c:1.89.8.4	Wed May 17 04:29:46 2017
+++ src/sys/dev/mscp/mscp_disk.c	Thu May 18 07:35:01 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mscp_disk.c,v 1.89.8.4 2017/05/17 04:29:46 pgoyette Exp $	*/
+/*	$NetBSD: mscp_disk.c,v 1.89.8.5 2017/05/18 07:35:01 pgoyette Exp $	*/
 /*
  * Copyright (c) 1988 Regents of the University of California.
  * All rights reserved.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mscp_disk.c,v 1.89.8.4 2017/05/17 04:29:46 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mscp_disk.c,v 1.89.8.5 2017/05/18 07:35:01 pgoyette Exp $");
 
 #include 
 #include 
@@ -289,7 +289,9 @@ raopen(dev_t dev, int flag, int fmt, str
 	error = 0;
  bad1:
 	mutex_exit(>ra_disk.dk_openlock);
+#if notyet
  bad2:
+#endif
 	device_release(ra->ra_dev);
 	return (error);
 }
@@ -1184,7 +1186,7 @@ ra_putonline(dev_t dev, struct ra_softc 
 static inline struct ra_softc *
 mscp_device_lookup(dev_t dev)
 {
-	const struct dev_cdevsw;
+	const struct cdevsw *dev_cdevsw;
 	struct ra_softc *ra;
 	int unit;
 
@@ -1207,20 +1209,13 @@ mscp_device_lookup(dev_t dev)
 		cdevsw_release(dev_cdevsw);
 #endif
 #if NRX
-	if ((dev_cdevsw = cdevsw_lookup_acquire(dev)) == _cdevsw)
+	if ((dev_cdevsw = cdevsw_lookup_acquire(dev)) == _cdevsw) {
 		ra = device_lookup_private_acquire(_cd, unit);
 		cdevsw_release(dev_cdevsw);
 		return ra;
-	else
+	} else
 		cdevsw_release(dev_cdevsw);
 #endif
 	panic("mscp_device_lookup: unexpected major %"PRIu32" unit %u",
 	major(dev), unit);
 }
-
-static void
-mscp_devsw_release(struct ra_softc *sc)
-{
-
-	device_release(sc->ra_dev);
-}



CVS commit: [prg-localcount2] src/sys/dev/mscp

2017-05-18 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu May 18 07:35:01 UTC 2017

Modified Files:
src/sys/dev/mscp [prg-localcount2]: mscp_disk.c

Log Message:
Fix previous, make it build again.


To generate a diff of this commit:
cvs rdiff -u -r1.89.8.4 -r1.89.8.5 src/sys/dev/mscp/mscp_disk.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci/ixgbe

2017-05-18 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu May 18 08:25:37 UTC 2017

Modified Files:
src/sys/dev/pci/ixgbe: ix_txrx.c

Log Message:
 Fix a bug that number of input packet counted twice. This bug was added
since sys/net/if.c rev.1.368.
http://mail-index.netbsd.org/source-changes/2016/12/15/msg079882.html


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/pci/ixgbe/ix_txrx.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/dev/pci/ixgbe/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.23 src/sys/dev/pci/ixgbe/ix_txrx.c:1.24
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.23	Mon May  8 10:00:41 2017
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Thu May 18 08:25:37 2017
@@ -59,7 +59,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 /*$FreeBSD: head/sys/dev/ixgbe/ix_txrx.c 301538 2016-06-07 04:51:50Z sephe $*/
-/*$NetBSD: ix_txrx.c,v 1.23 2017/05/08 10:00:41 msaitoh Exp $*/
+/*$NetBSD: ix_txrx.c,v 1.24 2017/05/18 08:25:37 msaitoh Exp $*/
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -1955,7 +1955,6 @@ ixgbe_rxeof(struct ix_queue *que)
 			mp->m_next = nbuf->buf;
 		} else { /* Sending this frame */
 			m_set_rcvif(sendmp, ifp);
-			ifp->if_ipackets++;
 			rxr->rx_packets.ev_count++;
 			/* capture data for AIM */
 			rxr->bytes += sendmp->m_pkthdr.len;



CVS commit: src/sys/dev/pci/ixgbe

2017-05-18 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu May 18 08:25:37 UTC 2017

Modified Files:
src/sys/dev/pci/ixgbe: ix_txrx.c

Log Message:
 Fix a bug that number of input packet counted twice. This bug was added
since sys/net/if.c rev.1.368.
http://mail-index.netbsd.org/source-changes/2016/12/15/msg079882.html


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/pci/ixgbe/ix_txrx.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci/ixgbe

2017-05-18 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu May 18 08:27:20 UTC 2017

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe.c ixgbe_type.h

Log Message:
- Count "Total Packets Missed" by evcnt(9)
- Call evcnt_attach_dynamic()/detach() for stats->mngpdc
  (Management Packets Dropped).
- Make stats->rnbc (Receive No Buffers) evcnt(9). Only 82598 has this register.
- Set RQSMR, TQSM (or TQSMR on 82598) to count qprc, qptc, qbrc, qbtc and qprdc
  in each queue counter. Without this change, all queue's counts are counted in
  queue 0's. Even if with this change, only MPC[0] is counted and other MPCs
  are not counted.


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/pci/ixgbe/ixgbe_type.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/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.81 src/sys/dev/pci/ixgbe/ixgbe.c:1.82
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.81	Fri Apr 28 10:24:45 2017
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Thu May 18 08:27:19 2017
@@ -59,7 +59,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 /*$FreeBSD: head/sys/dev/ixgbe/if_ix.c 302384 2016-07-07 03:39:18Z sbruno $*/
-/*$NetBSD: ixgbe.c,v 1.81 2017/04/28 10:24:45 msaitoh Exp $*/
+/*$NetBSD: ixgbe.c,v 1.82 2017/05/18 08:27:19 msaitoh Exp $*/
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -765,6 +765,7 @@ ixgbe_detach(device_t dev, int flags)
 	struct ix_queue *que = adapter->queues;
 	struct rx_ring *rxr = adapter->rx_rings;
 	struct tx_ring *txr = adapter->tx_rings;
+	struct ixgbe_hw *hw = >hw;
 	struct ixgbe_hw_stats *stats = >stats.pf;
 	u32	ctrl_ext;
 
@@ -860,6 +861,8 @@ ixgbe_detach(device_t dev, int flags)
 
 		if (i < __arraycount(stats->mpc)) {
 			evcnt_detach(>mpc[i]);
+			if (hw->mac.type == ixgbe_mac_82598EB)
+evcnt_detach(>rnbc[i]);
 		}
 		if (i < __arraycount(stats->pxontxc)) {
 			evcnt_detach(>pxontxc[i]);
@@ -892,6 +895,7 @@ ixgbe_detach(device_t dev, int flags)
 	evcnt_detach(>illerrc);
 	evcnt_detach(>errbc);
 	evcnt_detach(>mspdc);
+	evcnt_detach(>mpctotal);
 	evcnt_detach(>mlfc);
 	evcnt_detach(>mrfc);
 	evcnt_detach(>rlec);
@@ -918,6 +922,7 @@ ixgbe_detach(device_t dev, int flags)
 	evcnt_detach(>roc);
 	evcnt_detach(>rjc);
 	evcnt_detach(>mngprc);
+	evcnt_detach(>mngpdc);
 	evcnt_detach(>xec);
 
 	/* Packet Transmission Stats */
@@ -1587,7 +1592,7 @@ ixgbe_enable_queue(struct adapter *adapt
 	}
 }
 
-__unused static inline void
+static inline void
 ixgbe_disable_queue(struct adapter *adapter, u32 vector)
 {
 	struct ixgbe_hw *hw = >hw;
@@ -3498,6 +3503,9 @@ ixgbe_initialize_receive_units(struct ad
 	for (i = 0; i < adapter->num_queues; i++, rxr++) {
 		u64 rdba = rxr->rxdma.dma_paddr;
 		int j = rxr->me;
+		u32 tqsmreg, reg;
+		int regnum = i / 4;	/* 1 register per 4 queues */
+		int regshift = i % 4;	/* 4 bits per 1 queue */
 
 		/* Setup the Base and Length of the Rx Descriptor Ring */
 		IXGBE_WRITE_REG(hw, IXGBE_RDBAL(j),
@@ -3513,6 +3521,26 @@ ixgbe_initialize_receive_units(struct ad
 		srrctl |= bufsz;
 		srrctl |= IXGBE_SRRCTL_DESCTYPE_ADV_ONEBUF;
 
+		/* Set RQSMR (Receive Queue Statistic Mapping) register */
+		reg = IXGBE_READ_REG(hw, IXGBE_RQSMR(regnum));
+		reg &= ~(0x00ff << (regshift * 8));
+		reg |= i << (regshift * 8);
+		IXGBE_WRITE_REG(hw, IXGBE_RQSMR(regnum), reg);
+
+		/*
+		 * Set RQSMR (Receive Queue Statistic Mapping) register.
+		 * Register location for queue 0...7 are different between
+		 * 82598 and newer.
+		 */
+		if (adapter->hw.mac.type == ixgbe_mac_82598EB)
+			tqsmreg = IXGBE_TQSMR(regnum);
+		else
+			tqsmreg = IXGBE_TQSM(regnum);
+		reg = IXGBE_READ_REG(hw, tqsmreg);
+		reg &= ~(0x00ff << (regshift * 8));
+		reg |= i << (regshift * 8);
+		IXGBE_WRITE_REG(hw, tqsmreg, reg);
+
 		/*
 		 * Set DROP_EN iff we have no flow control and >1 queue.
 		 * Note that srrctl was cleared shortly before during reset,
@@ -4308,6 +4336,22 @@ ixgbe_update_stats_counters(struct adapt
 		stats->qptc[j].ev_count += IXGBE_READ_REG(hw, IXGBE_QPTC(i));
 		stats->qprdc[j].ev_count += IXGBE_READ_REG(hw, IXGBE_QPRDC(i));
 	}
+	for (int i = 0; i < __arraycount(stats->mpc); i++) {
+		uint32_t mp;
+		int j = i % adapter->num_queues;
+
+		mp = IXGBE_READ_REG(hw, IXGBE_MPC(i));
+		/* global total per queue */
+		stats->mpc[j].ev_count += mp;
+		/* running comprehensive total for stats display */
+		total_missed_rx += mp;
+
+		if (hw->mac.type == ixgbe_mac_82598EB)
+			stats->rnbc[j].ev_count
+			+= IXGBE_READ_REG(hw, IXGBE_RNBC(i));
+		
+	}
+	stats->mpctotal.ev_count += total_missed_rx;
 	stats->mlfc.ev_count += IXGBE_READ_REG(hw, IXGBE_MLFC);
 	stats->mrfc.ev_count += IXGBE_READ_REG(hw, IXGBE_MRFC);
 	rlec = IXGBE_READ_REG(hw, IXGBE_RLEC);
@@ -4699,6 +4743,7 @@ ixgbe_add_hw_stats(struct adapter *adapt
 	struct sysctllog **log = >sysctllog;
 	struct tx_ring *txr = adapter->tx_rings;
 	struct rx_ring 

CVS commit: src/sys/dev/pci/ixgbe

2017-05-18 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu May 18 08:27:20 UTC 2017

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe.c ixgbe_type.h

Log Message:
- Count "Total Packets Missed" by evcnt(9)
- Call evcnt_attach_dynamic()/detach() for stats->mngpdc
  (Management Packets Dropped).
- Make stats->rnbc (Receive No Buffers) evcnt(9). Only 82598 has this register.
- Set RQSMR, TQSM (or TQSMR on 82598) to count qprc, qptc, qbrc, qbtc and qprdc
  in each queue counter. Without this change, all queue's counts are counted in
  queue 0's. Even if with this change, only MPC[0] is counted and other MPCs
  are not counted.


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/pci/ixgbe/ixgbe_type.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [bouyer-socketcan] src

2017-05-18 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Thu May 18 11:28:49 UTC 2017

Modified Files:
src/distrib/sets/lists/man [bouyer-socketcan]: mi
src/share/man/man4 [bouyer-socketcan]: Makefile
Added Files:
src/share/man/man4 [bouyer-socketcan]: can.4 canloop.4

Log Message:
Add can(4) and canloop(4) man pages


To generate a diff of this commit:
cvs rdiff -u -r1.1545.2.2 -r1.1545.2.3 src/distrib/sets/lists/man/mi
cvs rdiff -u -r1.631.2.1 -r1.631.2.2 src/share/man/man4/Makefile
cvs rdiff -u -r0 -r1.1.2.1 src/share/man/man4/can.4 \
src/share/man/man4/canloop.4

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/man/mi
diff -u src/distrib/sets/lists/man/mi:1.1545.2.2 src/distrib/sets/lists/man/mi:1.1545.2.3
--- src/distrib/sets/lists/man/mi:1.1545.2.2	Fri Apr 21 16:51:14 2017
+++ src/distrib/sets/lists/man/mi	Thu May 18 11:28:49 2017
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1545.2.2 2017/04/21 16:51:14 bouyer Exp $
+# $NetBSD: mi,v 1.1545.2.3 2017/05/18 11:28:49 bouyer Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -954,6 +954,8 @@
 ./usr/share/man/cat4/bwi.0			man-sys-catman		.cat
 ./usr/share/man/cat4/ca.0			man-obsolete		obsolete
 ./usr/share/man/cat4/cac.0			man-sys-catman		.cat
+./usr/share/man/cat4/can.0			man-sys-catman		.cat
+./usr/share/man/cat4/canloop.0			man-sys-catman		.cat
 ./usr/share/man/cat4/cardbus.0			man-sys-catman		.cat
 ./usr/share/man/cat4/cardslot.0			man-sys-catman		.cat
 ./usr/share/man/cat4/carp.0			man-sys-catman		.cat
@@ -4066,6 +4068,8 @@
 ./usr/share/man/html4/btuart.html		man-sys-htmlman		html
 ./usr/share/man/html4/bwi.html			man-sys-htmlman		html
 ./usr/share/man/html4/cac.html			man-sys-htmlman		html
+./usr/share/man/html4/can.html			man-sys-htmlman		html
+./usr/share/man/html4/canloop.html		man-sys-htmlman		html
 ./usr/share/man/html4/cardbus.html		man-sys-htmlman		html
 ./usr/share/man/html4/cardslot.html		man-sys-htmlman		html
 ./usr/share/man/html4/carp.html			man-sys-htmlman		html
@@ -6950,6 +6954,8 @@
 ./usr/share/man/man4/bwi.4			man-sys-man		.man
 ./usr/share/man/man4/ca.4			man-obsolete		obsolete
 ./usr/share/man/man4/cac.4			man-sys-man		.man
+./usr/share/man/man4/can.4			man-sys-man		.man
+./usr/share/man/man4/canloop.4			man-sys-man		.man
 ./usr/share/man/man4/cardbus.4			man-sys-man		.man
 ./usr/share/man/man4/cardslot.4			man-sys-man		.man
 ./usr/share/man/man4/carp.4			man-sys-man		.man

Index: src/share/man/man4/Makefile
diff -u src/share/man/man4/Makefile:1.631.2.1 src/share/man/man4/Makefile:1.631.2.2
--- src/share/man/man4/Makefile:1.631.2.1	Fri Apr 21 16:53:15 2017
+++ src/share/man/man4/Makefile	Thu May 18 11:28:48 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.631.2.1 2017/04/21 16:53:15 bouyer Exp $
+#	$NetBSD: Makefile,v 1.631.2.2 2017/05/18 11:28:48 bouyer Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/18/93
 
 MAN=	aac.4 ac97.4 acardide.4 aceride.4 acphy.4 \
@@ -16,7 +16,7 @@ MAN=	aac.4 ac97.4 acardide.4 aceride.4 a
 	brgphy.4 bridge.4 bthidev.4 bthub.4 btkbd.4 \
 	btmagic.4 btms.4 btsco.4 btuart.4 \
 	bwi.4 \
-	cac.4 cardbus.4 carp.4 cas.4 ccd.4 cd.4 \
+	cac.4 can.4 canloop.4 cardbus.4 carp.4 cas.4 ccd.4 cd.4 \
 	cec.4 cgd.4 cfb.4 ch.4 chipsfb.4 ciphy.4 ciss.4 clcs.4 clct.4 \
 	clockctl.4 cmdide.4 cmpci.4 cms.4 cnw.4 \
 	com.4 coram.4 crypto.4 cs80bus.4 cuda.4 cypide.4 cxdtv.4 \

Added files:

Index: src/share/man/man4/can.4
diff -u /dev/null src/share/man/man4/can.4:1.1.2.1
--- /dev/null	Thu May 18 11:28:49 2017
+++ src/share/man/man4/can.4	Thu May 18 11:28:48 2017
@@ -0,0 +1,96 @@
+.\"	$NetBSD: can.4,v 1.1.2.1 2017/05/18 11:28:48 bouyer Exp $
+.\"
+.\" Copyright (c) 2017 Manuel Bouyer.
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"notice, this list of conditions and the following disclaimer in the
+.\"documentation and/or other materials provided with the distribution.
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF

CVS commit: [bouyer-socketcan] src

2017-05-18 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Thu May 18 11:28:49 UTC 2017

Modified Files:
src/distrib/sets/lists/man [bouyer-socketcan]: mi
src/share/man/man4 [bouyer-socketcan]: Makefile
Added Files:
src/share/man/man4 [bouyer-socketcan]: can.4 canloop.4

Log Message:
Add can(4) and canloop(4) man pages


To generate a diff of this commit:
cvs rdiff -u -r1.1545.2.2 -r1.1545.2.3 src/distrib/sets/lists/man/mi
cvs rdiff -u -r1.631.2.1 -r1.631.2.2 src/share/man/man4/Makefile
cvs rdiff -u -r0 -r1.1.2.1 src/share/man/man4/can.4 \
src/share/man/man4/canloop.4

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [bouyer-socketcan] src/lib/libc/sys

2017-05-18 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Thu May 18 11:29:54 UTC 2017

Modified Files:
src/lib/libc/sys [bouyer-socketcan]: socket.2

Log Message:
add PF_CAN


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.41.16.1 src/lib/libc/sys/socket.2

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/sys/socket.2
diff -u src/lib/libc/sys/socket.2:1.41 src/lib/libc/sys/socket.2:1.41.16.1
--- src/lib/libc/sys/socket.2:1.41	Fri Mar  1 18:25:16 2013
+++ src/lib/libc/sys/socket.2	Thu May 18 11:29:54 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: socket.2,v 1.41 2013/03/01 18:25:16 joerg Exp $
+.\"	$NetBSD: socket.2,v 1.41.16.1 2017/05/18 11:29:54 bouyer Exp $
 .\"
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" @(#)socket.2	8.1 (Berkeley) 6/4/93
 .\"
-.Dd February 5, 2013
+.Dd April 27, 2017
 .Dt SOCKET 2
 .Os
 .Sh NAME
@@ -61,6 +61,7 @@ PF_INET6	IPv6 (Internet Protocol version
 PF_NS		Xerox Network Systems protocols
 PF_APPLETALK	AppleTalk protocols
 PF_BLUETOOTH	Bluetooth protocols
+PF_CAN		CAN bus protocols
 .Ed
 .Pp
 The socket has the indicated



CVS commit: [bouyer-socketcan] src/lib/libc/sys

2017-05-18 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Thu May 18 11:29:54 UTC 2017

Modified Files:
src/lib/libc/sys [bouyer-socketcan]: socket.2

Log Message:
add PF_CAN


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.41.16.1 src/lib/libc/sys/socket.2

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/usr.bin

2017-05-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu May 18 10:29:47 UTC 2017

Modified Files:
src/tests/usr.bin/c++: t_hello.sh
src/tests/usr.bin/cc: t_hello.sh

Log Message:
Add (currently failing) test cases for profiled programs.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/c++/t_hello.sh
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/cc/t_hello.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/usr.bin/c++/t_hello.sh
diff -u src/tests/usr.bin/c++/t_hello.sh:1.1 src/tests/usr.bin/c++/t_hello.sh:1.2
--- src/tests/usr.bin/c++/t_hello.sh:1.1	Sun May 14 00:07:07 2017
+++ src/tests/usr.bin/c++/t_hello.sh	Thu May 18 10:29:47 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_hello.sh,v 1.1 2017/05/14 00:07:07 kamil Exp $
+#	$NetBSD: t_hello.sh,v 1.2 2017/05/18 10:29:47 martin Exp $
 #
 # Copyright (c) 2011 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -31,6 +31,12 @@ hello_head() {
 	atf_set "require.progs" "c++"
 }
 
+atf_test_case hello_profile
+hello_head() {
+	atf_set "descr" "compile and run \"hello world\" with profiling option"
+	atf_set "require.progs" "c++"
+}
+
 atf_test_case hello_pic
 hello_pic_head() {
 	atf_set "descr" "compile and run PIC \"hello world\""
@@ -59,6 +65,16 @@ EOF
 	atf_check -s exit:0 -o inline:"hello world\n" ./hello
 }
 
+hello_profile_body() {
+	cat > test.cpp << EOF
+#include 
+#include 
+int main(void) {printf("hello world\n");exit(0);}
+EOF
+	atf_check -s exit:0 -o ignore -e ignore c++ -pg -o hello test.cpp
+	atf_check -s exit:0 -o inline:"hello world\n" ./hello
+}
+
 hello_pic_body() {
 	cat > test.cpp << EOF
 #include 
@@ -139,6 +155,7 @@ atf_init_test_cases()
 {
 
 	atf_add_test_case hello
+	atf_add_test_case hello_profile
 	atf_add_test_case hello_pic
 	atf_add_test_case hello_pie
 	atf_add_test_case hello32

Index: src/tests/usr.bin/cc/t_hello.sh
diff -u src/tests/usr.bin/cc/t_hello.sh:1.4 src/tests/usr.bin/cc/t_hello.sh:1.5
--- src/tests/usr.bin/cc/t_hello.sh:1.4	Sat May 13 23:51:39 2017
+++ src/tests/usr.bin/cc/t_hello.sh	Thu May 18 10:29:47 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_hello.sh,v 1.4 2017/05/13 23:51:39 kamil Exp $
+#	$NetBSD: t_hello.sh,v 1.5 2017/05/18 10:29:47 martin Exp $
 #
 # Copyright (c) 2011 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -31,6 +31,12 @@ hello_head() {
 	atf_set "require.progs" "cc"
 }
 
+atf_test_case hello_profile
+hello_head() {
+	atf_set "descr" "compile and run \"hello world\" with profiling option"
+	atf_set "require.progs" "cc"
+}
+
 atf_test_case hello_pic
 hello_pic_head() {
 	atf_set "descr" "compile and run PIC \"hello world\""
@@ -59,6 +65,16 @@ EOF
 	atf_check -s exit:0 -o inline:"hello world\n" ./hello
 }
 
+hello_profile_body() {
+	cat > test.c << EOF
+#include 
+#include 
+int main(void) {printf("hello world\n");exit(0);}
+EOF
+	atf_check -s exit:0 -o ignore -e ignore cc -o hello -pg test.c
+	atf_check -s exit:0 -o inline:"hello world\n" ./hello
+}
+
 hello_pic_body() {
 	cat > test.c << EOF
 #include 
@@ -139,6 +155,7 @@ atf_init_test_cases()
 {
 
 	atf_add_test_case hello
+	atf_add_test_case hello_profile
 	atf_add_test_case hello_pic
 	atf_add_test_case hello_pie
 	atf_add_test_case hello32



CVS commit: src/tests/usr.bin

2017-05-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu May 18 10:29:47 UTC 2017

Modified Files:
src/tests/usr.bin/c++: t_hello.sh
src/tests/usr.bin/cc: t_hello.sh

Log Message:
Add (currently failing) test cases for profiled programs.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/c++/t_hello.sh
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/cc/t_hello.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/pmax/ibus

2017-05-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu May 18 16:37:06 UTC 2017

Modified Files:
src/sys/arch/pmax/ibus: dz_ibus.c

Log Message:
PR/52242: Utkarsh Anand: Minimal fix for fallout from moving to the common
mips bus_space code.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/pmax/ibus/dz_ibus.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/arch/pmax/ibus/dz_ibus.c
diff -u src/sys/arch/pmax/ibus/dz_ibus.c:1.11 src/sys/arch/pmax/ibus/dz_ibus.c:1.12
--- src/sys/arch/pmax/ibus/dz_ibus.c:1.11	Sat Jul  9 13:32:29 2011
+++ src/sys/arch/pmax/ibus/dz_ibus.c	Thu May 18 12:37:06 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: dz_ibus.c,v 1.11 2011/07/09 17:32:29 matt Exp $	*/
+/*	$NetBSD: dz_ibus.c,v 1.12 2017/05/18 16:37:06 christos Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2003 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dz_ibus.c,v 1.11 2011/07/09 17:32:29 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dz_ibus.c,v 1.12 2017/05/18 16:37:06 christos Exp $");
 
 #include "dzkbd.h"
 #include "dzms.h"
@@ -168,6 +168,7 @@ dz_ibus_attach(device_t parent, device_t
 	 * XXX - This is evil and ugly, but... due to the nature of how
 	 * bus_space_* works on pmax it will do for the time being.
 	 */
+	sc->sc_iot = normal_memt;
 	sc->sc_ioh = (bus_space_handle_t)MIPS_PHYS_TO_KSEG1(iba->ia_addr);
 
 	sc->sc_dr.dr_csr = 0;



CVS commit: src/sys/arch/pmax/ibus

2017-05-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu May 18 16:37:06 UTC 2017

Modified Files:
src/sys/arch/pmax/ibus: dz_ibus.c

Log Message:
PR/52242: Utkarsh Anand: Minimal fix for fallout from moving to the common
mips bus_space code.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/pmax/ibus/dz_ibus.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/bin/sh

2017-05-18 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu May 18 15:42:37 UTC 2017

Modified Files:
src/bin/sh: show.c

Log Message:
DEBUG mode only change - mostly to output when option to show shell
internal sub-process nesting is enabled, and very deep nesting levels exist.

NFC for anyone else.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/bin/sh/show.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/sh/show.c
diff -u src/bin/sh/show.c:1.40 src/bin/sh/show.c:1.41
--- src/bin/sh/show.c:1.40	Mon May 15 20:00:36 2017
+++ src/bin/sh/show.c	Thu May 18 15:42:37 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: show.c,v 1.40 2017/05/15 20:00:36 kre Exp $	*/
+/*	$NetBSD: show.c,v 1.41 2017/05/18 15:42:37 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)show.c	8.3 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: show.c,v 1.40 2017/05/15 20:00:36 kre Exp $");
+__RCSID("$NetBSD: show.c,v 1.41 2017/05/18 15:42:37 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -926,12 +926,18 @@ trace_id(TFILE *tf)
 	char *p;
 
 	if (DFlags & DBG_NEST) {
-		p = indent;
-		for (i = 0; i < 6; i++)
-			*p++ = (i < ShNest) ? '#' : ' ';
-		while (i++ < ShNest && p < [sizeof indent - 1])
-			*p++ = '#';
-		*p = '\0';
+		if ((unsigned)ShNest >= sizeof indent - 1) {
+			(void) snprintf(indent, sizeof indent,
+			"### %*d ###", (int)(sizeof indent) - 9, ShNest);
+			p = strchr(indent, '\0');
+		} else {
+			p = indent;
+			for (i = 0; i < 6; i++)
+*p++ = (i < ShNest) ? '#' : ' ';
+			while (i++ < ShNest && p < [sizeof indent - 1])
+*p++ = '#';
+			*p = '\0';
+		}
 	} else
 		indent[0] = '\0';
 
@@ -941,8 +947,6 @@ trace_id(TFILE *tf)
 		i == tf->pid ? ':' : '=', indent);
 		return p;
 	} else if (DFlags & DBG_NEST) {
-		*p++ = '\t';
-		*p = '\0';
 		(void) asprintf(, "%s\t", indent);
 		return p;
 	}
@@ -1112,6 +1116,7 @@ debugcmd(int argc, char **argv)
 	if (argc == 1) {
 		struct debug_flag *df;
 
+		out1fmt("Debug: %sabled.  Flags: ", debug ? "en" : "dis");
 		for (df = debug_flags; df->label != '\0'; df++) {
 			if (df->flag & (df->flag - 1))
 continue;



CVS commit: src/bin/sh

2017-05-18 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu May 18 15:42:37 UTC 2017

Modified Files:
src/bin/sh: show.c

Log Message:
DEBUG mode only change - mostly to output when option to show shell
internal sub-process nesting is enabled, and very deep nesting levels exist.

NFC for anyone else.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/bin/sh/show.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/su

2017-05-18 Thread Abhinav Upadhyay
Module Name:src
Committed By:   abhinav
Date:   Thu May 18 16:33:57 UTC 2017

Modified Files:
src/usr.bin/su: su.1

Log Message:
Correct the man page reference


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/usr.bin/su/su.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/su

2017-05-18 Thread Abhinav Upadhyay
Module Name:src
Committed By:   abhinav
Date:   Thu May 18 16:33:57 UTC 2017

Modified Files:
src/usr.bin/su: su.1

Log Message:
Correct the man page reference


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/usr.bin/su/su.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/su/su.1
diff -u src/usr.bin/su/su.1:1.51 src/usr.bin/su/su.1:1.52
--- src/usr.bin/su/su.1:1.51	Fri Sep 19 16:02:58 2014
+++ src/usr.bin/su/su.1	Thu May 18 16:33:57 2017
@@ -26,7 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	from: @(#)su.1	8.2 (Berkeley) 4/18/94
-.\"	$NetBSD: su.1,v 1.51 2014/09/19 16:02:58 wiz Exp $
+.\"	$NetBSD: su.1,v 1.52 2017/05/18 16:33:57 abhinav Exp $
 .\"
 .Dd November 20, 2012
 .Dt SU 1
@@ -190,7 +190,7 @@ The
 .Xr utmp 5 ,
 .Xr wtmp 5 ,
 and
-.Xr lastlogin 5
+.Xr lastlog 5
 databases are not updated.
 .It Fl
 Same as



CVS commit: src/sys/arch/pmax/pmax

2017-05-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu May 18 16:34:56 UTC 2017

Modified Files:
src/sys/arch/pmax/pmax: bus.c bus_dma.c

Log Message:
Fix debug (make it compile)


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/pmax/pmax/bus.c
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/pmax/pmax/bus_dma.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/arch/pmax/pmax/bus.c
diff -u src/sys/arch/pmax/pmax/bus.c:1.1 src/sys/arch/pmax/pmax/bus.c:1.2
--- src/sys/arch/pmax/pmax/bus.c:1.1	Wed Nov 16 14:37:06 2016
+++ src/sys/arch/pmax/pmax/bus.c	Thu May 18 12:34:56 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus.c,v 1.1 2016/11/16 19:37:06 macallan Exp $	*/
+/*	$NetBSD: bus.c,v 1.2 2017/05/18 16:34:56 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus.c,v 1.1 2016/11/16 19:37:06 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus.c,v 1.2 2017/05/18 16:34:56 christos Exp $");
 
 #include "opt_cputype.h"
 
@@ -182,9 +182,9 @@ _bus_dmamap_sync_r3k(bus_dma_tag_t t, bu
 		addr = map->dm_segs[i].ds_addr;
 
 #ifdef BUS_DMA_DEBUG
-		printf("bus_dmamap_sync_r3k: flushing segment %d "
-		"(0x%lx..0x%lx) ...", i, addr + offset,
-		addr + offset + minlen - 1);
+		printf("%s: flushing segment %d (%#jx..%#jx) ...", __func__, i,
+		(intmax_t)addr + offset,
+		(intmax_t)addr + offset + minlen - 1);
 #endif
 		mips_dcache_inv_range(
 		MIPS_PHYS_TO_KSEG0(addr + offset), minlen);
@@ -294,9 +294,9 @@ _bus_dmamap_sync_r4k(bus_dma_tag_t t, bu
 		addr = map->dm_segs[i]._ds_vaddr;
 
 #ifdef BUS_DMA_DEBUG
-		printf("bus_dmamap_sync: flushing segment %d "
-		"(0x%lx..0x%lx) ...", i, addr + offset,
-		addr + offset + minlen - 1);
+		printf("%s: flushing segment %d (%#jx..%#jx) ...",
+		__func__, i, (intmax_t)addr + offset,
+		(intmax_t)ddr + offset + minlen - 1);
 #endif
 
 		/*

Index: src/sys/arch/pmax/pmax/bus_dma.c
diff -u src/sys/arch/pmax/pmax/bus_dma.c:1.58 src/sys/arch/pmax/pmax/bus_dma.c:1.59
--- src/sys/arch/pmax/pmax/bus_dma.c:1.58	Thu Jun 11 04:22:09 2015
+++ src/sys/arch/pmax/pmax/bus_dma.c	Thu May 18 12:34:56 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.58 2015/06/11 08:22:09 matt Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.59 2017/05/18 16:34:56 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.58 2015/06/11 08:22:09 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.59 2017/05/18 16:34:56 christos Exp $");
 
 #include "opt_cputype.h"
 
@@ -493,9 +493,9 @@ _bus_dmamap_sync_r3k(bus_dma_tag_t t, bu
 		addr = map->dm_segs[i].ds_addr;
 
 #ifdef BUS_DMA_DEBUG
-		printf("bus_dmamap_sync_r3k: flushing segment %d "
-		"(0x%lx..0x%lx) ...", i, addr + offset,
-		addr + offset + minlen - 1);
+		printf("%s: flushing segment %d (%#jx..%#jx) ...", __func__,
+		i, (intmax_t)addr + offset,
+		(intmax_t)addr + offset + minlen - 1);
 #endif
 		mips_dcache_inv_range(
 		MIPS_PHYS_TO_KSEG0(addr + offset), minlen);
@@ -604,9 +604,9 @@ _bus_dmamap_sync_r4k(bus_dma_tag_t t, bu
 		addr = map->dm_segs[i]._ds_vaddr;
 
 #ifdef BUS_DMA_DEBUG
-		printf("bus_dmamap_sync: flushing segment %d "
-		"(0x%lx..0x%lx) ...", i, addr + offset,
-		addr + offset + minlen - 1);
+		printf("%s: flushing segment %d (%#jx..%#jx) ...", __func__,
+		i, (intmax_t)addr + offset,
+		(intmax_t)addr + offset + minlen - 1);
 #endif
 
 		/*



CVS commit: src/sys/arch/pmax/pmax

2017-05-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu May 18 16:34:56 UTC 2017

Modified Files:
src/sys/arch/pmax/pmax: bus.c bus_dma.c

Log Message:
Fix debug (make it compile)


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/pmax/pmax/bus.c
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/pmax/pmax/bus_dma.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libcurses

2017-05-18 Thread Abhinav Upadhyay
Module Name:src
Committed By:   abhinav
Date:   Thu May 18 16:41:12 UTC 2017

Modified Files:
src/lib/libcurses: curses.3

Log Message:
Fix typo in the man page reference


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/lib/libcurses/curses.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libcurses/curses.3
diff -u src/lib/libcurses/curses.3:1.71 src/lib/libcurses/curses.3:1.72
--- src/lib/libcurses/curses.3:1.71	Wed Jan 25 12:42:05 2017
+++ src/lib/libcurses/curses.3	Thu May 18 16:41:12 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: curses.3,v 1.71 2017/01/25 12:42:05 roy Exp $
+.\"	$NetBSD: curses.3,v 1.72 2017/05/18 16:41:12 abhinav Exp $
 .\"
 .\" Copyright (c) 1985, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -225,7 +225,7 @@ must be called before any of the other r
 .It resetty Ta Xr curses_tty 3
 .It resize_term Ta Xr curses_screen 3
 .It resizeterm Ta Xr curses_screen 3
-.It ripoffline Ta Xr curses_Screen 3
+.It ripoffline Ta Xr curses_screen 3
 .It savetty Ta Xr curses_tty 3
 .It scanw Ta Xr curses_scanw 3
 .It scrl Ta Xr curses_scroll 3



CVS commit: src/lib/libcurses

2017-05-18 Thread Abhinav Upadhyay
Module Name:src
Committed By:   abhinav
Date:   Thu May 18 16:41:12 UTC 2017

Modified Files:
src/lib/libcurses: curses.3

Log Message:
Fix typo in the man page reference


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/lib/libcurses/curses.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/bin/sh

2017-05-18 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu May 18 13:34:17 UTC 2017

Modified Files:
src/bin/sh: jobs.c

Log Message:
DEBUG mode only change - correctly track internal shell sub-shell nesting
levels for debug output.  This change accidentally omitted earlier (only
effect is incorrect nesting levels shown in trace output when the option
to show them is enabled.)   NFC for any normal shell build.


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/bin/sh/jobs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/sh/jobs.c
diff -u src/bin/sh/jobs.c:1.84 src/bin/sh/jobs.c:1.85
--- src/bin/sh/jobs.c:1.84	Thu May 11 14:57:14 2017
+++ src/bin/sh/jobs.c	Thu May 18 13:34:17 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: jobs.c,v 1.84 2017/05/11 14:57:14 kre Exp $	*/
+/*	$NetBSD: jobs.c,v 1.85 2017/05/18 13:34:17 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)jobs.c	8.5 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: jobs.c,v 1.84 2017/05/11 14:57:14 kre Exp $");
+__RCSID("$NetBSD: jobs.c,v 1.85 2017/05/18 13:34:17 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -869,6 +869,7 @@ forkshell(struct job *jp, union node *n,
 		error("Cannot fork (%s)", strerror(serrno));
 		break;
 	case 0:
+		SHELL_FORKED();
 		forkchild(jp, n, mode, 0);
 		return 0;
 	default:



CVS commit: src/bin/sh

2017-05-18 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu May 18 13:34:17 UTC 2017

Modified Files:
src/bin/sh: jobs.c

Log Message:
DEBUG mode only change - correctly track internal shell sub-shell nesting
levels for debug output.  This change accidentally omitted earlier (only
effect is incorrect nesting levels shown in trace output when the option
to show them is enabled.)   NFC for any normal shell build.


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/bin/sh/jobs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/net/ipsec

2017-05-18 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Thu May 18 14:43:42 UTC 2017

Modified Files:
src/tests/net/ipsec: t_ipsec_misc.sh

Log Message:
Don't check the existence of SA entries eagerly

They can be expired at that point if their lifetime is very short.
This may fix unexpected failures of tests running on anita.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/net/ipsec/t_ipsec_misc.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/net/ipsec

2017-05-18 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Thu May 18 14:43:42 UTC 2017

Modified Files:
src/tests/net/ipsec: t_ipsec_misc.sh

Log Message:
Don't check the existence of SA entries eagerly

They can be expired at that point if their lifetime is very short.
This may fix unexpected failures of tests running on anita.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/net/ipsec/t_ipsec_misc.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/ipsec/t_ipsec_misc.sh
diff -u src/tests/net/ipsec/t_ipsec_misc.sh:1.2 src/tests/net/ipsec/t_ipsec_misc.sh:1.3
--- src/tests/net/ipsec/t_ipsec_misc.sh:1.2	Wed May 17 06:30:15 2017
+++ src/tests/net/ipsec/t_ipsec_misc.sh	Thu May 18 14:43:42 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ipsec_misc.sh,v 1.2 2017/05/17 06:30:15 ozaki-r Exp $
+#	$NetBSD: t_ipsec_misc.sh,v 1.3 2017/05/18 14:43:42 ozaki-r Exp $
 #
 # Copyright (c) 2017 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -48,7 +48,8 @@ setup_sasp()
 	EOF
 	$DEBUG && cat $tmpfile
 	atf_check -s exit:0 -o empty $HIJACKING setkey -c < $tmpfile
-	check_sa_entries $SOCK_LOCAL $ip_local $ip_peer
+	# XXX it can be expired if $lifetime is very short
+	#check_sa_entries $SOCK_LOCAL $ip_local $ip_peer
 
 	export RUMP_SERVER=$SOCK_PEER
 	cat > $tmpfile <<-EOF
@@ -58,7 +59,8 @@ setup_sasp()
 	EOF
 	$DEBUG && cat $tmpfile
 	atf_check -s exit:0 -o empty $HIJACKING setkey -c < $tmpfile
-	check_sa_entries $SOCK_PEER $ip_local $ip_peer
+	# XXX it can be expired if $lifetime is very short
+	#check_sa_entries $SOCK_PEER $ip_local $ip_peer
 }
 
 test_ipsec4_lifetime()



CVS commit: src/sys/arch/mips/mips

2017-05-18 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu May 18 13:20:37 UTC 2017

Modified Files:
src/sys/arch/mips/mips: pmap_machdep.c

Log Message:
Don't use index cache operations unnecessarily.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/mips/mips/pmap_machdep.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/arch/mips/mips/pmap_machdep.c
diff -u src/sys/arch/mips/mips/pmap_machdep.c:1.18 src/sys/arch/mips/mips/pmap_machdep.c:1.19
--- src/sys/arch/mips/mips/pmap_machdep.c:1.18	Sun May 14 15:36:45 2017
+++ src/sys/arch/mips/mips/pmap_machdep.c	Thu May 18 13:20:37 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_machdep.c,v 1.18 2017/05/14 15:36:45 skrll Exp $	*/
+/*	$NetBSD: pmap_machdep.c,v 1.19 2017/05/18 13:20:37 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap_machdep.c,v 1.18 2017/05/14 15:36:45 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_machdep.c,v 1.19 2017/05/18 13:20:37 skrll Exp $");
 
 /*
  *	Manages physical address maps.
@@ -671,8 +671,6 @@ pmap_md_page_syncicache(struct vm_page *
 		return;
 
 	struct vm_page_md * const mdpg = VM_PAGE_TO_MD(pg);
-	pv_entry_t pv = >mdpg_first;
-	const register_t va = (intptr_t)trunc_page(pv->pv_va);
 
 	/*
 	 * If onproc is empty, we could do a
@@ -684,14 +682,23 @@ pmap_md_page_syncicache(struct vm_page *
 	if (MIPS_HAS_R4K_MMU) {
 		if (VM_PAGEMD_CACHED_P(mdpg)) {
 			/* This was probably mapped cached by UBC so flush it */
-			mips_dcache_wbinv_range_index(va, PAGE_SIZE);
-			mips_icache_sync_range_index(va, PAGE_SIZE);
+			pt_entry_t pte;
+			const register_t tva = pmap_md_map_ephemeral_page(pg, false,
+			VM_PROT_READ, );
+
+			UVMHIST_LOG(pmaphist, "  va %#"PRIxVADDR, tva, 0, 0, 0);
+			mips_dcache_wbinv_range(tva, PAGE_SIZE);
+			mips_icache_sync_range(tva, PAGE_SIZE);
+
+			pmap_md_unmap_ephemeral_page(pg, false, tva, pte);
 		}
 	} else {
 		mips_icache_sync_range(MIPS_PHYS_TO_KSEG0(VM_PAGE_TO_PHYS(pg)),
 		PAGE_SIZE);
 	}
 #ifdef MULTIPROCESSOR
+	pv_entry_t pv = >mdpg_first;
+	const register_t va = (intptr_t)trunc_page(pv->pv_va);
 	pmap_tlb_syncicache(va, onproc);
 #endif
 }



CVS commit: src/bin/sh

2017-05-18 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu May 18 13:53:18 UTC 2017

Modified Files:
src/bin/sh: options.c options.h sh.1

Log Message:
Command line, and "set" command options processing cleanup.

sh +c "command string"  no longer works (it must be -c)
sh +o   and   sh -o no longer work (if you could call what they did
before working.)  nb: this is without an option name.
-ooo Opt1 Opt2 Opt3 no longer works (set & cmd line), this should be
-o Opt1 -o Opt2 -o Opt3   (same with +ooo of course).
-oOpt   is now supported - option value (name of option in
this case) immediately following -o (or +o).
(as with other commands that use std opt parsing)
Both set comamnd and command line.

In addition, the output from "set +o" has shrunk dramatically, by borrowing
a trick from ksh93 (but implemented in a more traditional syntax).
"set +o" is required to produce a command (or commands) which when executed
later, will return all options to the state they were in when "set +o"
was done.  Previously that was done by generating a set command, with
every option listed (set -o opt +o other-opt ...) to set them all back
to their current setings.   Now we have a new "magic option" ("default")
which sets all options to their default values, so now set +o output
need only be "set -o default -o changed-opt ..." (only the options that
have been changed from their default values need be explicitly mentioned.)
The definition of "default value" for this is the value the shell set the
option to, after startup, after processing the command line (with any
flags, or -o option type settings), but before beginning processing any
user input (incuding startup files, like $ENV etc).

Anyone can execute "set -o default" of course, but only from a "set"
command (it makes no sense at all as a -o option to sh).   This also
causes "set +o" to be slightly more useful as a general command, as
ignoring the "set -o default" part of the result, it lists just those
options that have been altered after sh startup.  There is no +o default.
There isn't an option called "default" at all...

This causes some of the commented out text from sh.1 to become uncommented.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/bin/sh/options.c
cvs rdiff -u -r1.25 -r1.26 src/bin/sh/options.h
cvs rdiff -u -r1.141 -r1.142 src/bin/sh/sh.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/sh/options.c
diff -u src/bin/sh/options.c:1.47 src/bin/sh/options.c:1.48
--- src/bin/sh/options.c:1.47	Mon May 15 20:00:36 2017
+++ src/bin/sh/options.c	Thu May 18 13:53:18 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: options.c,v 1.47 2017/05/15 20:00:36 kre Exp $	*/
+/*	$NetBSD: options.c,v 1.48 2017/05/18 13:53:18 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)options.c	8.2 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: options.c,v 1.47 2017/05/15 20:00:36 kre Exp $");
+__RCSID("$NetBSD: options.c,v 1.48 2017/05/18 13:53:18 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -88,13 +88,23 @@ void
 procargs(int argc, char **argv)
 {
 	size_t i;
+	int psx;
 
 	argptr = argv;
 	if (argc > 0)
 		argptr++;
+
+	psx = posix;		/* save what we set it to earlier */
+	/*
+	 * option values are mostly boolean 0:off 1:on
+	 * we use 2 (just in this routine) to mean "unknown yet"
+	 */
 	for (i = 0; i < NOPTS; i++)
 		optlist[i].val = 2;
+	posix = psx;		/* restore before processing -o ... */
+
 	options(1);
+
 	if (*argptr == NULL && minusc == NULL)
 		sflag = 1;
 	if (iflag == 2 && sflag == 1 && isatty(0) && isatty(1))
@@ -107,12 +117,24 @@ procargs(int argc, char **argv)
 	if (usefork == 2)
 		usefork = 1;
 #endif
-	for (i = 0; i < NOPTS; i++)
-		if (optlist[i].val == 2)
-			optlist[i].val = 0;
 #if DEBUG == 2
-	debug = 1;
+	if (debug == 2)
+		debug = 1;
 #endif
+	/*
+	 * Any options not dealt with as special cases just above,
+	 * and which were not set on the command line, are set to
+	 * their expected default values (mostly "off")
+	 *
+	 * then as each option is initialised, save its setting now
+	 * as its "default" value for future use ("set -o default").
+	 */
+	for (i = 0; i < NOPTS; i++) {
+		if (optlist[i].val == 2)
+			optlist[i].val = optlist[i].dflt;
+		optlist[i].dflt = optlist[i].val;
+	}
+
 	arg0 = argv[0];
 	if (sflag == 0 && minusc == NULL) {
 		commandname = argv[0];
@@ -187,13 +209,20 @@ options(int cmdline)
 			break;
 		}
 		while ((c = *p++) != '\0') {
-			if (c == 'c' && cmdline) {
+			if (val == 1 && c == 'c' && cmdline) {
 /* command is after shell args*/
 minusc = empty;
 			} else if (c == 'o') {
-minus_o(*argptr, val);
-if (*argptr)
-	argptr++;
+if (*p != '\0')
+	minus_o(p, val + (cmdline ? val : 0));
+else if (*argptr)

CVS commit: src/bin/sh

2017-05-18 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu May 18 13:53:18 UTC 2017

Modified Files:
src/bin/sh: options.c options.h sh.1

Log Message:
Command line, and "set" command options processing cleanup.

sh +c "command string"  no longer works (it must be -c)
sh +o   and   sh -o no longer work (if you could call what they did
before working.)  nb: this is without an option name.
-ooo Opt1 Opt2 Opt3 no longer works (set & cmd line), this should be
-o Opt1 -o Opt2 -o Opt3   (same with +ooo of course).
-oOpt   is now supported - option value (name of option in
this case) immediately following -o (or +o).
(as with other commands that use std opt parsing)
Both set comamnd and command line.

In addition, the output from "set +o" has shrunk dramatically, by borrowing
a trick from ksh93 (but implemented in a more traditional syntax).
"set +o" is required to produce a command (or commands) which when executed
later, will return all options to the state they were in when "set +o"
was done.  Previously that was done by generating a set command, with
every option listed (set -o opt +o other-opt ...) to set them all back
to their current setings.   Now we have a new "magic option" ("default")
which sets all options to their default values, so now set +o output
need only be "set -o default -o changed-opt ..." (only the options that
have been changed from their default values need be explicitly mentioned.)
The definition of "default value" for this is the value the shell set the
option to, after startup, after processing the command line (with any
flags, or -o option type settings), but before beginning processing any
user input (incuding startup files, like $ENV etc).

Anyone can execute "set -o default" of course, but only from a "set"
command (it makes no sense at all as a -o option to sh).   This also
causes "set +o" to be slightly more useful as a general command, as
ignoring the "set -o default" part of the result, it lists just those
options that have been altered after sh startup.  There is no +o default.
There isn't an option called "default" at all...

This causes some of the commented out text from sh.1 to become uncommented.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/bin/sh/options.c
cvs rdiff -u -r1.25 -r1.26 src/bin/sh/options.h
cvs rdiff -u -r1.141 -r1.142 src/bin/sh/sh.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/bin/sh

2017-05-18 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu May 18 13:31:10 UTC 2017

Modified Files:
src/bin/sh: output.c

Log Message:
Added comma and plus to the "don't need quoting" set.  This affects
output from "sh -x" only (tracing execution), not quoting + is better,
as it makes tracing commands with + and - options, or numbers, more
consistent.

Also one minor white space change (excess indentation removed).


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/bin/sh/output.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/sh/output.c
diff -u src/bin/sh/output.c:1.35 src/bin/sh/output.c:1.36
--- src/bin/sh/output.c:1.35	Sat Mar 12 14:59:26 2016
+++ src/bin/sh/output.c	Thu May 18 13:31:10 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: output.c,v 1.35 2016/03/12 14:59:26 christos Exp $	*/
+/*	$NetBSD: output.c,v 1.36 2017/05/18 13:31:10 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)output.c	8.2 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: output.c,v 1.35 2016/03/12 14:59:26 christos Exp $");
+__RCSID("$NetBSD: output.c,v 1.36 2017/05/18 13:31:10 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -147,7 +147,7 @@ out2shstr(const char *p)
 
 
 static const char norm_chars [] = \
-"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789/-=_.'";
+"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789/+-=_,.'";
 
 static int
 inquote(const char *p)
@@ -176,7 +176,7 @@ outshstr(const char *p, struct output *f
 	 */
 	if (need_q) {
 		if ((inq = inquote(p)) != 0)
-outc('\'', file);
+			outc('\'', file);
 	} else
 		inq = 0;
 



CVS commit: src/bin/sh

2017-05-18 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu May 18 13:31:10 UTC 2017

Modified Files:
src/bin/sh: output.c

Log Message:
Added comma and plus to the "don't need quoting" set.  This affects
output from "sh -x" only (tracing execution), not quoting + is better,
as it makes tracing commands with + and - options, or numbers, more
consistent.

Also one minor white space change (excess indentation removed).


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/bin/sh/output.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/bin/sh

2017-05-18 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu May 18 13:56:58 UTC 2017

Modified Files:
src/bin/sh: redir.c sh.1

Log Message:
Allow abbreviations of option names for the "fdflags -s" command.
While documenting that, cleanup markup of the fdflags section of the
man page.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/bin/sh/redir.c
cvs rdiff -u -r1.142 -r1.143 src/bin/sh/sh.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/mips/mips

2017-05-18 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu May 18 13:20:37 UTC 2017

Modified Files:
src/sys/arch/mips/mips: pmap_machdep.c

Log Message:
Don't use index cache operations unnecessarily.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/mips/mips/pmap_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/bin/sh

2017-05-18 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu May 18 13:56:58 UTC 2017

Modified Files:
src/bin/sh: redir.c sh.1

Log Message:
Allow abbreviations of option names for the "fdflags -s" command.
While documenting that, cleanup markup of the fdflags section of the
man page.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/bin/sh/redir.c
cvs rdiff -u -r1.142 -r1.143 src/bin/sh/sh.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/sh/redir.c
diff -u src/bin/sh/redir.c:1.55 src/bin/sh/redir.c:1.56
--- src/bin/sh/redir.c:1.55	Sun May 14 17:27:05 2017
+++ src/bin/sh/redir.c	Thu May 18 13:56:58 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: redir.c,v 1.55 2017/05/14 17:27:05 kre Exp $	*/
+/*	$NetBSD: redir.c,v 1.56 2017/05/18 13:56:58 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)redir.c	8.2 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: redir.c,v 1.55 2017/05/14 17:27:05 kre Exp $");
+__RCSID("$NetBSD: redir.c,v 1.56 2017/05/18 13:56:58 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -653,42 +653,43 @@ renumber_sh_fd(struct shell_fds *fp)
 
 static const struct flgnames {
 	const char *name;
+	uint16_t minch;
 	uint32_t value;
 } nv[] = {
 #ifdef O_APPEND
-	{ "append",	O_APPEND 	},
+	{ "append",	2,	O_APPEND 	},
 #endif
 #ifdef O_ASYNC
-	{ "async",	O_ASYNC		},
+	{ "async",	2,	O_ASYNC		},
 #endif
 #ifdef O_SYNC
-	{ "sync",	O_SYNC		},
+	{ "sync",	2,	O_SYNC		},
 #endif
 #ifdef O_NONBLOCK
-	{ "nonblock",	O_NONBLOCK	},
+	{ "nonblock",	3,	O_NONBLOCK	},
 #endif
 #ifdef O_FSYNC
-	{ "fsync",	O_FSYNC		},
+	{ "fsync",	2,	O_FSYNC		},
 #endif
 #ifdef O_DSYNC
-	{ "dsync",	O_DSYNC		},
+	{ "dsync",	2,	O_DSYNC		},
 #endif
 #ifdef O_RSYNC
-	{ "rsync",	O_RSYNC		},
+	{ "rsync",	2,	O_RSYNC		},
 #endif
 #ifdef O_ALTIO
-	{ "altio",	O_ALT_IO	},
+	{ "altio",	2,	O_ALT_IO	},
 #endif
 #ifdef O_DIRECT
-	{ "direct",	O_DIRECT	},
+	{ "direct",	2,	O_DIRECT	},
 #endif
 #ifdef O_NOSIGPIPE
-	{ "nosigpipe",	O_NOSIGPIPE	},
+	{ "nosigpipe",	3,	O_NOSIGPIPE	},
 #endif
 #ifdef O_CLOEXEC
-	{ "cloexec",	O_CLOEXEC	},
+	{ "cloexec",	2,	O_CLOEXEC	},
 #endif
-	{ 0, 0 }
+	{ 0, 0, 0 }
 };
 #define ALLFLAGS (O_APPEND|O_ASYNC|O_SYNC|O_NONBLOCK|O_DSYNC|O_RSYNC|\
 O_ALT_IO|O_DIRECT|O_NOSIGPIPE|O_CLOEXEC)
@@ -752,6 +753,7 @@ parseflags(char *s, int *p, int *n)
 {
 	int *v, *w;
 	const struct flgnames *fn;
+	size_t len;
 
 	*p = 0;
 	*n = 0;
@@ -769,8 +771,9 @@ parseflags(char *s, int *p, int *n)
 			error("Missing +/- indicator before flag %s", s-1);
 		}
 			
+		len = strlen(s);
 		for (fn = nv; fn->name; fn++)
-			if (strcmp(s, fn->name) == 0) {
+			if (len >= fn->minch && strncmp(s,fn->name,len) == 0) {
 *v |= fn->value;
 *w &=~ fn->value;
 break;
@@ -846,11 +849,6 @@ fdflagscmd(int argc, char *argv[])
 		if (setflags)
 			goto msg;
 
-		/*
-		 * XXX  we should only ever operate on user defined fds
-		 * XXX  not on sh internal fds that might be open.
-		 * XXX  but for that we need to know their range (later)
-		 */
 		for (i = 0; i <= max_user_fd; i++)
 			printone(i, 0, verbose, 1);
 		return 0;

Index: src/bin/sh/sh.1
diff -u src/bin/sh/sh.1:1.142 src/bin/sh/sh.1:1.143
--- src/bin/sh/sh.1:1.142	Thu May 18 13:53:18 2017
+++ src/bin/sh/sh.1	Thu May 18 13:56:58 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sh.1,v 1.142 2017/05/18 13:53:18 kre Exp $
+.\"	$NetBSD: sh.1,v 1.143 2017/05/18 13:56:58 kre Exp $
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -1962,14 +1962,28 @@ flag interprets the
 .Ar flags
 argument as a comma separated list of file descriptor flags, each preceded
 with a
-.Dq +
+.Dq \(pl
 or a
-.Dq -
+.Dq \(mi
 indicating to set or clear the respective flag.
 Valid flags are:
-append,async,sync,nonblock,fsync,dsync,rsync,direct,nosigpipe,cloexec.
+.Cm append ,
+.Cm async ,
+.Cm sync ,
+.Cm nonblock ,
+.Cm fsync ,
+.Cm dsync ,
+.Cm rsync ,
+.Cm direct ,
+.Cm nosigpipe ,
+and
+.Cm cloexec .
+Unique abbreviations of these names, of at least 2 characters,
+may be used on input.
 See
 .Xr fcntl 2
+and
+.Xr open 2
 for more information.
 .It getopts Ar optstring var
 The



CVS commit: src/sys/dev/pci

2017-05-18 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu May 18 18:33:48 UTC 2017

Modified Files:
src/sys/dev/pci: if_re_pci.c

Log Message:
Re-enable RTKQ_IM_HW.  Timeout issues appear to be fixed since
src/sys/dev/ic/rtl8169.c r1.151


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/pci/if_re_pci.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/dev/pci/if_re_pci.c
diff -u src/sys/dev/pci/if_re_pci.c:1.47 src/sys/dev/pci/if_re_pci.c:1.48
--- src/sys/dev/pci/if_re_pci.c:1.47	Mon May  1 12:29:40 2017
+++ src/sys/dev/pci/if_re_pci.c	Thu May 18 18:33:48 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_re_pci.c,v 1.47 2017/05/01 12:29:40 jakllsch Exp $	*/
+/*	$NetBSD: if_re_pci.c,v 1.48 2017/05/18 18:33:48 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 1997, 1998-2003
@@ -46,7 +46,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_re_pci.c,v 1.47 2017/05/01 12:29:40 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_re_pci.c,v 1.48 2017/05/18 18:33:48 jakllsch Exp $");
 
 #include 
 
@@ -240,11 +240,8 @@ re_pci_attach(device_t parent, device_t 
 	t->rtk_basetype == RTK_8101E)
 		sc->sc_quirk |= RTKQ_PCIE;
 
-#if 0
-	/* This causes watchdog timeouts on some chips/systems. */
 	if (t->rtk_basetype == RTK_8168)
 		sc->sc_quirk |= RTKQ_IM_HW;
-#endif
 
 	if (pci_dma64_available(pa) && (sc->sc_quirk & RTKQ_PCIE))
 		sc->sc_dmat = pa->pa_dmat64;



CVS commit: src/sys/dev/pci

2017-05-18 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu May 18 18:33:48 UTC 2017

Modified Files:
src/sys/dev/pci: if_re_pci.c

Log Message:
Re-enable RTKQ_IM_HW.  Timeout issues appear to be fixed since
src/sys/dev/ic/rtl8169.c r1.151


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/pci/if_re_pci.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [prg-localcount2] src

2017-05-18 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri May 19 00:23:00 UTC 2017

Modified Files:
src/bin/sh [prg-localcount2]: Makefile builtins.def eval.c exec.c
jobs.c main.c miscbltin.c options.c options.h output.c parser.c
redir.c sh.1 shell.h show.c show.h syntax.h var.c
src/distrib/amd64/installimage [prg-localcount2]: Makefile
src/distrib/amd64/uefi-installimage [prg-localcount2]: Makefile
src/distrib/arc/ramdisk [prg-localcount2]: Makefile
src/distrib/notes/common [prg-localcount2]: main
src/distrib/sets/lists/base [prg-localcount2]: shl.mi
src/distrib/sets/lists/debug [prg-localcount2]: shl.mi
src/distrib/sets/lists/man [prg-localcount2]: mi
src/distrib/sets/lists/tests [prg-localcount2]: mi
src/distrib/utils/embedded/conf [prg-localcount2]: evbarm.conf
src/doc [prg-localcount2]: CHANGES
src/etc/mtree [prg-localcount2]: NetBSD.dist.tests
src/external/bsd/atf/dist/atf-sh [prg-localcount2]: atf-sh-api.3
src/external/bsd/bind/lib/libdns [prg-localcount2]: Makefile
src/external/cddl/osnet/dist/cmd/dtrace [prg-localcount2]: dtrace.1
src/external/gpl3/gcc/dist/gcc [prg-localcount2]: auto-profile.c
graphite-isl-ast-to-gimple.c system.h
src/lib/libc/gen [prg-localcount2]: assert.c signalname.3
src/lib/libc/sys [prg-localcount2]: execve.2 getdents.2 intro.2
lfs_markv.2 lfs_segclean.2 lfs_segwait.2 mmap.2 mount.2 mprotect.2
open.2 statvfs.2 sync.2 truncate.2 undelete.2
src/lib/libcurses [prg-localcount2]: curses.3
src/lib/libm [prg-localcount2]: shlib_version
src/lib/libm/compat [prg-localcount2]: compat_cabs.c compat_cabsf.c
src/lib/librumpclient [prg-localcount2]: Makefile rumpclient.h
src/lib/librumphijack [prg-localcount2]: Makefile
src/lib/librumpuser [prg-localcount2]: Makefile rumpuser_port.h
src/lib/libterminfo [prg-localcount2]: term.c
src/regress [prg-localcount2]: Makefile
src/regress/sys [prg-localcount2]: Makefile
src/regress/sys/fs [prg-localcount2]: Makefile
src/share/man/man4 [prg-localcount2]: Makefile virtio.4
src/share/man/man9 [prg-localcount2]: uvm_map.9
src/share/misc [prg-localcount2]: acronyms.comp airport
src/sys/arch/amd64/conf [prg-localcount2]: XEN3_DOMU
src/sys/arch/arm/arm [prg-localcount2]: ast.c
src/sys/arch/evbmips/conf [prg-localcount2]: LOONGSON
src/sys/arch/mips/mips [prg-localcount2]: cache.c mipsX_subr.S
pmap_machdep.c vm_machdep.c
src/sys/arch/pmax/ibus [prg-localcount2]: dz_ibus.c
src/sys/arch/pmax/pmax [prg-localcount2]: bus.c bus_dma.c
src/sys/arch/x86/include [prg-localcount2]: cpu.h specialreg.h
src/sys/arch/x86/x86 [prg-localcount2]: procfs_machdep.c
src/sys/dev [prg-localcount2]: audio.c
src/sys/dev/i2c [prg-localcount2]: axp20x.c
src/sys/dev/ic [prg-localcount2]: rtl8169.c
src/sys/dev/pci [prg-localcount2]: if_re_pci.c if_rtwn.c if_vioif.c
vioscsi.c
src/sys/dev/pci/ixgbe [prg-localcount2]: ix_txrx.c ixgbe.c ixgbe_type.h
src/sys/dev/rasops [prg-localcount2]: rasops.c
src/sys/dev/usb [prg-localcount2]: uaudio.c uts.c
src/sys/external/bsd/ipf/netinet [prg-localcount2]: ip_fil_netbsd.c
src/sys/kern [prg-localcount2]: kern_descrip.c kern_event.c vfs_mount.c
vfs_vnode.c
src/sys/modules/lua [prg-localcount2]: lua.c
src/sys/net/npf [prg-localcount2]: npf_ctl.c
src/sys/netinet [prg-localcount2]: if_arp.c in.c in_var.h ip_carp.c
ip_output.c
src/sys/netinet6 [prg-localcount2]: mld6.c
src/sys/netipsec [prg-localcount2]: ipsec.c ipsec.h ipsec_input.c
ipsec_output.c key.c key.h keydb.h keysock.c xform_ah.c xform_esp.c
xform_ipcomp.c xform_ipip.c
src/sys/opencrypto [prg-localcount2]: crypto.c cryptodev.c cryptodev.h
cryptosoft.c deflate.c ocryptodev.c
src/sys/rump/include/rump [prg-localcount2]: rump.h
src/sys/rump/librump/rumpkern [prg-localcount2]: vm.c
src/sys/uvm [prg-localcount2]: uvm_extern.h uvm_map.h
src/sys/uvm/pmap [prg-localcount2]: pmap.c pmap_segtab.c
src/tests/bin/sh [prg-localcount2]: t_expand.sh t_redircloexec.sh
src/tests/net [prg-localcount2]: net_common.sh
src/tests/net/carp [prg-localcount2]: t_basic.sh
src/tests/net/ipsec [prg-localcount2]: Makefile algorithms.sh common.sh
t_ipsec_gif.sh t_ipsec_l2tp.sh t_ipsec_transport.sh
t_ipsec_tunnel.sh t_ipsec_tunnel_odd.sh
src/tests/usr.bin [prg-localcount2]: Makefile
src/tests/usr.bin/cc [prg-localcount2]: t_hello.sh
src/usr.bin/infocmp [prg-localcount2]: infocmp.c
src/usr.bin/rump_allserver [prg-localcount2]: Makefile
  

CVS commit: [prg-localcount2] src/sys/sys

2017-05-18 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu May 18 23:52:01 UTC 2017

Modified Files:
src/sys/sys [prg-localcount2]: param.h

Log Message:
Bump version


To generate a diff of this commit:
cvs rdiff -u -r1.537.2.1 -r1.537.2.2 src/sys/sys/param.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/sys/param.h
diff -u src/sys/sys/param.h:1.537.2.1 src/sys/sys/param.h:1.537.2.2
--- src/sys/sys/param.h:1.537.2.1	Tue May  2 03:19:22 2017
+++ src/sys/sys/param.h	Thu May 18 23:52:01 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.537.2.1 2017/05/02 03:19:22 pgoyette Exp $	*/
+/*	$NetBSD: param.h,v 1.537.2.2 2017/05/18 23:52:01 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -67,7 +67,7 @@
  *	2.99.9		(299000900)
  */
 
-#define	__NetBSD_Version__	799007100	/* NetBSD 7.99.71 */
+#define	__NetBSD_Version__	799007200	/* NetBSD 7.99.72 */
 
 #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \
 (m) * 100) + (p) * 100) <= __NetBSD_Version__)



CVS commit: [prg-localcount2] src/sys/sys

2017-05-18 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu May 18 23:52:01 UTC 2017

Modified Files:
src/sys/sys [prg-localcount2]: param.h

Log Message:
Bump version


To generate a diff of this commit:
cvs rdiff -u -r1.537.2.1 -r1.537.2.2 src/sys/sys/param.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src

2017-05-18 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri May 19 00:01:34 UTC 2017

Modified Files:
src/distrib/sets/lists/comp: mi
src/doc: CHANGES
src/sys/kern: files.kern
src/sys/sys: Makefile param.h
Added Files:
src/share/man/man9: localcount.9
src/sys/kern: subr_localcount.c
src/sys/sys: localcount.h

Log Message:
Introduce new localcount(9) reference-count primitives.


To generate a diff of this commit:
cvs rdiff -u -r1.2132 -r1.2133 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.2282 -r1.2283 src/doc/CHANGES
cvs rdiff -u -r0 -r1.2 src/share/man/man9/localcount.9
cvs rdiff -u -r1.14 -r1.15 src/sys/kern/files.kern
cvs rdiff -u -r0 -r1.2 src/sys/kern/subr_localcount.c
cvs rdiff -u -r1.160 -r1.161 src/sys/sys/Makefile
cvs rdiff -u -r0 -r1.2 src/sys/sys/localcount.h
cvs rdiff -u -r1.538 -r1.539 src/sys/sys/param.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2132 src/distrib/sets/lists/comp/mi:1.2133
--- src/distrib/sets/lists/comp/mi:1.2132	Tue May  9 22:43:09 2017
+++ src/distrib/sets/lists/comp/mi	Fri May 19 00:01:33 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2132 2017/05/09 22:43:09 kamil Exp $
+#	$NetBSD: mi,v 1.2133 2017/05/19 00:01:33 pgoyette Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -2873,6 +2873,7 @@
 ./usr/include/sys/ksyms.h			comp-c-include
 ./usr/include/sys/ktrace.h			comp-c-include
 ./usr/include/sys/lkm.hcomp-obsolete		obsolete
+./usr/include/sys/localcount.h			comp-c-include
 ./usr/include/sys/localedef.h			comp-c-include
 ./usr/include/sys/lock.h			comp-c-include
 ./usr/include/sys/lockf.h			comp-c-include
@@ -10745,6 +10746,7 @@
 ./usr/share/man/cat9/le64enc.0			comp-sys-catman		.cat
 ./usr/share/man/cat9/le64toh.0			comp-sys-catman		.cat
 ./usr/share/man/cat9/linedisc.0			comp-sys-catman		.cat
+./usr/share/man/cat9/localcount.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/lock.0			comp-sys-catman		.cat
 ./usr/share/man/cat9/locking.0			comp-sys-catman		.cat
 ./usr/share/man/cat9/lockinit.0			comp-sys-catman		.cat
@@ -18192,6 +18194,7 @@
 ./usr/share/man/html9/le64enc.html		comp-sys-htmlman	html
 ./usr/share/man/html9/le64toh.html		comp-sys-htmlman	html
 ./usr/share/man/html9/linedisc.html		comp-sys-htmlman	html
+./usr/share/man/html9/localcount.html		comp-sys-htmlman	html
 ./usr/share/man/html9/lock.html			comp-sys-htmlman	html
 ./usr/share/man/html9/locking.html		comp-sys-htmlman	html
 ./usr/share/man/html9/lockinit.html		comp-sys-htmlman	html
@@ -25793,6 +25796,7 @@
 ./usr/share/man/man9/le64enc.9			comp-sys-man		.man
 ./usr/share/man/man9/le64toh.9			comp-sys-man		.man
 ./usr/share/man/man9/linedisc.9			comp-sys-man		.man
+./usr/share/man/man9/localcount.9		comp-sys-man		.man
 ./usr/share/man/man9/lock.9			comp-sys-man		.man
 ./usr/share/man/man9/locking.9			comp-sys-man		.man
 ./usr/share/man/man9/lockinit.9			comp-sys-man		.man

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2282 src/doc/CHANGES:1.2283
--- src/doc/CHANGES:1.2282	Tue May 16 23:00:42 2017
+++ src/doc/CHANGES	Fri May 19 00:01:33 2017
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2282 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2283 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -513,3 +513,4 @@ Changes from NetBSD 7.0 to NetBSD 8.0:
 	openpam(3): update to 20170430 (resedacea) [christos 20170506]
 	dhcpcd: Import dhcpcd 7.0.0-rc1 [roy 20170510]
 	vioscsi(4): Stability fixes [jdolecek 20170515]
+	localcount(9): Add localcount ref-count primitives [pgoyette 20170519]

Index: src/sys/kern/files.kern
diff -u src/sys/kern/files.kern:1.14 src/sys/kern/files.kern:1.15
--- src/sys/kern/files.kern:1.14	Wed Apr 12 20:05:54 2017
+++ src/sys/kern/files.kern	Fri May 19 00:01:33 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files.kern,v 1.14 2017/04/12 20:05:54 christos Exp $
+#	$NetBSD: files.kern,v 1.15 2017/05/19 00:01:33 pgoyette Exp $
 
 #
 # kernel sources
@@ -121,6 +121,7 @@ defparam opt_kmem.h			KMEM_GUARD_DEPTH
 file	kern/subr_kmem.c		kern
 file	kern/subr_kobj.c		kern
 file	kern/subr_kobj_vfs.c		kern
+file	kern/subr_localcount.c		kern
 file	kern/subr_lockdebug.c		kern
 file	kern/subr_log.c			kern
 file	kern/subr_lwp_specificdata.c	kern

Index: src/sys/sys/Makefile
diff -u src/sys/sys/Makefile:1.160 src/sys/sys/Makefile:1.161
--- src/sys/sys/Makefile:1.160	Fri Dec 16 22:10:12 2016
+++ src/sys/sys/Makefile	Fri May 19 00:01:34 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.160 2016/12/16 22:10:12 christos Exp $
+#	$NetBSD: Makefile,v 1.161 2017/05/19 00:01:34 pgoyette Exp $
 
 .include 
 
@@ -25,7 +25,7 @@ INCS=	acct.h agpio.h aio.h ansi.h aout_m
 	ioctl_compat.h iostat.h ipc.h \
 	joystick.h \
 	kcore.h kcpuset.h kgdb.h kmem.h ksem.h ksyms.h 

Re: CVS commit: src

2017-05-18 Thread Paul Goyette

Forgot the usual:

Welcome to 7.99.72

:)

On Fri, 19 May 2017, Paul Goyette wrote:


Module Name:src
Committed By:   pgoyette
Date:   Fri May 19 00:01:34 UTC 2017

Modified Files:
src/distrib/sets/lists/comp: mi
src/doc: CHANGES
src/sys/kern: files.kern
src/sys/sys: Makefile param.h
Added Files:
src/share/man/man9: localcount.9
src/sys/kern: subr_localcount.c
src/sys/sys: localcount.h

Log Message:
Introduce new localcount(9) reference-count primitives.


To generate a diff of this commit:
cvs rdiff -u -r1.2132 -r1.2133 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.2282 -r1.2283 src/doc/CHANGES
cvs rdiff -u -r0 -r1.2 src/share/man/man9/localcount.9
cvs rdiff -u -r1.14 -r1.15 src/sys/kern/files.kern
cvs rdiff -u -r0 -r1.2 src/sys/kern/subr_localcount.c
cvs rdiff -u -r1.160 -r1.161 src/sys/sys/Makefile
cvs rdiff -u -r0 -r1.2 src/sys/sys/localcount.h
cvs rdiff -u -r1.538 -r1.539 src/sys/sys/param.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.


!DSPAM:591e35f724602355716662!




+--+--++
| Paul Goyette | PGP Key fingerprint: | E-mail addresses:  |
| (Retired)| FA29 0E3B 35AF E8AE 6651 | paul at whooppee dot com   |
| Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd dot org |
+--+--++


CVS commit: src

2017-05-18 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri May 19 00:01:34 UTC 2017

Modified Files:
src/distrib/sets/lists/comp: mi
src/doc: CHANGES
src/sys/kern: files.kern
src/sys/sys: Makefile param.h
Added Files:
src/share/man/man9: localcount.9
src/sys/kern: subr_localcount.c
src/sys/sys: localcount.h

Log Message:
Introduce new localcount(9) reference-count primitives.


To generate a diff of this commit:
cvs rdiff -u -r1.2132 -r1.2133 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.2282 -r1.2283 src/doc/CHANGES
cvs rdiff -u -r0 -r1.2 src/share/man/man9/localcount.9
cvs rdiff -u -r1.14 -r1.15 src/sys/kern/files.kern
cvs rdiff -u -r0 -r1.2 src/sys/kern/subr_localcount.c
cvs rdiff -u -r1.160 -r1.161 src/sys/sys/Makefile
cvs rdiff -u -r0 -r1.2 src/sys/sys/localcount.h
cvs rdiff -u -r1.538 -r1.539 src/sys/sys/param.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/share/man/man9

2017-05-18 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri May 19 01:54:50 UTC 2017

Modified Files:
src/share/man/man9: localcount.9

Log Message:
Minor improvements in wording.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/share/man/man9/localcount.9

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/man/man9/localcount.9
diff -u src/share/man/man9/localcount.9:1.2 src/share/man/man9/localcount.9:1.3
--- src/share/man/man9/localcount.9:1.2	Fri May 19 00:01:33 2017
+++ src/share/man/man9/localcount.9	Fri May 19 01:54:50 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: localcount.9,v 1.2 2017/05/19 00:01:33 pgoyette Exp $
+.\"	$NetBSD: localcount.9,v 1.3 2017/05/19 01:54:50 pgoyette Exp $
 .\"
 .\" Copyright (c) 2016
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd December 8, 2016
+.Dd May 19, 2017
 .Dt LOCALCOUNT 9
 .Os
 .Sh NAME
@@ -151,7 +151,7 @@ it must be passed to
 .Fn localcount_fini
 before any other re-use.
 .Sh CODE REFERENCES
-The core of the localcount implementation is in
+The core of the localcount implementation is located in
 .Pa sys/kern/subr_localcount.c .
 .Pp
 The header file
@@ -183,10 +183,10 @@ actually waiting for the count to reach 
 .Pp
 Waiting for a
 .Nm
-reference count to reach zero is a one-shot operation.
+reference count to drain (reach zero) is a one-shot operation.
 Once the
 .Nm
-has been waited for, no further operations are allowed until the
+has been drained, no further operations are allowed until the
 .Nm
 has been re-initialized.
 



CVS commit: src/share/man/man9

2017-05-18 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri May 19 01:54:50 UTC 2017

Modified Files:
src/share/man/man9: localcount.9

Log Message:
Minor improvements in wording.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/share/man/man9/localcount.9

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/kern

2017-05-18 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri May 19 02:20:24 UTC 2017

Modified Files:
src/sys/kern: subr_localcount.c

Log Message:
Fix a comment - in localcount_fini(), we don't care whether it was the
caller or some other code that drained the localcount;  all we care is
that it has been drained.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/kern/subr_localcount.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/kern/subr_localcount.c
diff -u src/sys/kern/subr_localcount.c:1.2 src/sys/kern/subr_localcount.c:1.3
--- src/sys/kern/subr_localcount.c:1.2	Fri May 19 00:01:33 2017
+++ src/sys/kern/subr_localcount.c	Fri May 19 02:20:24 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_localcount.c,v 1.2 2017/05/19 00:01:33 pgoyette Exp $	*/
+/*	$NetBSD: subr_localcount.c,v 1.3 2017/05/19 02:20:24 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -44,7 +44,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_localcount.c,v 1.2 2017/05/19 00:01:33 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_localcount.c,v 1.3 2017/05/19 02:20:24 pgoyette Exp $");
 
 #include 
 #include 
@@ -138,7 +138,7 @@ localcount_drain(struct localcount *lc, 
  * localcount_fini(lc)
  *
  *	Finalize a localcount object, releasing any memory allocated
- *	for it.  Caller must have already called localcount_drain.
+ *	for it.  The localcount object must already have been drained.
  */
 void
 localcount_fini(struct localcount *lc)



CVS commit: src/sys/kern

2017-05-18 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri May 19 02:20:24 UTC 2017

Modified Files:
src/sys/kern: subr_localcount.c

Log Message:
Fix a comment - in localcount_fini(), we don't care whether it was the
caller or some other code that drained the localcount;  all we care is
that it has been drained.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/kern/subr_localcount.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/net

2017-05-18 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri May 19 02:56:58 UTC 2017

Modified Files:
src/tests/net: net_common.sh

Log Message:
Enable debug logging of kernels such as ARP and ND if $DEUBG=true


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/tests/net/net_common.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/net

2017-05-18 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri May 19 02:56:58 UTC 2017

Modified Files:
src/tests/net: net_common.sh

Log Message:
Enable debug logging of kernels such as ARP and ND if $DEUBG=true


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/tests/net/net_common.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/net_common.sh
diff -u src/tests/net/net_common.sh:1.16 src/tests/net/net_common.sh:1.17
--- src/tests/net/net_common.sh:1.16	Wed May 17 06:30:15 2017
+++ src/tests/net/net_common.sh	Fri May 19 02:56:58 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: net_common.sh,v 1.16 2017/05/17 06:30:15 ozaki-r Exp $
+#	$NetBSD: net_common.sh,v 1.17 2017/05/19 02:56:58 ozaki-r Exp $
 #
 # Copyright (c) 2016 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -185,16 +185,31 @@ _rump_server_socks=./.__socks
 _rump_server_ifaces=./.__ifaces
 _rump_server_buses=./.__buses
 
+DEBUG_SYSCTL_ENTRIES="net.inet.arp.debug net.inet6.icmp6.nd6_debug \
+net.inet.ipsec.debug"
+
 _rump_server_start_common()
 {
 	local sock=$1
 	local libs=
+	local backup=$RUMP_SERVER
 
 	shift 1
 	libs="$*"
 
 	atf_check -s exit:0 rump_server $libs $sock
 
+	if $DEBUG; then
+		# Enable debugging features in the kernel
+		export RUMP_SERVER=$sock
+		for ent in $DEBUG_SYSCTL_ENTRIES; do
+			if rump.sysctl -q $ent; then
+atf_check -s exit:0 rump.sysctl -q -w $ent=1
+			fi
+		done
+		export RUMP_SERVER=$backup
+	fi
+
 	echo $sock >> $_rump_server_socks
 	$DEBUG && cat $_rump_server_socks
 }



CVS commit: src/share/man/man9

2017-05-18 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri May 19 03:33:31 UTC 2017

Modified Files:
src/share/man/man9: Makefile

Log Message:
Missed this during the localcount(9) import:

Add localcount(9) man-page - fix the build


To generate a diff of this commit:
cvs rdiff -u -r1.412 -r1.413 src/share/man/man9/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/share/man/man9

2017-05-18 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri May 19 03:33:31 UTC 2017

Modified Files:
src/share/man/man9: Makefile

Log Message:
Missed this during the localcount(9) import:

Add localcount(9) man-page - fix the build


To generate a diff of this commit:
cvs rdiff -u -r1.412 -r1.413 src/share/man/man9/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/man/man9/Makefile
diff -u src/share/man/man9/Makefile:1.412 src/share/man/man9/Makefile:1.413
--- src/share/man/man9/Makefile:1.412	Mon May  1 23:07:14 2017
+++ src/share/man/man9/Makefile	Fri May 19 03:33:31 2017
@@ -1,4 +1,4 @@
-#   $NetBSD: Makefile,v 1.412 2017/05/01 23:07:14 pgoyette Exp $
+#   $NetBSD: Makefile,v 1.413 2017/05/19 03:33:31 pgoyette Exp $
 
 #	Makefile for section 9 (kernel function and variable) manual pages.
 
@@ -32,7 +32,7 @@ MAN=	accept_filter.9 accf_data.9 accf_ht
 	kcpuset.9 kernhist.9 klua_lock.9 klua_mod_register.9 kmem.9 kpause.9 \
 	kfilter_register.9 knote.9 \
 	kprintf.9 kthread.9 linedisc.9 lock.9 locking.9 log.9 ltsleep.9 \
-	LWP_CACHE_CREDS.9 \
+	localcount.9 LWP_CACHE_CREDS.9 \
 	makeiplcookie.9 \
 	malloc.9 mb.9 mbuf.9 mca.9 memcmp.9 memcpy.9 memoryallocators.9 \
 	memmove.9 memset.9 \



CVS commit: src/bin/sh

2017-05-18 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu May 18 13:28:00 UTC 2017

Modified Files:
src/bin/sh: main.c

Log Message:
NFC: added a minor comment (and enev then, in DEBUG code only)


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/bin/sh/main.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/sh/main.c
diff -u src/bin/sh/main.c:1.68 src/bin/sh/main.c:1.69
--- src/bin/sh/main.c:1.68	Sat Apr 22 16:02:39 2017
+++ src/bin/sh/main.c	Thu May 18 13:28:00 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.68 2017/04/22 16:02:39 kre Exp $	*/
+/*	$NetBSD: main.c,v 1.69 2017/05/18 13:28:00 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 19
 #if 0
 static char sccsid[] = "@(#)main.c	8.7 (Berkeley) 7/19/95";
 #else
-__RCSID("$NetBSD: main.c,v 1.68 2017/04/22 16:02:39 kre Exp $");
+__RCSID("$NetBSD: main.c,v 1.69 2017/05/18 13:28:00 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -173,7 +173,7 @@ main(int argc, char **argv)
 	handler = 
 #ifdef DEBUG
 #if DEBUG == 2
-	debug = 1;
+	debug = 1;	/* this may be reset by procargs() later */
 #endif
 	opentrace();
 	trputs("Shell args:  ");  trargs(argv);



CVS commit: src/bin/sh

2017-05-18 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu May 18 13:28:00 UTC 2017

Modified Files:
src/bin/sh: main.c

Log Message:
NFC: added a minor comment (and enev then, in DEBUG code only)


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/bin/sh/main.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/usb

2017-05-18 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Fri May 19 04:16:06 UTC 2017

Modified Files:
src/sys/dev/usb: uaudio.c

Log Message:
Fix locking botch.  Ensure that sc_lock is still held when exiting
trigger_[input/output].


To generate a diff of this commit:
cvs rdiff -u -r1.148 -r1.149 src/sys/dev/usb/uaudio.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/usb

2017-05-18 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Fri May 19 04:16:06 UTC 2017

Modified Files:
src/sys/dev/usb: uaudio.c

Log Message:
Fix locking botch.  Ensure that sc_lock is still held when exiting
trigger_[input/output].


To generate a diff of this commit:
cvs rdiff -u -r1.148 -r1.149 src/sys/dev/usb/uaudio.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/dev/usb/uaudio.c
diff -u src/sys/dev/usb/uaudio.c:1.148 src/sys/dev/usb/uaudio.c:1.149
--- src/sys/dev/usb/uaudio.c:1.148	Tue May 16 23:49:43 2017
+++ src/sys/dev/usb/uaudio.c	Fri May 19 04:16:06 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: uaudio.c,v 1.148 2017/05/16 23:49:43 nat Exp $	*/
+/*	$NetBSD: uaudio.c,v 1.149 2017/05/19 04:16:06 nat Exp $	*/
 
 /*
  * Copyright (c) 1999, 2012 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.148 2017/05/16 23:49:43 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.149 2017/05/19 04:16:06 nat Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -2603,6 +2603,7 @@ uaudio_trigger_input(void *addr, void *s
 	mutex_exit(>sc_lock);
 	err = uaudio_chan_open(sc, ch);
 	if (err) {
+		mutex_enter(>sc_lock);
 		mutex_enter(>sc_intr_lock);
 		return EIO;
 	}
@@ -2610,6 +2611,7 @@ uaudio_trigger_input(void *addr, void *s
 	err = uaudio_chan_alloc_buffers(sc, ch);
 	if (err) {
 		uaudio_chan_close(sc, ch);
+		mutex_enter(>sc_lock);
 		mutex_enter(>sc_intr_lock);
 		return EIO;
 	}
@@ -2655,6 +2657,7 @@ uaudio_trigger_output(void *addr, void *
 	mutex_exit(>sc_lock);
 	err = uaudio_chan_open(sc, ch);
 	if (err) {
+		mutex_enter(>sc_lock);
 		mutex_enter(>sc_intr_lock);
 		return EIO;
 	}
@@ -2662,6 +2665,7 @@ uaudio_trigger_output(void *addr, void *
 	err = uaudio_chan_alloc_buffers(sc, ch);
 	if (err) {
 		uaudio_chan_close(sc, ch);
+		mutex_enter(>sc_lock);
 		mutex_enter(>sc_intr_lock);
 		return EIO;
 	}



CVS commit: src/sys/netipsec

2017-05-18 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri May 19 04:34:09 UTC 2017

Modified Files:
src/sys/netipsec: ipsec.c ipsec.h ipsec_input.c ipsec_mbuf.c
ipsec_output.c

Log Message:
Introduce IPSECLOG and replace ipseclog and DPRINTF with it


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/sys/netipsec/ipsec.c
cvs rdiff -u -r1.47 -r1.48 src/sys/netipsec/ipsec.h \
src/sys/netipsec/ipsec_output.c
cvs rdiff -u -r1.42 -r1.43 src/sys/netipsec/ipsec_input.c
cvs rdiff -u -r1.15 -r1.16 src/sys/netipsec/ipsec_mbuf.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/netipsec/ipsec.c
diff -u src/sys/netipsec/ipsec.c:1.91 src/sys/netipsec/ipsec.c:1.92
--- src/sys/netipsec/ipsec.c:1.91	Tue May 16 07:25:57 2017
+++ src/sys/netipsec/ipsec.c	Fri May 19 04:34:09 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsec.c,v 1.91 2017/05/16 07:25:57 ozaki-r Exp $	*/
+/*	$NetBSD: ipsec.c,v 1.92 2017/05/19 04:34:09 ozaki-r Exp $	*/
 /*	$FreeBSD: /usr/local/www/cvsroot/FreeBSD/src/sys/netipsec/ipsec.c,v 1.2.2.2 2003/07/01 01:38:13 sam Exp $	*/
 /*	$KAME: ipsec.c,v 1.103 2001/05/24 07:14:18 sakane Exp $	*/
 
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.91 2017/05/16 07:25:57 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.92 2017/05/19 04:34:09 ozaki-r Exp $");
 
 /*
  * IPsec controller part.
@@ -389,8 +389,8 @@ key_allocsp_default(int af, const char *
 
 	if (sp->policy != IPSEC_POLICY_DISCARD &&
 		sp->policy != IPSEC_POLICY_NONE) {
-		ipseclog((LOG_INFO, "fixed system default policy: %d->%d\n",
-		sp->policy, IPSEC_POLICY_NONE));
+		IPSECLOG(LOG_INFO, "fixed system default policy: %d->%d\n",
+		sp->policy, IPSEC_POLICY_NONE);
 		sp->policy = IPSEC_POLICY_NONE;
 	}
 	sp->refcnt++;
@@ -525,8 +525,8 @@ ipsec_getpolicybysock(struct mbuf *m, u_
 			break;
 
 		default:
-			ipseclog((LOG_ERR, "%s: Invalid policy for PCB %d\n",
-			__func__, currsp->policy));
+			IPSECLOG(LOG_ERR, "Invalid policy for PCB %d\n",
+			currsp->policy);
 			*error = EINVAL;
 			return NULL;
 		}
@@ -535,9 +535,9 @@ ipsec_getpolicybysock(struct mbuf *m, u_
 		if (sp == NULL) {		/* no SP found */
 			switch (currsp->policy) {
 			case IPSEC_POLICY_BYPASS:
-ipseclog((LOG_ERR, "%s: Illegal policy for "
-"non-priviliged defined %d\n", __func__,
-currsp->policy));
+IPSECLOG(LOG_ERR, "Illegal policy for "
+"non-priviliged defined %d\n",
+currsp->policy);
 *error = EINVAL;
 return NULL;
 
@@ -551,8 +551,8 @@ ipsec_getpolicybysock(struct mbuf *m, u_
 break;
 
 			default:
-ipseclog((LOG_ERR, "%s: Invalid policy for "
-"PCB %d\n", __func__, currsp->policy));
+IPSECLOG(LOG_ERR, "Invalid policy for "
+"PCB %d\n", currsp->policy);
 *error = EINVAL;
 return NULL;
 			}
@@ -592,8 +592,7 @@ ipsec_getpolicybyaddr(struct mbuf *m, u_
 	/* Make an index to look for a policy. */
 	*error = ipsec_setspidx(m, , (flag & IP_FORWARDING) ? 0 : 1);
 	if (*error != 0) {
-		DPRINTF(("%s: setpidx failed, dir %u flag %u\n", __func__,
-		dir, flag));
+		IPSECLOG(LOG_DEBUG, "setpidx failed, dir %u flag %u\n", dir, flag);
 		memset(, 0, sizeof (spidx));
 		return NULL;
 	}
@@ -652,7 +651,7 @@ ipsec4_checkpolicy(struct mbuf *m, u_int
 	if (*error != 0) {
 		KEY_FREESP();
 		sp = NULL;
-		DPRINTF(("%s: done, error %d\n", __func__, *error));
+		IPSECLOG(LOG_DEBUG, "done, error %d\n", *error);
 	}
 	return sp;
 }
@@ -898,7 +897,7 @@ ipsec6_checkpolicy(struct mbuf *m, u_int
 	if (*error != 0) {
 		KEY_FREESP();
 		sp = NULL;
-		DPRINTF(("%s: done, error %d\n", __func__, *error));
+		IPSECLOG(LOG_DEBUG, "done, error %d\n", *error);
 	}
 	return sp;
 }
@@ -1279,7 +1278,7 @@ ipsec_init_policy(struct socket *so, str
 
 	new = kmem_intr_zalloc(sizeof(*new), KM_NOSLEEP);
 	if (new == NULL) {
-		ipseclog((LOG_DEBUG, "%s: No more memory.\n", __func__));
+		IPSECLOG(LOG_DEBUG, "No more memory.\n");
 		return ENOBUFS;
 	}
 
@@ -1458,7 +1457,7 @@ ipsec_get_policy(struct secpolicy *polic
 
 	*mp = key_sp2msg(policy);
 	if (!*mp) {
-		ipseclog((LOG_DEBUG, "%s: No more memory.\n", __func__));
+		IPSECLOG(LOG_DEBUG, "No more memory.\n");
 		return ENOBUFS;
 	}
 
@@ -1498,8 +1497,8 @@ ipsec4_set_policy(struct inpcb *inp, int
 		policy = >inp_sp->sp_out;
 		break;
 	default:
-		ipseclog((LOG_ERR, "%s: invalid direction=%u\n", __func__,
-		xpl->sadb_x_policy_dir));
+		IPSECLOG(LOG_ERR, "invalid direction=%u\n",
+		xpl->sadb_x_policy_dir);
 		return EINVAL;
 	}
 
@@ -1530,8 +1529,8 @@ ipsec4_get_policy(struct inpcb *inp, con
 		policy = inp->inp_sp->sp_out;
 		break;
 	default:
-		ipseclog((LOG_ERR, "%s: invalid direction=%u\n", __func__,
-		xpl->sadb_x_policy_dir));
+		IPSECLOG(LOG_ERR, "invalid direction=%u\n",
+		xpl->sadb_x_policy_dir);
 		return EINVAL;
 	}
 
@@ -1588,8 +1587,8 @@ ipsec6_set_policy(struct in6pcb 

CVS commit: src/sys/netipsec

2017-05-18 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri May 19 04:34:09 UTC 2017

Modified Files:
src/sys/netipsec: ipsec.c ipsec.h ipsec_input.c ipsec_mbuf.c
ipsec_output.c

Log Message:
Introduce IPSECLOG and replace ipseclog and DPRINTF with it


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/sys/netipsec/ipsec.c
cvs rdiff -u -r1.47 -r1.48 src/sys/netipsec/ipsec.h \
src/sys/netipsec/ipsec_output.c
cvs rdiff -u -r1.42 -r1.43 src/sys/netipsec/ipsec_input.c
cvs rdiff -u -r1.15 -r1.16 src/sys/netipsec/ipsec_mbuf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/usb

2017-05-18 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Fri May 19 04:20:45 UTC 2017

Modified Files:
src/sys/dev/usb: uaudio.c

Log Message:
Release sc_intr_lock between successive calls to audio[p/r]int to allow
mixing to occur.


To generate a diff of this commit:
cvs rdiff -u -r1.149 -r1.150 src/sys/dev/usb/uaudio.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/dev/usb/uaudio.c
diff -u src/sys/dev/usb/uaudio.c:1.149 src/sys/dev/usb/uaudio.c:1.150
--- src/sys/dev/usb/uaudio.c:1.149	Fri May 19 04:16:06 2017
+++ src/sys/dev/usb/uaudio.c	Fri May 19 04:20:45 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: uaudio.c,v 1.149 2017/05/19 04:16:06 nat Exp $	*/
+/*	$NetBSD: uaudio.c,v 1.150 2017/05/19 04:20:45 nat Exp $	*/
 
 /*
  * Copyright (c) 1999, 2012 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.149 2017/05/19 04:16:06 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.150 2017/05/19 04:20:45 nat Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -2889,14 +2889,14 @@ uaudio_chan_pintr(struct usbd_xfer *xfer
 #endif
 
 	ch->transferred += cb->size;
-	mutex_enter(>sc->sc_intr_lock);
 	/* Call back to upper layer */
 	while (ch->transferred >= ch->blksize) {
+		mutex_enter(>sc->sc_intr_lock);
 		ch->transferred -= ch->blksize;
 		DPRINTFN(5, "call %p(%p)\n", ch->intr, ch->arg);
 		ch->intr(ch->arg);
+		mutex_exit(>sc->sc_intr_lock);
 	}
-	mutex_exit(>sc->sc_intr_lock);
 
 	/* start next transfer */
 	uaudio_chan_ptransfer(ch);
@@ -2991,13 +2991,13 @@ uaudio_chan_rintr(struct usbd_xfer *xfer
 
 	/* Call back to upper layer */
 	ch->transferred += count;
-	mutex_enter(>sc->sc_intr_lock);
 	while (ch->transferred >= ch->blksize) {
+		mutex_enter(>sc->sc_intr_lock);
 		ch->transferred -= ch->blksize;
 		DPRINTFN(5, "call %p(%p)\n", ch->intr, ch->arg);
 		ch->intr(ch->arg);
+		mutex_exit(>sc->sc_intr_lock);
 	}
-	mutex_exit(>sc->sc_intr_lock);
 
 	/* start next transfer */
 	uaudio_chan_rtransfer(ch);



CVS commit: src/sys/dev/usb

2017-05-18 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Fri May 19 04:20:45 UTC 2017

Modified Files:
src/sys/dev/usb: uaudio.c

Log Message:
Release sc_intr_lock between successive calls to audio[p/r]int to allow
mixing to occur.


To generate a diff of this commit:
cvs rdiff -u -r1.149 -r1.150 src/sys/dev/usb/uaudio.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/netipsec

2017-05-18 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri May 19 04:39:25 UTC 2017

Modified Files:
src/sys/netipsec: key.c

Log Message:
Use kmem_intr_free in key_freesaval which can be called in softint


To generate a diff of this commit:
cvs rdiff -u -r1.132 -r1.133 src/sys/netipsec/key.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/netipsec

2017-05-18 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri May 19 04:39:25 UTC 2017

Modified Files:
src/sys/netipsec: key.c

Log Message:
Use kmem_intr_free in key_freesaval which can be called in softint


To generate a diff of this commit:
cvs rdiff -u -r1.132 -r1.133 src/sys/netipsec/key.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/netipsec/key.c
diff -u src/sys/netipsec/key.c:1.132 src/sys/netipsec/key.c:1.133
--- src/sys/netipsec/key.c:1.132	Wed May 17 02:19:09 2017
+++ src/sys/netipsec/key.c	Fri May 19 04:39:25 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: key.c,v 1.132 2017/05/17 02:19:09 ozaki-r Exp $	*/
+/*	$NetBSD: key.c,v 1.133 2017/05/19 04:39:25 ozaki-r Exp $	*/
 /*	$FreeBSD: src/sys/netipsec/key.c,v 1.3.2.3 2004/02/14 22:23:23 bms Exp $	*/
 /*	$KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane Exp $	*/
 
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.132 2017/05/17 02:19:09 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.133 2017/05/19 04:39:25 ozaki-r Exp $");
 
 /*
  * This code is referd to RFC 2367
@@ -3136,30 +3136,30 @@ key_freesaval(struct secasvar *sav)
 {
 
 	if (sav->replay != NULL) {
-		kmem_free(sav->replay, sav->replay_len);
+		kmem_intr_free(sav->replay, sav->replay_len);
 		sav->replay = NULL;
 		sav->replay_len = 0;
 	}
 	if (sav->key_auth != NULL) {
-		kmem_free(sav->key_auth, sav->key_auth_len);
+		kmem_intr_free(sav->key_auth, sav->key_auth_len);
 		sav->key_auth = NULL;
 		sav->key_auth_len = 0;
 	}
 	if (sav->key_enc != NULL) {
-		kmem_free(sav->key_enc, sav->key_enc_len);
+		kmem_intr_free(sav->key_enc, sav->key_enc_len);
 		sav->key_enc = NULL;
 		sav->key_enc_len = 0;
 	}
 	if (sav->lft_c != NULL) {
-		kmem_free(sav->lft_c, sizeof(*(sav->lft_c)));
+		kmem_intr_free(sav->lft_c, sizeof(*(sav->lft_c)));
 		sav->lft_c = NULL;
 	}
 	if (sav->lft_h != NULL) {
-		kmem_free(sav->lft_h, sizeof(*(sav->lft_h)));
+		kmem_intr_free(sav->lft_h, sizeof(*(sav->lft_h)));
 		sav->lft_h = NULL;
 	}
 	if (sav->lft_s != NULL) {
-		kmem_free(sav->lft_s, sizeof(*(sav->lft_s)));
+		kmem_intr_free(sav->lft_s, sizeof(*(sav->lft_s)));
 		sav->lft_s = NULL;
 	}
 }