CVS commit: src/tools/compat

2016-02-29 Thread Aymeric Vincent
Module Name:src
Committed By:   aymeric
Date:   Tue Mar  1 06:48:55 UTC 2016

Modified Files:
src/tools/compat: Makefile

Log Message:
remove regsub.c from the list of files to build because it unbreaks the build
and this API is not yet endorsed. OK christos@


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/tools/compat/Makefile

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

Modified files:

Index: src/tools/compat/Makefile
diff -u src/tools/compat/Makefile:1.78 src/tools/compat/Makefile:1.79
--- src/tools/compat/Makefile:1.78	Mon Feb 29 22:19:29 2016
+++ src/tools/compat/Makefile	Tue Mar  1 06:48:55 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.78 2016/02/29 22:19:29 aymeric Exp $
+#	$NetBSD: Makefile,v 1.79 2016/03/01 06:48:55 aymeric Exp $
 
 HOSTLIB=	nbcompat
 
@@ -14,7 +14,7 @@ SRCS=		atoll.c basename.c cdbr.c cdbw.c 
 		mkstemp.c pread.c putc_unlocked.c pwcache.c pwrite.c \
 		pw_scan.c \
 		raise_default_signal.c reallocarr.c rmd160.c rmd160hl.c \
-		regcomp.c regerror.c regexec.c regfree.c regsub.c \
+		regcomp.c regerror.c regexec.c regfree.c \
 		setenv.c setgroupent.c \
 		setpassent.c setprogname.c sha1.c sha1hl.c sha2.c \
 		sha256hl.c sha384hl.c sha512hl.c snprintb.c snprintf.c \



CVS commit: src/tests/bin/sh

2016-02-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Feb 29 23:52:53 UTC 2016

Modified Files:
src/tests/bin/sh: t_here.sh

Log Message:
more tests from kre


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/bin/sh/t_here.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/bin/sh/t_here.sh
diff -u src/tests/bin/sh/t_here.sh:1.1 src/tests/bin/sh/t_here.sh:1.2
--- src/tests/bin/sh/t_here.sh:1.1	Sat Mar 17 12:33:11 2012
+++ src/tests/bin/sh/t_here.sh	Mon Feb 29 18:52:53 2016
@@ -1,4 +1,4 @@
-# $NetBSD: t_here.sh,v 1.1 2012/03/17 16:33:11 jruoho Exp $
+# $NetBSD: t_here.sh,v 1.2 2016/02/29 23:52:53 christos Exp $
 #
 # Copyright (c) 2007 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -24,50 +24,238 @@
 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 # POSSIBILITY OF SUCH DAMAGE.
 #
+# the implementation of "sh" to test
+: ${TEST_SH:="/bin/sh"}
 
 nl='
 '
 
 check()
 {
-	SVIFS="$IFS"
-	result="$(eval $1)"
-	# Remove newlines
+	fail=false
+	TEMP_FILE=$( mktemp OUT.XX )
+
+	# our local shell (ATF_SHELL) better do quoting correctly...
+	# some of the tests expect us to expand $nl internally...
+	CMD="nl='${nl}'; $1"
+
+echo "${CMD}" >/tmp/CMD
+	rm -f trace.*
+	result="$( ${TEST_SH} -c "${CMD}" 2>"${TEMP_FILE}" )"
+	STATUS=$?
+
+	if [ -s "${O_FILE}" ]; then
+		echo >&2 "unexpected shell output noise on stdout"
+		cat "${O_FILE}" >&2
+		fail=true
+	fi
+
+	if [ "${STATUS}" -ne "$3" ]; then
+		echo >&2 "expected exit code $3, got ${STATUS}"
+
+		# don't actually fail just because of wrong exit code
+		# unless we either expected, or received "good"
+		case "$3/${STATUS}" in
+		(*/0|0/*) fail=true;;
+		esac
+	fi
+
+	if [ "$3" -eq 0 ]; then
+		if [ -s "${TEMP_FILE}" ]; then
+			echo >&2 "Messages produced on stderr unexpected..."
+			cat "${TEMP_FILE}" >&2
+			fail=true
+		fi
+	else
+		if ! [ -s "${TEMP_FILE}" ]; then
+			echo >&2 "Expected messages on stderr, nothing produced"
+			fail=true
+		fi
+	fi
+	rm -f "${TEMP_FILE}"
+
+	# Remove newlines (use local shell for this)
 	oifs="$IFS"
 	IFS="$nl"
 	result="$(echo $result)"
 	IFS="$oifs"
 	if [ "$2" != "$result" ]
 	then
-		atf_fail "expected [$2], found [$result]"
+		echo >&2 "Expected output '$2', received '$result'"
+		fail=true
 	fi
-	IFS="$SVIFS"
+
+	$fail && atf_fail "test of '$1' failed"
+	return 0
 }
 
-atf_test_case all
-all_head() {
+atf_test_case do_simple
+do_simple_head() {
 	atf_set "descr" "Basic tests for here documents"
 }
-all_body() {
+do_simple_body() {
 	y=x
 
 	IFS=
-	check 'x=`cat <

CVS commit: src/bin/sh

2016-02-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Feb 29 23:52:04 UTC 2016

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

Log Message:
Even more debugging improvements (from kre)


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 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.31 src/bin/sh/show.c:1.32
--- src/bin/sh/show.c:1.31	Sun Feb 28 18:12:23 2016
+++ src/bin/sh/show.c	Mon Feb 29 18:52:04 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: show.c,v 1.31 2016/02/28 23:12:23 christos Exp $	*/
+/*	$NetBSD: show.c,v 1.32 2016/02/29 23:52:04 christos Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)show.c	8.3 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: show.c,v 1.31 2016/02/28 23:12:23 christos Exp $");
+__RCSID("$NetBSD: show.c,v 1.32 2016/02/29 23:52:04 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -63,6 +63,8 @@ FILE *tracefile;
 #ifdef DEBUG
 static int shtree(union node *, int, int, char *, FILE*);
 static int shcmd(union node *, FILE *);
+static int shsubsh(union node *, FILE *);
+static int shredir(union node *, FILE *, int);
 static int sharg(union node *, FILE *);
 static int indent(int, char *, FILE *);
 static void trstring(char *);
@@ -142,6 +144,11 @@ binop:
 		if (nl || len >= 60)
 			len = 0, fputc('\n', fp);
 		break;
+	case NSUBSHELL:
+		len += shsubsh(n, fp);
+		if (nl && len > 0)
+			len = 0, putc('\n', fp);
+		break;
 	default:
 #ifdef NODETYPENAME
 		len += fprintf(fp, "", n->type,
@@ -174,6 +181,31 @@ shcmd(union node *cmd, FILE *fp)
 		len += sharg(np, fp);
 		first = 0;
 	}
+	return len + shredir(cmd, fp, first);
+}
+
+static int
+shsubsh(union node *cmd, FILE *fp)
+{
+	int len = 6;
+
+	fputs(" ( ", fp);
+	len += shtree(cmd->nredir.n, -1, 0, NULL, fp);
+	fputs(" ) ", fp);
+	len += shredir(cmd, fp, 1);
+
+	return len;
+}
+
+static int
+shredir(union node *cmd, FILE *fp, int first)
+{
+	union node *np;
+	const char *s;
+	int dftfd;
+	int len = 0;
+	char buf[106];
+
 	for (np = cmd->ncmd.redirect ; np ; np = np->nfile.next) {
 		if (! first)
 			len++, fputc(' ', fp);
@@ -199,7 +231,14 @@ shcmd(union node *cmd, FILE *fp)
 			if (np->nfile.type == NHERE)
 fputc('\\', fp);
 			fputs("!!!\n", fp);
-			fputs(np->nhere.doc->narg.text, fp);
+			s = np->nhere.doc->narg.text;
+			if (strlen(s) > 100) {
+memmove(buf, s, 100);
+buf[100] = '\0';
+strcat(buf, " ...");
+s = buf;
+			}
+			fputs(s, fp);
 			fputs("!!!", fp);
 			len = 3;
 		} else {



CVS commit: src/bin/sh

2016-02-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Feb 29 23:51:36 UTC 2016

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

Log Message:
Complete implementation of the noexec option (-n) including
disabling noexec, if the shell is interactive, each time that
a new command is about to be read.  Also correct the -I
(ignoreeof) option so that it only applies to interactive shells,
as required by posix. (from kre)


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/bin/sh/eval.c
cvs rdiff -u -r1.60 -r1.61 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/eval.c
diff -u src/bin/sh/eval.c:1.114 src/bin/sh/eval.c:1.115
--- src/bin/sh/eval.c:1.114	Sat Feb 27 13:34:12 2016
+++ src/bin/sh/eval.c	Mon Feb 29 18:51:36 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: eval.c,v 1.114 2016/02/27 18:34:12 christos Exp $	*/
+/*	$NetBSD: eval.c,v 1.115 2016/02/29 23:51:36 christos Exp $	*/
 
 /*-
  * Copyright (c) 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)eval.c	8.9 (Berkeley) 6/8/95";
 #else
-__RCSID("$NetBSD: eval.c,v 1.114 2016/02/27 18:34:12 christos Exp $");
+__RCSID("$NetBSD: eval.c,v 1.115 2016/02/29 23:51:36 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -243,37 +243,38 @@ evaltree(union node *n, int flags)
 	bool do_etest;
 
 	do_etest = false;
-	if (n == NULL) {
-		TRACE(("evaltree(NULL) called\n"));
-		exitstatus = 0;
+	if (n == NULL || nflag) {
+		TRACE(("evaltree(%s) called\n", n == NULL ? "NULL" : "-n"));
+		if (nflag == 0)
+			exitstatus = 0;
 		goto out;
 	}
 #ifndef SMALL
 	displayhist = 1;	/* show history substitutions done with fc */
 #endif
 #ifdef NODETYPENAME
-	TRACE(("pid %d, evaltree(%p: %s(%d), %d) called\n",
+	TRACE(("pid %d, evaltree(%p: %s(%d), %#x) called\n",
 	getpid(), n, NODETYPENAME(n->type), n->type, flags));
 #else
-	TRACE(("pid %d, evaltree(%p: %d, %d) called\n",
+	TRACE(("pid %d, evaltree(%p: %d, %#x) called\n",
 	getpid(), n, n->type, flags));
 #endif
 	switch (n->type) {
 	case NSEMI:
 		evaltree(n->nbinary.ch1, flags & EV_TESTED);
-		if (evalskip)
+		if (nflag || evalskip)
 			goto out;
 		evaltree(n->nbinary.ch2, flags);
 		break;
 	case NAND:
 		evaltree(n->nbinary.ch1, EV_TESTED);
-		if (evalskip || exitstatus != 0)
+		if (nflag || evalskip || exitstatus != 0)
 			goto out;
 		evaltree(n->nbinary.ch2, flags);
 		break;
 	case NOR:
 		evaltree(n->nbinary.ch1, EV_TESTED);
-		if (evalskip || exitstatus == 0)
+		if (nflag || evalskip || exitstatus == 0)
 			goto out;
 		evaltree(n->nbinary.ch2, flags);
 		break;
@@ -292,7 +293,7 @@ evaltree(union node *n, int flags)
 		break;
 	case NIF: {
 		evaltree(n->nif.test, EV_TESTED);
-		if (evalskip)
+		if (nflag || evalskip)
 			goto out;
 		if (exitstatus == 0)
 			evaltree(n->nif.ifpart, flags);
@@ -329,7 +330,11 @@ evaltree(union node *n, int flags)
 		do_etest = !(flags & EV_TESTED);
 		break;
 	default:
+#ifdef NODETYPENAME
+		out1fmt("Node type = %d(%s)\n", n->type, NODETYPENAME(n->type));
+#else
 		out1fmt("Node type = %d\n", n->type);
+#endif
 		flushout();
 		break;
 	}
@@ -360,6 +365,8 @@ evalloop(union node *n, int flags)
 
 	for (;;) {
 		evaltree(n->nbinary.ch1, EV_TESTED);
+		if (nflag)
+			break;
 		if (evalskip) {
 skipping:	  if (evalskip == SKIPCONT && --skipcount <= 0) {
 evalskip = SKIPNONE;
@@ -394,7 +401,9 @@ evalfor(union node *n, int flags)
 	union node *argp;
 	struct strlist *sp;
 	struct stackmark smark;
-	int status = 0;
+	int status;
+
+	status = nflag ? exitstatus : 0;
 
 	setstackmark();
 	arglist.lastp = 
@@ -410,6 +419,8 @@ evalfor(union node *n, int flags)
 		setvar(n->nfor.var, sp->text, 0);
 		evaltree(n->nfor.body, flags & EV_TESTED);
 		status = exitstatus;
+		if (nflag)
+			break;
 		if (evalskip) {
 			if (evalskip == SKIPCONT && --skipcount <= 0) {
 evalskip = SKIPNONE;
@@ -577,7 +588,8 @@ evalpipe(union node *n)
 	if (n->npipe.backgnd == 0) {
 		exitstatus = waitforjob(jp);
 		TRACE(("evalpipe:  job done exit status %d\n", exitstatus));
-	}
+	} else
+		exitstatus = 0;
 	INTON;
 }
 
@@ -602,7 +614,7 @@ evalbackcmd(union node *n, struct backcm
 	result->buf = NULL;
 	result->nleft = 0;
 	result->jp = NULL;
-	if (n == NULL) {
+	if (nflag || n == NULL) {
 		goto out;
 	}
 #ifdef notyet

Index: src/bin/sh/main.c
diff -u src/bin/sh/main.c:1.60 src/bin/sh/main.c:1.61
--- src/bin/sh/main.c:1.60	Sat Feb 27 13:34:12 2016
+++ src/bin/sh/main.c	Mon Feb 29 18:51:36 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.60 2016/02/27 18:34:12 christos Exp $	*/
+/*	$NetBSD: main.c,v 1.61 2016/02/29 23:51:36 christos 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.60 2016/02/27 18:34:12 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.61 2016/02/29 23:51:36 christos Exp $");
 #endif
 #endif /* not 

CVS commit: src/bin/sh/funcs

2016-02-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Feb 29 23:50:59 UTC 2016

Modified Files:
src/bin/sh/funcs: cmv dirs kill login newgrp popd pushd suspend

Log Message:
delete clauses 3,4


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/bin/sh/funcs/cmv src/bin/sh/funcs/dirs \
src/bin/sh/funcs/kill src/bin/sh/funcs/login src/bin/sh/funcs/newgrp \
src/bin/sh/funcs/popd src/bin/sh/funcs/pushd src/bin/sh/funcs/suspend

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/funcs/cmv
diff -u src/bin/sh/funcs/cmv:1.7 src/bin/sh/funcs/cmv:1.8
--- src/bin/sh/funcs/cmv:1.7	Thu May 11 17:31:05 1995
+++ src/bin/sh/funcs/cmv	Mon Feb 29 18:50:59 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: cmv,v 1.7 1995/05/11 21:31:05 christos Exp $
+#	$NetBSD: cmv,v 1.8 2016/02/29 23:50:59 christos Exp $
 # Copyright (c) 1991, 1993
 #	The Regents of the University of California.  All rights reserved.
 #
@@ -13,13 +13,6 @@
 # 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.
-# 3. All advertising materials mentioning features or use of this software
-#must display the following acknowledgement:
-#	This product includes software developed by the University of
-#	California, Berkeley and its contributors.
-# 4. Neither the name of the University nor the names of its contributors
-#may be used to endorse or promote products derived from this software
-#without specific prior written permission.
 #
 # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Index: src/bin/sh/funcs/dirs
diff -u src/bin/sh/funcs/dirs:1.7 src/bin/sh/funcs/dirs:1.8
--- src/bin/sh/funcs/dirs:1.7	Thu May 11 17:31:08 1995
+++ src/bin/sh/funcs/dirs	Mon Feb 29 18:50:59 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: dirs,v 1.7 1995/05/11 21:31:08 christos Exp $
+#	$NetBSD: dirs,v 1.8 2016/02/29 23:50:59 christos Exp $
 # Copyright (c) 1991, 1993
 #	The Regents of the University of California.  All rights reserved.
 #
@@ -13,13 +13,6 @@
 # 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.
-# 3. All advertising materials mentioning features or use of this software
-#must display the following acknowledgement:
-#	This product includes software developed by the University of
-#	California, Berkeley and its contributors.
-# 4. Neither the name of the University nor the names of its contributors
-#may be used to endorse or promote products derived from this software
-#without specific prior written permission.
 #
 # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Index: src/bin/sh/funcs/kill
diff -u src/bin/sh/funcs/kill:1.7 src/bin/sh/funcs/kill:1.8
--- src/bin/sh/funcs/kill:1.7	Thu May 11 17:31:10 1995
+++ src/bin/sh/funcs/kill	Mon Feb 29 18:50:59 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: kill,v 1.7 1995/05/11 21:31:10 christos Exp $
+#	$NetBSD: kill,v 1.8 2016/02/29 23:50:59 christos Exp $
 # Copyright (c) 1991, 1993
 #	The Regents of the University of California.  All rights reserved.
 #
@@ -13,13 +13,6 @@
 # 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.
-# 3. All advertising materials mentioning features or use of this software
-#must display the following acknowledgement:
-#	This product includes software developed by the University of
-#	California, Berkeley and its contributors.
-# 4. Neither the name of the University nor the names of its contributors
-#may be used to endorse or promote products derived from this software
-#without specific prior written permission.
 #
 # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Index: src/bin/sh/funcs/login
diff -u src/bin/sh/funcs/login:1.7 src/bin/sh/funcs/login:1.8
--- src/bin/sh/funcs/login:1.7	Thu May 11 17:31:11 1995
+++ src/bin/sh/funcs/login	Mon Feb 29 18:50:59 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: login,v 1.7 1995/05/11 21:31:11 christos Exp $
+#	$NetBSD: login,v 1.8 2016/02/29 23:50:59 christos Exp $
 # Copyright (c) 1991, 1993
 #	The Regents of the University of California.  All rights reserved.
 #
@@ -13,13 +13,6 @@
 # 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 

CVS commit: src

2016-02-29 Thread Aymeric Vincent
Module Name:src
Committed By:   aymeric
Date:   Mon Feb 29 22:49:11 UTC 2016

Modified Files:
src: UPDATING

Log Message:
mention that the recent addition of the NetBSD implementation of regexps
to libnbcompat may lead to crashes in tools using them on non-NetBSD hosts
if these are not rebuilt from scratch.


To generate a diff of this commit:
cvs rdiff -u -r1.264 -r1.265 src/UPDATING

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

Modified files:

Index: src/UPDATING
diff -u src/UPDATING:1.264 src/UPDATING:1.265
--- src/UPDATING:1.264	Mon Jan 25 09:24:29 2016
+++ src/UPDATING	Mon Feb 29 22:49:11 2016
@@ -1,4 +1,4 @@
-$NetBSD: UPDATING,v 1.264 2016/01/25 09:24:29 martin Exp $
+$NetBSD: UPDATING,v 1.265 2016/02/29 22:49:11 aymeric Exp $
 
 This file (UPDATING) is intended to be a brief reference to recent
 changes that might cause problems in the build process, and a guide for
@@ -19,6 +19,14 @@ See also: BUILDING, build.sh, Makefile.
 Recent changes:
 ^^^
 
+20160229:
+	NetBSD's regexp implementation is now part of libnbcompat.
+	Nblex, nbm4, nbpax, nbsed use it and they may crash on
+	non-NetBSD hosts if linked with stale object files produced
+	while they included a non-NetBSD regex.h.
+	In any case, you should "make cleandir" at least these tools
+	before updating your toolchain.
+
 20160125:
 	Dtrace has been enabled by default on some architectures.
 	When doing an update build, make sure to clean the etc/mtree



CVS commit: src/tools/compat

2016-02-29 Thread Aymeric Vincent
Module Name:src
Committed By:   aymeric
Date:   Mon Feb 29 22:19:29 UTC 2016

Modified Files:
src/tools/compat: Makefile
Added Files:
src/tools/compat: regex.h

Log Message:
add our libc's regex implementation to libnbcompat.

This way, nbsed picks it up and it unbreaks the build of xf86-video-intel-old's
man page under Linux and probably other future changes which rightfully expect
the (net)bsd behaviour.


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/tools/compat/Makefile
cvs rdiff -u -r0 -r1.1 src/tools/compat/regex.h

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

Modified files:

Index: src/tools/compat/Makefile
diff -u src/tools/compat/Makefile:1.77 src/tools/compat/Makefile:1.78
--- src/tools/compat/Makefile:1.77	Sat Jan  9 17:40:37 2016
+++ src/tools/compat/Makefile	Mon Feb 29 22:19:29 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.77 2016/01/09 17:40:37 christos Exp $
+#	$NetBSD: Makefile,v 1.78 2016/02/29 22:19:29 aymeric Exp $
 
 HOSTLIB=	nbcompat
 
@@ -14,6 +14,7 @@ SRCS=		atoll.c basename.c cdbr.c cdbw.c 
 		mkstemp.c pread.c putc_unlocked.c pwcache.c pwrite.c \
 		pw_scan.c \
 		raise_default_signal.c reallocarr.c rmd160.c rmd160hl.c \
+		regcomp.c regerror.c regexec.c regfree.c regsub.c \
 		setenv.c setgroupent.c \
 		setpassent.c setprogname.c sha1.c sha1hl.c sha2.c \
 		sha256hl.c sha384hl.c sha512hl.c snprintb.c snprintf.c \
@@ -47,6 +48,7 @@ CPPFLAGS+=	-I. -I./include -I${.CURDIR} 
 		${.CURDIR}/../../lib/libc/hash/sha1 \
 		${.CURDIR}/../../lib/libc/hash/sha2 \
 		${.CURDIR}/../../lib/libc/md \
+		${.CURDIR}/../../lib/libc/regex \
 		${.CURDIR}/../../lib/libc/stdio \
 		${.CURDIR}/../../lib/libc/stdlib \
 		${.CURDIR}/../../lib/libc/string \

Added files:

Index: src/tools/compat/regex.h
diff -u /dev/null src/tools/compat/regex.h:1.1
--- /dev/null	Mon Feb 29 22:19:29 2016
+++ src/tools/compat/regex.h	Mon Feb 29 22:19:29 2016
@@ -0,0 +1,4 @@
+/*	$NetBSD: regex.h,v 1.1 2016/02/29 22:19:29 aymeric Exp $ */
+
+#include "nbtool_config.h"
+#include "../../include/regex.h"



CVS commit: src/lib/libc/regex

2016-02-29 Thread Aymeric Vincent
Module Name:src
Committed By:   aymeric
Date:   Mon Feb 29 22:10:13 UTC 2016

Modified Files:
src/lib/libc/regex: regsub.c

Log Message:
protect __RCSID the same way other reg*.c files do, so that we can use this
file in libnbcompat


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/regex/regsub.c

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/regex/regsub.c
diff -u src/lib/libc/regex/regsub.c:1.2 src/lib/libc/regex/regsub.c:1.3
--- src/lib/libc/regex/regsub.c:1.2	Thu Jan 14 21:45:01 2016
+++ src/lib/libc/regex/regsub.c	Mon Feb 29 22:10:13 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: regsub.c,v 1.2 2016/01/14 21:45:01 christos Exp $	*/
+/*	$NetBSD: regsub.c,v 1.3 2016/02/29 22:10:13 aymeric Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -29,7 +29,9 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: regsub.c,v 1.2 2016/01/14 21:45:01 christos Exp $");
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: regsub.c,v 1.3 2016/02/29 22:10:13 aymeric Exp $");
+#endif
 
 #include 
 #include 



CVS commit: src/distrib/sets/lists/man

2016-02-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Feb 29 22:01:20 UTC 2016

Modified Files:
src/distrib/sets/lists/man: mi

Log Message:
Tag ctf.5 man page with ctf, not dtrace.


To generate a diff of this commit:
cvs rdiff -u -r1.1519 -r1.1520 src/distrib/sets/lists/man/mi

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.1519 src/distrib/sets/lists/man/mi:1.1520
--- src/distrib/sets/lists/man/mi:1.1519	Sun Feb 21 04:16:16 2016
+++ src/distrib/sets/lists/man/mi	Mon Feb 29 22:01:20 2016
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1519 2016/02/21 04:16:16 christos Exp $
+# $NetBSD: mi,v 1.1520 2016/02/29 22:01:20 riastradh Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -7952,7 +7952,7 @@
 ./usr/share/man/man5/cidr_table.5		man-postfix-man		postfix,.man
 ./usr/share/man/man5/core.5			man-sys-man		.man
 ./usr/share/man/man5/crontab.5			man-cron-man		.man
-./usr/share/man/man5/ctf.5			man-sys-man		dtrace,.man
+./usr/share/man/man5/ctf.5			man-sys-man		ctf,.man
 ./usr/share/man/man5/daily.5			man-sys-man		.man
 ./usr/share/man/man5/daily.conf.5		man-sys-man		.man
 ./usr/share/man/man5/dhclient.conf.5		man-dhclient-man	.man



CVS commit: src/lib

2016-02-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Feb 29 20:59:35 UTC 2016

Modified Files:
src/lib: Makefile

Log Message:
Skip libctf if MKCTF=no irrespective of MKDTRACE, for real.

Apparently this logic is copied in lib/Makefile and in
external/cddl/osnet/lib/Makefile.  Is the latter even used?


To generate a diff of this commit:
cvs rdiff -u -r1.239 -r1.240 src/lib/Makefile

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

Modified files:

Index: src/lib/Makefile
diff -u src/lib/Makefile:1.239 src/lib/Makefile:1.240
--- src/lib/Makefile:1.239	Tue Jan 26 17:47:35 2016
+++ src/lib/Makefile	Mon Feb 29 20:59:35 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.239 2016/01/26 17:47:35 christos Exp $
+#	$NetBSD: Makefile,v 1.240 2016/02/29 20:59:35 riastradh Exp $
 #	from: @(#)Makefile	5.25.1.1 (Berkeley) 5/7/91
 
 .include 
@@ -103,7 +103,7 @@ SUBDIR+=	.WAIT
 SUBDIR+=	../external/bsd/librtld_db/lib		# depends on libutil
 .endif
 
-.if ${MKDTRACE} != "no" || ${MKCTF} != "no"
+.if ${MKCTF} != "no"
 SUBDIR+=../external/cddl/osnet/lib/libctf
 .endif
 



CVS commit: src/usr.sbin/grfconfig

2016-02-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Feb 29 18:59:53 UTC 2016

Modified Files:
src/usr.sbin/grfconfig: grfconfig.c

Log Message:
PR/50867: David Binderman: Fix parsing loop.
While here, modernize error handling, merge copy and pasted code.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/grfconfig/grfconfig.c

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

Modified files:

Index: src/usr.sbin/grfconfig/grfconfig.c
diff -u src/usr.sbin/grfconfig/grfconfig.c:1.15 src/usr.sbin/grfconfig/grfconfig.c:1.16
--- src/usr.sbin/grfconfig/grfconfig.c:1.15	Tue Jan  4 04:32:31 2011
+++ src/usr.sbin/grfconfig/grfconfig.c	Mon Feb 29 13:59:52 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: grfconfig.c,v 1.15 2011/01/04 09:32:31 wiz Exp $	*/
+/*	$NetBSD: grfconfig.c,v 1.16 2016/02/29 18:59:52 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -36,11 +36,12 @@ __COPYRIGHT("@(#) Copyright (c) 1997\
 #endif /* not lint */
 
 #ifndef lint
-__RCSID("$NetBSD: grfconfig.c,v 1.15 2011/01/04 09:32:31 wiz Exp $");
+__RCSID("$NetBSD: grfconfig.c,v 1.16 2016/02/29 18:59:52 christos Exp $");
 #endif /* not lint */
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -50,8 +51,8 @@ __RCSID("$NetBSD: grfconfig.c,v 1.15 201
 
 #include 
 
-int main __P((int, char **));
-static void print_rawdata __P((struct grfvideo_mode *, int));
+static void print_modeline(FILE *fp, struct grfvideo_mode *, int); 
+static void suggest(struct grfvideo_mode *, const char *, const char *);
 
 static struct grf_flag {
 	u_short	grf_flag_number;
@@ -71,18 +72,17 @@ static struct grf_flag {
  * Dynamic mode loader for NetBSD/Amiga grf devices.
  */
 int
-main(ac, av)
-	int ac;
-	char  **av;
+main(int ac, char  **av)
 {
 	struct	grfvideo_mode gv[1];
 	struct	grf_flag *grf_flagp;
 	FILE	*fp;
 	int	c, y, grffd;
-	int	i, lineno = 0;
+	size_t  i;
+	int	lineno = 0;
 	int	uplim, lowlim;
 	char	rawdata = 0, testmode = 0;
-	char	*grfdevice = 0;
+	char	*grfdevice = 0, *ptr;
 	char	*modefile = 0;
 	char	buf[_POSIX2_LINE_MAX];
 	char	*cps[31];
@@ -107,29 +107,23 @@ main(ac, av)
 	av += optind;
 
 
-	if (ac >= 1)
-		grfdevice = av[0];
-	else {
-		printf("grfconfig: No grf device specified.\n");
-		return (1);
-	}
+	if (ac < 1)
+		errx(EXIT_FAILURE, "No grf device specified");
+	grfdevice = av[0];
 
 	if (ac >= 2)
 		modefile = av[1];
 
-	if ((grffd = open(grfdevice, O_RDWR)) < 0) {
-		printf("grfconfig: can't open grf device.\n");
-		return (1);
-	}
+	if ((grffd = open(grfdevice, O_RDWR)) == -1)
+		err(EXIT_FAILURE, "Can't open grf device `%s'", grfdevice);
+
 	/* If a mode file is specificied, load it in, don't display any info. */
 
 	if (modefile) {
-		if (!(fp = fopen(modefile, "r"))) {
-			printf("grfconfig: Cannot open mode definition "
-			"file.\n");
-			(void)close(grffd);
-			return (1);
-		}
+		if (!(fp = fopen(modefile, "r")))
+			err(EXIT_FAILURE, 
+			"Cannot open mode definition file `%s'", modefile);
+
 		while (fgets(buf, sizeof(buf), fp)) {
 			char *obuf, tbuf[_POSIX2_LINE_MAX], *tbuf2;
 			/*
@@ -161,18 +155,17 @@ main(ac, av)
 
 			lineno = lineno + 1;
 
-			for (i = 0, *cps = strtok(buf, " \b\t\r\n");
-			cps[i] != NULL && i < 30; i++)
-cps[i + 1] = strtok(NULL, " \b\t\r\n");
-			cps[i] = NULL;
-
-			if (i < 14) {
-printf("grfconfig: too few values in mode "
-"definition file:\n %s\n", obuf);
-(void)fclose(fp);
-(void)close(grffd);
-return (1);
-			}
+#define SP " \b\t\r\n"
+			memset(cps, 0, sizeof(cps));
+			for (i = 0, ptr = strtok(buf, SP);
+			ptr != NULL && i < __arraycount(cps);
+			i++, ptr = strtok(NULL, SP))
+cps[i] = ptr;
+
+
+			if (i < 14)
+errx(EXIT_FAILURE, "Too few values in mode "
+"definition file: `%s'\n", obuf);
 
 			gv->pixel_clock	= atoi(cps[1]);
 			gv->disp_width	= atoi(cps[2]);
@@ -194,11 +187,8 @@ main(ac, av)
 	gv->mode_num = 255;
 	gv->depth = 4;
 } else {
-	printf("grfconfig: Illegal mode "
-	"number: %s\n", cps[0]);
-	(void)fclose(fp);
-	(void)close(grffd);
-	return (1);
+	errx(EXIT_FAILURE,
+	"Illegal mode number: %s", cps[0]);
 }
 
 			if ((gv->pixel_clock == 0) ||
@@ -213,11 +203,8 @@ main(ac, av)
 			(gv->vsync_start == 0) ||
 			(gv->vsync_stop == 0) ||
 			(gv->vtotal == 0)) {
-printf("grfconfig: Illegal value in "
-"mode #%d:\n %s\n", gv->mode_num, obuf);
-(void)fclose(fp);
-(void)close(grffd);
-return (1);  
+errx(EXIT_FAILURE, "Illegal value in "
+"mode #%d: `%s'", gv->mode_num, obuf);
 			}
 
 			if (strstr(obuf, "default") != NULL) {
@@ -230,17 +217,10 @@ main(ac, av)
 	gv->disp_flags |= grf_flagp->grf_flag_number;
 }
 }
-if (gv->disp_flags == GRF_FLAGS_DEFAULT) {
-	printf("grfconfig: Your are using an "
+if (gv->disp_flags == GRF_FLAGS_DEFAULT)
+	

CVS commit: src/sys/arch/atari/dev

2016-02-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Feb 29 18:25:29 UTC 2016

Modified Files:
src/sys/arch/atari/dev: ite.c

Log Message:
PR/50868: David Binderman: Fix operator precedence.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/arch/atari/dev/ite.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/atari/dev/ite.c
diff -u src/sys/arch/atari/dev/ite.c:1.76 src/sys/arch/atari/dev/ite.c:1.77
--- src/sys/arch/atari/dev/ite.c:1.76	Fri Jul 25 04:10:32 2014
+++ src/sys/arch/atari/dev/ite.c	Mon Feb 29 13:25:29 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ite.c,v 1.76 2014/07/25 08:10:32 dholland Exp $	*/
+/*	$NetBSD: ite.c,v 1.77 2016/02/29 18:25:29 christos Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -44,7 +44,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.76 2014/07/25 08:10:32 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.77 2016/02/29 18:25:29 christos Exp $");
 
 #include "opt_ddb.h"
 
@@ -801,7 +801,7 @@ ite_cnfilter(u_int c, enum caller caller
 	/* handle dead keys */
 	if (key->mode & KBD_MODE_DEAD) {
 		/* if entered twice, send accent itself */
-		if (last_dead == key->mode & KBD_MODE_ACCMASK)
+		if (last_dead == (key->mode & KBD_MODE_ACCMASK))
 			last_dead = 0;
 		else {
 			last_dead = key->mode & KBD_MODE_ACCMASK;



CVS commit: src/sys/arch/evbmips/loongson/dev

2016-02-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Feb 29 18:24:31 UTC 2016

Modified Files:
src/sys/arch/evbmips/loongson/dev: stvii.c

Log Message:
PR/50869: David Binderman: Use logical and instead of arithmetic


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbmips/loongson/dev/stvii.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/evbmips/loongson/dev/stvii.c
diff -u src/sys/arch/evbmips/loongson/dev/stvii.c:1.4 src/sys/arch/evbmips/loongson/dev/stvii.c:1.5
--- src/sys/arch/evbmips/loongson/dev/stvii.c:1.4	Thu Feb 28 08:21:15 2013
+++ src/sys/arch/evbmips/loongson/dev/stvii.c	Mon Feb 29 13:24:31 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: stvii.c,v 1.4 2013/02/28 13:21:15 macallan Exp $	*/
+/*	$NetBSD: stvii.c,v 1.5 2016/02/29 18:24:31 christos Exp $	*/
 
 /*-
  * Copyright (C) 2011 Michael Lorenz.
@@ -30,7 +30,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: stvii.c,v 1.4 2013/02/28 13:21:15 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: stvii.c,v 1.5 2016/02/29 18:24:31 christos Exp $");
 
 #include 
 #include 
@@ -303,10 +303,10 @@ stvii_worker(void *cookie)
 			nctrl = sc->sc_control & ~(STC_TRICKLE | STC_CHARGE_ENABLE);
 			bl = stvii_battery_level(sc);
 			sc->sc_bat_level = bl;
-			if (charging & (bl > BAT_FULL)) {
+			if (charging && (bl > BAT_FULL)) {
 /* stop charging, we're full */
 charging = 0;
-			} else if (!charging & (bl < BAT_LOW)) {
+			} else if (!charging && (bl < BAT_LOW)) {
 charging = 1;
 			}
 			if (st & STS_AC_AVAILABLE) {



CVS commit: src/sys/arch/hppa/spmath

2016-02-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Feb 29 18:22:06 UTC 2016

Modified Files:
src/sys/arch/hppa/spmath: dfsqrt.c

Log Message:
PR/50870: David Binderman: Use logical and instead of arithmetic


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/hppa/spmath/dfsqrt.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/hppa/spmath/dfsqrt.c
diff -u src/sys/arch/hppa/spmath/dfsqrt.c:1.5 src/sys/arch/hppa/spmath/dfsqrt.c:1.6
--- src/sys/arch/hppa/spmath/dfsqrt.c:1.5	Sat Feb  4 12:03:09 2012
+++ src/sys/arch/hppa/spmath/dfsqrt.c	Mon Feb 29 13:22:06 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: dfsqrt.c,v 1.5 2012/02/04 17:03:09 skrll Exp $	*/
+/*	$NetBSD: dfsqrt.c,v 1.6 2016/02/29 18:22:06 christos Exp $	*/
 
 /*	$OpenBSD: dfsqrt.c,v 1.5 2001/03/29 03:58:17 mickey Exp $	*/
 
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dfsqrt.c,v 1.5 2012/02/04 17:03:09 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dfsqrt.c,v 1.6 2016/02/29 18:22:06 christos Exp $");
 
 #include "../spmath/float.h"
 #include "../spmath/dbl_float.h"
@@ -158,7 +158,7 @@ dbl_fsqrt(dbl_floating_point *srcptr, db
 
 	/* check for inexact */
 	if (Dbl_isnotzero(srcp1,srcp2)) {
-		if (!even_exponent & Dbl_islessthan(resultp1,resultp2,srcp1,srcp2)) {
+		if (!even_exponent && Dbl_islessthan(resultp1,resultp2,srcp1,srcp2)) {
 			Dbl_increment(resultp1,resultp2);
 		}
 		guardbit = Dbl_lowmantissap2(resultp2);



CVS commit: src/usr.bin/netstat

2016-02-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Feb 29 18:21:15 UTC 2016

Modified Files:
src/usr.bin/netstat: if.c

Log Message:
PR/50872: David Binderman: Use logical and instead of arithmetic


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/usr.bin/netstat/if.c

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/netstat/if.c
diff -u src/usr.bin/netstat/if.c:1.82 src/usr.bin/netstat/if.c:1.83
--- src/usr.bin/netstat/if.c:1.82	Sat Sep 19 20:30:04 2015
+++ src/usr.bin/netstat/if.c	Mon Feb 29 13:21:15 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.c,v 1.82 2015/09/20 00:30:04 mrg Exp $	*/
+/*	$NetBSD: if.c,v 1.83 2016/02/29 18:21:15 christos Exp $	*/
 
 /*
  * Copyright (c) 1983, 1988, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "from: @(#)if.c	8.2 (Berkeley) 2/21/94";
 #else
-__RCSID("$NetBSD: if.c,v 1.82 2015/09/20 00:30:04 mrg Exp $");
+__RCSID("$NetBSD: if.c,v 1.83 2016/02/29 18:21:15 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -144,7 +144,7 @@ static void
 intpr_header(void)
 {
 
-	if (!sflag & !pflag) {
+	if (!sflag && !pflag) {
 		if (bflag) {
 			printf("%-5.5s %-5.5s %-13.13s %-17.17s "
 			   "%10.10s %10.10s",



CVS commit: src/sys/arch/hppa/spmath

2016-02-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Feb 29 18:20:31 UTC 2016

Modified Files:
src/sys/arch/hppa/spmath: sfsqrt.c

Log Message:
PR/50871: David Binderman: use logical and instead of arithmetic


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/hppa/spmath/sfsqrt.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/hppa/spmath/sfsqrt.c
diff -u src/sys/arch/hppa/spmath/sfsqrt.c:1.5 src/sys/arch/hppa/spmath/sfsqrt.c:1.6
--- src/sys/arch/hppa/spmath/sfsqrt.c:1.5	Sat Feb  4 12:03:10 2012
+++ src/sys/arch/hppa/spmath/sfsqrt.c	Mon Feb 29 13:20:31 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: sfsqrt.c,v 1.5 2012/02/04 17:03:10 skrll Exp $	*/
+/*	$NetBSD: sfsqrt.c,v 1.6 2016/02/29 18:20:31 christos Exp $	*/
 
 /*	$OpenBSD: sfsqrt.c,v 1.5 2001/03/29 03:58:19 mickey Exp $	*/
 
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sfsqrt.c,v 1.5 2012/02/04 17:03:10 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sfsqrt.c,v 1.6 2016/02/29 18:20:31 christos Exp $");
 
 #include "../spmath/float.h"
 #include "../spmath/sgl_float.h"
@@ -150,7 +150,7 @@ sgl_fsqrt(sgl_floating_point *srcptr, sg
 
 	/* check for inexact */
 	if (Sgl_isnotzero(src)) {
-		if (!even_exponent & Sgl_islessthan(result,src))
+		if (!even_exponent && Sgl_islessthan(result,src))
 			Sgl_increment(result);
 		guardbit = Sgl_lowmantissa(result);
 		Sgl_rightshiftby1(result);



CVS commit: src/usr.bin/netstat

2016-02-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Feb 29 18:19:46 UTC 2016

Modified Files:
src/usr.bin/netstat: vtw.c

Log Message:
PR/50873: David Binderman: use logical or instead of arithmetic


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/netstat/vtw.c

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/netstat/vtw.c
diff -u src/usr.bin/netstat/vtw.c:1.8 src/usr.bin/netstat/vtw.c:1.9
--- src/usr.bin/netstat/vtw.c:1.8	Tue Jun 16 18:54:10 2015
+++ src/usr.bin/netstat/vtw.c	Mon Feb 29 13:19:46 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: vtw.c,v 1.8 2015/06/16 22:54:10 christos Exp $	*/
+/*	$NetBSD: vtw.c,v 1.9 2016/02/29 18:19:46 christos Exp $	*/
 
 /*
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
 #if 0
 static char sccsid[] = "from: @(#)inet.c	8.4 (Berkeley) 4/20/94";
 #else
-__RCSID("$NetBSD: vtw.c,v 1.8 2015/06/16 22:54:10 christos Exp $");
+__RCSID("$NetBSD: vtw.c,v 1.9 2016/02/29 18:19:46 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -269,7 +269,7 @@ show_vtw_v4(void (*print)(const vtw_t *)
 		kbase = vtw_tcpv4[i].base.v4;
 		klim = vtw_tcpv4[i].lim.v4;
 
-		if (!kbase | !klim)
+		if (!kbase || !klim)
 			continue;
 
 		n = (klim - kbase + 1);
@@ -300,7 +300,7 @@ show_vtw_v4(void (*print)(const vtw_t *)
 	base = fat_tcpv4.base;
 	lim = fat_tcpv4.lim;
 
-	if (!base | !lim)
+	if (!base || !lim)
 		goto end;
 
 	mem += (lim - base + 1) * sizeof(*base);
@@ -369,7 +369,7 @@ show_vtw_v6(void (*print)(const vtw_t *)
 		kbase = vtw_tcpv6[i].base.v6;
 		klim = vtw_tcpv6[i].lim.v6;
 
-		if (!kbase | !klim)
+		if (!kbase || !klim)
 			continue;
 
 		n = (klim - kbase + 1);
@@ -399,7 +399,7 @@ show_vtw_v6(void (*print)(const vtw_t *)
 	base = fat_tcpv6.base;
 	lim = fat_tcpv6.lim;
 
-	if (!base | !lim)
+	if (!base || !lim)
 		goto end;
 
 	mem += (lim - base + 1) * sizeof(*base);



CVS commit: src/external/cddl/osnet/lib

2016-02-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Feb 29 17:46:54 UTC 2016

Modified Files:
src/external/cddl/osnet/lib: Makefile

Log Message:
Let MKCTF alone control whether we build libctf.

If MKDTRACE=yes MKCTF=no makes no sense, we can express that
somewhere else, not as a confusing set lists error at the end -- as
far as I know, there's no way to express MKDTRACE *or* MKCTF as a
condition for set list entries.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/cddl/osnet/lib/Makefile

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

Modified files:

Index: src/external/cddl/osnet/lib/Makefile
diff -u src/external/cddl/osnet/lib/Makefile:1.7 src/external/cddl/osnet/lib/Makefile:1.8
--- src/external/cddl/osnet/lib/Makefile:1.7	Sun Feb 28 19:10:10 2016
+++ src/external/cddl/osnet/lib/Makefile	Mon Feb 29 17:46:54 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.7 2016/02/28 19:10:10 christos Exp $
+#	$NetBSD: Makefile,v 1.8 2016/02/29 17:46:54 riastradh Exp $
 #
 #
 
@@ -8,7 +8,7 @@
 SUBDIR+=	libdtrace
 SUBDIR+=	drti
 .endif
-.if ${MKDTRACE:Uno} != "no" || ${MKCTF:Uno} != "no"
+.if ${MKCTF:Uno} != "no"
 SUBDIR+=	libctf
 .endif
 



CVS commit: src/sbin/ping6

2016-02-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Feb 29 16:25:06 UTC 2016

Modified Files:
src/sbin/ping6: ping6.c

Log Message:
#ifdef forward declaration of setpolicy like definition.


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/sbin/ping6/ping6.c

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

Modified files:

Index: src/sbin/ping6/ping6.c
diff -u src/sbin/ping6/ping6.c:1.91 src/sbin/ping6/ping6.c:1.92
--- src/sbin/ping6/ping6.c:1.91	Wed Nov  4 08:07:54 2015
+++ src/sbin/ping6/ping6.c	Mon Feb 29 16:25:06 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ping6.c,v 1.91 2015/11/04 08:07:54 ozaki-r Exp $	*/
+/*	$NetBSD: ping6.c,v 1.92 2016/02/29 16:25:06 riastradh Exp $	*/
 /*	$KAME: ping6.c,v 1.164 2002/11/16 14:05:37 itojun Exp $	*/
 
 /*
@@ -77,7 +77,7 @@ static char sccsid[] = "@(#)ping.c	8.1 (
 #else
 #include 
 #ifndef lint
-__RCSID("$NetBSD: ping6.c,v 1.91 2015/11/04 08:07:54 ozaki-r Exp $");
+__RCSID("$NetBSD: ping6.c,v 1.92 2016/02/29 16:25:06 riastradh Exp $");
 #endif
 #endif
 
@@ -282,7 +282,11 @@ static int	 pr_bitrange(u_int32_t, int, 
 static void	 pr_retip(struct ip6_hdr *, u_char *);
 static void	 summary(void);
 static void	 tvsub(struct timeval *, struct timeval *);
+#ifdef IPSEC
+#ifdef IPSEC_POLICY_IPSEC
 static int	 setpolicy(int, char *);
+#endif	/* IPSEC_POLICY_IPSEC */
+#endif	/* IPSEC */
 static char	*nigroup(char *);
 static double	timespec_to_sec(const struct timespec *tp);
 static double	diffsec(struct timespec *, struct timespec *);



CVS commit: src/sbin/ifconfig

2016-02-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Feb 29 16:23:25 UTC 2016

Modified Files:
src/sbin/ifconfig: af_inet.c af_inet6.c

Log Message:
Consistently use estrlcpy for ifr.ifr_name here, not strncpy.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sbin/ifconfig/af_inet.c
cvs rdiff -u -r1.34 -r1.35 src/sbin/ifconfig/af_inet6.c

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

Modified files:

Index: src/sbin/ifconfig/af_inet.c
diff -u src/sbin/ifconfig/af_inet.c:1.18 src/sbin/ifconfig/af_inet.c:1.19
--- src/sbin/ifconfig/af_inet.c:1.18	Thu Jan  7 11:32:21 2016
+++ src/sbin/ifconfig/af_inet.c	Mon Feb 29 16:23:25 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: af_inet.c,v 1.18 2016/01/07 11:32:21 roy Exp $	*/
+/*	$NetBSD: af_inet.c,v 1.19 2016/02/29 16:23:25 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1983, 1993
@@ -31,7 +31,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: af_inet.c,v 1.18 2016/01/07 11:32:21 roy Exp $");
+__RCSID("$NetBSD: af_inet.c,v 1.19 2016/02/29 16:23:25 riastradh Exp $");
 #endif /* not lint */
 
 #include  
@@ -231,7 +231,7 @@ in_addr_flags(struct ifaddrs *ifa, int f
 	struct ifreq ifr;
 
 	memset(, 0, sizeof(ifr));
-	strncpy(ifr.ifr_name, ifa->ifa_name, sizeof(ifr.ifr_name));
+	estrlcpy(ifr.ifr_name, ifa->ifa_name, sizeof(ifr.ifr_name));
 	ifr.ifr_addr = *ifa->ifa_addr;
 	if ((s = getsock(AF_INET)) == -1)
 		err(EXIT_FAILURE, "%s: getsock", __func__);

Index: src/sbin/ifconfig/af_inet6.c
diff -u src/sbin/ifconfig/af_inet6.c:1.34 src/sbin/ifconfig/af_inet6.c:1.35
--- src/sbin/ifconfig/af_inet6.c:1.34	Thu Jan  7 11:32:21 2016
+++ src/sbin/ifconfig/af_inet6.c	Mon Feb 29 16:23:25 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: af_inet6.c,v 1.34 2016/01/07 11:32:21 roy Exp $	*/
+/*	$NetBSD: af_inet6.c,v 1.35 2016/02/29 16:23:25 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1983, 1993
@@ -31,7 +31,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: af_inet6.c,v 1.34 2016/01/07 11:32:21 roy Exp $");
+__RCSID("$NetBSD: af_inet6.c,v 1.35 2016/02/29 16:23:25 riastradh Exp $");
 #endif /* not lint */
 
 #include  
@@ -488,7 +488,7 @@ in6_addr_flags(struct ifaddrs *ifa, int 
 	if ((s = getsock(AF_INET6)) == -1)
 		err(EXIT_FAILURE, "%s: getsock", __func__);
 	memset(, 0, sizeof(ifr));
-	strncpy(ifr.ifr_name, ifa->ifa_name, sizeof(ifr.ifr_name));
+	estrlcpy(ifr.ifr_name, ifa->ifa_name, sizeof(ifr.ifr_name));
 	ifr.ifr_addr = *(struct sockaddr_in6 *)ifa->ifa_addr;
 	if (prog_ioctl(s, SIOCGIFAFLAG_IN6, ) == -1)
 		err(EXIT_FAILURE, "SIOCGIFAFLAG_IN6");



CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs

2016-02-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Feb 29 16:19:20 UTC 2016

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: zvol.c

Log Message:
uint64_t can't be negative.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zvol.c

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

Modified files:

Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/zvol.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zvol.c:1.6 src/external/cddl/osnet/dist/uts/common/fs/zfs/zvol.c:1.7
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zvol.c:1.6	Mon Jul 28 10:01:23 2014
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zvol.c	Mon Feb 29 16:19:20 2016
@@ -1246,7 +1246,7 @@ zvol_strategy(buf_t *bp)
 	addr = bp->b_data;
 	resid = bp->b_bcount;
 
-	if (resid > 0 && (off < 0 || off >= volsize)) {
+	if (resid > 0 && off >= volsize) {
 		bioerror(bp, EIO);
 		biodone(bp);
 		return;



CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs

2016-02-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Feb 29 16:18:37 UTC 2016

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_rlock.c

Log Message:
Sprinkle some more zfs range lock reference count kasserts.

>From a debugging session months ago, might as well share them.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_rlock.c

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

Modified files:

Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_rlock.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_rlock.c:1.4 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_rlock.c:1.5
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_rlock.c:1.4	Sat Apr 11 04:35:39 2015
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_rlock.c	Mon Feb 29 16:18:37 2016
@@ -98,6 +98,8 @@ static int
 zfs_range_lock_hold(rl_t *rl)
 {
 
+	KASSERT(rl->r_zp != NULL);
+	KASSERT(0 < rl->r_refcnt);
 	KASSERT(mutex_owned(>r_zp->z_range_lock));
 
 	if (rl->r_refcnt >= ULONG_MAX)
@@ -111,8 +113,9 @@ static void
 zfs_range_lock_rele(rl_t *rl)
 {
 
+	KASSERT(rl->r_zp != NULL);
+	KASSERT(0 < rl->r_refcnt);
 	KASSERT(mutex_owned(>r_zp->z_range_lock));
-	KASSERT(rl->r_refcnt > 0);
 
 	if (--rl->r_refcnt == 0) {
 		cv_destroy(>r_wr_cv);
@@ -184,10 +187,12 @@ zfs_range_lock_writer(znode_t *zp, rl_t 
 			goto wait; /* already locked at same offset */
 
 		rl = (rl_t *)avl_nearest(tree, where, AVL_AFTER);
+		KASSERT(0 < rl->r_refcnt);
 		if (rl && (rl->r_off < new->r_off + new->r_len))
 			goto wait;
 
 		rl = (rl_t *)avl_nearest(tree, where, AVL_BEFORE);
+		KASSERT(0 < rl->r_refcnt);
 		if (rl && rl->r_off + rl->r_len > new->r_off)
 			goto wait;
 
@@ -345,6 +350,7 @@ zfs_range_add_reader(avl_tree_t *tree, r
 		return;
 	}
 
+	KASSERT(0 < next->r_refcnt);
 	if (off < next->r_off) {
 		/* Add a proxy for initial range before the overlap */
 		zfs_range_new_proxy(tree, off, next->r_off - off, zp);
@@ -369,17 +375,20 @@ zfs_range_add_reader(avl_tree_t *tree, r
 		if (off + len == next->r_off + next->r_len) {
 			/* exact overlap with end */
 			next = zfs_range_proxify(tree, next);
+			KASSERT(0 < next->r_refcnt);
 			next->r_cnt++;
 			return;
 		}
 		if (off + len < next->r_off + next->r_len) {
 			/* new range ends in the middle of this block */
 			next = zfs_range_split(tree, next, off + len);
+			KASSERT(0 < next->r_refcnt);
 			next->r_cnt++;
 			return;
 		}
 		ASSERT3U(off + len, >, next->r_off + next->r_len);
 		next = zfs_range_proxify(tree, next);
+		KASSERT(0 < next->r_refcnt);
 		next->r_cnt++;
 	}
 



CVS commit: src/etc

2016-02-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Feb 29 16:16:42 UTC 2016

Modified Files:
src/etc: security

Log Message:
Record current raid configurations too in /etc/security.


To generate a diff of this commit:
cvs rdiff -u -r1.120 -r1.121 src/etc/security

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

Modified files:

Index: src/etc/security
diff -u src/etc/security:1.120 src/etc/security:1.121
--- src/etc/security:1.120	Mon Apr 20 22:46:35 2015
+++ src/etc/security	Mon Feb 29 16:16:42 2016
@@ -1,6 +1,6 @@
 #!/bin/sh -
 #
-#	$NetBSD: security,v 1.120 2015/04/20 22:46:35 pgoyette Exp $
+#	$NetBSD: security,v 1.121 2016/02/29 16:16:42 riastradh Exp $
 #	from: @(#)security	8.1 (Berkeley) 6/9/93
 #
 
@@ -952,9 +952,18 @@ if checkyesno check_disklabels; then
 		done
 	fi
 
+		# if raidctl is available, generate raidctls for:	raid
+	if [ -x /sbin/raidctl ]; then
+		disks=$(iostat -x | awk 'NR > 1 && $1 ~ /^raid/ { print $1; }')
+		for i in $disks; do
+			/sbin/raidctl -G $i > "$work_dir/raidconf.$i" \
+2>/dev/null
+		done
+	fi
+
 		# append list of new disklabels, fdisks and wedges
 	ls -1d $work_dir/disklabel.* $work_dir/fdisk.* $work_dir/wedges.* \
-	2>/dev/null |
+	$work_dir/raidconf.* 2>/dev/null |
 	egrep -v '\.(backup|current)(,v)?$' >> $LABELS
 	CHANGELIST="$LABELS $CHANGELIST"
 fi



CVS commit: src/external/cddl/osnet/dist/lib/libuutil/common

2016-02-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Feb 29 16:14:57 UTC 2016

Modified Files:
src/external/cddl/osnet/dist/lib/libuutil/common: uu_open.c

Log Message:
Cast int64_t to long long before printfing with %lld.

Not doing so broke something months ago and I forgot why.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/external/cddl/osnet/dist/lib/libuutil/common/uu_open.c

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

Modified files:

Index: src/external/cddl/osnet/dist/lib/libuutil/common/uu_open.c
diff -u src/external/cddl/osnet/dist/lib/libuutil/common/uu_open.c:1.1.1.1 src/external/cddl/osnet/dist/lib/libuutil/common/uu_open.c:1.2
--- src/external/cddl/osnet/dist/lib/libuutil/common/uu_open.c:1.1.1.1	Fri Aug  7 18:32:35 2009
+++ src/external/cddl/osnet/dist/lib/libuutil/common/uu_open.c	Mon Feb 29 16:14:57 2016
@@ -53,7 +53,8 @@ uu_open_tmp(const char *dir, uint_t ufla
 		return (-1);
 
 	for (;;) {
-		(void) snprintf(fname, PATH_MAX, "%s/uu%lld", dir, gethrtime());
+		(void) snprintf(fname, PATH_MAX, "%s/uu%lld", dir,
+		(long long)gethrtime());
 
 		f = open(fname, O_CREAT | O_EXCL | O_RDWR, 0600);
 



CVS commit: src/sys/arch/alpha/isa

2016-02-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Feb 29 15:28:35 UTC 2016

Modified Files:
src/sys/arch/alpha/isa: isadma_bounce.c

Log Message:
PR/50854: David Binderman: Remove redundant code.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/alpha/isa/isadma_bounce.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/alpha/isa/isadma_bounce.c
diff -u src/sys/arch/alpha/isa/isadma_bounce.c:1.12 src/sys/arch/alpha/isa/isadma_bounce.c:1.13
--- src/sys/arch/alpha/isa/isadma_bounce.c:1.12	Sun Feb  5 21:14:13 2012
+++ src/sys/arch/alpha/isa/isadma_bounce.c	Mon Feb 29 10:28:35 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: isadma_bounce.c,v 1.12 2012/02/06 02:14:13 matt Exp $ */
+/* $NetBSD: isadma_bounce.c,v 1.13 2016/02/29 15:28:35 christos Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: isadma_bounce.c,v 1.12 2012/02/06 02:14:13 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isadma_bounce.c,v 1.13 2016/02/29 15:28:35 christos Exp $");
 
 #include 
 #include 
@@ -213,8 +213,7 @@ isadma_bounce_dmamap_load(bus_dma_tag_t 
 	 * and we can bounce, we will.
 	 */
 	error = _bus_dmamap_load_direct(t, map, buf, buflen, p, flags);
-	if (error == 0 ||
-	(error != 0 && (cookie->id_flags & ID_MIGHT_NEED_BOUNCE) == 0))
+	if (error == 0 || (cookie->id_flags & ID_MIGHT_NEED_BOUNCE) == 0)
 		return (error);
 
 	/*
@@ -284,8 +283,7 @@ isadma_bounce_dmamap_load_mbuf(bus_dma_t
 	 * and we can bounce, we will.
 	 */
 	error = _bus_dmamap_load_mbuf_direct(t, map, m0, flags);
-	if (error == 0 ||
-	(error != 0 && (cookie->id_flags & ID_MIGHT_NEED_BOUNCE) == 0))
+	if (error == 0 || (cookie->id_flags & ID_MIGHT_NEED_BOUNCE) == 0)
 		return (error);
 
 	/*



CVS commit: src/lib/libc/compiler_rt

2016-02-29 Thread Adam Ciarcinski
Module Name:src
Committed By:   adam
Date:   Mon Feb 29 14:57:07 UTC 2016

Modified Files:
src/lib/libc/compiler_rt: Makefile.inc

Log Message:
Fix buidling with MKPROFILE=no


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/lib/libc/compiler_rt/Makefile.inc

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/compiler_rt/Makefile.inc
diff -u src/lib/libc/compiler_rt/Makefile.inc:1.28 src/lib/libc/compiler_rt/Makefile.inc:1.29
--- src/lib/libc/compiler_rt/Makefile.inc:1.28	Sat Feb 27 19:08:23 2016
+++ src/lib/libc/compiler_rt/Makefile.inc	Mon Feb 29 14:57:07 2016
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.28 2016/02/27 19:08:23 joerg Exp $
+# $NetBSD: Makefile.inc,v 1.29 2016/02/29 14:57:07 adam Exp $
 
 COMPILER_RT_SRCDIR=	${NETBSDSRCDIR}/sys/external/bsd/compiler_rt/dist
 
@@ -216,7 +216,9 @@ GENERIC_SRCS+= \
 	InstrProfilingValue.c \
 	InstrProfilingWriter.c
 
+.if ${MKPROFILE} != "no"
 POBJS+= InstrProfilingRuntime.po
+.endif
 
 .if ${LIBC_MACHINE_ARCH} == "powerpc" || ${LIBC_MACHINE_ARCH} == "powerpc64"
 GENERIC_SRCS+= \



CVS commit: src/tests/net

2016-02-29 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Feb 29 09:35:16 UTC 2016

Modified Files:
src/tests/net/arp: t_arp.sh
src/tests/net/ndp: t_ndp.sh

Log Message:
Add tests on activating a new MAC address


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/net/arp/t_arp.sh
cvs rdiff -u -r1.8 -r1.9 src/tests/net/ndp/t_ndp.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/arp/t_arp.sh
diff -u src/tests/net/arp/t_arp.sh:1.11 src/tests/net/arp/t_arp.sh:1.12
--- src/tests/net/arp/t_arp.sh:1.11	Thu Feb 25 03:23:15 2016
+++ src/tests/net/arp/t_arp.sh	Mon Feb 29 09:35:16 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: t_arp.sh,v 1.11 2016/02/25 03:23:15 ozaki-r Exp $
+#	$NetBSD: t_arp.sh,v 1.12 2016/02/29 09:35:16 ozaki-r Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -46,6 +46,7 @@ atf_test_case command cleanup
 atf_test_case garp cleanup
 atf_test_case cache_overwriting cleanup
 atf_test_case pubproxy_arp cleanup
+atf_test_case link_activation cleanup
 
 cache_expiration_5s_head()
 {
@@ -83,6 +84,12 @@ pubproxy_arp_head()
 	atf_set "require.progs" "rump_server"
 }
 
+link_activation_head()
+{
+	atf_set "descr" "Tests for activating a new MAC address"
+	atf_set "require.progs" "rump_server"
+}
+
 setup_dst_server()
 {
 	export RUMP_SERVER=$SOCKDST
@@ -408,6 +415,44 @@ pubproxy_arp_body()
 	return 0
 }
 
+link_activation_body()
+{
+	local arp_keep=5
+	local bonus=2
+
+	atf_check -s exit:0 ${inetserver} $SOCKSRC
+	atf_check -s exit:0 ${inetserver} $SOCKDST
+
+	setup_dst_server
+	setup_src_server $arp_keep
+
+	# flush old packets
+	extract_new_packets > ./out
+
+	export RUMP_SERVER=$SOCKSRC
+
+	atf_check -s exit:0 -o ignore rump.ifconfig shmif0 link \
+	b2:a1:00:00:00:01
+
+	atf_check -s exit:0 sleep 1
+	extract_new_packets > ./out
+	$DEBUG && cat ./out
+
+	pkt=$(make_pkt_str_arpreq $IP4SRC $IP4SRC)
+	atf_check -s not-exit:0 -x "cat ./out |grep -q '$pkt'"
+
+	atf_check -s exit:0 -o ignore rump.ifconfig shmif0 link \
+	b2:a1:00:00:00:02 active
+
+	atf_check -s exit:0 sleep 1
+	extract_new_packets > ./out
+	$DEBUG && cat ./out
+
+	pkt=$(make_pkt_str_arpreq $IP4SRC $IP4SRC)
+	atf_check -s exit:0 -x \
+	"cat ./out |grep '$pkt' |grep -q 'b2:a1:00:00:00:02'"
+}
+
 cleanup()
 {
 	env RUMP_SERVER=$SOCKSRC rump.halt
@@ -476,6 +521,12 @@ pubproxy_arp_cleanup()
 	cleanup
 }
 
+link_activation_cleanup()
+{
+	$DEBUG && dump
+	cleanup
+}
+
 atf_init_test_cases()
 {
 	atf_add_test_case cache_expiration_5s
@@ -484,4 +535,5 @@ atf_init_test_cases()
 	atf_add_test_case garp
 	atf_add_test_case cache_overwriting
 	atf_add_test_case pubproxy_arp
+	atf_add_test_case link_activation
 }

Index: src/tests/net/ndp/t_ndp.sh
diff -u src/tests/net/ndp/t_ndp.sh:1.8 src/tests/net/ndp/t_ndp.sh:1.9
--- src/tests/net/ndp/t_ndp.sh:1.8	Wed Nov 18 04:13:01 2015
+++ src/tests/net/ndp/t_ndp.sh	Mon Feb 29 09:35:16 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ndp.sh,v 1.8 2015/11/18 04:13:01 ozaki-r Exp $
+#	$NetBSD: t_ndp.sh,v 1.9 2016/02/29 09:35:16 ozaki-r Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -41,6 +41,7 @@ atf_test_case cache_expiration cleanup
 atf_test_case command cleanup
 atf_test_case cache_overwriting cleanup
 atf_test_case neighborgcthresh cleanup
+atf_test_case link_activation cleanup
 
 cache_expiration_head()
 {
@@ -66,6 +67,12 @@ neighborgcthresh_head()
 	atf_set "require.progs" "rump_server"
 }
 
+link_activation_head()
+{
+	atf_set "descr" "Tests for activating a new MAC address"
+	atf_set "require.progs" "rump_server"
+}
+
 setup_dst_server()
 {
 	local assign_ip=$1
@@ -303,6 +310,73 @@ neighborgcthresh_body()
 	return 0
 }
 
+make_pkt_str_na()
+{
+	local ip=$1
+	local mac=$2
+	local pkt=
+	pkt="$mac > 33:33:00:00:00:01, ethertype IPv6 (0x86dd), length 86:"
+	pkt="$pkt $ip > ff02::1: ICMP6, neighbor advertisement"
+	echo $pkt
+}
+
+extract_new_packets()
+{
+	local old=./old
+
+	if [ ! -f $old ]; then
+		old=/dev/null
+	fi
+
+	shmif_dumpbus -p - bus1 2>/dev/null| \
+	tcpdump -n -e -r - 2>/dev/null > ./new
+	diff -u $old ./new |grep '^+' |cut -d '+' -f 2 > ./diff
+	mv -f ./new ./old
+	cat ./diff
+}
+
+link_activation_body()
+{
+	local linklocal=
+
+	atf_check -s exit:0 ${inetserver} $SOCKSRC
+	atf_check -s exit:0 ${inetserver} $SOCKDST
+
+	setup_dst_server
+	setup_src_server
+
+	# flush old packets
+	extract_new_packets > ./out
+
+	export RUMP_SERVER=$SOCKSRC
+
+	atf_check -s exit:0 -o ignore rump.ifconfig shmif0 link \
+	b2:a1:00:00:00:01
+
+	atf_check -s exit:0 sleep 1
+	extract_new_packets > ./out
+	$DEBUG && cat ./out
+
+	linklocal=$(rump.ifconfig shmif0 |awk '/fe80/ {print $2;}' |awk -F % '{print $1;}')
+	$DEBUG && echo $linklocal
+
+	pkt=$(make_pkt_str_na $linklocal b2:a1:00:00:00:01)
+	atf_check -s not-exit:0 -x "cat ./out |grep -q '$pkt'"
+
+	atf_check -s exit:0 -o ignore rump.ifconfig shmif0 link 

CVS commit: src/tests/net/if

2016-02-29 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Feb 29 08:13:41 UTC 2016

Modified Files:
src/tests/net/if: t_ifconfig.sh

Log Message:
Add tests deleting active/inactive links


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/net/if/t_ifconfig.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/if/t_ifconfig.sh
diff -u src/tests/net/if/t_ifconfig.sh:1.6 src/tests/net/if/t_ifconfig.sh:1.7
--- src/tests/net/if/t_ifconfig.sh:1.6	Fri Nov 20 05:05:40 2015
+++ src/tests/net/if/t_ifconfig.sh	Mon Feb 29 08:13:41 2016
@@ -1,4 +1,4 @@
-# $NetBSD: t_ifconfig.sh,v 1.6 2015/11/20 05:05:40 ozaki-r Exp $
+# $NetBSD: t_ifconfig.sh,v 1.7 2016/02/29 08:13:41 ozaki-r Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -247,6 +247,12 @@ parameters_body()
 	atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::2 delete
 	atf_check -s exit:0 -o not-match:'fc00::1' rump.ifconfig shmif0 inet6
 	atf_check -s exit:0 -o not-match:'fc00::2' rump.ifconfig shmif0 inet6
+	# can delete inactive link
+	atf_check -s exit:0 rump.ifconfig shmif0 link b2:a0:75:00:00:02
+	atf_check -s exit:0 rump.ifconfig shmif0 link b2:a0:75:00:00:02 delete
+	# cannot delete active link
+	atf_check -s not-exit:0 -e match:'SIOCDLIFADDR: Device busy' \
+	rump.ifconfig shmif0 link b2:a0:75:00:00:01 delete
 
 	atf_check -s exit:0 rump.ifconfig shmif0 inet 192.168.0.1/24