CVS commit: src/external/bsd/byacc/bin

2020-07-26 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Mon Jul 27 00:34:56 UTC 2020

Modified Files:
src/external/bsd/byacc/bin: yacc.1

Log Message:
Improve PostScript output.

Some highlights in no particular order:

%destructor was somehow lost from the list that follows, it should be
part of it.

Use .Ic for yacc directives when they are defined, .Ql otherwise.

Use explicit .Sq Li (instead of .Ql) in description of %destructor to
make sure the result is consistently quoted.  It more readable that
way.

Use .Va and .Vt where appropriate.

C preprocessor directives are marked up with .No (a nop), so that it's
easy to switch them to something else if need be.  For now just use
them as plain words.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/external/bsd/byacc/bin/yacc.1

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

Modified files:

Index: src/external/bsd/byacc/bin/yacc.1
diff -u src/external/bsd/byacc/bin/yacc.1:1.8 src/external/bsd/byacc/bin/yacc.1:1.9
--- src/external/bsd/byacc/bin/yacc.1:1.8	Sun Jul 26 23:18:06 2020
+++ src/external/bsd/byacc/bin/yacc.1	Mon Jul 27 00:34:56 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: yacc.1,v 1.8 2020/07/26 23:18:06 uwe Exp $
+.\"	$NetBSD: yacc.1,v 1.9 2020/07/27 00:34:56 uwe Exp $
 .\"
 .\" Copyright (c) 1989, 1990 The Regents of the University of California.
 .\" All rights reserved.
@@ -32,7 +32,7 @@
 .\"
 .\"	from: @(#)yacc.1	5.7 (Berkeley) 7/30/91
 .\"	from: Id: yacc.1,v 1.24 2014/10/06 00:03:48 tom Exp
-.\"	$NetBSD: yacc.1,v 1.8 2020/07/26 23:18:06 uwe Exp $
+.\"	$NetBSD: yacc.1,v 1.9 2020/07/27 00:34:56 uwe Exp $
 .\"
 .Dd October 5, 2014
 .Dt YACC 1
@@ -40,7 +40,7 @@
 .Sh NAME
 .Nm yacc
 .Nd an
-.Tn LALR(1)
+.Tn LALR Ns (1)
 parser generator
 .Sh SYNOPSIS
 .Nm
@@ -54,10 +54,10 @@ parser generator
 reads the grammar specification in the file
 .Ar filename
 and generates an
-.Tn LALR(1)
+.Tn LALR Ns (1)
 parser for it.
 The parsers consist of a set of
-.Tn LALR(1)
+.Tn LALR Ns (1)
 parsing tables and a driver routine
 written in the C programming language.
 .Nm
@@ -65,7 +65,7 @@ normally writes the parse tables and the
 .Pa y.tab.c .
 .Pp
 The following options are available:
-.Bl -tag -width symbol_prefixXXX
+.Bl -tag -width Fl
 .It Fl b Ar file_prefix
 The
 .Fl b
@@ -73,7 +73,7 @@ option changes the prefix prepended to t
 the string denoted by
 .Ar file_prefix .
 The default prefix is the character
-.Ar y .
+.Ql y .
 .It Fl B
 Create a backtracking parser (compile-type configuration for
 .Nm ) .
@@ -83,12 +83,14 @@ The
 option causes the header file
 .Pa y.tab.h
 to be written.
-It contains #define's for the token identifiers.
+It contains
+.No #define Ns 's
+for the token identifiers.
 .It Fl g
 The
 .Fl g
 option causes a graphical description of the generated
-.Tn LALR(1)
+.Tn LALR Ns (1)
 parser to be written to the file
 .Pa y.dot
 in graphviz format, ready to be processed by
@@ -100,15 +102,19 @@ option causes a supplementary header fil
 .Pa y.tab.i
 to be written.
 It contains extern declarations
-and supplementary #define's as needed to map the conventional
+and supplementary
+.No #define Ns 's
+as needed to map the conventional
 .Nm
-yy-prefixed names to whatever the
+.Va yy Ns \&-prefixed
+names to whatever the
 .Fl p
 option may specify.
 The code file, e.g.,
 .Pa y.tab.c
-is modified to #include this file
-as well as the
+is modified to
+.No #include
+this file as well as the
 .Pa y.tab.h
 file, enforcing consistent usage of the symbols defined in those files.
 The supplementary header file makes it simpler to separate compilation
@@ -118,18 +124,25 @@ If the
 .Fl l
 option is not specified,
 .Nm
-will insert #line directives in the generated code.
-The #line directives let the C compiler relate errors in the
+will insert
+.No #line
+directives in the generated code.
+The
+.No #line
+directives let the C compiler relate errors in the
 generated code to the user's original code.
 If the
 .Fl l
 option is specified,
 .Nm
-will not insert the #line directives.
-#line directives specified by the user will be retained.
+will not insert the
+.No #line
+directives.
+.No #line
+directives specified by the user will be retained.
 .It Fl L
 Enable position processing, e.g.,
-.Dq %locations
+.Ql %locations
 (compile-type configuration for
 .Nm ) .
 .It Fl o Ar output_file
@@ -146,7 +159,7 @@ The
 options instructs
 .Nm
 to create a reentrant parser, like
-.Dq %pure-parser
+.Ql %pure-parser
 does.
 .It Fl p Ar symbol_prefix
 The
@@ -155,7 +168,7 @@ option changes the prefix prepended to y
 the string denoted by
 .Ar symbol_prefix .
 The default prefix is the string
-.Ar yy .
+.Ql yy .
 .It Fl r
 The
 .Fl r
@@ -167,15 +180,15 @@ The code file is named
 and the tables file is named
 .Pa y.tab.c .
 The prefix
-.Dq y .
+.Ql y
 can be overridden using the
 .Fl b
 option.
 .It Fl s
 Suppress
-.Dq #define
+.No #define
 statements generated for string literals in a
-.Dq %token

CVS commit: src/external/bsd/byacc/bin

2020-07-26 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Sun Jul 26 23:18:06 UTC 2020

Modified Files:
src/external/bsd/byacc/bin: yacc.1

Log Message:
Fix markup errors.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/bsd/byacc/bin/yacc.1

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

Modified files:

Index: src/external/bsd/byacc/bin/yacc.1
diff -u src/external/bsd/byacc/bin/yacc.1:1.7 src/external/bsd/byacc/bin/yacc.1:1.8
--- src/external/bsd/byacc/bin/yacc.1:1.7	Tue Jul 24 05:40:15 2018
+++ src/external/bsd/byacc/bin/yacc.1	Sun Jul 26 23:18:06 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: yacc.1,v 1.7 2018/07/24 05:40:15 wiz Exp $
+.\"	$NetBSD: yacc.1,v 1.8 2020/07/26 23:18:06 uwe Exp $
 .\"
 .\" Copyright (c) 1989, 1990 The Regents of the University of California.
 .\" All rights reserved.
@@ -32,7 +32,7 @@
 .\"
 .\"	from: @(#)yacc.1	5.7 (Berkeley) 7/30/91
 .\"	from: Id: yacc.1,v 1.24 2014/10/06 00:03:48 tom Exp
-.\"	$NetBSD: yacc.1,v 1.7 2018/07/24 05:40:15 wiz Exp $
+.\"	$NetBSD: yacc.1,v 1.8 2020/07/26 23:18:06 uwe Exp $
 .\"
 .Dd October 5, 2014
 .Dt YACC 1
@@ -424,7 +424,7 @@ in this array.
 .El
 .Sh PORTABILITY
 According to Robert Corbett:
-.Bd -offset indent
+.Bd -filled -offset indent
 Berkeley Yacc is an LALR(1) parser generator.
 Berkeley Yacc has been made as compatible as possible with AT\*[Am]T Yacc.
 Berkeley Yacc can accept any input specification that conforms to the
@@ -475,7 +475,7 @@ delete that directive.
 .Pp
 .Xr bison 1
 no equivalent for some of
-.Nm 's
+.Nm Ns 's
 command-line options, relying on directives embedded in the grammar file.
 .Pp
 .Xr bison 1
@@ -522,7 +522,6 @@ but
 for destructors.
 .Nm
 matches this behavior.
-.El
 .Sh ENVIRONMENT
 The following environment variable is referenced by
 .Nm :



CVS commit: src/usr.bin/make

2020-07-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul 26 23:03:54 UTC 2020

Modified Files:
src/usr.bin/make: var.c

Log Message:
make(1): make test for dynamic variable name more specific

Since all the string literals have either 7 or 8 characters, there is no
need to call strcmp for shorter or longer variable names.


To generate a diff of this commit:
cvs rdiff -u -r1.335 -r1.336 src/usr.bin/make/var.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/make/var.c
diff -u src/usr.bin/make/var.c:1.335 src/usr.bin/make/var.c:1.336
--- src/usr.bin/make/var.c:1.335	Sun Jul 26 22:43:16 2020
+++ src/usr.bin/make/var.c	Sun Jul 26 23:03:54 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.335 2020/07/26 22:43:16 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.336 2020/07/26 23:03:54 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.335 2020/07/26 22:43:16 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.336 2020/07/26 23:03:54 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.335 2020/07/26 22:43:16 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.336 2020/07/26 23:03:54 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -3384,7 +3384,7 @@ VarIsDynamic(GNode *ctxt, const char *va
 	return FALSE;
 }
 
-if (namelen > 2 && varname[0] == '.' &&
+if ((namelen == 7 || namelen == 8) && varname[0] == '.' &&
 	isupper((unsigned char) varname[1]) &&
 	(ctxt == VAR_CMD || ctxt == VAR_GLOBAL))
 {



CVS commit: src/usr.bin/make

2020-07-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul 26 22:43:17 UTC 2020

Modified Files:
src/usr.bin/make: var.c

Log Message:
make(1): extract code for dynamic variable names out of Var_Parse


To generate a diff of this commit:
cvs rdiff -u -r1.334 -r1.335 src/usr.bin/make/var.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/make/var.c
diff -u src/usr.bin/make/var.c:1.334 src/usr.bin/make/var.c:1.335
--- src/usr.bin/make/var.c:1.334	Sun Jul 26 22:19:11 2020
+++ src/usr.bin/make/var.c	Sun Jul 26 22:43:16 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.334 2020/07/26 22:19:11 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.335 2020/07/26 22:43:16 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.334 2020/07/26 22:19:11 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.335 2020/07/26 22:43:16 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.334 2020/07/26 22:19:11 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.335 2020/07/26 22:43:16 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -3358,6 +3358,45 @@ cleanup:
 return var_Error;
 }
 
+static Boolean
+VarIsDynamic(GNode *ctxt, const char *varname, size_t namelen)
+{
+if ((namelen == 1 ||
+	 (namelen == 2 && (varname[1] == 'F' || varname[1] == 'D'))) &&
+	(ctxt == VAR_CMD || ctxt == VAR_GLOBAL))
+{
+	/*
+	 * If substituting a local variable in a non-local context,
+	 * assume it's for dynamic source stuff. We have to handle
+	 * this specially and return the longhand for the variable
+	 * with the dollar sign escaped so it makes it back to the
+	 * caller. Only four of the local variables are treated
+	 * specially as they are the only four that will be set
+	 * when dynamic sources are expanded.
+	 */
+	switch (varname[0]) {
+	case '@':
+	case '%':
+	case '*':
+	case '!':
+	return TRUE;
+	}
+	return FALSE;
+}
+
+if (namelen > 2 && varname[0] == '.' &&
+	isupper((unsigned char) varname[1]) &&
+	(ctxt == VAR_CMD || ctxt == VAR_GLOBAL))
+{
+	return strcmp(varname, ".TARGET") == 0 ||
+	strcmp(varname, ".ARCHIVE") == 0 ||
+	strcmp(varname, ".PREFIX") == 0 ||
+	strcmp(varname, ".MEMBER") == 0;
+}
+
+return FALSE;
+}
+
 /*-
  *---
  * Var_Parse --
@@ -3542,39 +3581,7 @@ Var_Parse(const char * const str, GNode 
 	}
 
 	if (v == NULL) {
-	if ((namelen == 1 ||
-		 (namelen == 2 && (varname[1] == 'F' || varname[1] == 'D'))) &&
-		(ctxt == VAR_CMD || ctxt == VAR_GLOBAL))
-	{
-		/*
-		 * If substituting a local variable in a non-local context,
-		 * assume it's for dynamic source stuff. We have to handle
-		 * this specially and return the longhand for the variable
-		 * with the dollar sign escaped so it makes it back to the
-		 * caller. Only four of the local variables are treated
-		 * specially as they are the only four that will be set
-		 * when dynamic sources are expanded.
-		 */
-		switch (varname[0]) {
-		case '@':
-		case '%':
-		case '*':
-		case '!':
-		dynamic = TRUE;
-		break;
-		}
-	} else if (namelen > 2 && varname[0] == '.' &&
-		   isupper((unsigned char) varname[1]) &&
-		   (ctxt == VAR_CMD || ctxt == VAR_GLOBAL))
-	{
-		if ((strcmp(varname, ".TARGET") == 0) ||
-		(strcmp(varname, ".ARCHIVE") == 0) ||
-		(strcmp(varname, ".PREFIX") == 0) ||
-		(strcmp(varname, ".MEMBER") == 0))
-		{
-		dynamic = TRUE;
-		}
-	}
+	dynamic = VarIsDynamic(ctxt, varname, namelen);
 
 	if (!haveModifier) {
 		/*



CVS commit: src/usr.bin/config

2020-07-26 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Sun Jul 26 22:40:52 UTC 2020

Modified Files:
src/usr.bin/config: gram.y

Log Message:
Add debug output for ENDDEFS.

This makes it more clear in the debug output where config switched
from definitions to selections.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/usr.bin/config/gram.y

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/config/gram.y
diff -u src/usr.bin/config/gram.y:1.55 src/usr.bin/config/gram.y:1.56
--- src/usr.bin/config/gram.y:1.55	Sat Mar  7 19:26:13 2020
+++ src/usr.bin/config/gram.y	Sun Jul 26 22:40:52 2020
@@ -1,5 +1,5 @@
 %{
-/*	$NetBSD: gram.y,v 1.55 2020/03/07 19:26:13 christos Exp $	*/
+/*	$NetBSD: gram.y,v 1.56 2020/07/26 22:40:52 uwe Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -42,7 +42,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: gram.y,v 1.55 2020/03/07 19:26:13 christos Exp $");
+__RCSID("$NetBSD: gram.y,v 1.56 2020/07/26 22:40:52 uwe Exp $");
 
 #include 
 #include 
@@ -306,7 +306,11 @@ no:
 
 /* Complete definition part: the contents of all files.* files. */
 definition_part:
-	definitions ENDDEFS		{ check_maxpart(); check_version(); }
+	definitions ENDDEFS		{
+		CFGDBG(1, "ENDDEFS");
+		check_maxpart();
+		check_version();
+	}
 ;
 
 /* Zero or more definitions. Trap errors. */



CVS commit: src/usr.bin/config

2020-07-26 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Sun Jul 26 22:25:47 UTC 2020

Modified Files:
src/usr.bin/config: scan.l

Log Message:
Don't print the location of the include directive twice.

cfgdbg() already prints the current file and line number, so don't
print the same information ourselves in the message too.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/usr.bin/config/scan.l

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/config/scan.l
diff -u src/usr.bin/config/scan.l:1.32 src/usr.bin/config/scan.l:1.33
--- src/usr.bin/config/scan.l:1.32	Fri Apr  3 19:53:41 2020
+++ src/usr.bin/config/scan.l	Sun Jul 26 22:25:47 2020
@@ -1,5 +1,5 @@
 %{
-/*	$NetBSD: scan.l,v 1.32 2020/04/03 19:53:41 joerg Exp $	*/
+/*	$NetBSD: scan.l,v 1.33 2020/07/26 22:25:47 uwe Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -42,7 +42,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: scan.l,v 1.32 2020/04/03 19:53:41 joerg Exp $");
+__RCSID("$NetBSD: scan.l,v 1.33 2020/07/26 22:25:47 uwe Exp $");
 
 #include 
 #include 
@@ -555,7 +555,7 @@ include(const char *fname, int ateof, in
 	if (interesting)
 		logconfig_include(fp, fname);
 	incl = in;
-	CFGDBG(1, "include `%s' from `%s' line %d", fname, yyfile, yyline);
+	CFGDBG(1, "include `%s'", fname);
 	yy_switch_to_buffer(yy_create_buffer(fp, YY_BUF_SIZE));
 	yyfile = intern(s);
 	yyline = 1;



CVS commit: src/usr.bin/make

2020-07-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul 26 22:19:12 UTC 2020

Modified Files:
src/usr.bin/make: var.c
src/usr.bin/make/unit-tests: varparse-dynamic.exp

Log Message:
make(1): fix off-by-one error in Var_Parse for dynamic variables


To generate a diff of this commit:
cvs rdiff -u -r1.333 -r1.334 src/usr.bin/make/var.c
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/varparse-dynamic.exp

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/make/var.c
diff -u src/usr.bin/make/var.c:1.333 src/usr.bin/make/var.c:1.334
--- src/usr.bin/make/var.c:1.333	Sun Jul 26 21:31:11 2020
+++ src/usr.bin/make/var.c	Sun Jul 26 22:19:11 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.333 2020/07/26 21:31:11 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.334 2020/07/26 22:19:11 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.333 2020/07/26 21:31:11 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.334 2020/07/26 22:19:11 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.333 2020/07/26 21:31:11 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.334 2020/07/26 22:19:11 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -136,6 +136,12 @@ __RCSID("$NetBSD: var.c,v 1.333 2020/07/
 #include"job.h"
 #include"metachar.h"
 
+#define VAR_DEBUG(fmt, ...)	\
+if (!DEBUG(VAR))		\
+	(void) 0;		\
+else			\
+	fprintf(debug_file, fmt, __VA_ARGS__)
+
 /*
  * This lets us tell if we have replaced the original environ
  * (which we cannot free).
@@ -3561,11 +3567,10 @@ Var_Parse(const char * const str, GNode 
 		   isupper((unsigned char) varname[1]) &&
 		   (ctxt == VAR_CMD || ctxt == VAR_GLOBAL))
 	{
-		int len = namelen - 1;
-		if ((strncmp(varname, ".TARGET", len) == 0) ||
-		(strncmp(varname, ".ARCHIVE", len) == 0) ||
-		(strncmp(varname, ".PREFIX", len) == 0) ||
-		(strncmp(varname, ".MEMBER", len) == 0))
+		if ((strcmp(varname, ".TARGET") == 0) ||
+		(strcmp(varname, ".ARCHIVE") == 0) ||
+		(strcmp(varname, ".PREFIX") == 0) ||
+		(strcmp(varname, ".MEMBER") == 0))
 		{
 		dynamic = TRUE;
 		}

Index: src/usr.bin/make/unit-tests/varparse-dynamic.exp
diff -u src/usr.bin/make/unit-tests/varparse-dynamic.exp:1.1 src/usr.bin/make/unit-tests/varparse-dynamic.exp:1.2
--- src/usr.bin/make/unit-tests/varparse-dynamic.exp:1.1	Sun Jul 26 22:15:36 2020
+++ src/usr.bin/make/unit-tests/varparse-dynamic.exp	Sun Jul 26 22:19:12 2020
@@ -1,3 +1,4 @@
+make: "varparse-dynamic.mk" line 8: Malformed conditional (${.TARGEX})
 make: "varparse-dynamic.mk" line 10: Malformed conditional (${.TARGXX})
 make: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests



CVS commit: src

2020-07-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul 26 22:15:36 UTC 2020

Modified Files:
src/distrib/sets/lists/tests: mi
src/usr.bin/make/unit-tests: Makefile
Added Files:
src/usr.bin/make/unit-tests: varparse-dynamic.exp varparse-dynamic.mk

Log Message:
make(1): add test for off-by-one error in Var_Parse


To generate a diff of this commit:
cvs rdiff -u -r1.877 -r1.878 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.65 -r1.66 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/varparse-dynamic.exp \
src/usr.bin/make/unit-tests/varparse-dynamic.mk

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/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.877 src/distrib/sets/lists/tests/mi:1.878
--- src/distrib/sets/lists/tests/mi:1.877	Sun Jul 26 14:22:22 2020
+++ src/distrib/sets/lists/tests/mi	Sun Jul 26 22:15:36 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.877 2020/07/26 14:22:22 riastradh Exp $
+# $NetBSD: mi,v 1.878 2020/07/26 22:15:36 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -4608,6 +4608,8 @@
 ./usr/tests/usr.bin/make/unit-tests/varmisc.mk	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/varmod-edge.exp	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/varmod-edge.mk	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/varparse-dynamic.exp	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/varparse-dynamic.mk	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/varquote.exp	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/varquote.mk	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/varshell.exp	tests-usr.bin-tests	compattestfile,atf

Index: src/usr.bin/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.65 src/usr.bin/make/unit-tests/Makefile:1.66
--- src/usr.bin/make/unit-tests/Makefile:1.65	Sun Jul 26 11:10:29 2020
+++ src/usr.bin/make/unit-tests/Makefile	Sun Jul 26 22:15:36 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.65 2020/07/26 11:10:29 rillig Exp $
+# $NetBSD: Makefile,v 1.66 2020/07/26 22:15:36 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -72,6 +72,7 @@ TESTS+=		vardebug
 TESTS+=		varfind
 TESTS+=		varmisc
 TESTS+=		varmod-edge
+TESTS+=		varparse-dynamic
 TESTS+=		varquote
 TESTS+=		varshell
 

Added files:

Index: src/usr.bin/make/unit-tests/varparse-dynamic.exp
diff -u /dev/null src/usr.bin/make/unit-tests/varparse-dynamic.exp:1.1
--- /dev/null	Sun Jul 26 22:15:36 2020
+++ src/usr.bin/make/unit-tests/varparse-dynamic.exp	Sun Jul 26 22:15:36 2020
@@ -0,0 +1,4 @@
+make: "varparse-dynamic.mk" line 10: Malformed conditional (${.TARGXX})
+make: Fatal errors encountered -- cannot continue
+make: stopped in unit-tests
+exit status 1
Index: src/usr.bin/make/unit-tests/varparse-dynamic.mk
diff -u /dev/null src/usr.bin/make/unit-tests/varparse-dynamic.mk:1.1
--- /dev/null	Sun Jul 26 22:15:36 2020
+++ src/usr.bin/make/unit-tests/varparse-dynamic.mk	Sun Jul 26 22:15:36 2020
@@ -0,0 +1,14 @@
+# $NetBSD: varparse-dynamic.mk,v 1.1 2020/07/26 22:15:36 rillig Exp $
+
+# Before 2020-07-27, there was an off-by-one error in Var_Parse that skipped
+# the last character in the variable name.
+# To trigger the bug, the variable must not be defined.
+.if ${.TARGET}			# exact match, may be undefined
+.endif
+.if ${.TARGEX}			# 1 character difference, must be defined
+.endif
+.if ${.TARGXX}			# 2 characters difference, must be defined
+.endif
+
+all:
+	@:



CVS commit: src/share/man/man4

2020-07-26 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Jul 26 21:47:16 UTC 2020

Modified Files:
src/share/man/man4: wwanc.4

Log Message:
Minor wording improvements.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/share/man/man4/wwanc.4

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/man4/wwanc.4
diff -u src/share/man/man4/wwanc.4:1.3 src/share/man/man4/wwanc.4:1.4
--- src/share/man/man4/wwanc.4:1.3	Sun Jul 26 15:57:03 2020
+++ src/share/man/man4/wwanc.4	Sun Jul 26 21:47:16 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: wwanc.4,v 1.3 2020/07/26 15:57:03 jdolecek Exp $
+.\" $NetBSD: wwanc.4,v 1.4 2020/07/26 21:47:16 wiz Exp $
 .\"
 .\" Copyright (c) 2020 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -38,13 +38,14 @@ The
 .Nm
 driver provides support for Fibocom L850-GL / Intel XMM7360.
 .Pp
-Device establishes connections via cellular networks such as
+The device establishes connections via cellular networks such as
 GPRS, UMTS, and LTE.
 They appear as a regular point-to-point network interface,
 transporting raw IP frames.
 .Pp
-SIM card needs to be unlocked, driver provides no means to provide
-password for the SIM.
+The SIM card needs to be unlocked, the
+.Nm
+driver provides no means to provide a password for the SIM.
 .Sh HARDWARE
 The following devices should work:
 .Pp
@@ -81,7 +82,7 @@ The
 .Nm
 driver IPv6 support is untested.
 .Pp
-Network initialization requires Python script published on the Linux
+Network initialization requires a Python script published in the Linux
 driver repository.
 The script requires the management device nodes to be created via:
 .Bd -literal -offset indent



CVS commit: src/usr.bin/make/unit-tests

2020-07-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul 26 21:46:10 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: varmisc.exp varmisc.mk

Log Message:
make(1): add coverage test for dynamic = TRUE in Var_Parse


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/varmisc.exp
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/make/unit-tests/varmisc.mk

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/make/unit-tests/varmisc.exp
diff -u src/usr.bin/make/unit-tests/varmisc.exp:1.12 src/usr.bin/make/unit-tests/varmisc.exp:1.13
--- src/usr.bin/make/unit-tests/varmisc.exp:1.12	Sun Jul 26 21:09:49 2020
+++ src/usr.bin/make/unit-tests/varmisc.exp	Sun Jul 26 21:46:10 2020
@@ -44,6 +44,8 @@ export-appended: env
 export-appended: env
 export-appended: env mk
 parse-dynamic: parse-dynamic parse-dynamic before
+parse-dynamic: parse-dynamic parse-dynamic after
+parse-dynamic: parse-dynamic parse-dynamic after
 varerror-unclosed:begin
 
 make: Unclosed variable specification (expecting '}') for "UNCLOSED" (value "") modifier M

Index: src/usr.bin/make/unit-tests/varmisc.mk
diff -u src/usr.bin/make/unit-tests/varmisc.mk:1.16 src/usr.bin/make/unit-tests/varmisc.mk:1.17
--- src/usr.bin/make/unit-tests/varmisc.mk:1.16	Sun Jul 26 21:09:49 2020
+++ src/usr.bin/make/unit-tests/varmisc.mk	Sun Jul 26 21:46:10 2020
@@ -1,4 +1,4 @@
-# $Id: varmisc.mk,v 1.16 2020/07/26 21:09:49 rillig Exp $
+# $Id: varmisc.mk,v 1.17 2020/07/26 21:46:10 rillig Exp $
 #
 # Miscellaneous variable tests.
 
@@ -165,16 +165,31 @@ export-appended:
 # the global context. They are preserved until there is a local context
 # in which resolving them makes sense.
 
+# There are different code paths for short names ...
 ${:U>}=		before
-G_TARGET:=	$@
-G_MEMBER:=	$%
-G_PREFIX:=	$*
-G_ARCHIVE:=	$!
-G_ALLSRC:=	$>
+GS_TARGET:=	$@
+GS_MEMBER:=	$%
+GS_PREFIX:=	$*
+GS_ARCHIVE:=	$!
+GS_ALLSRC:=	$>
 ${:U>}=		after
+# ... and for braced short names ...
+GB_TARGET:=	${@}
+GB_MEMBER:=	${%}
+GB_PREFIX:=	${*}
+GB_ARCHIVE:=	${!}
+GB_ALLSRC:=	${>}
+# ... and for long names.
+GL_TARGET:=	${.TARGET}
+GL_MEMBER:=	${.MEMBER}
+GL_PREFIX:=	${.PREFIX}
+GL_ARCHIVE:=	${.ARCHIVE}
+GL_ALLSRC:=	${.ALLSRC}
 
 parse-dynamic:
-	@echo $@: ${G_TARGET} ${G_MEMBER} ${G_PREFIX} ${G_ARCHIVE} ${G_ALLSRC}
+	@echo $@: ${GS_TARGET} ${GS_MEMBER} ${GS_PREFIX} ${GS_ARCHIVE} ${GS_ALLSRC}
+	@echo $@: ${GB_TARGET} ${GB_MEMBER} ${GB_PREFIX} ${GB_ARCHIVE} ${GB_ALLSRC}
+	@echo $@: ${GL_TARGET} ${GL_MEMBER} ${GL_PREFIX} ${GL_ARCHIVE} ${GL_ALLSRC}
 
 # As of 2020-07-26, make does not complain about unclosed variables.
 # It does complain about unclosed variables when parsing modifiers though.



CVS commit: src/usr.bin/make

2020-07-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul 26 21:31:11 UTC 2020

Modified Files:
src/usr.bin/make: var.c

Log Message:
make(1): rename VarEvalFlags variables to eflags

This way, they cannot be confused with other flags, and any mismatch of
mixing eflags with constants other than VARE_* is immediately apparent.


To generate a diff of this commit:
cvs rdiff -u -r1.332 -r1.333 src/usr.bin/make/var.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/make/var.c
diff -u src/usr.bin/make/var.c:1.332 src/usr.bin/make/var.c:1.333
--- src/usr.bin/make/var.c:1.332	Sun Jul 26 21:19:42 2020
+++ src/usr.bin/make/var.c	Sun Jul 26 21:31:11 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.332 2020/07/26 21:19:42 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.333 2020/07/26 21:31:11 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.332 2020/07/26 21:19:42 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.333 2020/07/26 21:31:11 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.332 2020/07/26 21:19:42 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.333 2020/07/26 21:31:11 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -2232,7 +2232,7 @@ ApplyModifier_Hash(const char *mod, Appl
 static void
 ApplyModifier_Path(const char *mod, ApplyModifiersState *st)
 {
-if ((st->v->flags & VAR_JUNK) != 0)
+if (st->v->flags & VAR_JUNK)
 	st->v->flags |= VAR_KEEP;
 GNode *gn = Targ_FindNode(st->v->name, TARG_NOCREATE);
 if (gn == NULL || gn->type & OP_NOPATH) {
@@ -2888,7 +2888,7 @@ ApplyModifier_Assign(const char *mod, Ap
 	break;
 	}
 	case '?':
-	if ((st->v->flags & VAR_JUNK) == 0)
+	if (!(st->v->flags & VAR_JUNK))
 		break;
 	/* FALLTHROUGH */
 	default:
@@ -3156,7 +3156,7 @@ ApplyModifiers(char *nstr, const char *t
 	break;
 	case 'L':
 	{
-		if ((st.v->flags & VAR_JUNK) != 0)
+		if (st.v->flags & VAR_JUNK)
 		st.v->flags |= VAR_KEEP;
 		st.newStr = bmake_strdup(st.v->name);
 		st.cp = p + 1;
@@ -3384,7 +3384,7 @@ cleanup:
  */
 /* coverity[+alloc : arg-*4] */
 const char *
-Var_Parse(const char * const str, GNode *ctxt, VarEvalFlags flags,
+Var_Parse(const char * const str, GNode *ctxt, VarEvalFlags eflags,
 	  int *lengthPtr, void **freePtr)
 {
 const char	*tstr;		/* Pointer into str */
@@ -3445,7 +3445,7 @@ Var_Parse(const char * const str, GNode 
 		return "$(.ARCHIVE)";
 		}
 	}
-	return (flags & VARE_UNDEFERR) ? var_Error : varNoError;
+	return (eflags & VARE_UNDEFERR) ? var_Error : varNoError;
 	} else {
 	haveModifier = FALSE;
 	tstr = str + 1;
@@ -3475,7 +3475,7 @@ Var_Parse(const char * const str, GNode 
 	if (*tstr == '$') {
 		int rlen;
 		void *freeIt;
-		const char *rval = Var_Parse(tstr, ctxt, flags, , );
+		const char *rval = Var_Parse(tstr, ctxt, eflags, , );
 		if (rval != NULL)
 		Buf_AddStr(, rval);
 		free(freeIt);
@@ -3584,7 +3584,7 @@ Var_Parse(const char * const str, GNode 
 		return pstr;
 		} else {
 		Buf_Destroy(, TRUE);
-		return (flags & VARE_UNDEFERR) ? var_Error : varNoError;
+		return (eflags & VARE_UNDEFERR) ? var_Error : varNoError;
 		}
 	} else {
 		/*
@@ -3617,8 +3617,8 @@ Var_Parse(const char * const str, GNode 
  * return.
  */
 nstr = Buf_GetAll(>val, NULL);
-if (strchr(nstr, '$') != NULL && (flags & VARE_WANTRES) != 0) {
-	nstr = Var_Subst(NULL, nstr, ctxt, flags);
+if (strchr(nstr, '$') != NULL && (eflags & VARE_WANTRES) != 0) {
+	nstr = Var_Subst(NULL, nstr, ctxt, eflags);
 	*freePtr = nstr;
 }
 
@@ -3631,7 +3631,7 @@ Var_Parse(const char * const str, GNode 
 	extraFree = NULL;
 	if (extramodifiers != NULL) {
 	nstr = ApplyModifiers(nstr, extramodifiers, '(', ')',
-  v, ctxt, flags, , );
+  v, ctxt, eflags, , );
 	}
 
 	if (haveModifier) {
@@ -3639,7 +3639,7 @@ Var_Parse(const char * const str, GNode 
 	tstr++;
 
 	nstr = ApplyModifiers(nstr, tstr, startc, endc,
-  v, ctxt, flags, , freePtr);
+  v, ctxt, eflags, , freePtr);
 	tstr += used;
 	free(extraFree);
 	} else {
@@ -3676,7 +3676,7 @@ Var_Parse(const char * const str, GNode 
 		nstr = bmake_strndup(str, *lengthPtr);
 		*freePtr = nstr;
 	} else {
-		nstr = (flags & VARE_UNDEFERR) ? var_Error : varNoError;
+		nstr = (eflags & VARE_UNDEFERR) ? var_Error : varNoError;
 	}
 	}
 	if (nstr != Buf_GetAll(>val, NULL))
@@ -3691,14 +3691,14 @@ Var_Parse(const char * const str, GNode 
  *---
  * Var_Subst  --
  *	Substitute for all variables in the given string in the given context.
- *	If flags & VARE_UNDEFERR, Parse_Error will be called when an undefined
+ *	If eflags & 

CVS commit: src/sys/kern

2020-07-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul 26 21:28:33 UTC 2020

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

Log Message:
use the right printing function


To generate a diff of this commit:
cvs rdiff -u -r1.488 -r1.489 src/sys/kern/vfs_subr.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/vfs_subr.c
diff -u src/sys/kern/vfs_subr.c:1.488 src/sys/kern/vfs_subr.c:1.489
--- src/sys/kern/vfs_subr.c:1.488	Tue May 26 14:38:37 2020
+++ src/sys/kern/vfs_subr.c	Sun Jul 26 17:28:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_subr.c,v 1.488 2020/05/26 18:38:37 ad Exp $	*/
+/*	$NetBSD: vfs_subr.c,v 1.489 2020/07/26 21:28:33 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2004, 2005, 2007, 2008, 2019, 2020
@@ -69,7 +69,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.488 2020/05/26 18:38:37 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.489 2020/07/26 21:28:33 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -1543,7 +1543,7 @@ vfs_vnode_print(struct vnode *vp, int fu
 
 	uvm_object_printit(>v_uobj, full, pr);
 	(*pr)("\n");
-	vprint_common(vp, "", printf);
+	vprint_common(vp, "", pr);
 	if (full) {
 		struct buf *bp;
 



CVS commit: src/usr.bin/make

2020-07-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul 26 21:19:43 UTC 2020

Modified Files:
src/usr.bin/make: var.c

Log Message:
make(1): rename local variable in Var_Parse


To generate a diff of this commit:
cvs rdiff -u -r1.331 -r1.332 src/usr.bin/make/var.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/make/var.c
diff -u src/usr.bin/make/var.c:1.331 src/usr.bin/make/var.c:1.332
--- src/usr.bin/make/var.c:1.331	Sun Jul 26 20:21:31 2020
+++ src/usr.bin/make/var.c	Sun Jul 26 21:19:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.331 2020/07/26 20:21:31 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.332 2020/07/26 21:19:42 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.331 2020/07/26 20:21:31 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.332 2020/07/26 21:19:42 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.331 2020/07/26 20:21:31 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.332 2020/07/26 21:19:42 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -3452,11 +3452,11 @@ Var_Parse(const char * const str, GNode 
 	endc = str[1];
 	}
 } else {
-	Buffer buf;		/* Holds the variable name */
+	Buffer namebuf;		/* Holds the variable name */
 	int depth = 1;
 
 	endc = startc == PROPEN ? PRCLOSE : BRCLOSE;
-	Buf_Init(, 0);
+	Buf_Init(, 0);
 
 	/*
 	 * Skip to the end character or a colon, whichever comes first.
@@ -3477,11 +3477,11 @@ Var_Parse(const char * const str, GNode 
 		void *freeIt;
 		const char *rval = Var_Parse(tstr, ctxt, flags, , );
 		if (rval != NULL)
-		Buf_AddStr(, rval);
+		Buf_AddStr(, rval);
 		free(freeIt);
 		tstr += rlen - 1;
 	} else
-		Buf_AddByte(, *tstr);
+		Buf_AddByte(, *tstr);
 	}
 	if (*tstr == ':') {
 	haveModifier = TRUE;
@@ -3494,16 +3494,16 @@ Var_Parse(const char * const str, GNode 
 	 * the end of the string, since that's what make does.
 	 */
 	*lengthPtr = tstr - str;
-	Buf_Destroy(, TRUE);
+	Buf_Destroy(, TRUE);
 	return var_Error;
 	}
 
 	int namelen;
-	char *varname = Buf_GetAll(, );
+	char *varname = Buf_GetAll(, );
 
 	/*
 	 * At this point, varname points into newly allocated memory from
-	 * buf, containing only the name of the variable.
+	 * namebuf, containing only the name of the variable.
 	 *
 	 * start and tstr point into the const string that was pointed
 	 * to by the original value of the str parameter.  start points
@@ -3580,10 +3580,10 @@ Var_Parse(const char * const str, GNode 
 		if (dynamic) {
 		char *pstr = bmake_strndup(str, *lengthPtr);
 		*freePtr = pstr;
-		Buf_Destroy(, TRUE);
+		Buf_Destroy(, TRUE);
 		return pstr;
 		} else {
-		Buf_Destroy(, TRUE);
+		Buf_Destroy(, TRUE);
 		return (flags & VARE_UNDEFERR) ? var_Error : varNoError;
 		}
 	} else {
@@ -3595,10 +3595,10 @@ Var_Parse(const char * const str, GNode 
 		v->name = varname;
 		Buf_Init(>val, 1);
 		v->flags = VAR_JUNK;
-		Buf_Destroy(, FALSE);
+		Buf_Destroy(, FALSE);
 	}
 	} else
-	Buf_Destroy(, TRUE);
+	Buf_Destroy(, TRUE);
 }
 
 if (v->flags & VAR_IN_USE) {



CVS commit: src/usr.bin/make/unit-tests

2020-07-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul 26 21:09:49 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: varmisc.exp varmisc.mk

Log Message:
make(1): add test for unclosed variables


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/varmisc.exp
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/make/unit-tests/varmisc.mk

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/make/unit-tests/varmisc.exp
diff -u src/usr.bin/make/unit-tests/varmisc.exp:1.11 src/usr.bin/make/unit-tests/varmisc.exp:1.12
--- src/usr.bin/make/unit-tests/varmisc.exp:1.11	Sun Jul 26 20:30:42 2020
+++ src/usr.bin/make/unit-tests/varmisc.exp	Sun Jul 26 21:09:49 2020
@@ -44,4 +44,10 @@ export-appended: env
 export-appended: env
 export-appended: env mk
 parse-dynamic: parse-dynamic parse-dynamic before
+varerror-unclosed:begin
+
+make: Unclosed variable specification (expecting '}') for "UNCLOSED" (value "") modifier M
+
+
+varerror-unclosed:end
 exit status 0

Index: src/usr.bin/make/unit-tests/varmisc.mk
diff -u src/usr.bin/make/unit-tests/varmisc.mk:1.15 src/usr.bin/make/unit-tests/varmisc.mk:1.16
--- src/usr.bin/make/unit-tests/varmisc.mk:1.15	Sun Jul 26 20:30:42 2020
+++ src/usr.bin/make/unit-tests/varmisc.mk	Sun Jul 26 21:09:49 2020
@@ -1,4 +1,4 @@
-# $Id: varmisc.mk,v 1.15 2020/07/26 20:30:42 rillig Exp $
+# $Id: varmisc.mk,v 1.16 2020/07/26 21:09:49 rillig Exp $
 #
 # Miscellaneous variable tests.
 
@@ -7,6 +7,7 @@ all: unmatched_var_paren D_true U_true D
 all: save-dollars
 all: export-appended
 all: parse-dynamic
+all: varerror-unclosed
 
 unmatched_var_paren:
 	@echo ${foo::=foo-text}
@@ -174,3 +175,12 @@ ${:U>}=		after
 
 parse-dynamic:
 	@echo $@: ${G_TARGET} ${G_MEMBER} ${G_PREFIX} ${G_ARCHIVE} ${G_ALLSRC}
+
+# As of 2020-07-26, make does not complain about unclosed variables.
+# It does complain about unclosed variables when parsing modifiers though.
+varerror-unclosed:
+	@echo $@:begin
+	@echo ${UNCLOSED
+	@echo ${UNCLOSED:M${PATTERN
+	@echo ${UNCLOSED.${param
+	@echo $@:end



CVS commit: src/usr.bin/make/unit-tests

2020-07-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul 26 20:30:42 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: varmisc.exp varmisc.mk

Log Message:
make(1): add test for expanding dynamic variables


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/varmisc.exp
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/make/unit-tests/varmisc.mk

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/make/unit-tests/varmisc.exp
diff -u src/usr.bin/make/unit-tests/varmisc.exp:1.10 src/usr.bin/make/unit-tests/varmisc.exp:1.11
--- src/usr.bin/make/unit-tests/varmisc.exp:1.10	Sun Jul 26 11:10:29 2020
+++ src/usr.bin/make/unit-tests/varmisc.exp	Sun Jul 26 20:30:42 2020
@@ -43,4 +43,5 @@ save-dollars: off  = $
 export-appended: env
 export-appended: env
 export-appended: env mk
+parse-dynamic: parse-dynamic parse-dynamic before
 exit status 0

Index: src/usr.bin/make/unit-tests/varmisc.mk
diff -u src/usr.bin/make/unit-tests/varmisc.mk:1.14 src/usr.bin/make/unit-tests/varmisc.mk:1.15
--- src/usr.bin/make/unit-tests/varmisc.mk:1.14	Sun Jul 26 11:10:29 2020
+++ src/usr.bin/make/unit-tests/varmisc.mk	Sun Jul 26 20:30:42 2020
@@ -1,4 +1,4 @@
-# $Id: varmisc.mk,v 1.14 2020/07/26 11:10:29 rillig Exp $
+# $Id: varmisc.mk,v 1.15 2020/07/26 20:30:42 rillig Exp $
 #
 # Miscellaneous variable tests.
 
@@ -6,6 +6,7 @@ all: unmatched_var_paren D_true U_true D
 	strftime cmpv manok
 all: save-dollars
 all: export-appended
+all: parse-dynamic
 
 unmatched_var_paren:
 	@echo ${foo::=foo-text}
@@ -156,3 +157,20 @@ export-appended:
 	@echo $@: "$$FROM_ENV"
 	@echo $@: "$$FROM_ENV_BEFORE"
 	@echo $@: "$$FROM_ENV_AFTER"
+
+# begin parse-dynamic
+#
+# Demonstrate that the target-specific variables are not evaluated in
+# the global context. They are preserved until there is a local context
+# in which resolving them makes sense.
+
+${:U>}=		before
+G_TARGET:=	$@
+G_MEMBER:=	$%
+G_PREFIX:=	$*
+G_ARCHIVE:=	$!
+G_ALLSRC:=	$>
+${:U>}=		after
+
+parse-dynamic:
+	@echo $@: ${G_TARGET} ${G_MEMBER} ${G_PREFIX} ${G_ARCHIVE} ${G_ALLSRC}



CVS commit: src/usr.bin/make

2020-07-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul 26 20:21:31 UTC 2020

Modified Files:
src/usr.bin/make: arch.c cond.c nonints.h suff.c var.c

Log Message:
make(1): make return value of Var_Parse constant

This return value is not supposed to be modified since it can be a string
literal.  The modifiable part is returned via freePtr, but only for
freeing, not for actually modifying anything.


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/usr.bin/make/arch.c
cvs rdiff -u -r1.81 -r1.82 src/usr.bin/make/cond.c
cvs rdiff -u -r1.85 -r1.86 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.89 -r1.90 src/usr.bin/make/suff.c
cvs rdiff -u -r1.330 -r1.331 src/usr.bin/make/var.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/make/arch.c
diff -u src/usr.bin/make/arch.c:1.74 src/usr.bin/make/arch.c:1.75
--- src/usr.bin/make/arch.c:1.74	Sun Jul 19 12:26:17 2020
+++ src/usr.bin/make/arch.c	Sun Jul 26 20:21:31 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: arch.c,v 1.74 2020/07/19 12:26:17 rillig Exp $	*/
+/*	$NetBSD: arch.c,v 1.75 2020/07/26 20:21:31 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: arch.c,v 1.74 2020/07/19 12:26:17 rillig Exp $";
+static char rcsid[] = "$NetBSD: arch.c,v 1.75 2020/07/26 20:21:31 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)arch.c	8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: arch.c,v 1.74 2020/07/19 12:26:17 rillig Exp $");
+__RCSID("$NetBSD: arch.c,v 1.75 2020/07/26 20:21:31 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -257,7 +257,7 @@ Arch_ParseArchive(char **linePtr, Lst no
 	 */
 	int 	length;
 	void	*freeIt;
-	char	*result;
+	const char	*result;
 
 	result = Var_Parse(cp, ctxt, VARE_UNDEFERR|VARE_WANTRES,
 			   , );
@@ -299,7 +299,7 @@ Arch_ParseArchive(char **linePtr, Lst no
 		 */
 		int 	length;
 		void	*freeIt;
-		char	*result;
+		const char *result;
 
 		result = Var_Parse(cp, ctxt, VARE_UNDEFERR|VARE_WANTRES,
    , );

Index: src/usr.bin/make/cond.c
diff -u src/usr.bin/make/cond.c:1.81 src/usr.bin/make/cond.c:1.82
--- src/usr.bin/make/cond.c:1.81	Sun Jul 19 12:35:30 2020
+++ src/usr.bin/make/cond.c	Sun Jul 26 20:21:31 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.81 2020/07/19 12:35:30 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.82 2020/07/26 20:21:31 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: cond.c,v 1.81 2020/07/19 12:35:30 rillig Exp $";
+static char rcsid[] = "$NetBSD: cond.c,v 1.82 2020/07/26 20:21:31 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)cond.c	8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: cond.c,v 1.81 2020/07/19 12:35:30 rillig Exp $");
+__RCSID("$NetBSD: cond.c,v 1.82 2020/07/26 20:21:31 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -153,7 +153,7 @@ static Boolean CondDoMake(int, const cha
 static Boolean CondDoExists(int, const char *);
 static Boolean CondDoTarget(int, const char *);
 static Boolean CondDoCommands(int, const char *);
-static Boolean CondCvtArg(char *, double *);
+static Boolean CondCvtArg(const char *, double *);
 static Token CondToken(Boolean);
 static Token CondT(Boolean);
 static Token CondF(Boolean);
@@ -286,7 +286,7 @@ CondGetArg(Boolean doEval, char **linePt
 	int		len;
 	void	*freeIt;
 	VarEvalFlags eflags = VARE_UNDEFERR | (doEval ? VARE_WANTRES : 0);
-	char *cp2 = Var_Parse(cp, VAR_CMD, eflags, , );
+	const char *cp2 = Var_Parse(cp, VAR_CMD, eflags, , );
 	Buf_AddBytes(, strlen(cp2), cp2);
 	free(freeIt);
 	cp += len;
@@ -479,7 +479,7 @@ CondDoCommands(int argLen MAKE_ATTR_UNUS
  *---
  */
 static Boolean
-CondCvtArg(char *str, double *value)
+CondCvtArg(const char *str, double *value)
 {
 char *eptr, ech;
 unsigned long l_val;
@@ -525,12 +525,12 @@ CondCvtArg(char *str, double *value)
  *---
  */
 /* coverity:[+alloc : arg-*2] */
-static char *
+static const char *
 CondGetString(Boolean doEval, Boolean *quoted, void **freeIt, Boolean strictLHS)
 {
 Buffer buf;
-char *cp;
-char *str;
+const char *cp;
+const char *str;
 int	len;
 int qt;
 char *start;
@@ -626,8 +626,8 @@ CondGetString(Boolean doEval, Boolean *q
 	}
 }
  got_str:
-str = Buf_GetAll(, NULL);
-*freeIt = str;
+*freeIt = Buf_GetAll(, NULL);
+str = *freeIt;
  cleanup:
 Buf_Destroy(, FALSE);
 return str;
@@ -650,8 +650,8 @@ static Token
 compare_expression(Boolean doEval)
 {
 Token	t;
-char	*lhs;
-char	*rhs;
+const char	*lhs;
+

CVS commit: src/usr.bin/make

2020-07-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul 26 20:04:57 UTC 2020

Modified Files:
src/usr.bin/make: Makefile

Log Message:
make(1): explicitly add dependencies on headers

This prevents partial builds after changing a header.  The declared
dependencies are more than strictly necessary, but that's still better
than having inconsistent partial builds because too few dependencies are
declared.


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/usr.bin/make/Makefile

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/make/Makefile
diff -u src/usr.bin/make/Makefile:1.74 src/usr.bin/make/Makefile:1.75
--- src/usr.bin/make/Makefile:1.74	Sun Jul 26 07:15:26 2020
+++ src/usr.bin/make/Makefile	Sun Jul 26 20:04:57 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.74 2020/07/26 07:15:26 rillig Exp $
+#	$NetBSD: Makefile,v 1.75 2020/07/26 20:04:57 rillig Exp $
 #	@(#)Makefile	5.2 (Berkeley) 12/28/90
 
 PROG=	make
@@ -37,12 +37,14 @@ COPTS.filemon_dev.c+= \
 .  endif
 .endif
 
-.PATH:	${.CURDIR}/lst.lib
 SUBDIR.roff+=	PSD.doc
 .if make(obj) || make(clean)
 SUBDIR+=	unit-tests
 .endif
 
+${SRCS:M*.c:.c=.o}: buf.h config.h dir.h hash.h job.h lst.h make.h make_malloc.h
+${SRCS:M*.c:.c=.o}: meta.h metachar.h nonints.h pathnames.h sprite.h strlist.h trace.h
+
 .include 
 .include 
 



CVS commit: src/usr.bin/make

2020-07-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul 26 19:55:24 UTC 2020

Modified Files:
src/usr.bin/make: nonints.h var.c

Log Message:
make(1): revert making Var_Parse return a const string

The dependencies between the C files and nonints.h are not declared
properly, which resulted in a successful partial build, but a full "make
clean && make" failed.


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.329 -r1.330 src/usr.bin/make/var.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/make/nonints.h
diff -u src/usr.bin/make/nonints.h:1.84 src/usr.bin/make/nonints.h:1.85
--- src/usr.bin/make/nonints.h:1.84	Sun Jul 26 19:44:04 2020
+++ src/usr.bin/make/nonints.h	Sun Jul 26 19:55:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nonints.h,v 1.84 2020/07/26 19:44:04 rillig Exp $	*/
+/*	$NetBSD: nonints.h,v 1.85 2020/07/26 19:55:24 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -191,7 +191,7 @@ void Var_Set(const char *, const char *,
 void Var_Append(const char *, const char *, GNode *);
 Boolean Var_Exists(const char *, GNode *);
 char *Var_Value(const char *, GNode *, char **);
-const char *Var_Parse(const char *, GNode *, VarEvalFlags, int *, void **);
+char *Var_Parse(const char *, GNode *, VarEvalFlags, int *, void **);
 char *Var_Subst(const char *, const char *, GNode *, VarEvalFlags);
 char *Var_GetTail(const char *);
 char *Var_GetHead(const char *);

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.329 src/usr.bin/make/var.c:1.330
--- src/usr.bin/make/var.c:1.329	Sun Jul 26 19:44:04 2020
+++ src/usr.bin/make/var.c	Sun Jul 26 19:55:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.329 2020/07/26 19:44:04 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.330 2020/07/26 19:55:24 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.329 2020/07/26 19:44:04 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.330 2020/07/26 19:55:24 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.329 2020/07/26 19:44:04 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.330 2020/07/26 19:55:24 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1838,6 +1838,7 @@ ParseModifierPart(const char **tstr, int
 		Buf_AddByte(, *cp);
 	} else {
 		if (eflags & VARE_WANTRES) {
+		char   *cp2;
 		int len;
 		void   *freeIt;
 
@@ -1846,9 +1847,8 @@ ParseModifierPart(const char **tstr, int
 		 * delimiter, assume it's a variable
 		 * substitution and recurse.
 		 */
-		VarEvalFlags sub_eflags = errnum | (eflags & VARE_WANTRES);
-		const char *cp2 = Var_Parse(cp, ctxt, sub_eflags,
-		, );
+		cp2 = Var_Parse(cp, ctxt, errnum | (eflags & VARE_WANTRES),
+, );
 		Buf_AddStr(, cp2);
 		free(freeIt);
 		cp += len - 1;
@@ -2145,11 +2145,11 @@ ApplyModifier_Defined(const char *mod, A
 	 * If unescaped dollar sign, assume it's a
 	 * variable substitution and recurse.
 	 */
+	char*cp2;
 	int	len;
 	void*freeIt;
 
-	const char *cp2 = Var_Parse(st->cp, st->ctxt, neflags,
-	, );
+	cp2 = Var_Parse(st->cp, st->ctxt, neflags, , );
 	Buf_AddStr(, cp2);
 	free(freeIt);
 	st->cp += len - 1;
@@ -3077,11 +3077,11 @@ ApplyModifiers(char *nstr, const char *t
 	 * We may have some complex modifiers in a variable.
 	 */
 	void *freeIt;
+	char *rval;
 	int rlen;
 	int c;
 
-	const char *rval = Var_Parse(p, st.ctxt, st.eflags,
-	 , );
+	rval = Var_Parse(p, st.ctxt, st.eflags, , );
 
 	/*
 	 * If we have not parsed up to st.endc or ':',
@@ -3383,7 +3383,7 @@ cleanup:
  *---
  */
 /* coverity[+alloc : arg-*4] */
-const char *
+char *
 Var_Parse(const char * const str, GNode *ctxt, VarEvalFlags flags,
 	  int *lengthPtr, void **freePtr)
 {
@@ -3436,13 +3436,13 @@ Var_Parse(const char * const str, GNode 
 		 */
 		switch (str[1]) {
 		case '@':
-		return "$(.TARGET)";
+		return UNCONST("$(.TARGET)");
 		case '%':
-		return "$(.MEMBER)";
+		return UNCONST("$(.MEMBER)");
 		case '*':
-		return "$(.PREFIX)";
+		return UNCONST("$(.PREFIX)");
 		case '!':
-		return "$(.ARCHIVE)";
+		return UNCONST("$(.ARCHIVE)");
 		}
 	}
 	return (flags & VARE_UNDEFERR) ? var_Error : varNoError;
@@ -3475,8 +3475,7 @@ Var_Parse(const char * const str, GNode 
 	if (*tstr == '$') {
 		int rlen;
 		void *freeIt;
-		const char *rval = Var_Parse(tstr, ctxt, flags,
-	 , );
+		char *rval = Var_Parse(tstr, ctxt, flags, , );
 		if (rval != NULL)
 		Buf_AddStr(, rval);
 		free(freeIt);
@@ -3714,7 +3713,7 @@ 

CVS commit: src/usr.bin/make

2020-07-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul 26 19:44:04 UTC 2020

Modified Files:
src/usr.bin/make: nonints.h var.c

Log Message:
make(1): mark result of Var_Parse as const

Var_Parse can return either a string literal or an allocated string.  The
former must not be modified by the caller.  If the string is allocated,
it is returned in freePtr as well, but only for freeing it after use.


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.328 -r1.329 src/usr.bin/make/var.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/make/nonints.h
diff -u src/usr.bin/make/nonints.h:1.83 src/usr.bin/make/nonints.h:1.84
--- src/usr.bin/make/nonints.h:1.83	Sun Jul 26 18:11:12 2020
+++ src/usr.bin/make/nonints.h	Sun Jul 26 19:44:04 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nonints.h,v 1.83 2020/07/26 18:11:12 rillig Exp $	*/
+/*	$NetBSD: nonints.h,v 1.84 2020/07/26 19:44:04 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -191,7 +191,7 @@ void Var_Set(const char *, const char *,
 void Var_Append(const char *, const char *, GNode *);
 Boolean Var_Exists(const char *, GNode *);
 char *Var_Value(const char *, GNode *, char **);
-char *Var_Parse(const char *, GNode *, VarEvalFlags, int *, void **);
+const char *Var_Parse(const char *, GNode *, VarEvalFlags, int *, void **);
 char *Var_Subst(const char *, const char *, GNode *, VarEvalFlags);
 char *Var_GetTail(const char *);
 char *Var_GetHead(const char *);

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.328 src/usr.bin/make/var.c:1.329
--- src/usr.bin/make/var.c:1.328	Sun Jul 26 19:36:24 2020
+++ src/usr.bin/make/var.c	Sun Jul 26 19:44:04 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.328 2020/07/26 19:36:24 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.329 2020/07/26 19:44:04 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.328 2020/07/26 19:36:24 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.329 2020/07/26 19:44:04 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.328 2020/07/26 19:36:24 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.329 2020/07/26 19:44:04 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1838,7 +1838,6 @@ ParseModifierPart(const char **tstr, int
 		Buf_AddByte(, *cp);
 	} else {
 		if (eflags & VARE_WANTRES) {
-		char   *cp2;
 		int len;
 		void   *freeIt;
 
@@ -1847,8 +1846,9 @@ ParseModifierPart(const char **tstr, int
 		 * delimiter, assume it's a variable
 		 * substitution and recurse.
 		 */
-		cp2 = Var_Parse(cp, ctxt, errnum | (eflags & VARE_WANTRES),
-, );
+		VarEvalFlags sub_eflags = errnum | (eflags & VARE_WANTRES);
+		const char *cp2 = Var_Parse(cp, ctxt, sub_eflags,
+		, );
 		Buf_AddStr(, cp2);
 		free(freeIt);
 		cp += len - 1;
@@ -2145,11 +2145,11 @@ ApplyModifier_Defined(const char *mod, A
 	 * If unescaped dollar sign, assume it's a
 	 * variable substitution and recurse.
 	 */
-	char*cp2;
 	int	len;
 	void*freeIt;
 
-	cp2 = Var_Parse(st->cp, st->ctxt, neflags, , );
+	const char *cp2 = Var_Parse(st->cp, st->ctxt, neflags,
+	, );
 	Buf_AddStr(, cp2);
 	free(freeIt);
 	st->cp += len - 1;
@@ -3077,11 +3077,11 @@ ApplyModifiers(char *nstr, const char *t
 	 * We may have some complex modifiers in a variable.
 	 */
 	void *freeIt;
-	char *rval;
 	int rlen;
 	int c;
 
-	rval = Var_Parse(p, st.ctxt, st.eflags, , );
+	const char *rval = Var_Parse(p, st.ctxt, st.eflags,
+	 , );
 
 	/*
 	 * If we have not parsed up to st.endc or ':',
@@ -3383,7 +3383,7 @@ cleanup:
  *---
  */
 /* coverity[+alloc : arg-*4] */
-char *
+const char *
 Var_Parse(const char * const str, GNode *ctxt, VarEvalFlags flags,
 	  int *lengthPtr, void **freePtr)
 {
@@ -3436,13 +3436,13 @@ Var_Parse(const char * const str, GNode 
 		 */
 		switch (str[1]) {
 		case '@':
-		return UNCONST("$(.TARGET)");
+		return "$(.TARGET)";
 		case '%':
-		return UNCONST("$(.MEMBER)");
+		return "$(.MEMBER)";
 		case '*':
-		return UNCONST("$(.PREFIX)");
+		return "$(.PREFIX)";
 		case '!':
-		return UNCONST("$(.ARCHIVE)");
+		return "$(.ARCHIVE)";
 		}
 	}
 	return (flags & VARE_UNDEFERR) ? var_Error : varNoError;
@@ -3475,7 +3475,8 @@ Var_Parse(const char * const str, GNode 
 	if (*tstr == '$') {
 		int rlen;
 		void *freeIt;
-		char *rval = Var_Parse(tstr, ctxt, flags, , );
+		const char *rval = Var_Parse(tstr, ctxt, flags,
+	 , );
 		if (rval != NULL)
 		Buf_AddStr(, rval);
 	

CVS commit: src/usr.bin/make

2020-07-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul 26 19:36:24 UTC 2020

Modified Files:
src/usr.bin/make: var.c

Log Message:
make(1): reduce scope and rename local variable in Var_Parse


To generate a diff of this commit:
cvs rdiff -u -r1.327 -r1.328 src/usr.bin/make/var.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/make/var.c
diff -u src/usr.bin/make/var.c:1.327 src/usr.bin/make/var.c:1.328
--- src/usr.bin/make/var.c:1.327	Sun Jul 26 19:16:17 2020
+++ src/usr.bin/make/var.c	Sun Jul 26 19:36:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.327 2020/07/26 19:16:17 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.328 2020/07/26 19:36:24 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.327 2020/07/26 19:16:17 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.328 2020/07/26 19:36:24 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.327 2020/07/26 19:16:17 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.328 2020/07/26 19:36:24 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -3355,9 +3355,10 @@ cleanup:
 /*-
  *---
  * Var_Parse --
- *	Given the start of a variable invocation, extract the variable
- *	name and find its value, then modify it according to the
- *	specification.
+ *	Given the start of a variable invocation (such as $v, $(VAR),
+ *	${VAR:Mpattern}), extract the variable name, possibly some
+ *	modifiers and find its value by applying the modifiers to the
+ *	original value.
  *
  * Input:
  *	str		The string to parse
@@ -3393,7 +3394,6 @@ Var_Parse(const char * const str, GNode 
  * or braces */
 char	 startc;	/* Starting character when variable in parens
  * or braces */
-int		 vlen;		/* Length of variable name */
 char	*nstr;		/* New string, used during expansion */
 Boolean	 dynamic;	/* TRUE if the variable is local and we're
  * expanding it in a non-local context. This
@@ -3498,7 +3498,8 @@ Var_Parse(const char * const str, GNode 
 	return var_Error;
 	}
 
-	char *varname = Buf_GetAll(, );
+	int namelen;
+	char *varname = Buf_GetAll(, );
 
 	/*
 	 * At this point, varname points into newly allocated memory from
@@ -3517,7 +3518,7 @@ Var_Parse(const char * const str, GNode 
 	 * in a local context and the name is the right length.
 	 */
 	if (v == NULL && ctxt != VAR_CMD && ctxt != VAR_GLOBAL &&
-		vlen == 2 && (varname[1] == 'F' || varname[1] == 'D') &&
+		namelen == 2 && (varname[1] == 'F' || varname[1] == 'D') &&
 		strchr("@%?*!<>", varname[0]) != NULL) {
 	/*
 	 * Well, it's local -- go look for it.
@@ -3535,8 +3536,8 @@ Var_Parse(const char * const str, GNode 
 	}
 
 	if (v == NULL) {
-	if ((vlen == 1 ||
-		 ((vlen == 2 && (varname[1] == 'F' || varname[1] == 'D' &&
+	if ((namelen == 1 ||
+		 (namelen == 2 && (varname[1] == 'F' || varname[1] == 'D'))) &&
 		(ctxt == VAR_CMD || ctxt == VAR_GLOBAL))
 	{
 		/*
@@ -3556,11 +3557,11 @@ Var_Parse(const char * const str, GNode 
 		dynamic = TRUE;
 		break;
 		}
-	} else if (vlen > 2 && varname[0] == '.' &&
+	} else if (namelen > 2 && varname[0] == '.' &&
 		   isupper((unsigned char) varname[1]) &&
 		   (ctxt == VAR_CMD || ctxt == VAR_GLOBAL))
 	{
-		int len = vlen - 1;
+		int len = namelen - 1;
 		if ((strncmp(varname, ".TARGET", len) == 0) ||
 		(strncmp(varname, ".ARCHIVE", len) == 0) ||
 		(strncmp(varname, ".PREFIX", len) == 0) ||



CVS commit: src/usr.bin/make

2020-07-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul 26 19:16:18 UTC 2020

Modified Files:
src/usr.bin/make: var.c

Log Message:
make(1): eliminate another local variable in Var_Parse


To generate a diff of this commit:
cvs rdiff -u -r1.326 -r1.327 src/usr.bin/make/var.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/make/var.c
diff -u src/usr.bin/make/var.c:1.326 src/usr.bin/make/var.c:1.327
--- src/usr.bin/make/var.c:1.326	Sun Jul 26 19:13:42 2020
+++ src/usr.bin/make/var.c	Sun Jul 26 19:16:17 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.326 2020/07/26 19:13:42 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.327 2020/07/26 19:16:17 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.326 2020/07/26 19:13:42 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.327 2020/07/26 19:16:17 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.326 2020/07/26 19:13:42 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.327 2020/07/26 19:16:17 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -3383,7 +3383,7 @@ cleanup:
  */
 /* coverity[+alloc : arg-*4] */
 char *
-Var_Parse(const char *str, GNode *ctxt, VarEvalFlags flags,
+Var_Parse(const char * const str, GNode *ctxt, VarEvalFlags flags,
 	  int *lengthPtr, void **freePtr)
 {
 const char	*tstr;		/* Pointer into str */
@@ -3394,7 +3394,6 @@ Var_Parse(const char *str, GNode *ctxt, 
 char	 startc;	/* Starting character when variable in parens
  * or braces */
 int		 vlen;		/* Length of variable name */
-const char 	*start;		/* Points to original start of str */
 char	*nstr;		/* New string, used during expansion */
 Boolean	 dynamic;	/* TRUE if the variable is local and we're
  * expanding it in a non-local context. This
@@ -3405,7 +3404,6 @@ Var_Parse(const char *str, GNode *ctxt, 
 *freePtr = NULL;
 extramodifiers = NULL;
 dynamic = FALSE;
-start = str;
 
 startc = str[1];
 if (startc != PROPEN && startc != BROPEN) {
@@ -3577,9 +3575,9 @@ Var_Parse(const char *str, GNode *ctxt, 
 		 * No modifiers -- have specification length so we can return
 		 * now.
 		 */
-		*lengthPtr = tstr - start + 1;
+		*lengthPtr = tstr - str + 1;
 		if (dynamic) {
-		char *pstr = bmake_strndup(start, *lengthPtr);
+		char *pstr = bmake_strndup(str, *lengthPtr);
 		*freePtr = pstr;
 		Buf_Destroy(, TRUE);
 		return pstr;
@@ -3647,7 +3645,7 @@ Var_Parse(const char *str, GNode *ctxt, 
 	*freePtr = extraFree;
 	}
 }
-*lengthPtr = tstr - start + (*tstr ? 1 : 0);
+*lengthPtr = tstr - str + (*tstr ? 1 : 0);
 
 if (v->flags & VAR_FROM_ENV) {
 	Boolean destroy = FALSE;
@@ -3674,7 +3672,7 @@ Var_Parse(const char *str, GNode *ctxt, 
 		*freePtr = NULL;
 	}
 	if (dynamic) {
-		nstr = bmake_strndup(start, *lengthPtr);
+		nstr = bmake_strndup(str, *lengthPtr);
 		*freePtr = nstr;
 	} else {
 		nstr = (flags & VARE_UNDEFERR) ? var_Error : varNoError;



CVS commit: src/usr.bin/make

2020-07-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul 26 19:13:43 UTC 2020

Modified Files:
src/usr.bin/make: var.c

Log Message:
make(1): split local variable into two in Var_Parse


To generate a diff of this commit:
cvs rdiff -u -r1.325 -r1.326 src/usr.bin/make/var.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/make/var.c
diff -u src/usr.bin/make/var.c:1.325 src/usr.bin/make/var.c:1.326
--- src/usr.bin/make/var.c:1.325	Sun Jul 26 19:11:06 2020
+++ src/usr.bin/make/var.c	Sun Jul 26 19:13:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.325 2020/07/26 19:11:06 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.326 2020/07/26 19:13:42 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.325 2020/07/26 19:11:06 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.326 2020/07/26 19:13:42 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.325 2020/07/26 19:11:06 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.326 2020/07/26 19:13:42 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -3401,7 +3401,6 @@ Var_Parse(const char *str, GNode *ctxt, 
  * is done to support dynamic sources. The
  * result is just the invocation, unaltered */
 const char	*extramodifiers; /* extra modifiers to apply first */
-char	 name[2];
 
 *freePtr = NULL;
 extramodifiers = NULL;
@@ -3421,8 +3420,7 @@ Var_Parse(const char *str, GNode *ctxt, 
 	*lengthPtr = 1;
 	return var_Error;
 	}
-	name[0] = startc;
-	name[1] = '\0';
+	char name[] = { startc, '\0' };
 
 	v = VarFind(name, ctxt, FIND_ENV | FIND_GLOBAL | FIND_CMD);
 	if (v == NULL) {
@@ -3526,8 +3524,7 @@ Var_Parse(const char *str, GNode *ctxt, 
 	/*
 	 * Well, it's local -- go look for it.
 	 */
-	name[0] = varname[0];
-	name[1] = '\0';
+	char name[] = {varname[0], '\0' };
 	v = VarFind(name, ctxt, 0);
 
 	if (v != NULL) {



CVS commit: src/usr.bin/make

2020-07-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul 26 19:11:06 UTC 2020

Modified Files:
src/usr.bin/make: var.c

Log Message:
make(1): split local variable into two

Reusing a const char * parameter to store a char * and later free that
string was not a good idea. It made the pretty long code of Var_Parse
more difficult to understand.


To generate a diff of this commit:
cvs rdiff -u -r1.324 -r1.325 src/usr.bin/make/var.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/make/var.c
diff -u src/usr.bin/make/var.c:1.324 src/usr.bin/make/var.c:1.325
--- src/usr.bin/make/var.c:1.324	Sun Jul 26 18:47:02 2020
+++ src/usr.bin/make/var.c	Sun Jul 26 19:11:06 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.324 2020/07/26 18:47:02 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.325 2020/07/26 19:11:06 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.324 2020/07/26 18:47:02 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.325 2020/07/26 19:11:06 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.324 2020/07/26 18:47:02 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.325 2020/07/26 19:11:06 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -3452,7 +3452,7 @@ Var_Parse(const char *str, GNode *ctxt, 
 	return (flags & VARE_UNDEFERR) ? var_Error : varNoError;
 	} else {
 	haveModifier = FALSE;
-	tstr = [1];
+	tstr = str + 1;
 	endc = str[1];
 	}
 } else {
@@ -3501,10 +3501,11 @@ Var_Parse(const char *str, GNode *ctxt, 
 	Buf_Destroy(, TRUE);
 	return var_Error;
 	}
-	str = Buf_GetAll(, );
+
+	char *varname = Buf_GetAll(, );
 
 	/*
-	 * At this point, str points into newly allocated memory from
+	 * At this point, varname points into newly allocated memory from
 	 * buf, containing only the name of the variable.
 	 *
 	 * start and tstr point into the const string that was pointed
@@ -3514,23 +3515,23 @@ Var_Parse(const char *str, GNode *ctxt, 
 	 * will be '\0', ':', PRCLOSE, or BRCLOSE.
 	 */
 
-	v = VarFind(str, ctxt, FIND_ENV | FIND_GLOBAL | FIND_CMD);
+	v = VarFind(varname, ctxt, FIND_ENV | FIND_GLOBAL | FIND_CMD);
 	/*
 	 * Check also for bogus D and F forms of local variables since we're
 	 * in a local context and the name is the right length.
 	 */
-	if ((v == NULL) && (ctxt != VAR_CMD) && (ctxt != VAR_GLOBAL) &&
-		(vlen == 2) && (str[1] == 'F' || str[1] == 'D') &&
-		strchr("@%?*!<>", str[0]) != NULL) {
+	if (v == NULL && ctxt != VAR_CMD && ctxt != VAR_GLOBAL &&
+		vlen == 2 && (varname[1] == 'F' || varname[1] == 'D') &&
+		strchr("@%?*!<>", varname[0]) != NULL) {
 	/*
 	 * Well, it's local -- go look for it.
 	 */
-	name[0] = *str;
+	name[0] = varname[0];
 	name[1] = '\0';
 	v = VarFind(name, ctxt, 0);
 
 	if (v != NULL) {
-		if (str[1] == 'D') {
+		if (varname[1] == 'D') {
 		extramodifiers = "H:";
 		} else { /* F */
 		extramodifiers = "T:";
@@ -3539,9 +3540,9 @@ Var_Parse(const char *str, GNode *ctxt, 
 	}
 
 	if (v == NULL) {
-	if (((vlen == 1) ||
-		 (((vlen == 2) && (str[1] == 'F' || str[1] == 'D' &&
-		((ctxt == VAR_CMD) || (ctxt == VAR_GLOBAL)))
+	if ((vlen == 1 ||
+		 ((vlen == 2 && (varname[1] == 'F' || varname[1] == 'D' &&
+		(ctxt == VAR_CMD || ctxt == VAR_GLOBAL))
 	{
 		/*
 		 * If substituting a local variable in a non-local context,
@@ -3552,7 +3553,7 @@ Var_Parse(const char *str, GNode *ctxt, 
 		 * specially as they are the only four that will be set
 		 * when dynamic sources are expanded.
 		 */
-		switch (*str) {
+		switch (varname[0]) {
 		case '@':
 		case '%':
 		case '*':
@@ -3560,15 +3561,15 @@ Var_Parse(const char *str, GNode *ctxt, 
 		dynamic = TRUE;
 		break;
 		}
-	} else if (vlen > 2 && *str == '.' &&
-		   isupper((unsigned char) str[1]) &&
+	} else if (vlen > 2 && varname[0] == '.' &&
+		   isupper((unsigned char) varname[1]) &&
 		   (ctxt == VAR_CMD || ctxt == VAR_GLOBAL))
 	{
 		int len = vlen - 1;
-		if ((strncmp(str, ".TARGET", len) == 0) ||
-		(strncmp(str, ".ARCHIVE", len) == 0) ||
-		(strncmp(str, ".PREFIX", len) == 0) ||
-		(strncmp(str, ".MEMBER", len) == 0))
+		if ((strncmp(varname, ".TARGET", len) == 0) ||
+		(strncmp(varname, ".ARCHIVE", len) == 0) ||
+		(strncmp(varname, ".PREFIX", len) == 0) ||
+		(strncmp(varname, ".MEMBER", len) == 0))
 		{
 		dynamic = TRUE;
 		}
@@ -3595,7 +3596,7 @@ Var_Parse(const char *str, GNode *ctxt, 
 		 * so kludge up a Var structure for the modifications
 		 */
 		v = bmake_malloc(sizeof(Var));
-		v->name = UNCONST(str);
+		v->name = varname;
 		Buf_Init(>val, 1);
 		v->flags = VAR_JUNK;
 		Buf_Destroy(, FALSE);
@@ -3668,7 +3669,7 @@ Var_Parse(const char *str, 

CVS commit: src/distrib/notes/common

2020-07-26 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Sun Jul 26 18:53:50 UTC 2020

Modified Files:
src/distrib/notes/common: postinstall

Log Message:
replace KDE with a desktop that's actually current in pkgsrc


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/distrib/notes/common/postinstall

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

Modified files:

Index: src/distrib/notes/common/postinstall
diff -u src/distrib/notes/common/postinstall:1.86 src/distrib/notes/common/postinstall:1.87
--- src/distrib/notes/common/postinstall:1.86	Wed Nov 27 09:29:25 2019
+++ src/distrib/notes/common/postinstall	Sun Jul 26 18:53:50 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: postinstall,v 1.86 2019/11/27 09:29:25 martin Exp $
+.\"	$NetBSD: postinstall,v 1.87 2020/07/26 18:53:50 nia Exp $
 .\"
 .\" Copyright (c) 1999-2004 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -348,7 +348,7 @@ is correctly configured, you can install
 .Ic # pkgin install bash
 .Ic # pkgin install perl
 .Ic # pkgin install apache
-.Ic # pkgin install kde
+.Ic # pkgin install xfce4
 .Ic # pkgin install firefox
 \&...
 .Ed
@@ -359,7 +359,7 @@ directory.
 .Note)
 .Pp
 The above commands will install the Tenex-csh and Bourne Again shells,
-the Perl programming language, Apache web server, KDE desktop
+the Perl programming language, Apache web server, Xfce desktop
 environment and the Firefox web browser
 as well as all the packages they depend on.
 .It



CVS commit: src/usr.bin/make

2020-07-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul 26 18:47:02 UTC 2020

Modified Files:
src/usr.bin/make: var.c

Log Message:
make(1): reorder arguments of ParseModifierPart

First the input parameters, then additional data, then special arguments.


To generate a diff of this commit:
cvs rdiff -u -r1.323 -r1.324 src/usr.bin/make/var.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/make/var.c
diff -u src/usr.bin/make/var.c:1.323 src/usr.bin/make/var.c:1.324
--- src/usr.bin/make/var.c:1.323	Sun Jul 26 18:11:12 2020
+++ src/usr.bin/make/var.c	Sun Jul 26 18:47:02 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.323 2020/07/26 18:11:12 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.324 2020/07/26 18:47:02 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.323 2020/07/26 18:11:12 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.324 2020/07/26 18:47:02 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.323 2020/07/26 18:11:12 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.324 2020/07/26 18:47:02 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1786,27 +1786,29 @@ VarRange(const char *str, int ac)
 
 /*-
  * Parse a text part of a modifier such as the "from" and "to" in :S/from/to/
- * or the :@ modifier. Nested variables in the text are expanded unless
- * VARE_NOSUBST is set.
+ * or the :@ modifier, until the next unescaped delimiter.  The delimiter, as
+ * well as the backslash or the dollar, can be escaped with a backslash.
  *
- * The text part is parsed until the next delimiter.  To escape the delimiter,
- * a backslash or a dollar, put a backslash before it.
+ * Return the parsed (and possibly expanded) string, or NULL if no delimiter
+ * was found.
  *
- * Return the expanded string or NULL if the delimiter was missing.
+ * Nested variables in the text are expanded unless VARE_NOSUBST is set.
  *
- * If pattern is specified, handle escaped ampersands and replace unescaped
- * ampersands with the lhs of the pattern (for the :S modifier).
- *
- * If out_length is specified, return the string length of the buffer
- * (except on parse errors).
+ * If out_length is specified, store the length of the returned string, just
+ * to save another strlen call.
  *
  * If out_pflags is specified and the last character of the pattern is a $,
- * set the VARP_ANCHOR_END bit of mpflags.
+ * set the VARP_ANCHOR_END bit of mpflags (for the first part of the :S
+ * modifier).
+ *
+ * If subst is specified, handle escaped ampersands and replace unescaped
+ * ampersands with the lhs of the pattern (for the second part of the :S
+ * modifier).
  */
 static char *
-ParseModifierPart(GNode *ctxt, const char **tstr, int delim,
-		  VarEvalFlags eflags, VarPatternFlags *out_pflags,
-		  size_t *out_length, ModifyWord_SubstArgs *subst)
+ParseModifierPart(const char **tstr, int delim, VarEvalFlags eflags,
+		  GNode *ctxt, size_t *out_length,
+		  VarPatternFlags *out_pflags, ModifyWord_SubstArgs *subst)
 {
 const char *cp;
 char *rstr;
@@ -1822,8 +1824,9 @@ ParseModifierPart(GNode *ctxt, const cha
  * touch other backslashes.
  */
 for (cp = *tstr; *cp != '\0' && *cp != delim; cp++) {
-	Boolean is_escaped = cp[0] == '\\' && (cp[1] == delim ||
-	cp[1] == '\\' || cp[1] == '$' || (subst != NULL && cp[1] == '&'));
+	Boolean is_escaped = cp[0] == '\\' && (
+	cp[1] == delim || cp[1] == '\\' || cp[1] == '$' ||
+	(cp[1] == '&' && subst != NULL));
 	if (is_escaped) {
 	Buf_AddByte(, cp[1]);
 	cp++;
@@ -2074,17 +2077,15 @@ ApplyModifier_Loop(const char *mod, Appl
 args.ctx = st->ctxt;
 st->cp = mod + 1;
 char delim = '@';
-args.tvar = ParseModifierPart(st->ctxt, >cp, delim,
-  st->eflags & ~VARE_WANTRES,
-  NULL, NULL, NULL);
+args.tvar = ParseModifierPart(>cp, delim, st->eflags & ~VARE_WANTRES,
+  st->ctxt, NULL, NULL, NULL);
 if (args.tvar == NULL) {
 	st->missing_delim = delim;
 	return FALSE;
 }
 
-args.str = ParseModifierPart(st->ctxt, >cp, delim,
- st->eflags & ~VARE_WANTRES,
- NULL, NULL, NULL);
+args.str = ParseModifierPart(>cp, delim, st->eflags & ~VARE_WANTRES,
+ st->ctxt, NULL, NULL, NULL);
 if (args.str == NULL) {
 	st->missing_delim = delim;
 	return FALSE;
@@ -2253,7 +2254,7 @@ ApplyModifier_Exclam(const char *mod, Ap
 {
 st->cp = mod + 1;
 char delim = '!';
-char *cmd = ParseModifierPart(st->ctxt, >cp, delim, st->eflags,
+char *cmd = ParseModifierPart(>cp, delim, st->eflags, st->ctxt,
   NULL, NULL, NULL);
 if (cmd == NULL) {
 	st->missing_delim = delim;
@@ -2399,16 +2400,16 @@ ApplyModifier_Subst(const char * const m
 	st->cp++;
 }
 
-char *lhs = 

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

2020-07-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul 26 18:11:43 UTC 2020

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

Log Message:
extattr.3 is obsolete


To generate a diff of this commit:
cvs rdiff -u -r1.2340 -r1.2341 src/distrib/sets/lists/comp/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/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2340 src/distrib/sets/lists/comp/mi:1.2341
--- src/distrib/sets/lists/comp/mi:1.2340	Fri Jul 17 11:34:17 2020
+++ src/distrib/sets/lists/comp/mi	Sun Jul 26 14:11:43 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2340 2020/07/17 15:34:17 kamil Exp $
+#	$NetBSD: mi,v 1.2341 2020/07/26 18:11:43 christos Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -7073,7 +7073,7 @@
 ./usr/share/man/cat3/explicit_memset.0		comp-c-catman		.cat
 ./usr/share/man/cat3/expm1.0			comp-c-catman		.cat
 ./usr/share/man/cat3/expm1f.0			comp-c-catman		.cat
-./usr/share/man/cat3/extattr.0			comp-c-catman		.cat
+./usr/share/man/cat3/extattr.0			comp-obsolete		obsolete
 ./usr/share/man/cat3/extattr_copy_fd.0		comp-c-catman		.cat
 ./usr/share/man/cat3/extattr_copy_file.0	comp-c-catman		.cat
 ./usr/share/man/cat3/extattr_copy_link.0	comp-c-catman		.cat
@@ -15324,7 +15324,7 @@
 ./usr/share/man/html3/explicit_memset.html	comp-c-htmlman		html
 ./usr/share/man/html3/expm1.html		comp-c-htmlman		html
 ./usr/share/man/html3/expm1f.html		comp-c-htmlman		html
-./usr/share/man/html3/extattr.html		comp-c-htmlman		html
+./usr/share/man/html3/extattr.html		comp-obsolete		obsolete
 ./usr/share/man/html3/extattr_copy_fd.html	comp-c-htmlman		html
 ./usr/share/man/html3/extattr_copy_file.html	comp-c-htmlman		html
 ./usr/share/man/html3/extattr_copy_link.html	comp-c-htmlman		html
@@ -23511,7 +23511,7 @@
 ./usr/share/man/man3/explicit_memset.3		comp-c-man		.man
 ./usr/share/man/man3/expm1.3			comp-c-man		.man
 ./usr/share/man/man3/expm1f.3			comp-c-man		.man
-./usr/share/man/man3/extattr.3			comp-c-man		.man
+./usr/share/man/man3/extattr.3			comp-obsolete		obsolete
 ./usr/share/man/man3/extattr_copy_fd.3		comp-c-man		.man
 ./usr/share/man/man3/extattr_copy_file.3	comp-c-man		.man
 ./usr/share/man/man3/extattr_copy_link.3	comp-c-man		.man



CVS commit: src/usr.bin/make

2020-07-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul 26 18:11:12 UTC 2020

Modified Files:
src/usr.bin/make: nonints.h var.c

Log Message:
make(1): merge VARE_NOSUBST into VARE_WANTRES

The flag VARE_NOSUBST is only a few days old. It had grown out of the
VARP_NOSUBST and VAR_NOSUBST flags, not knowing at that time that it
meant the exact opposite of VARE_WANTRES.


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.322 -r1.323 src/usr.bin/make/var.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/make/nonints.h
diff -u src/usr.bin/make/nonints.h:1.82 src/usr.bin/make/nonints.h:1.83
--- src/usr.bin/make/nonints.h:1.82	Mon Jul 20 19:53:40 2020
+++ src/usr.bin/make/nonints.h	Sun Jul 26 18:11:12 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nonints.h,v 1.82 2020/07/20 19:53:40 rillig Exp $	*/
+/*	$NetBSD: nonints.h,v 1.83 2020/07/26 18:11:12 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -181,12 +181,9 @@ void Targ_Propagate_Wait(void);
 typedef enum {
 /* Treat undefined variables as errors. */
 VARE_UNDEFERR	= 0x01,
-/* Actually evaluate the text, fully expanding variables.
- * Without this flag, the text is only parsed but not evaluated. */
+/* Expand and evaluate variables during parsing. */
 VARE_WANTRES	= 0x02,
-VARE_ASSIGN		= 0x04,
-/* Return the literal text, without expanding variables. */
-VARE_NOSUBST	= 0x08
+VARE_ASSIGN		= 0x04
 } VarEvalFlags;
 
 void Var_Delete(const char *, GNode *);

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.322 src/usr.bin/make/var.c:1.323
--- src/usr.bin/make/var.c:1.322	Sun Jul 26 17:44:54 2020
+++ src/usr.bin/make/var.c	Sun Jul 26 18:11:12 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.322 2020/07/26 17:44:54 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.323 2020/07/26 18:11:12 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.322 2020/07/26 17:44:54 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.323 2020/07/26 18:11:12 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.322 2020/07/26 17:44:54 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.323 2020/07/26 18:11:12 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1834,7 +1834,7 @@ ParseModifierPart(GNode *ctxt, const cha
 		else
 		Buf_AddByte(, *cp);
 	} else {
-		if (!(eflags & VARE_NOSUBST)) {
+		if (eflags & VARE_WANTRES) {
 		char   *cp2;
 		int len;
 		void   *freeIt;
@@ -2075,7 +2075,7 @@ ApplyModifier_Loop(const char *mod, Appl
 st->cp = mod + 1;
 char delim = '@';
 args.tvar = ParseModifierPart(st->ctxt, >cp, delim,
-  st->eflags | VARE_NOSUBST,
+  st->eflags & ~VARE_WANTRES,
   NULL, NULL, NULL);
 if (args.tvar == NULL) {
 	st->missing_delim = delim;
@@ -2083,7 +2083,7 @@ ApplyModifier_Loop(const char *mod, Appl
 }
 
 args.str = ParseModifierPart(st->ctxt, >cp, delim,
- st->eflags | VARE_NOSUBST,
+ st->eflags & ~VARE_WANTRES,
  NULL, NULL, NULL);
 if (args.str == NULL) {
 	st->missing_delim = delim;
@@ -2857,9 +2857,8 @@ ApplyModifier_Assign(const char *mod, Ap
 }
 
 char delim = st->startc == PROPEN ? PRCLOSE : BRCLOSE;
-VarEvalFlags eflags = (st->eflags & VARE_WANTRES) ? 0 : VARE_NOSUBST;
 char *val = ParseModifierPart(st->ctxt, >cp, delim,
-  st->eflags | eflags, NULL, NULL, NULL);
+  st->eflags, NULL, NULL, NULL);
 if (st->v->flags & VAR_JUNK) {
 	/* restore original name */
 	free(st->v->name);



CVS commit: src/lib/libc/posix1e

2020-07-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul 26 18:10:01 UTC 2020

Modified Files:
src/lib/libc/posix1e: Makefile.inc
Removed Files:
src/lib/libc/posix1e: extattr.3

Log Message:
this file contained the same information as extattr_namespace_to_string.3
and somewhat incorrect too.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/posix1e/Makefile.inc
cvs rdiff -u -r1.3 -r0 src/lib/libc/posix1e/extattr.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/libc/posix1e/Makefile.inc
diff -u src/lib/libc/posix1e/Makefile.inc:1.2 src/lib/libc/posix1e/Makefile.inc:1.3
--- src/lib/libc/posix1e/Makefile.inc:1.2	Sat Jul 25 17:53:34 2020
+++ src/lib/libc/posix1e/Makefile.inc	Sun Jul 26 14:10:00 2020
@@ -63,7 +63,6 @@ MAN+=	acl.3\
 	acl_strip_np.3			\
 	acl_to_text.3			\
 	acl_valid.3			\
-	extattr.3			\
 	posix1e.3
 
 MLINKS+=acl_create_entry.3 acl_create_entry_np.3 \



CVS commit: src/usr.bin/make

2020-07-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul 26 17:44:54 UTC 2020

Modified Files:
src/usr.bin/make: var.c

Log Message:
make(1): remove wrong comment from VarOrder


To generate a diff of this commit:
cvs rdiff -u -r1.321 -r1.322 src/usr.bin/make/var.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/make/var.c
diff -u src/usr.bin/make/var.c:1.321 src/usr.bin/make/var.c:1.322
--- src/usr.bin/make/var.c:1.321	Sun Jul 26 17:23:00 2020
+++ src/usr.bin/make/var.c	Sun Jul 26 17:44:54 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.321 2020/07/26 17:23:00 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.322 2020/07/26 17:44:54 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.321 2020/07/26 17:23:00 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.322 2020/07/26 17:44:54 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.321 2020/07/26 17:23:00 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.322 2020/07/26 17:44:54 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1666,7 +1666,7 @@ static char *
 VarOrder(const char *str, const char otype)
 {
 Buffer buf;			/* Buffer for the new string */
-char **av;			/* word list [first word does not count] */
+char **av;			/* word list */
 char *as;			/* word list memory */
 int ac, i;
 



CVS commit: src/usr.bin/make

2020-07-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul 26 17:23:00 UTC 2020

Modified Files:
src/usr.bin/make: var.c

Log Message:
make(1): reorder code in ParseModifierPart to be more readable


To generate a diff of this commit:
cvs rdiff -u -r1.320 -r1.321 src/usr.bin/make/var.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/make/var.c
diff -u src/usr.bin/make/var.c:1.320 src/usr.bin/make/var.c:1.321
--- src/usr.bin/make/var.c:1.320	Sun Jul 26 17:21:28 2020
+++ src/usr.bin/make/var.c	Sun Jul 26 17:23:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.320 2020/07/26 17:21:28 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.321 2020/07/26 17:23:00 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.320 2020/07/26 17:21:28 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.321 2020/07/26 17:23:00 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.320 2020/07/26 17:21:28 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.321 2020/07/26 17:23:00 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1829,10 +1829,10 @@ ParseModifierPart(GNode *ctxt, const cha
 	cp++;
 	} else if (*cp == '$') {
 	if (cp[1] == delim) {	/* Unescaped $ at end of pattern */
-		if (out_pflags == NULL)
-		Buf_AddByte(, *cp);
-		else
+		if (out_pflags != NULL)
 		*out_pflags |= VARP_ANCHOR_END;
+		else
+		Buf_AddByte(, *cp);
 	} else {
 		if (!(eflags & VARE_NOSUBST)) {
 		char   *cp2;



CVS commit: src/usr.bin/make

2020-07-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul 26 17:21:28 UTC 2020

Modified Files:
src/usr.bin/make: var.c

Log Message:
make(1): in ParseModifierPart, only update length on success


To generate a diff of this commit:
cvs rdiff -u -r1.319 -r1.320 src/usr.bin/make/var.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/make/var.c
diff -u src/usr.bin/make/var.c:1.319 src/usr.bin/make/var.c:1.320
--- src/usr.bin/make/var.c:1.319	Sun Jul 26 17:10:56 2020
+++ src/usr.bin/make/var.c	Sun Jul 26 17:21:28 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.319 2020/07/26 17:10:56 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.320 2020/07/26 17:21:28 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.319 2020/07/26 17:10:56 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.320 2020/07/26 17:21:28 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.319 2020/07/26 17:10:56 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.320 2020/07/26 17:21:28 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1793,27 +1793,27 @@ VarRange(const char *str, int ac)
  * a backslash or a dollar, put a backslash before it.
  *
  * Return the expanded string or NULL if the delimiter was missing.
+ *
  * If pattern is specified, handle escaped ampersands and replace unescaped
- * ampersands with the lhs of the pattern (for the :S and :C modifiers).
+ * ampersands with the lhs of the pattern (for the :S modifier).
+ *
+ * If out_length is specified, return the string length of the buffer
+ * (except on parse errors).
  *
- * If length is specified, return the string length of the buffer.
- * If mpflags is specified and the last character of the pattern is a $,
+ * If out_pflags is specified and the last character of the pattern is a $,
  * set the VARP_ANCHOR_END bit of mpflags.
  */
 static char *
 ParseModifierPart(GNode *ctxt, const char **tstr, int delim,
-		  VarEvalFlags eflags, VarPatternFlags *mpflags,
-		  size_t *length, ModifyWord_SubstArgs *subst)
+		  VarEvalFlags eflags, VarPatternFlags *out_pflags,
+		  size_t *out_length, ModifyWord_SubstArgs *subst)
 {
 const char *cp;
 char *rstr;
 Buffer buf;
-size_t junk;
 VarEvalFlags errnum = eflags & VARE_UNDEFERR;
 
 Buf_Init(, 0);
-if (length == NULL)
-	length = 
 
 /*
  * Skim through until the matching delimiter is found;
@@ -1829,10 +1829,10 @@ ParseModifierPart(GNode *ctxt, const cha
 	cp++;
 	} else if (*cp == '$') {
 	if (cp[1] == delim) {	/* Unescaped $ at end of pattern */
-		if (mpflags == NULL)
+		if (out_pflags == NULL)
 		Buf_AddByte(, *cp);
 		else
-		*mpflags |= VARP_ANCHOR_END;
+		*out_pflags |= VARP_ANCHOR_END;
 	} else {
 		if (!(eflags & VARE_NOSUBST)) {
 		char   *cp2;
@@ -1884,12 +1884,12 @@ ParseModifierPart(GNode *ctxt, const cha
 
 if (*cp != delim) {
 	*tstr = cp;
-	*length = 0;
 	return NULL;
 }
 
 *tstr = ++cp;
-*length = Buf_Size();
+if (out_length != NULL)
+	*out_length = Buf_Size();
 rstr = Buf_Destroy(, FALSE);
 if (DEBUG(VAR))
 	fprintf(debug_file, "Modifier part: \"%s\"\n", rstr);



CVS commit: src/sys/dev/pci

2020-07-26 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sun Jul 26 17:12:41 UTC 2020

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

Log Message:
fix attribution - I was confused what was the correct final version


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/pci/xmm7360.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/xmm7360.c
diff -u src/sys/dev/pci/xmm7360.c:1.1 src/sys/dev/pci/xmm7360.c:1.2
--- src/sys/dev/pci/xmm7360.c:1.1	Sun Jul 26 14:51:18 2020
+++ src/sys/dev/pci/xmm7360.c	Sun Jul 26 17:12:41 2020
@@ -8,9 +8,9 @@
  *
  * Copyright (c) 2020 genua GmbH 
  * Copyright (c) 2020 James Wah 
- * Copyright (c) 2020 Jaromir Dolecek 
  *
- * OpenBSD port written by Jaromir Dolecek for genua GmbH
+ * The OpenBSD and NetBSD support was written by Jaromir Dolecek for
+ * Moritz Systems Technology Company Sp. z o.o.
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -74,7 +74,7 @@ MODULE_DEVICE_TABLE(pci, xmm7360_ids);
 #include "opt_gateway.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xmm7360.c,v 1.1 2020/07/26 14:51:18 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xmm7360.c,v 1.2 2020/07/26 17:12:41 jdolecek Exp $");
 #endif
 
 #include 



CVS commit: src/usr.bin/make

2020-07-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul 26 17:10:56 UTC 2020

Modified Files:
src/usr.bin/make: var.c

Log Message:
make(1): remove wrong comment for VarUniq

VarUniq is not about sorting the words.


To generate a diff of this commit:
cvs rdiff -u -r1.318 -r1.319 src/usr.bin/make/var.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/make/var.c
diff -u src/usr.bin/make/var.c:1.318 src/usr.bin/make/var.c:1.319
--- src/usr.bin/make/var.c:1.318	Sun Jul 26 17:09:23 2020
+++ src/usr.bin/make/var.c	Sun Jul 26 17:10:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.318 2020/07/26 17:09:23 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.319 2020/07/26 17:10:56 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.318 2020/07/26 17:09:23 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.319 2020/07/26 17:10:56 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.318 2020/07/26 17:09:23 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.319 2020/07/26 17:10:56 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1711,22 +1711,7 @@ VarOrder(const char *str, const char oty
 }
 
 
-/*-
- *---
- * VarUniq --
- *	Remove adjacent duplicate words.
- *
- * Input:
- *	str		String whose words should be sorted
- *
- * Results:
- *	A string containing the resulting words.
- *
- * Side Effects:
- *	None.
- *
- *---
- */
+/* Remove adjacent duplicate words. */
 static char *
 VarUniq(const char *str)
 {



CVS commit: src/usr.bin/make

2020-07-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul 26 17:09:23 UTC 2020

Modified Files:
src/usr.bin/make: var.c

Log Message:
make(1): save a few bytes and cycles by comparing against 0

The comparison against ac - 1 could have been optimized by the compilers
as well, but both GCC 5 and Clang produce smaller code for the comparison
against 0.


To generate a diff of this commit:
cvs rdiff -u -r1.317 -r1.318 src/usr.bin/make/var.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/make/var.c
diff -u src/usr.bin/make/var.c:1.317 src/usr.bin/make/var.c:1.318
--- src/usr.bin/make/var.c:1.317	Sun Jul 26 16:59:08 2020
+++ src/usr.bin/make/var.c	Sun Jul 26 17:09:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.317 2020/07/26 16:59:08 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.318 2020/07/26 17:09:23 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.317 2020/07/26 16:59:08 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.318 2020/07/26 17:09:23 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.317 2020/07/26 16:59:08 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.318 2020/07/26 17:09:23 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1699,9 +1699,9 @@ VarOrder(const char *str, const char oty
 }
 
 for (i = 0; i < ac; i++) {
-	Buf_AddStr(, av[i]);
-	if (i != ac - 1)
+	if (i != 0)
 	Buf_AddByte(, ' ');
+	Buf_AddStr(, av[i]);
 }
 
 free(as);
@@ -1746,9 +1746,9 @@ VarUniq(const char *str)
 }
 
 for (i = 0; i < ac; i++) {
-	Buf_AddStr(, av[i]);
-	if (i != ac - 1)
+	if (i != 0)
 	Buf_AddByte(, ' ');
+	Buf_AddStr(, av[i]);
 }
 
 free(as);
@@ -1787,9 +1787,9 @@ VarRange(const char *str, int ac)
 	av = brk_string(str, , FALSE, );
 }
 for (i = 0; i < ac; i++) {
-	Buf_AddInt(, 1 + i);
-	if (i != ac - 1)
+	if (i != 0)
 	Buf_AddByte(, ' ');
+	Buf_AddInt(, 1 + i);
 }
 
 free(as);



CVS commit: src/usr.bin/make

2020-07-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul 26 16:59:09 UTC 2020

Modified Files:
src/usr.bin/make: var.c

Log Message:
make(1): remove unnecessary block scope


To generate a diff of this commit:
cvs rdiff -u -r1.316 -r1.317 src/usr.bin/make/var.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/make/var.c
diff -u src/usr.bin/make/var.c:1.316 src/usr.bin/make/var.c:1.317
--- src/usr.bin/make/var.c:1.316	Sun Jul 26 15:53:01 2020
+++ src/usr.bin/make/var.c	Sun Jul 26 16:59:08 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.316 2020/07/26 15:53:01 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.317 2020/07/26 16:59:08 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.316 2020/07/26 15:53:01 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.317 2020/07/26 16:59:08 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.316 2020/07/26 15:53:01 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.317 2020/07/26 16:59:08 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1683,19 +1683,17 @@ VarOrder(const char *str, const char oty
 	qsort(av, ac, sizeof(char *), VarWordCompare);
 	break;
 	case 'x':		/* randomize */
-	{
-		/*
-		 * We will use [ac..2] range for mod factors. This will produce
-		 * random numbers in [(ac-1)..0] interval, and minimal
-		 * reasonable value for mod factor is 2 (the mod 1 will produce
-		 * 0 with probability 1).
-		 */
-		for (i = ac - 1; i > 0; i--) {
-		int rndidx = random() % (i + 1);
-		char *t = av[i];
-		av[i] = av[rndidx];
-		av[rndidx] = t;
-		}
+	/*
+	 * We will use [ac..2] range for mod factors. This will produce
+	 * random numbers in [(ac-1)..0] interval, and minimal
+	 * reasonable value for mod factor is 2 (the mod 1 will produce
+	 * 0 with probability 1).
+	 */
+	for (i = ac - 1; i > 0; i--) {
+		int rndidx = random() % (i + 1);
+		char *t = av[i];
+		av[i] = av[rndidx];
+		av[rndidx] = t;
 	}
 	}
 }



CVS commit: src/usr.bin/make

2020-07-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul 26 16:51:53 UTC 2020

Modified Files:
src/usr.bin/make: str.c

Log Message:
make(1): document the circumstances in which brk_string returns NULL


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/usr.bin/make/str.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/make/str.c
diff -u src/usr.bin/make/str.c:1.52 src/usr.bin/make/str.c:1.53
--- src/usr.bin/make/str.c:1.52	Sun Jul 19 09:26:18 2020
+++ src/usr.bin/make/str.c	Sun Jul 26 16:51:53 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: str.c,v 1.52 2020/07/19 09:26:18 rillig Exp $	*/
+/*	$NetBSD: str.c,v 1.53 2020/07/26 16:51:53 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: str.c,v 1.52 2020/07/19 09:26:18 rillig Exp $";
+static char rcsid[] = "$NetBSD: str.c,v 1.53 2020/07/26 16:51:53 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)str.c	5.8 (Berkeley) 6/1/90";
 #else
-__RCSID("$NetBSD: str.c,v 1.52 2020/07/19 09:26:18 rillig Exp $");
+__RCSID("$NetBSD: str.c,v 1.53 2020/07/26 16:51:53 rillig Exp $");
 #endif
 #endif/* not lint */
 #endif
@@ -128,18 +128,19 @@ str_concat(const char *s1, const char *s
  *	spaces) taking quotation marks into account.  Leading tabs/spaces
  *	are ignored.
  *
- * If expand is TRUE, quotes are removed and escape sequences
- *  such as \r, \t, etc... are expanded.
+ *	If expand is TRUE, quotes are removed and escape sequences
+ *	such as \r, \t, etc... are expanded. In this case, the return value
+ *	is NULL on parse errors.
  *
  * returns --
  *	Pointer to the array of pointers to the words.
- *  Memory containing the actual words in *store_words_buf.
- *		Both of these must be free'd by the caller.
- *  Number of words in *store_words_len.
+ *	Memory containing the actual words in *out_words_buf.
+ *	Both of these must be free'd by the caller.
+ *	Number of words in *out_words_len.
  */
 char **
-brk_string(const char *str, int *store_words_len, Boolean expand,
-	char **store_words_buf)
+brk_string(const char *str, int *out_words_len, Boolean expand,
+	char **out_words_buf)
 {
 	char inquote;
 	const char *str_p;
@@ -226,7 +227,7 @@ brk_string(const char *str, int *store_w
 if (expand && inquote) {
 	free(words);
 	free(words_buf);
-	*store_words_buf = NULL;
+	*out_words_buf = NULL;
 	return NULL;
 }
 goto done;
@@ -274,8 +275,8 @@ brk_string(const char *str, int *store_w
 		*word_end++ = ch;
 	}
 done:	words[words_len] = NULL;
-	*store_words_len = words_len;
-	*store_words_buf = words_buf;
+	*out_words_len = words_len;
+	*out_words_buf = words_buf;
 	return words;
 }
 



CVS commit: src/share/man/man4

2020-07-26 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sun Jul 26 15:56:30 UTC 2020

Modified Files:
src/share/man/man4: wwanc.4

Log Message:
add note that the network initialization script needs the device nodes
to be created


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/share/man/man4/wwanc.4

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/man4/wwanc.4
diff -u src/share/man/man4/wwanc.4:1.1 src/share/man/man4/wwanc.4:1.2
--- src/share/man/man4/wwanc.4:1.1	Sun Jul 26 15:13:09 2020
+++ src/share/man/man4/wwanc.4	Sun Jul 26 15:56:30 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: wwanc.4,v 1.1 2020/07/26 15:13:09 jdolecek Exp $
+.\" $NetBSD: wwanc.4,v 1.2 2020/07/26 15:56:30 jdolecek Exp $
 .\"
 .\" Copyright (c) 2020 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -57,6 +57,7 @@ The following devices should work:
 .Xr pci 4 ,
 .Xr ifconfig.if 5 ,
 .Xr ifconfig 8 ,
+.Xr MAKEDEV 8 ,
 .Lk https://github.com/xmm7360/xmm7360-pci "Linux driver repository"
 .Sh HISTORY
 The
@@ -82,3 +83,7 @@ driver IPv6 support is untested.
 .Pp
 Network initialization requires Python script published on the Linux
 driver repository.
+The script requires the management device nodes to be created via:
+.Bd -literal -offset indent
+cd /dev && ./MAKEDEV xmm0
+.Ed



CVS commit: src/share/man/man4

2020-07-26 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sun Jul 26 15:57:03 UTC 2020

Modified Files:
src/share/man/man4: wwanc.4

Log Message:
finish sentence


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/share/man/man4/wwanc.4

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/man4/wwanc.4
diff -u src/share/man/man4/wwanc.4:1.2 src/share/man/man4/wwanc.4:1.3
--- src/share/man/man4/wwanc.4:1.2	Sun Jul 26 15:56:30 2020
+++ src/share/man/man4/wwanc.4	Sun Jul 26 15:57:03 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: wwanc.4,v 1.2 2020/07/26 15:56:30 jdolecek Exp $
+.\" $NetBSD: wwanc.4,v 1.3 2020/07/26 15:57:03 jdolecek Exp $
 .\"
 .\" Copyright (c) 2020 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -43,8 +43,8 @@ GPRS, UMTS, and LTE.
 They appear as a regular point-to-point network interface,
 transporting raw IP frames.
 .Pp
-SIM card needs to be unlocked, driver provides no means
-to 
+SIM card needs to be unlocked, driver provides no means to provide
+password for the SIM.
 .Sh HARDWARE
 The following devices should work:
 .Pp



CVS commit: src/lib/libexecinfo

2020-07-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul 26 15:53:05 UTC 2020

Modified Files:
src/lib/libexecinfo: unwind.c

Log Message:
If Unwind_Backtrace is broken, ctx.n will still contain ~0, and we will
return that which poor behavior for the user, so return 0 instead.
We could document ~0 to be an error, but that would deviate from the
Linux behavior which is not desirable. Noted by Poul-Henning Kamp


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/libexecinfo/unwind.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/libexecinfo/unwind.c
diff -u src/lib/libexecinfo/unwind.c:1.4 src/lib/libexecinfo/unwind.c:1.5
--- src/lib/libexecinfo/unwind.c:1.4	Wed Jan 22 11:07:40 2020
+++ src/lib/libexecinfo/unwind.c	Sun Jul 26 11:53:05 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: unwind.c,v 1.4 2020/01/22 16:07:40 mgorny Exp $	*/
+/*	$NetBSD: unwind.c,v 1.5 2020/07/26 15:53:05 christos Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -67,7 +67,9 @@ backtrace(void **arr, size_t len)
 	ctx.n = (size_t)~0;
 
 	_Unwind_Backtrace(tracer, );
-	if (ctx.n != (size_t)~0 && ctx.n > 0)
+	if (ctx.n == (size_t)~0)
+		ctx.n = 0;
+	else if (ctx.n > 0)
 		ctx.arr[--ctx.n] = NULL;	/* Skip frame below __start */
 
 	return ctx.n;



CVS commit: src/usr.bin/make

2020-07-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul 26 15:53:01 UTC 2020

Modified Files:
src/usr.bin/make: var.c

Log Message:
make(1): avoid memory allocation for oneBigWord in modifiers


To generate a diff of this commit:
cvs rdiff -u -r1.315 -r1.316 src/usr.bin/make/var.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/make/var.c
diff -u src/usr.bin/make/var.c:1.315 src/usr.bin/make/var.c:1.316
--- src/usr.bin/make/var.c:1.315	Sun Jul 26 15:37:44 2020
+++ src/usr.bin/make/var.c	Sun Jul 26 15:53:01 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.315 2020/07/26 15:37:44 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.316 2020/07/26 15:53:01 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.315 2020/07/26 15:37:44 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.316 2020/07/26 15:53:01 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.315 2020/07/26 15:37:44 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.316 2020/07/26 15:53:01 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1595,6 +1595,13 @@ static char *
 ModifyWords(GNode *ctx, Byte sep, Boolean oneBigWord,
 	const char *str, ModifyWordsCallback modifyWord, void *data)
 {
+if (oneBigWord) {
+	SepBuf result;
+	SepBuf_Init(, sep);
+	modifyWord(str, , data);
+	return SepBuf_Destroy(, FALSE);
+}
+
 SepBuf result;
 char **av;			/* word list */
 char *as;			/* word list memory */
@@ -1602,16 +1609,7 @@ ModifyWords(GNode *ctx, Byte sep, Boolea
 
 SepBuf_Init(, sep);
 
-if (oneBigWord) {
-	/* fake what brk_string() would do if there were only one word */
-	ac = 1;
-	av = bmake_malloc((ac + 1) * sizeof(char *));
-	as = bmake_strdup(str);
-	av[0] = as;
-	av[1] = NULL;
-} else {
-	av = brk_string(str, , FALSE, );
-}
+av = brk_string(str, , FALSE, );
 
 if (DEBUG(VAR)) {
 	fprintf(debug_file, "ModifyWords: split \"%s\" into %d words\n",



CVS commit: src/etc

2020-07-26 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sun Jul 26 15:47:27 UTC 2020

Modified Files:
src/etc: MAKEDEV.tmpl
src/etc/etc.amd64: MAKEDEV.conf

Log Message:
add support for wwanc(4) device nodes (xmm[0-9])


To generate a diff of this commit:
cvs rdiff -u -r1.220 -r1.221 src/etc/MAKEDEV.tmpl
cvs rdiff -u -r1.29 -r1.30 src/etc/etc.amd64/MAKEDEV.conf

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

Modified files:

Index: src/etc/MAKEDEV.tmpl
diff -u src/etc/MAKEDEV.tmpl:1.220 src/etc/MAKEDEV.tmpl:1.221
--- src/etc/MAKEDEV.tmpl:1.220	Sun Jun  7 09:45:19 2020
+++ src/etc/MAKEDEV.tmpl	Sun Jul 26 15:47:27 2020
@@ -1,5 +1,5 @@
 #!/bin/sh -
-#	$NetBSD: MAKEDEV.tmpl,v 1.220 2020/06/07 09:45:19 maxv Exp $
+#	$NetBSD: MAKEDEV.tmpl,v 1.221 2020/07/26 15:47:27 jdolecek Exp $
 #
 # Copyright (c) 2003,2007,2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -2235,6 +2235,14 @@ ipmi[0-9]*)
 	mkdev ipmi${unit} c %ipmi_chr% $unit 600
 	;;
 
+xmm[0-9])
+	unit=${i#xmm}
+	makedir xmm${unit} 755
+	mkdev xmm${unit}/rpc c %wwanc_chr% $(($unit * 65536 + 1))
+	mkdev ttyXMM${unit}0 c %wwanc_chr% $(($unit * 65536 + 2))
+	mkdev ttyXMM${unit}1 c %wwanc_chr% $(($unit * 65536 + 4))
+	;;
+
 midevend)
 %MI_DEVICES_END%
 local)

Index: src/etc/etc.amd64/MAKEDEV.conf
diff -u src/etc/etc.amd64/MAKEDEV.conf:1.29 src/etc/etc.amd64/MAKEDEV.conf:1.30
--- src/etc/etc.amd64/MAKEDEV.conf:1.29	Sun Apr  5 14:09:17 2020
+++ src/etc/etc.amd64/MAKEDEV.conf	Sun Jul 26 15:47:27 2020
@@ -1,4 +1,4 @@
-# $NetBSD: MAKEDEV.conf,v 1.29 2020/04/05 14:09:17 jdolecek Exp $
+# $NetBSD: MAKEDEV.conf,v 1.30 2020/07/26 15:47:27 jdolecek Exp $
 
 # As of 2003-04-17, the "init" case must not create more than 890 entries.
 all_md)
@@ -44,6 +44,7 @@ all_md)
 	makedev cir0 cir1 irframe0 irframe1
 	makedev kttcp
 	makedev bio
+	makedev xmm0
 	;;
 
 xen)



CVS commit: src/games/robots

2020-07-26 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Sun Jul 26 15:38:22 UTC 2020

Modified Files:
src/games/robots: main.c rnd_pos.c

Log Message:
robots: Use arc4random_uniform for better uniform distribution


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/games/robots/main.c
cvs rdiff -u -r1.10 -r1.11 src/games/robots/rnd_pos.c

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

Modified files:

Index: src/games/robots/main.c
diff -u src/games/robots/main.c:1.32 src/games/robots/main.c:1.33
--- src/games/robots/main.c:1.32	Wed Aug 12 08:30:55 2009
+++ src/games/robots/main.c	Sun Jul 26 15:38:22 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.32 2009/08/12 08:30:55 dholland Exp $	*/
+/*	$NetBSD: main.c,v 1.33 2020/07/26 15:38:22 nia Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "@(#)main.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: main.c,v 1.32 2009/08/12 08:30:55 dholland Exp $");
+__RCSID("$NetBSD: main.c,v 1.33 2020/07/26 15:38:22 nia Exp $");
 #endif
 #endif /* not lint */
 
@@ -167,7 +167,6 @@ main(int argc, char **argv)
 		stdscr = newwin(Y_SIZE, X_SIZE, 0, 0);
 	}
 
-	srandom(time(NULL));
 	if (Real_time)
 		signal(SIGALRM, move_robots);
 	do {

Index: src/games/robots/rnd_pos.c
diff -u src/games/robots/rnd_pos.c:1.10 src/games/robots/rnd_pos.c:1.11
--- src/games/robots/rnd_pos.c:1.10	Wed Aug 12 08:30:55 2009
+++ src/games/robots/rnd_pos.c	Sun Jul 26 15:38:22 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rnd_pos.c,v 1.10 2009/08/12 08:30:55 dholland Exp $	*/
+/*	$NetBSD: rnd_pos.c,v 1.11 2020/07/26 15:38:22 nia Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)rnd_pos.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: rnd_pos.c,v 1.10 2009/08/12 08:30:55 dholland Exp $");
+__RCSID("$NetBSD: rnd_pos.c,v 1.11 2020/07/26 15:38:22 nia Exp $");
 #endif
 #endif /* not lint */
 
@@ -44,8 +44,6 @@ __RCSID("$NetBSD: rnd_pos.c,v 1.10 2009/
 
 #define IS_SAME(p,y,x)	((p).y != -1 && (p).y == y && (p).x == x)
 
-static int rnd(int);
-
 /*
  * rnd_pos:
  *	Pick a random, unoccupied position
@@ -57,17 +55,10 @@ rnd_pos(void)
 	static int call = 0;
 
 	do {
-		pos.y = rnd(Y_FIELDSIZE - 1) + 1;
-		pos.x = rnd(X_FIELDSIZE - 1) + 1;
+		pos.y = arc4random_uniform(Y_FIELDSIZE - 1) + 1;
+		pos.x = arc4random_uniform(X_FIELDSIZE - 1) + 1;
 		refresh();
 	} while (Field[pos.y][pos.x] != 0);
 	call++;
 	return 
 }
-
-static int
-rnd(int range)
-{
-
-	return random() % range;
-}



CVS commit: src/usr.bin/make

2020-07-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul 26 15:37:44 UTC 2020

Modified Files:
src/usr.bin/make: var.c

Log Message:
make(1): help the compiler to find common subexpressions


To generate a diff of this commit:
cvs rdiff -u -r1.314 -r1.315 src/usr.bin/make/var.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/make/var.c
diff -u src/usr.bin/make/var.c:1.314 src/usr.bin/make/var.c:1.315
--- src/usr.bin/make/var.c:1.314	Sun Jul 26 15:26:27 2020
+++ src/usr.bin/make/var.c	Sun Jul 26 15:37:44 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.314 2020/07/26 15:26:27 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.315 2020/07/26 15:37:44 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.314 2020/07/26 15:26:27 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.315 2020/07/26 15:37:44 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.314 2020/07/26 15:26:27 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.315 2020/07/26 15:37:44 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1325,6 +1325,7 @@ ModifyWord_Subst(const char *word, SepBu
 if (args->pflags & VARP_ANCHOR_END) {
 	if (wordLen < args->lhsLen)
 	goto nosub;
+
 	const char *start = word + (wordLen - args->lhsLen);
 	if (memcmp(start, args->lhs, args->lhsLen) != 0)
 	goto nosub;
@@ -1336,13 +1337,13 @@ ModifyWord_Subst(const char *word, SepBu
 }
 
 /* unanchored */
-const char *cp;
-while ((cp = Str_FindSubstring(word, args->lhs)) != NULL) {
-	SepBuf_AddBytesBetween(buf, word, cp);
+const char *match;
+while ((match = Str_FindSubstring(word, args->lhs)) != NULL) {
+	SepBuf_AddBytesBetween(buf, word, match);
 	SepBuf_AddBytes(buf, args->rhs, args->rhsLen);
 	args->pflags |= VARP_SUB_MATCHED;
-	wordLen -= (cp - word) + args->lhsLen;
-	word = cp + args->lhsLen;
+	wordLen -= (match - word) + args->lhsLen;
+	word += (match - word) + args->lhsLen;
 	if (wordLen == 0 || !(args->pflags & VARP_SUB_GLOBAL))
 	break;
 }



CVS commit: src/usr.bin/make

2020-07-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul 26 15:26:27 UTC 2020

Modified Files:
src/usr.bin/make: var.c

Log Message:
make(1): add convenience functions for adding to a SepBuf


To generate a diff of this commit:
cvs rdiff -u -r1.313 -r1.314 src/usr.bin/make/var.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/make/var.c
diff -u src/usr.bin/make/var.c:1.313 src/usr.bin/make/var.c:1.314
--- src/usr.bin/make/var.c:1.313	Sun Jul 26 15:09:10 2020
+++ src/usr.bin/make/var.c	Sun Jul 26 15:26:27 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.313 2020/07/26 15:09:10 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.314 2020/07/26 15:26:27 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.313 2020/07/26 15:09:10 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.314 2020/07/26 15:26:27 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.313 2020/07/26 15:09:10 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.314 2020/07/26 15:26:27 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1059,7 +1059,7 @@ SepBuf_Sep(SepBuf *buf)
 }
 
 static void
-SepBuf_AddBytes(SepBuf *buf, const void *mem, size_t mem_size)
+SepBuf_AddBytes(SepBuf *buf, const char *mem, size_t mem_size)
 {
 if (mem_size == 0)
 	return;
@@ -1070,6 +1070,18 @@ SepBuf_AddBytes(SepBuf *buf, const void 
 Buf_AddBytes(>buf, mem_size, mem);
 }
 
+static void
+SepBuf_AddBytesBetween(SepBuf *buf, const char *start, const char *end)
+{
+SepBuf_AddBytes(buf, start, (size_t)(end - start));
+}
+
+static void
+SepBuf_AddStr(SepBuf *buf, const char *str)
+{
+SepBuf_AddBytes(buf, str, strlen(str));
+}
+
 static char *
 SepBuf_Destroy(SepBuf *buf, Boolean free_buf)
 {
@@ -1090,9 +1102,9 @@ ModifyWord_Head(const char *word, SepBuf
 {
 const char *slash = strrchr(word, '/');
 if (slash != NULL)
-	SepBuf_AddBytes(buf, word, slash - word);
+	SepBuf_AddBytesBetween(buf, word, slash);
 else
-	SepBuf_AddBytes(buf, ".", 1);
+	SepBuf_AddStr(buf, ".");
 }
 
 /* Callback for ModifyWords to implement the :T modifier.
@@ -1102,7 +1114,7 @@ ModifyWord_Tail(const char *word, SepBuf
 {
 const char *slash = strrchr(word, '/');
 const char *base = slash != NULL ? slash + 1 : word;
-SepBuf_AddBytes(buf, base, strlen(base));
+SepBuf_AddStr(buf, base);
 }
 
 /* Callback for ModifyWords to implement the :E modifier.
@@ -1112,7 +1124,7 @@ ModifyWord_Suffix(const char *word, SepB
 {
 const char *dot = strrchr(word, '.');
 if (dot != NULL)
-	SepBuf_AddBytes(buf, dot + 1, strlen(dot + 1));
+	SepBuf_AddStr(buf, dot + 1);
 }
 
 /* Callback for ModifyWords to implement the :R modifier.
@@ -1120,7 +1132,7 @@ ModifyWord_Suffix(const char *word, SepB
 static void
 ModifyWord_Root(const char *word, SepBuf *buf, void *dummy MAKE_ATTR_UNUSED)
 {
-char *dot = strrchr(word, '.');
+const char *dot = strrchr(word, '.');
 size_t len = dot != NULL ? (size_t)(dot - word) : strlen(word);
 SepBuf_AddBytes(buf, word, len);
 }
@@ -1134,7 +1146,7 @@ ModifyWord_Match(const char *word, SepBu
 if (DEBUG(VAR))
 	fprintf(debug_file, "VarMatch [%s] [%s]\n", word, pattern);
 if (Str_Match(word, pattern))
-	SepBuf_AddBytes(buf, word, strlen(word));
+	SepBuf_AddStr(buf, word);
 }
 
 /* Callback for ModifyWords to implement the :N modifier.
@@ -1144,7 +1156,7 @@ ModifyWord_NoMatch(const char *word, Sep
 {
 const char *pattern = data;
 if (!Str_Match(word, pattern))
-	SepBuf_AddBytes(buf, word, strlen(word));
+	SepBuf_AddStr(buf, word);
 }
 
 #ifdef SYSVVARSUB
@@ -1231,7 +1243,7 @@ Str_SYSVSubst(SepBuf *buf, const char *p
 
 if ((m = strchr(pat, '%')) != NULL && lhsHasPercent) {
 	/* Copy the prefix */
-	SepBuf_AddBytes(buf, pat, m - pat);
+	SepBuf_AddBytesBetween(buf, pat, m);
 	/* skip the % */
 	pat = m + 1;
 }
@@ -1241,7 +1253,7 @@ Str_SYSVSubst(SepBuf *buf, const char *p
 }
 
 /* append the rest */
-SepBuf_AddBytes(buf, pat, strlen(pat));
+SepBuf_AddStr(buf, pat);
 }
 
 
@@ -1265,7 +1277,7 @@ ModifyWord_SYSVSubst(const char *word, S
 	Str_SYSVSubst(buf, varexp, ptr, len, hasPercent);
 	free(varexp);
 } else {
-	SepBuf_AddBytes(buf, word, strlen(word));
+	SepBuf_AddStr(buf, word);
 }
 }
 #endif
@@ -1317,7 +1329,7 @@ ModifyWord_Subst(const char *word, SepBu
 	if (memcmp(start, args->lhs, args->lhsLen) != 0)
 	goto nosub;
 
-	SepBuf_AddBytes(buf, word, start - word);
+	SepBuf_AddBytesBetween(buf, word, start);
 	SepBuf_AddBytes(buf, args->rhs, args->rhsLen);
 	args->pflags |= VARP_SUB_MATCHED;
 	return;
@@ -1326,7 +1338,7 @@ ModifyWord_Subst(const char *word, SepBu
 /* unanchored */
 const char *cp;
 while ((cp = Str_FindSubstring(word, args->lhs)) != NULL) {
-	

CVS commit: src/games/random

2020-07-26 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Sun Jul 26 15:24:00 UTC 2020

Modified Files:
src/games/random: random.c

Log Message:
random(6): Use arc4random_uniform to simplify code


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/games/random/random.c

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

Modified files:

Index: src/games/random/random.c
diff -u src/games/random/random.c:1.14 src/games/random/random.c:1.15
--- src/games/random/random.c:1.14	Wed Aug 12 08:27:24 2009
+++ src/games/random/random.c	Sun Jul 26 15:24:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: random.c,v 1.14 2009/08/12 08:27:24 dholland Exp $	*/
+/*	$NetBSD: random.c,v 1.15 2020/07/26 15:24:00 nia Exp $	*/
 
 /*
  * Copyright (c) 1994
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1994\
 #if 0
 static char sccsid[] = "@(#)random.c	8.6 (Berkeley) 6/1/94";
 #else
-__RCSID("$NetBSD: random.c,v 1.14 2009/08/12 08:27:24 dholland Exp $");
+__RCSID("$NetBSD: random.c,v 1.15 2020/07/26 15:24:00 nia Exp $");
 #endif
 #endif /* not lint */
 
@@ -62,7 +62,6 @@ static void usage(void) __dead;
 int
 main(int argc, char *argv[])
 {
-	struct timeval tp;
 	double denom;
 	int ch, random_exit, selected, unbuffer_output;
 	char *ep;
@@ -103,12 +102,9 @@ main(int argc, char *argv[])
 		/* NOTREACHED */
 	}
 
-	(void)gettimeofday(, NULL);
-	srandom((unsigned long)tp.tv_usec + tp.tv_sec + getpid());
-
 	/* Compute a random exit status between 0 and denom - 1. */
 	if (random_exit)
-		return ((denom * random()) / RANDOM_MAX);
+		return arc4random_uniform(denom);
 
 	/*
 	 * Act as a filter, randomly choosing lines of the standard input
@@ -123,7 +119,7 @@ main(int argc, char *argv[])
 	 * 0 (which has a 1 / denom chance of being true), we select the
 	 * line.
 	 */
-	selected = (int)(denom * random() / RANDOM_MAX) == 0;
+	selected = (arc4random_uniform(denom) == 0);
 	while ((ch = getchar()) != EOF) {
 		if (selected)
 			(void)putchar(ch);
@@ -133,7 +129,7 @@ main(int argc, char *argv[])
 err(2, "stdout");
 
 			/* Now see if the next line is to be printed. */
-			selected = (int)(denom * random() / RANDOM_MAX) == 0;
+			selected = (arc4random_uniform(denom) == 0);
 		}
 	}
 	if (ferror(stdin))



CVS commit: src/doc

2020-07-26 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sun Jul 26 15:14:23 UTC 2020

Modified Files:
src/doc: CHANGES

Log Message:
note new Intel XMM7360 driver


To generate a diff of this commit:
cvs rdiff -u -r1.2719 -r1.2720 src/doc/CHANGES

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2719 src/doc/CHANGES:1.2720
--- src/doc/CHANGES:1.2719	Wed Jul 22 20:56:05 2020
+++ src/doc/CHANGES	Sun Jul 26 15:14:23 2020
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2719 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2720 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -260,3 +260,4 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	openresolv: Import version 3.11.0 [roy 20200722]
 	sun3: Add Xorg-Server-1.20'fied ancient monolithc Xsun servers.
 		[tsutsui 20200722]
+	wwanc(4): Add driver for Intel XMM7360 LTE modem [jdolecek 20200726]



CVS commit: src/games/fortune/strfile

2020-07-26 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Sun Jul 26 15:14:09 UTC 2020

Modified Files:
src/games/fortune/strfile: strfile.c

Log Message:
Revert arc4random usage for now

this is a host tool and needs to be portable

future plans: add arc4random to libnbcompat


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/games/fortune/strfile/strfile.c

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

Modified files:

Index: src/games/fortune/strfile/strfile.c
diff -u src/games/fortune/strfile/strfile.c:1.41 src/games/fortune/strfile/strfile.c:1.42
--- src/games/fortune/strfile/strfile.c:1.41	Tue Jul 21 03:05:40 2020
+++ src/games/fortune/strfile/strfile.c	Sun Jul 26 15:14:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: strfile.c,v 1.41 2020/07/21 03:05:40 nia Exp $	*/
+/*	$NetBSD: strfile.c,v 1.42 2020/07/26 15:14:09 nia Exp $	*/
 
 /*-
  * Copyright (c) 1989, 1993
@@ -47,7 +47,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 19
 #if 0
 static char sccsid[] = "@(#)strfile.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: strfile.c,v 1.41 2020/07/21 03:05:40 nia Exp $");
+__RCSID("$NetBSD: strfile.c,v 1.42 2020/07/26 15:14:09 nia Exp $");
 #endif
 #endif /* not lint */
 #endif /* __NetBSD__ */
@@ -438,6 +438,8 @@ randomize(void)
 	off_t	tmp;
 	off_t	*sp;
 
+	srandom((int)(time(NULL) + getpid()));
+
 	Tbl.str_flags |= STR_RANDOM;
 	cnt = Tbl.str_numstr;
 
@@ -446,7 +448,7 @@ randomize(void)
 	 */
 
 	for (sp = Seekpts; cnt > 0; cnt--, sp++) {
-		i = arc4random_uniform(cnt);
+		i = random() % cnt;
 		tmp = sp[0];
 		sp[0] = sp[i];
 		sp[i] = tmp;



CVS commit: src

2020-07-26 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sun Jul 26 15:13:10 UTC 2020

Modified Files:
src/distrib/sets/lists/man: mi
src/share/man/man4: Makefile
Added Files:
src/share/man/man4: wwanc.4

Log Message:
add rudimentary wwanc(4) manpage


To generate a diff of this commit:
cvs rdiff -u -r1.1696 -r1.1697 src/distrib/sets/lists/man/mi
cvs rdiff -u -r1.705 -r1.706 src/share/man/man4/Makefile
cvs rdiff -u -r0 -r1.1 src/share/man/man4/wwanc.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.1696 src/distrib/sets/lists/man/mi:1.1697
--- src/distrib/sets/lists/man/mi:1.1696	Fri Jul 17 15:24:03 2020
+++ src/distrib/sets/lists/man/mi	Sun Jul 26 15:13:09 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1696 2020/07/17 15:24:03 kamil Exp $
+# $NetBSD: mi,v 1.1697 2020/07/26 15:13:09 jdolecek Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -2049,6 +2049,8 @@
 ./usr/share/man/cat4/wsmuxctl.0			man-sys-catman		.cat
 ./usr/share/man/cat4/wss.0			man-sys-catman		.cat
 ./usr/share/man/cat4/wt.0			man-sys-catman		.cat
+./usr/share/man/cat4/wwan.0			man-sys-catman		.cat
+./usr/share/man/cat4/wwanc.0			man-sys-catman		.cat
 ./usr/share/man/cat4/x68k/bmd.0			man-sys-catman		.cat
 ./usr/share/man/cat4/x68k/intio.0		man-sys-catman		.cat
 ./usr/share/man/cat4/x68k/intro.0		man-sys-catman		.cat
@@ -5177,6 +5179,8 @@
 ./usr/share/man/html4/wsmuxctl.html		man-sys-htmlman		html
 ./usr/share/man/html4/wss.html			man-sys-htmlman		html
 ./usr/share/man/html4/wt.html			man-sys-htmlman		html
+./usr/share/man/html4/wwan.html			man-sys-htmlman		html
+./usr/share/man/html4/wwanc.html		man-sys-htmlman		html
 ./usr/share/man/html4/x68k/bmd.html		man-sys-htmlman		html
 ./usr/share/man/html4/x68k/intio.html		man-sys-htmlman		html
 ./usr/share/man/html4/x68k/intro.html		man-sys-htmlman		html
@@ -8237,6 +8241,8 @@
 ./usr/share/man/man4/wsmuxctl.4			man-sys-man		.man
 ./usr/share/man/man4/wss.4			man-sys-man		.man
 ./usr/share/man/man4/wt.4			man-sys-man		.man
+./usr/share/man/man4/wwan.4			man-sys-man		.man
+./usr/share/man/man4/wwanc.4			man-sys-man		.man
 ./usr/share/man/man4/x68k/bmd.4			man-sys-man		.man
 ./usr/share/man/man4/x68k/intio.4		man-sys-man		.man
 ./usr/share/man/man4/x68k/intro.4		man-sys-man		.man

Index: src/share/man/man4/Makefile
diff -u src/share/man/man4/Makefile:1.705 src/share/man/man4/Makefile:1.706
--- src/share/man/man4/Makefile:1.705	Sat May 16 13:46:10 2020
+++ src/share/man/man4/Makefile	Sun Jul 26 15:13:09 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.705 2020/05/16 13:46:10 maya Exp $
+#	$NetBSD: Makefile,v 1.706 2020/07/26 15:13:09 jdolecek Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/18/93
 
 MAN=	aac.4 ac97.4 acardide.4 aceride.4 acphy.4 \
@@ -74,6 +74,7 @@ MAN=	aac.4 ac97.4 acardide.4 aceride.4 a
 	wsbell.4 wscons.4 wsdisplay.4 wsfont.4 wskbd.4 wsmouse.4 wsmux.4 \
 	xbox.4 xge.4 \
 	yds.4 ym.4 \
+	wwanc.4 \
 	zero.4 zstty.4 zyd.4
 
 # USB devices
@@ -238,6 +239,7 @@ MLINKS+=tty.4 dty.4
 MLINKS+=url.4 urlphy.4
 MLINKS+=usb.4 uhub.4
 MLINKS+=usb.4 usbtask.4
+MLINKS+=wwanc.4 wwan.4
 MLINKS+=wsmux.4 wsmuxctl.4
 MLINKS+=zstty.4 zs.4 zstty.4 zsc.4
 

Added files:

Index: src/share/man/man4/wwanc.4
diff -u /dev/null src/share/man/man4/wwanc.4:1.1
--- /dev/null	Sun Jul 26 15:13:10 2020
+++ src/share/man/man4/wwanc.4	Sun Jul 26 15:13:09 2020
@@ -0,0 +1,84 @@
+.\" $NetBSD: wwanc.4,v 1.1 2020/07/26 15:13:09 jdolecek Exp $
+.\"
+.\" Copyright (c) 2020 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``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 FOUNDATION OR CONTRIBUTORS
+.\" 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 THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" 

CVS commit: src/usr.bin/make

2020-07-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul 26 15:09:10 UTC 2020

Modified Files:
src/usr.bin/make: buf.c buf.h var.c

Log Message:
make(1): add Buffer functions for common tasks

Adding a string or a substring to a buffer are common tasks when handling
variables.  There is no need to spell out the strlen call or the pointer
subtraction at every call site.

Subtracting pointers results in a ptrdiff_t, which would have to be
converted to an int in each case for WARNS=6. Having this conversion in a
single place keeps the code clean.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/make/buf.c
cvs rdiff -u -r1.20 -r1.21 src/usr.bin/make/buf.h
cvs rdiff -u -r1.312 -r1.313 src/usr.bin/make/var.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/make/buf.c
diff -u src/usr.bin/make/buf.c:1.27 src/usr.bin/make/buf.c:1.28
--- src/usr.bin/make/buf.c:1.27	Sun Jul 26 13:39:30 2020
+++ src/usr.bin/make/buf.c	Sun Jul 26 15:09:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: buf.c,v 1.27 2020/07/26 13:39:30 rillig Exp $	*/
+/*	$NetBSD: buf.c,v 1.28 2020/07/26 15:09:10 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: buf.c,v 1.27 2020/07/26 13:39:30 rillig Exp $";
+static char rcsid[] = "$NetBSD: buf.c,v 1.28 2020/07/26 15:09:10 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)buf.c	8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: buf.c,v 1.27 2020/07/26 13:39:30 rillig Exp $");
+__RCSID("$NetBSD: buf.c,v 1.28 2020/07/26 15:09:10 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -141,6 +141,18 @@ Buf_AddBytes(Buffer *bp, int numBytes, c
 memcpy(ptr, bytesPtr, numBytes);
 }
 
+void
+Buf_AddBytesBetween(Buffer *bp, const char *start, const char *end)
+{
+Buf_AddBytes(bp, (int)(end - start), start);
+}
+
+void
+Buf_AddStr(Buffer *bp, const char *str)
+{
+Buf_AddBytes(bp, (int)strlen(str), str);
+}
+
 /*-
  *---
  * Buf_AddInt --

Index: src/usr.bin/make/buf.h
diff -u src/usr.bin/make/buf.h:1.20 src/usr.bin/make/buf.h:1.21
--- src/usr.bin/make/buf.h:1.20	Sun Jul 26 13:39:30 2020
+++ src/usr.bin/make/buf.h	Sun Jul 26 15:09:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: buf.h,v 1.20 2020/07/26 13:39:30 rillig Exp $	*/
+/*	$NetBSD: buf.h,v 1.21 2020/07/26 15:09:10 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -110,6 +110,8 @@ typedef struct Buffer {
 
 void Buf_Expand_1(Buffer *);
 void Buf_AddBytes(Buffer *, int, const Byte *);
+void Buf_AddBytesBetween(Buffer *, const Byte *, const Byte *);
+void Buf_AddStr(Buffer *, const char *);
 void Buf_AddInt(Buffer *, int);
 Byte *Buf_GetAll(Buffer *, int *);
 void Buf_Empty(Buffer *);

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.312 src/usr.bin/make/var.c:1.313
--- src/usr.bin/make/var.c:1.312	Sun Jul 26 13:39:30 2020
+++ src/usr.bin/make/var.c	Sun Jul 26 15:09:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.312 2020/07/26 13:39:30 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.313 2020/07/26 15:09:10 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.312 2020/07/26 13:39:30 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.313 2020/07/26 15:09:10 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.312 2020/07/26 13:39:30 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.313 2020/07/26 15:09:10 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -279,9 +279,6 @@ typedef enum {
 static Var *
 VarFind(const char *name, GNode *ctxt, VarFindFlags flags)
 {
-Hash_Entry 	*var;
-Var			*v;
-
 /*
  * If the variable name begins with a '.', it could very well be one of
  * the local ones.  We check the name against all the local variables
@@ -330,7 +327,7 @@ VarFind(const char *name, GNode *ctxt, V
  * look for it in VAR_CMD, VAR_GLOBAL and the environment, in that order,
  * depending on the FIND_* flags in 'flags'
  */
-var = Hash_FindEntry(>context, name);
+Hash_Entry *var = Hash_FindEntry(>context, name);
 
 if (var == NULL && (flags & FIND_CMD) && ctxt != VAR_CMD) {
 	var = Hash_FindEntry(_CMD->context, name);
@@ -348,13 +345,10 @@ VarFind(const char *name, GNode *ctxt, V
 	char *env;
 
 	if ((env = getenv(name)) != NULL) {
-	int len;
-
-	v = bmake_malloc(sizeof(Var));
+	Var *v = bmake_malloc(sizeof(Var));
 	v->name = bmake_strdup(name);
 
-	len = strlen(env);
-
+	int len = (int)strlen(env);
 	Buf_Init(>val, len + 1);
 	Buf_AddBytes(>val, len, env);
 

CVS commit: src/sys

2020-07-26 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sun Jul 26 14:51:19 UTC 2020

Modified Files:
src/sys/arch/amd64/conf: ALL
src/sys/conf: majors
src/sys/dev/pci: files.pci
Added Files:
src/sys/dev/pci: xmm7360.c

Log Message:
Add driver for Intel XMM7360 LTE modem, based upon Linux driver available
at https://github.com/xmm7360/xmm7360-pci

This version works on Linux, OpenBSD, and NetBSD.

OpenBSD port written for genua GmbH

Modem requires python script from the master site to initialize the network,
it will be added to pkgsrc shortly


To generate a diff of this commit:
cvs rdiff -u -r1.157 -r1.158 src/sys/arch/amd64/conf/ALL
cvs rdiff -u -r1.94 -r1.95 src/sys/conf/majors
cvs rdiff -u -r1.429 -r1.430 src/sys/dev/pci/files.pci
cvs rdiff -u -r0 -r1.1 src/sys/dev/pci/xmm7360.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/amd64/conf/ALL
diff -u src/sys/arch/amd64/conf/ALL:1.157 src/sys/arch/amd64/conf/ALL:1.158
--- src/sys/arch/amd64/conf/ALL:1.157	Sun Jul 19 14:31:31 2020
+++ src/sys/arch/amd64/conf/ALL	Sun Jul 26 14:51:18 2020
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.157 2020/07/19 14:31:31 maxv Exp $
+# $NetBSD: ALL,v 1.158 2020/07/26 14:51:18 jdolecek Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"ALL-$Revision: 1.157 $"
+#ident		"ALL-$Revision: 1.158 $"
 
 maxusers	64		# estimated number of users
 
@@ -1022,6 +1022,8 @@ wi*	at pci? dev ? function ?	# Intersil 
 wm*	at pci? dev ? function ?	# Intel 8254x gigabit
 wpi*	at pci? dev ? function ?	# Intel PRO/Wireless 3945ABG
 xge*	at pci? dev ? function ?	# Neterion (S2io) Xframe-I 10GbE
+wwanc*  at pci? dev ? function ?	# Intel XMM7360 LTE modem
+wwan*   at wwanc?			# Intel XMM7360 LTE modem
 
 # PCMCIA network interfaces
 an*	at pcmcia? function ?		# Aironet PC4500/PC4800 (802.11)

Index: src/sys/conf/majors
diff -u src/sys/conf/majors:1.94 src/sys/conf/majors:1.95
--- src/sys/conf/majors:1.94	Sun Jun  7 09:45:19 2020
+++ src/sys/conf/majors	Sun Jul 26 14:51:18 2020
@@ -1,4 +1,4 @@
-# $NetBSD: majors,v 1.94 2020/06/07 09:45:19 maxv Exp $
+# $NetBSD: majors,v 1.95 2020/07/26 14:51:18 jdolecek Exp $
 #
 # Device majors for Machine-Independent drivers.
 #
@@ -89,3 +89,4 @@ device-major ipmi  char 354		   ipmi
 device-major vhci  char 355vhci
 device-major vio9p char 356		   vio9p
 device-major fault char 357		   fault
+device-major wwanc char 358	   wwanc

Index: src/sys/dev/pci/files.pci
diff -u src/sys/dev/pci/files.pci:1.429 src/sys/dev/pci/files.pci:1.430
--- src/sys/dev/pci/files.pci:1.429	Wed Jun 24 03:38:01 2020
+++ src/sys/dev/pci/files.pci	Sun Jul 26 14:51:18 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: files.pci,v 1.429 2020/06/24 03:38:01 thorpej Exp $
+#	$NetBSD: files.pci,v 1.430 2020/07/26 14:51:18 jdolecek Exp $
 #
 # Config file and device description for machine-independent PCI code.
 # Included by ports that need it.  Requires that the SCSI files be
@@ -1165,3 +1165,10 @@ file	dev/pci/if_ixl.c	ixl
 defflag	opt_if_ixl.h	IXL_DEBUG
 defparam opt_if_ixl.h	IXL_STATS_INTERVAL_MSEC
 			IXL_QUEUE_NUM
+
+# Intel XMM 7360 LTE modem
+device  wwanc {} : tty
+attach  wwanc at pci
+device  wwan: ifnet
+attach  wwan at wwanc
+filedev/pci/xmm7360.c   wwanc | wwanneeds-flag

Added files:

Index: src/sys/dev/pci/xmm7360.c
diff -u /dev/null src/sys/dev/pci/xmm7360.c:1.1
--- /dev/null	Sun Jul 26 14:51:19 2020
+++ src/sys/dev/pci/xmm7360.c	Sun Jul 26 14:51:18 2020
@@ -0,0 +1,3335 @@
+// vim: noet ts=8 sts=8 sw=8
+/*
+ * Device driver for Intel XMM7360 LTE modems, eg. Fibocom L850-GL.
+ * Written by James Wah
+ * ja...@laird-wah.net
+ *
+ * Development of this driver was supported by genua GmbH
+ *
+ * Copyright (c) 2020 genua GmbH 
+ * Copyright (c) 2020 James Wah 
+ * Copyright (c) 2020 Jaromir Dolecek 
+ *
+ * OpenBSD port written by Jaromir Dolecek for genua GmbH
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES ON
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGE
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef __linux__
+
+#include 
+#include 
+#include 
+#include 
+#include 

CVS commit: src/usr.bin/make/unit-tests

2020-07-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul 26 14:39:46 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: moderrs.exp moderrs.mk

Log Message:
make(1): add tests for :!...! parse errors


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/moderrs.exp
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/moderrs.mk

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/make/unit-tests/moderrs.exp
diff -u src/usr.bin/make/unit-tests/moderrs.exp:1.4 src/usr.bin/make/unit-tests/moderrs.exp:1.5
--- src/usr.bin/make/unit-tests/moderrs.exp:1.4	Sun Jul 26 14:16:45 2020
+++ src/usr.bin/make/unit-tests/moderrs.exp	Sun Jul 26 14:39:46 2020
@@ -26,4 +26,9 @@ make: Unclosed substitution for UNDEF (]
 
 13=
 12345=ok
+Expect: 2 errors about missing ! delimiter
+make: Unclosed substitution for VARNAME (! missing)
+
+make: Unclosed substitution for ! (! missing)
+
 exit status 0

Index: src/usr.bin/make/unit-tests/moderrs.mk
diff -u src/usr.bin/make/unit-tests/moderrs.mk:1.3 src/usr.bin/make/unit-tests/moderrs.mk:1.4
--- src/usr.bin/make/unit-tests/moderrs.mk:1.3	Sun Jul 26 14:16:45 2020
+++ src/usr.bin/make/unit-tests/moderrs.mk	Sun Jul 26 14:39:46 2020
@@ -1,4 +1,4 @@
-# $Id: moderrs.mk,v 1.3 2020/07/26 14:16:45 rillig Exp $
+# $Id: moderrs.mk,v 1.4 2020/07/26 14:39:46 rillig Exp $
 #
 # various modifier error tests
 
@@ -10,6 +10,7 @@ MOD_S:= ${MOD_TERM},
 
 all:	modunkn modunknV varterm vartermV modtermV modloop
 all:	modwords
+all:	modexclam
 
 modunkn:
 	@echo "Expect: Unknown modifier 'Z'"
@@ -57,3 +58,12 @@ modwords:
 	# This results in a range from LONG_MAX - 1 to 3,
 	# which is empty.
 	@echo 12345=${UNDEF:U1 2 3:[123451234512345123451234512345]:S,^$,ok,:S,^3$,ok,}
+
+modexclam:
+	@echo "Expect: 2 errors about missing ! delimiter"
+	@echo ${VARNAME:!echo}
+	# When the final exclamation mark is missing, there is no
+	# fallback to the SysV substitution modifier.
+	# If there were a fallback, the output would be "exclam",
+	# and the above would have produced an "Unknown modifier '!'".
+	@echo ${!:L:!=exclam}



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

2020-07-26 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 26 14:22:22 UTC 2020

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

Log Message:
Another /usr/libdata/usr/tests/sys/crypto/chacha set list entry.

(Why do we need this here _and_ in debug/mi?)


To generate a diff of this commit:
cvs rdiff -u -r1.876 -r1.877 src/distrib/sets/lists/tests/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/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.876 src/distrib/sets/lists/tests/mi:1.877
--- src/distrib/sets/lists/tests/mi:1.876	Sat Jul 25 22:53:38 2020
+++ src/distrib/sets/lists/tests/mi	Sun Jul 26 14:22:22 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.876 2020/07/25 22:53:38 riastradh Exp $
+# $NetBSD: mi,v 1.877 2020/07/26 14:22:22 riastradh Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -184,6 +184,7 @@
 ./usr/libdata/debug/usr/tests/sys	tests-sys-debug		compattestfile,atf
 ./usr/libdata/debug/usr/tests/sys/cryptotests-sys-debug		compattestfile,atf
 ./usr/libdata/debug/usr/tests/sys/crypto/aestests-sys-debug		compattestfile,atf
+./usr/libdata/debug/usr/tests/sys/crypto/chachatests-sys-debug		compattestfile,atf
 ./usr/libdata/debug/usr/tests/sys/net	tests-sys-debug		compattestfile,atf
 ./usr/libdata/debug/usr/tests/sys/netatalktests-sys-debug		compattestfile,atf
 ./usr/libdata/debug/usr/tests/sys/netinettests-sys-debug		compattestfile,atf



CVS commit: src/usr.bin/make/unit-tests

2020-07-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul 26 14:16:45 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: moderrs.exp moderrs.mk

Log Message:
make(1): add test for missing input validation in :[123] modifier


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/moderrs.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/moderrs.mk

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/make/unit-tests/moderrs.exp
diff -u src/usr.bin/make/unit-tests/moderrs.exp:1.3 src/usr.bin/make/unit-tests/moderrs.exp:1.4
--- src/usr.bin/make/unit-tests/moderrs.exp:1.3	Sun Jul 26 10:11:04 2020
+++ src/usr.bin/make/unit-tests/moderrs.exp	Sun Jul 26 14:16:45 2020
@@ -13,10 +13,17 @@ VAR:S,V,v,=Thevariable
 Expect: Unclosed substitution for VAR (, missing)
 make: Unclosed substitution for VAR (, missing)
 VAR:S,V,v=
-Expect: errors about missing @ delimiter
+Expect: 2 errors about missing @ delimiter
 make: Unclosed substitution for UNDEF (@ missing)
 
 make: Unclosed substitution for UNDEF (@ missing)
 
 1 2 3
+Expect: 2 errors about missing ] delimiter
+make: Unclosed substitution for UNDEF (] missing)
+
+make: Unclosed substitution for UNDEF (] missing)
+
+13=
+12345=ok
 exit status 0

Index: src/usr.bin/make/unit-tests/moderrs.mk
diff -u src/usr.bin/make/unit-tests/moderrs.mk:1.2 src/usr.bin/make/unit-tests/moderrs.mk:1.3
--- src/usr.bin/make/unit-tests/moderrs.mk:1.2	Sun Jul 26 10:04:06 2020
+++ src/usr.bin/make/unit-tests/moderrs.mk	Sun Jul 26 14:16:45 2020
@@ -1,4 +1,4 @@
-# $Id: moderrs.mk,v 1.2 2020/07/26 10:04:06 rillig Exp $
+# $Id: moderrs.mk,v 1.3 2020/07/26 14:16:45 rillig Exp $
 #
 # various modifier error tests
 
@@ -9,6 +9,7 @@ MOD_TERM=S,V,v
 MOD_S:= ${MOD_TERM},
 
 all:	modunkn modunknV varterm vartermV modtermV modloop
+all:	modwords
 
 modunkn:
 	@echo "Expect: Unknown modifier 'Z'"
@@ -31,7 +32,28 @@ modtermV:
 	-@echo "VAR:${MOD_TERM}=${VAR:${MOD_TERM}}"
 
 modloop:
-	@echo "Expect: errors about missing @ delimiter"
+	@echo "Expect: 2 errors about missing @ delimiter"
 	@echo ${UNDEF:U1 2 3:@var}
 	@echo ${UNDEF:U1 2 3:@var@...}
 	@echo ${UNDEF:U1 2 3:@var@${var}@}
+
+modwords:
+	@echo "Expect: 2 errors about missing ] delimiter"
+	@echo ${UNDEF:U1 2 3:[}
+	@echo ${UNDEF:U1 2 3:[#}
+
+	# out of bounds => empty
+	@echo 13=${UNDEF:U1 2 3:[13]}
+
+	# Word index out of bounds.
+	#
+	# On LP64I32, strtol returns LONG_MAX,
+	# which is then truncated to int (undefined behavior),
+	# typically resulting in -1.
+	# This -1 is interpreted as "the last word".
+	#
+	# On ILP32, strtol returns LONG_MAX,
+	# which is a large number.
+	# This results in a range from LONG_MAX - 1 to 3,
+	# which is empty.
+	@echo 12345=${UNDEF:U1 2 3:[123451234512345123451234512345]:S,^$,ok,:S,^3$,ok,}



CVS commit: src/tests/sys/crypto/aes

2020-07-26 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 26 14:01:14 UTC 2020

Modified Files:
src/tests/sys/crypto/aes: t_aes.c

Log Message:
Sort includes.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/sys/crypto/aes/t_aes.c

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

Modified files:

Index: src/tests/sys/crypto/aes/t_aes.c
diff -u src/tests/sys/crypto/aes/t_aes.c:1.2 src/tests/sys/crypto/aes/t_aes.c:1.3
--- src/tests/sys/crypto/aes/t_aes.c:1.2	Sun Jul 26 12:43:27 2020
+++ src/tests/sys/crypto/aes/t_aes.c	Sun Jul 26 14:01:14 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_aes.c,v 1.2 2020/07/26 12:43:27 martin Exp $	*/
+/*	$NetBSD: t_aes.c,v 1.3 2020/07/26 14:01:14 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -29,8 +29,8 @@
 #include 
 
 #include 
-#include 
 #include 
+#include 
 
 #if defined(__i386__) || defined(__x86_64__)
 #include 



CVS commit: src/usr.bin/make

2020-07-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul 26 13:39:30 UTC 2020

Modified Files:
src/usr.bin/make: buf.c buf.h var.c

Log Message:
make(1): add Buf_AddInt to make the calling code simpler


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/usr.bin/make/buf.c
cvs rdiff -u -r1.19 -r1.20 src/usr.bin/make/buf.h
cvs rdiff -u -r1.311 -r1.312 src/usr.bin/make/var.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/make/buf.c
diff -u src/usr.bin/make/buf.c:1.26 src/usr.bin/make/buf.c:1.27
--- src/usr.bin/make/buf.c:1.26	Fri Jul  3 08:02:55 2020
+++ src/usr.bin/make/buf.c	Sun Jul 26 13:39:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: buf.c,v 1.26 2020/07/03 08:02:55 rillig Exp $	*/
+/*	$NetBSD: buf.c,v 1.27 2020/07/26 13:39:30 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,25 +70,26 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: buf.c,v 1.26 2020/07/03 08:02:55 rillig Exp $";
+static char rcsid[] = "$NetBSD: buf.c,v 1.27 2020/07/26 13:39:30 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)buf.c	8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: buf.c,v 1.26 2020/07/03 08:02:55 rillig Exp $");
+__RCSID("$NetBSD: buf.c,v 1.27 2020/07/26 13:39:30 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
 
 /*-
  * buf.c --
- *	Functions for automatically-expanded buffers.
+ *	Functions for automatically-expanded NUL-terminated buffers.
  */
 
-#include"make.h"
-#include"buf.h"
+#include 
+#include "make.h"
+#include "buf.h"
 
 #ifndef max
 #define max(a,b)  ((a) > (b) ? (a) : (b))
@@ -142,6 +143,28 @@ Buf_AddBytes(Buffer *bp, int numBytes, c
 
 /*-
  *---
+ * Buf_AddInt --
+ *	Add the given number to the buffer.
+ *
+ *---
+ */
+void
+Buf_AddInt(Buffer *bp, int n)
+{
+/*
+ * We need enough space for the decimal representation of an int.
+ * We calculate the space needed for the octal representation, and
+ * add enough slop to cope with a '-' sign and a trailing '\0'.
+ */
+size_t bits = sizeof(int) * CHAR_BIT;
+char buf[1 + (bits + 2) / 3 + 1];
+
+int len = snprintf(buf, sizeof buf, "%d", n);
+Buf_AddBytes(bp, len, buf);
+}
+
+/*-
+ *---
  * Buf_GetAll --
  *	Get all the available data at once.
  *

Index: src/usr.bin/make/buf.h
diff -u src/usr.bin/make/buf.h:1.19 src/usr.bin/make/buf.h:1.20
--- src/usr.bin/make/buf.h:1.19	Wed May 31 22:02:06 2017
+++ src/usr.bin/make/buf.h	Sun Jul 26 13:39:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: buf.h,v 1.19 2017/05/31 22:02:06 maya Exp $	*/
+/*	$NetBSD: buf.h,v 1.20 2020/07/26 13:39:30 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -110,6 +110,7 @@ typedef struct Buffer {
 
 void Buf_Expand_1(Buffer *);
 void Buf_AddBytes(Buffer *, int, const Byte *);
+void Buf_AddInt(Buffer *, int);
 Byte *Buf_GetAll(Buffer *, int *);
 void Buf_Empty(Buffer *);
 void Buf_Init(Buffer *, int);

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.311 src/usr.bin/make/var.c:1.312
--- src/usr.bin/make/var.c:1.311	Sun Jul 26 12:27:09 2020
+++ src/usr.bin/make/var.c	Sun Jul 26 13:39:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.311 2020/07/26 12:27:09 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.312 2020/07/26 13:39:30 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.311 2020/07/26 12:27:09 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.312 2020/07/26 13:39:30 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.311 2020/07/26 12:27:09 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.312 2020/07/26 13:39:30 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1776,10 +1776,9 @@ static char *
 VarRange(const char *str, int ac)
 {
 Buffer	  buf;		/* Buffer for new string */
-char	  tmp[32];	/* each element */
 char 	**av;		/* List of words to affect */
 char 	 *as;		/* Word list memory */
-int 	  i, n;
+int 	  i;
 
 Buf_Init(, 0);
 if (ac > 0) {
@@ -1789,10 +1788,7 @@ VarRange(const char *str, int ac)
 	av = brk_string(str, , FALSE, );
 }
 for (i = 0; i < ac; i++) {
-	n = snprintf(tmp, sizeof(tmp), "%d", 1 + i);
-	if (n >= (int)sizeof(tmp))
-	break;
-	Buf_AddBytes(, n, tmp);
+	Buf_AddInt(, 1 + i);
 	if (i != ac - 1)
 	Buf_AddByte(, ' ');
 }
@@ -2657,28 +2653,21 @@ ApplyModifier_Words(const char *mod, App
 	goto bad_modifier;	/* empty square brackets in ":[]". */
 
 if (estr[0] == '#' && estr[1] 

CVS commit: src/usr.bin/make/unit-tests

2020-07-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul 26 13:09:53 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: modmisc.mk

Log Message:
make(1): add basic tests for the :S modifier


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.bin/make/unit-tests/modmisc.mk

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/make/unit-tests/modmisc.mk
diff -u src/usr.bin/make/unit-tests/modmisc.mk:1.25 src/usr.bin/make/unit-tests/modmisc.mk:1.26
--- src/usr.bin/make/unit-tests/modmisc.mk:1.25	Sun Jul 26 12:19:37 2020
+++ src/usr.bin/make/unit-tests/modmisc.mk	Sun Jul 26 13:09:53 2020
@@ -1,4 +1,4 @@
-# $Id: modmisc.mk,v 1.25 2020/07/26 12:19:37 rillig Exp $
+# $Id: modmisc.mk,v 1.26 2020/07/26 13:09:53 rillig Exp $
 #
 # miscellaneous modifier tests
 
@@ -73,23 +73,53 @@ undefvar:
 	@echo @:${:U:@var@empty@}
 
 WORDS=		sequences of letters
+.if ${WORDS:S,,,} != ${WORDS}
+.warning The empty pattern matches something.
+.endif
 .if ${WORDS:S,e,*,1} != "s*quences of letters"
-.warning ${WORDS:S,e,*,1}
+.warning The :S modifier flag '1' is not applied exactly once.
 .endif
 .if ${WORDS:S,e,*,} != "s*quences of l*tters"
-.error oops
+.warning The :S modifier does not replace every first match per word.
 .endif
 .if ${WORDS:S,e,*,g} != "s*qu*nc*s of l*tt*rs"
-.error oops
+.warning The :S modifier flag 'g' does not replace every occurrence.
 .endif
 .if ${WORDS:S,^sequ,occurr,} != "occurrences of letters"
-.error oops
+.warning The :S modifier fails for a short match anchored at the start.
 .endif
 .if ${WORDS:S,^of,with,} != "sequences with letters"
-.error oops
+.warning The :S modifier fails for an exact match anchored at the start.
 .endif
 .if ${WORDS:S,^office,does not match,} != ${WORDS}
-.error oops
+.warning The :S modifier matches a too long pattern anchored at the start.
+.endif
+.if ${WORDS:S,f$,r,} != "sequences or letters"
+.warning The :S modifier fails for a short match anchored at the end.
+.endif
+.if ${WORDS:S,s$,,} != "sequence of letter"
+.warning The :S modifier fails to replace one occurrence per word.
+.endif
+.if ${WORDS:S,of$,,} != "sequences letters"
+.warning The :S modifier fails for an exact match anchored at the end.
+.endif
+.if ${WORDS:S,eof$,,} != ${WORDS}
+.warning The :S modifier matches a too long pattern anchored at the end.
+.endif
+.if ${WORDS:S,^of$,,} != "sequences letters"
+.warning The :S modifier does not match a word anchored at both ends.
+.endif
+.if ${WORDS:S,^o$,,} != ${WORDS}
+.warning The :S modifier matches a prefix anchored at both ends.
+.endif
+.if ${WORDS:S,^f$,,} != ${WORDS}
+.warning The :S modifier matches a suffix anchored at both ends.
+.endif
+.if ${WORDS:S,^eof$,,} != ${WORDS}
+.warning The :S modifier matches a too long prefix anchored at both ends.
+.endif
+.if ${WORDS:S,^office$,,} != ${WORDS}
+.warning The :S modifier matches a too long suffix anchored at both ends.
 .endif
 
 mod-subst:



CVS commit: src/tests/sys/crypto/aes

2020-07-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jul 26 12:43:27 UTC 2020

Modified Files:
src/tests/sys/crypto/aes: t_aes.c

Log Message:
Add missing include to fix the build on architectures w/o any special
accelerated AES implementation.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/sys/crypto/aes/t_aes.c

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

Modified files:

Index: src/tests/sys/crypto/aes/t_aes.c
diff -u src/tests/sys/crypto/aes/t_aes.c:1.1 src/tests/sys/crypto/aes/t_aes.c:1.2
--- src/tests/sys/crypto/aes/t_aes.c:1.1	Tue Jun 30 20:32:11 2020
+++ src/tests/sys/crypto/aes/t_aes.c	Sun Jul 26 12:43:27 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_aes.c,v 1.1 2020/06/30 20:32:11 riastradh Exp $	*/
+/*	$NetBSD: t_aes.c,v 1.2 2020/07/26 12:43:27 martin Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -29,6 +29,7 @@
 #include 
 
 #include 
+#include 
 #include 
 
 #if defined(__i386__) || defined(__x86_64__)



CVS commit: src/usr.bin/make

2020-07-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul 26 12:27:09 UTC 2020

Modified Files:
src/usr.bin/make: var.c

Log Message:
make(1): make code in the :S modifier simpler

This code path is covered by the "sequences of letters" in modmisc.mk.


To generate a diff of this commit:
cvs rdiff -u -r1.310 -r1.311 src/usr.bin/make/var.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/make/var.c
diff -u src/usr.bin/make/var.c:1.310 src/usr.bin/make/var.c:1.311
--- src/usr.bin/make/var.c:1.310	Sun Jul 26 12:19:37 2020
+++ src/usr.bin/make/var.c	Sun Jul 26 12:27:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.310 2020/07/26 12:19:37 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.311 2020/07/26 12:27:09 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.310 2020/07/26 12:19:37 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.311 2020/07/26 12:27:09 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.310 2020/07/26 12:19:37 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.311 2020/07/26 12:27:09 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1298,8 +1298,7 @@ ModifyWord_Subst(const char *word, SepBu
 ModifyWord_SubstArgs *args = data;
 const VarPatternFlags pflags = args->pflags;
 
-if ((pflags & (VARP_SUB_ONE | VARP_SUB_MATCHED)) ==
-	(VARP_SUB_ONE | VARP_SUB_MATCHED))
+if ((pflags & VARP_SUB_ONE) && (pflags & VARP_SUB_MATCHED))
 	goto nosub;
 
 if (args->pflags & VARP_ANCHOR_START) {



CVS commit: src/usr.bin/make

2020-07-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul 26 12:19:37 UTC 2020

Modified Files:
src/usr.bin/make: var.c
src/usr.bin/make/unit-tests: modmisc.mk

Log Message:
make(1): fix bug in :S modifier from 2020-07-19


To generate a diff of this commit:
cvs rdiff -u -r1.309 -r1.310 src/usr.bin/make/var.c
cvs rdiff -u -r1.24 -r1.25 src/usr.bin/make/unit-tests/modmisc.mk

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/make/var.c
diff -u src/usr.bin/make/var.c:1.309 src/usr.bin/make/var.c:1.310
--- src/usr.bin/make/var.c:1.309	Sun Jul 26 10:11:04 2020
+++ src/usr.bin/make/var.c	Sun Jul 26 12:19:37 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.309 2020/07/26 10:11:04 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.310 2020/07/26 12:19:37 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.309 2020/07/26 10:11:04 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.310 2020/07/26 12:19:37 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.309 2020/07/26 10:11:04 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.310 2020/07/26 12:19:37 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1339,11 +1339,11 @@ ModifyWord_Subst(const char *word, SepBu
 while ((cp = Str_FindSubstring(word, args->lhs)) != NULL) {
 	SepBuf_AddBytes(buf, word, cp - word);
 	SepBuf_AddBytes(buf, args->rhs, args->rhsLen);
+	args->pflags |= VARP_SUB_MATCHED;
 	wordLen -= (cp - word) + args->lhsLen;
 	word = cp + args->lhsLen;
 	if (wordLen == 0 || !(args->pflags & VARP_SUB_GLOBAL))
 	break;
-	args->pflags |= VARP_SUB_MATCHED;
 }
 nosub:
 SepBuf_AddBytes(buf, word, wordLen);

Index: src/usr.bin/make/unit-tests/modmisc.mk
diff -u src/usr.bin/make/unit-tests/modmisc.mk:1.24 src/usr.bin/make/unit-tests/modmisc.mk:1.25
--- src/usr.bin/make/unit-tests/modmisc.mk:1.24	Sun Jul 26 12:18:11 2020
+++ src/usr.bin/make/unit-tests/modmisc.mk	Sun Jul 26 12:19:37 2020
@@ -1,4 +1,4 @@
-# $Id: modmisc.mk,v 1.24 2020/07/26 12:18:11 rillig Exp $
+# $Id: modmisc.mk,v 1.25 2020/07/26 12:19:37 rillig Exp $
 #
 # miscellaneous modifier tests
 
@@ -73,8 +73,7 @@ undefvar:
 	@echo @:${:U:@var@empty@}
 
 WORDS=		sequences of letters
-# FIXME: The "*" in "letters" must not be substituted because of the 1.
-.if ${WORDS:S,e,*,1} != "s*quences of l*tters"
+.if ${WORDS:S,e,*,1} != "s*quences of letters"
 .warning ${WORDS:S,e,*,1}
 .endif
 .if ${WORDS:S,e,*,} != "s*quences of l*tters"



CVS commit: src/usr.bin/make/unit-tests

2020-07-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul 26 12:18:12 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: modmisc.mk

Log Message:
make(1): demonstrate bug in the :S modifier with the 1 modifier

The bug has been introduced in var.c r1.268 on 2020-07-19.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/usr.bin/make/unit-tests/modmisc.mk

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/make/unit-tests/modmisc.mk
diff -u src/usr.bin/make/unit-tests/modmisc.mk:1.23 src/usr.bin/make/unit-tests/modmisc.mk:1.24
--- src/usr.bin/make/unit-tests/modmisc.mk:1.23	Sun Jul 26 11:39:55 2020
+++ src/usr.bin/make/unit-tests/modmisc.mk	Sun Jul 26 12:18:11 2020
@@ -1,4 +1,4 @@
-# $Id: modmisc.mk,v 1.23 2020/07/26 11:39:55 rillig Exp $
+# $Id: modmisc.mk,v 1.24 2020/07/26 12:18:11 rillig Exp $
 #
 # miscellaneous modifier tests
 
@@ -72,6 +72,27 @@ undefvar:
 	@echo C:${:U:C,^$,empty,}
 	@echo @:${:U:@var@empty@}
 
+WORDS=		sequences of letters
+# FIXME: The "*" in "letters" must not be substituted because of the 1.
+.if ${WORDS:S,e,*,1} != "s*quences of l*tters"
+.warning ${WORDS:S,e,*,1}
+.endif
+.if ${WORDS:S,e,*,} != "s*quences of l*tters"
+.error oops
+.endif
+.if ${WORDS:S,e,*,g} != "s*qu*nc*s of l*tt*rs"
+.error oops
+.endif
+.if ${WORDS:S,^sequ,occurr,} != "occurrences of letters"
+.error oops
+.endif
+.if ${WORDS:S,^of,with,} != "sequences with letters"
+.error oops
+.endif
+.if ${WORDS:S,^office,does not match,} != ${WORDS}
+.error oops
+.endif
+
 mod-subst:
 	@echo $@:
 	@echo :${:Ua b b c:S,a b,,:Q}:



CVS commit: src/usr.bin/make/unit-tests

2020-07-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul 26 11:39:56 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: modmisc.exp modmisc.mk

Log Message:
make(1): use consistent test names in modmisc.mk


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/usr.bin/make/unit-tests/modmisc.exp
cvs rdiff -u -r1.22 -r1.23 src/usr.bin/make/unit-tests/modmisc.mk

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/make/unit-tests/modmisc.exp
diff -u src/usr.bin/make/unit-tests/modmisc.exp:1.28 src/usr.bin/make/unit-tests/modmisc.exp:1.29
--- src/usr.bin/make/unit-tests/modmisc.exp:1.28	Sat Jul 25 20:35:35 2020
+++ src/usr.bin/make/unit-tests/modmisc.exp	Sun Jul 26 11:39:55 2020
@@ -17,14 +17,14 @@ C:
 S:empty
 C:empty
 @:
-mod-S:
+mod-subst:
 :a b b c:
 :a b b c:
 : b c:
 :a c:
 :x__ 3 x__ 3:
 12345
-mod-C:
+mod-regex:
 :a b b c:
 :a b b c:
 : b c:
@@ -33,10 +33,10 @@ make: RE substitution error: (details om
 :a c:
 :x__ 3 x__ 3:
 :+one+ +two+ +three+:
-mod-at-resolve:w1d2d3w w2i3w w1i2d3 2i${RES3}w w1d2d3 2i${RES3} 1i${RES2}w:
-mod-at-dollar:(1) (2) (3).
-mod-at-dollar:() () ().
-mod-at-dollar:() () ().
+mod-loop-resolve:w1d2d3w w2i3w w1i2d3 2i${RES3}w w1d2d3 2i${RES3} 1i${RES2}w:
+mod-loop-varname-dollar:(1) (2) (3).
+mod-loop-varname-dollar:() () ().
+mod-loop-varname-dollar:() () ().
 mod-subst-dollar:$1:
 mod-subst-dollar:$2:
 mod-subst-dollar:$3:
@@ -53,27 +53,27 @@ mod-loop-dollar:$3$:
 mod-loop-dollar:$${word}$$:
 mod-loop-dollar:$$5$$:
 mod-loop-dollar:$$${word}$$$:
-mod-C-limits:00-ok:1 2323 45456
+mod-regex-limits:00-ok:1 2323 45456
 make: No subexpression \1
 make: No subexpression \1
 make: No subexpression \1
 make: No subexpression \1
-mod-C-limits:11-missing:1 6
-mod-C-limits:11-ok:1 22 446
+mod-regex-limits:11-missing:1 6
+mod-regex-limits:11-ok:1 22 446
 make: No subexpression \2
 make: No subexpression \2
 make: No subexpression \2
 make: No subexpression \2
-mod-C-limits:22-missing:1 6
+mod-regex-limits:22-missing:1 6
 make: No subexpression \2
 make: No subexpression \2
 make: No subexpression \2
 make: No subexpression \2
-mod-C-limits:22-missing:1 6
-mod-C-limits:22-ok:1 33 556
-mod-C-limits:capture:ihgfedcbaabcdefghijABCDEFGHIJa0a1a2rest
+mod-regex-limits:22-missing:1 6
+mod-regex-limits:22-ok:1 33 556
+mod-regex-limits:capture:ihgfedcbaabcdefghijABCDEFGHIJa0a1a2rest
 make: RE substitution error: (details omitted)
-mod-C-errors:
+mod-regex-errors:
 mod-assign: first=1.
 mod-assign: last=3.
 mod-assign: appended=1 2 3.
@@ -87,7 +87,7 @@ mod-assign-nested: else2e2
 mod-assign-nested: then3t3
 mod-assign-nested: else4e4
 mod-tu-space: A   B
-mod-Q: new
+mod-quote: new
 
 line
 mod-break-many-words: 500

Index: src/usr.bin/make/unit-tests/modmisc.mk
diff -u src/usr.bin/make/unit-tests/modmisc.mk:1.22 src/usr.bin/make/unit-tests/modmisc.mk:1.23
--- src/usr.bin/make/unit-tests/modmisc.mk:1.22	Sat Jul 25 20:35:35 2020
+++ src/usr.bin/make/unit-tests/modmisc.mk	Sun Jul 26 11:39:55 2020
@@ -1,4 +1,4 @@
-# $Id: modmisc.mk,v 1.22 2020/07/25 20:35:35 rillig Exp $
+# $Id: modmisc.mk,v 1.23 2020/07/26 11:39:55 rillig Exp $
 #
 # miscellaneous modifier tests
 
@@ -16,19 +16,23 @@ MOD_OPT=@d@$${exists($$d):?$$d:$${d:S,/u
 MOD_SEP=S,:, ,g
 
 all:	modvar modvarloop modsysv mod-HTE emptyvar undefvar
-all:	mod-S mod-C mod-at-varname mod-at-resolve mod-at-dollar
+all:	mod-subst
+all:	mod-regex
+all:	mod-loop-varname mod-loop-resolve mod-loop-varname-dollar
 all:	mod-subst-dollar mod-loop-dollar
-all:	mod-C-limits
-all:	mod-C-errors
+all:	mod-regex-limits
+all:	mod-regex-errors
 all:	mod-assign
 all:	mod-assign-nested
 all:	mod-tu-space
-all:	mod-Q
+all:	mod-quote
 all:	mod-break-many-words
 
+# See also sysv.mk.
 modsysv:
 	@echo "The answer is ${libfoo.a:L:libfoo.a=42}"
 
+# Demonstrates modifiers that are given indirectly from a variable.
 modvar:
 	@echo "path='${path}'"
 	@echo "path='${path:${MOD_NODOT}}'"
@@ -68,7 +72,7 @@ undefvar:
 	@echo C:${:U:C,^$,empty,}
 	@echo @:${:U:@var@empty@}
 
-mod-S:
+mod-subst:
 	@echo $@:
 	@echo :${:Ua b b c:S,a b,,:Q}:
 	@echo :${:Ua b b c:S,a b,,1:Q}:
@@ -77,7 +81,7 @@ mod-S:
 	@echo :${:U1 2 3 1 2 3:S,1 2,___,Wg:S,_,x,:Q}:
 	@echo ${:U12345:S,,sep,g:Q}
 
-mod-C:
+mod-regex:
 	@echo $@:
 	@echo :${:Ua b b c:C,a b,,:Q}:
 	@echo :${:Ua b b c:C,a b,,1:Q}:
@@ -89,7 +93,7 @@ mod-C:
 # In the :@ modifier, the name of the loop variable can even be generated
 # dynamically.  There's no practical use-case for this, and hopefully nobody
 # will ever depend on this, but technically it's possible.
-mod-at-varname:
+mod-loop-varname:
 	@echo :${:Uone two three:@${:Ubar:S,b,v,}@+${var}+@:Q}:
 
 # The :@ modifier resolves the variables a little more often than expected.
@@ -102,13 +106,13 @@ RES1=		1d${RES2} 1i$${RES2}
 RES2=		2d${RES3} 2i$${RES3}
 RES3=		3
 
-mod-at-resolve:
+mod-loop-resolve:
 	@echo $@:${RESOLVE:@v@w${v}w@:Q}:
 
-# As of 

CVS commit: src/usr.bin/make/unit-tests

2020-07-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul 26 11:19:04 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: sysv.exp sysv.mk

Log Message:
make(1): add test for prefix mismatch in SysV substitution


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/sysv.exp \
src/usr.bin/make/unit-tests/sysv.mk

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/make/unit-tests/sysv.exp
diff -u src/usr.bin/make/unit-tests/sysv.exp:1.8 src/usr.bin/make/unit-tests/sysv.exp:1.9
--- src/usr.bin/make/unit-tests/sysv.exp:1.8	Mon Jul 20 16:32:14 2020
+++ src/usr.bin/make/unit-tests/sysv.exp	Sun Jul 26 11:19:04 2020
@@ -17,4 +17,6 @@ bcd.e
 &
 anchor-dollar: value
 anchor-dollar: valux
+mismatch: file.cpp file.h
+mismatch: renamed.c other.c
 exit status 0
Index: src/usr.bin/make/unit-tests/sysv.mk
diff -u src/usr.bin/make/unit-tests/sysv.mk:1.8 src/usr.bin/make/unit-tests/sysv.mk:1.9
--- src/usr.bin/make/unit-tests/sysv.mk:1.8	Mon Jul 20 16:27:55 2020
+++ src/usr.bin/make/unit-tests/sysv.mk	Sun Jul 26 11:19:04 2020
@@ -1,6 +1,7 @@
-# $Id: sysv.mk,v 1.8 2020/07/20 16:27:55 rillig Exp $
+# $Id: sysv.mk,v 1.9 2020/07/26 11:19:04 rillig Exp $
 
 all: foo fun sam bla words ampersand anchor-dollar
+all: mismatch
 
 FOO ?=
 FOOBAR = ${FOO:=bar}
@@ -61,3 +62,9 @@ ampersand:
 anchor-dollar:
 	@echo $@: ${:U${value:L:e$=x}:Q}
 	@echo $@: ${:U${value:L:e=x}:Q}
+
+# Words that don't match are copied unmodified.
+# The % placeholder can be anywhere in the string.
+mismatch:
+	@echo $@: ${:Ufile.c file.h:%.c=%.cpp}
+	@echo $@: ${:Ufile.c other.c:file.%=renamed.%}



CVS commit: src/usr.bin/make/unit-tests

2020-07-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul 26 11:10:29 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: Makefile varmisc.exp varmisc.mk

Log Message:
make(1): add test for appending and exporting a variable


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/varmisc.exp
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/make/unit-tests/varmisc.mk

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/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.64 src/usr.bin/make/unit-tests/Makefile:1.65
--- src/usr.bin/make/unit-tests/Makefile:1.64	Sat Jul 25 21:19:29 2020
+++ src/usr.bin/make/unit-tests/Makefile	Sun Jul 26 11:10:29 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.64 2020/07/25 21:19:29 rillig Exp $
+# $NetBSD: Makefile,v 1.65 2020/07/26 11:10:29 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -77,6 +77,9 @@ TESTS+=		varshell
 
 # Override environment variables for some of the tests.
 ENV.envfirst=		FROM_ENV=value-from-env
+ENV.varmisc=		FROM_ENV=env
+ENV.varmisc+=		FROM_ENV_BEFORE=env
+ENV.varmisc+=		FROM_ENV_AFTER=env
 
 # Override make flags for some of the tests; default is -k.
 FLAGS.doterror=		# none

Index: src/usr.bin/make/unit-tests/varmisc.exp
diff -u src/usr.bin/make/unit-tests/varmisc.exp:1.9 src/usr.bin/make/unit-tests/varmisc.exp:1.10
--- src/usr.bin/make/unit-tests/varmisc.exp:1.9	Sun Jul 26 10:48:21 2020
+++ src/usr.bin/make/unit-tests/varmisc.exp	Sun Jul 26 11:10:29 2020
@@ -40,4 +40,7 @@ save-dollars: ON   = $$
 save-dollars: OFF  = $
 save-dollars: on   = $$
 save-dollars: off  = $
+export-appended: env
+export-appended: env
+export-appended: env mk
 exit status 0

Index: src/usr.bin/make/unit-tests/varmisc.mk
diff -u src/usr.bin/make/unit-tests/varmisc.mk:1.13 src/usr.bin/make/unit-tests/varmisc.mk:1.14
--- src/usr.bin/make/unit-tests/varmisc.mk:1.13	Sun Jul 26 10:59:56 2020
+++ src/usr.bin/make/unit-tests/varmisc.mk	Sun Jul 26 11:10:29 2020
@@ -1,10 +1,11 @@
-# $Id: varmisc.mk,v 1.13 2020/07/26 10:59:56 rillig Exp $
+# $Id: varmisc.mk,v 1.14 2020/07/26 11:10:29 rillig Exp $
 #
 # Miscellaneous variable tests.
 
 all: unmatched_var_paren D_true U_true D_false U_false Q_lhs Q_rhs NQ_none \
 	strftime cmpv manok
 all: save-dollars
+all: export-appended
 
 unmatched_var_paren:
 	@echo ${foo::=foo-text}
@@ -139,3 +140,19 @@ VAR.${param}=	${param}
 .if ${VAR.+} != "+" || ${VAR.!} != "!" || ${VAR.?} != "?"
 .error "${VAR.+}" "${VAR.!}" "${VAR.?}"
 .endif
+
+# Appending to a variable from the environment creates a copy of that variable
+# in the global context.
+# The appended value is not exported automatically.
+# When a variable is exported, the exported value is taken at the time of the
+# .export directive. Later changes to the variable have no effect.
+.export FROM_ENV_BEFORE
+FROM_ENV+=		mk
+FROM_ENV_BEFORE+=	mk
+FROM_ENV_AFTER+=	mk
+.export FROM_ENV_AFTER
+
+export-appended:
+	@echo $@: "$$FROM_ENV"
+	@echo $@: "$$FROM_ENV_BEFORE"
+	@echo $@: "$$FROM_ENV_AFTER"



CVS commit: [netbsd-9] src/doc

2020-07-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jul 26 11:09:19 UTC 2020

Modified Files:
src/doc [netbsd-9]: CHANGES-9.1

Log Message:
Tickets #1023 - #1030


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.83 -r1.1.2.84 src/doc/CHANGES-9.1

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

Modified files:

Index: src/doc/CHANGES-9.1
diff -u src/doc/CHANGES-9.1:1.1.2.83 src/doc/CHANGES-9.1:1.1.2.84
--- src/doc/CHANGES-9.1:1.1.2.83	Mon Jul 20 18:35:18 2020
+++ src/doc/CHANGES-9.1	Sun Jul 26 11:09:19 2020
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.1,v 1.1.2.83 2020/07/20 18:35:18 martin Exp $
+# $NetBSD: CHANGES-9.1,v 1.1.2.84 2020/07/26 11:09:19 martin Exp $
 
 A complete list of changes from the NetBSD 9.0 release to the NetBSD 9.1
 release:
@@ -3504,3 +3504,56 @@ distrib/notes/evbarm/xfer			1.3,1.4
 	Modernize evbarm install instructions.
 	[nia, ticket #1022]
 
+external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c 1.13,1.14
+external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c 1.17
+external/apache2/mDNSResponder/dist/mDNSShared/PlatformCommon.c 1.6
+
+	Silence mdnsd at start/stop time.
+	[roy, ticket #1023]
+
+sys/dev/pci/pci_subr.c1.224
+
+	change pci_conf_print() to allocate memory for the regs dynamically
+	instead of on-stack.
+	[jdolecek, ticket #1024]
+
+sys/dev/wsfb/genfb.c1.73
+
+	reduce stack usage in genfb_calc_hsize()
+	[jdolecek, ticket #1025]
+
+xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kInit.c 1.3
+
+	Use AllocDevicePair() to initialize input devices in InitInput().
+	[tsutsui, ticket #1026]
+
+xsrc/external/mit/xorg-server.old/dist/fb/fb.h	1.2
+xsrc/external/mit/xorg-server.old/dist/fb/fbcmap_mi.c 1.2
+xsrc/external/mit/xorg-server.old/dist/fb/fbscreen.c	1.2
+xsrc/external/mit/xorg-server/dist/fb/fb.h		1.2
+xsrc/external/mit/xorg-server/dist/fb/fbcmap_mi.c	1.2
+xsrc/external/mit/xorg-server/dist/fb/fbscreen.c	1.2
+
+	Fix 1bpp Xservers on "whitePixel=0, blackPixel=1" VRAMs.
+	[tsutsui, ticket #1027]
+
+external/mit/xorg/server/xorg-server.old/hw/xnest/Makefile 1.4
+external/mit/xorg/server/xorg-server/hw/xnest/Makefile 1.22
+share/mk/bsd.x11.mk1.135
+
+	PR 55500: fix typos in ${X11INCS.DIX} include paths.
+	Remove extra "-I" for ${X11INCS.DIX} macro.
+	[tsutsui, ticket #1028]
+
+distrib/notes/evbarm/upgrade			1.3-1.5
+
+	Improve upgrade instrucstions for evbarm.
+	[nia, ticket #1029]
+
+distrib/notes/evbarm/contents			1.11
+distrib/notes/evbarm/hardware			1.15
+
+	Fix location of device trees.
+	Add more supported hardware.
+	[nia, ticket #1030]
+



CVS commit: [netbsd-9] src/distrib/notes/evbarm

2020-07-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jul 26 11:07:56 UTC 2020

Modified Files:
src/distrib/notes/evbarm [netbsd-9]: contents hardware

Log Message:
Pull up following revision(s) (requested by nia in ticket #1030):

distrib/notes/evbarm/hardware: revision 1.15
distrib/notes/evbarm/contents: revision 1.11

Fix location of device trees

more 9.0 hardware


To generate a diff of this commit:
cvs rdiff -u -r1.4.4.3 -r1.4.4.4 src/distrib/notes/evbarm/contents
cvs rdiff -u -r1.10.66.1 -r1.10.66.2 src/distrib/notes/evbarm/hardware

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

Modified files:

Index: src/distrib/notes/evbarm/contents
diff -u src/distrib/notes/evbarm/contents:1.4.4.3 src/distrib/notes/evbarm/contents:1.4.4.4
--- src/distrib/notes/evbarm/contents:1.4.4.3	Mon Jul 20 18:32:55 2020
+++ src/distrib/notes/evbarm/contents	Sun Jul 26 11:07:56 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: contents,v 1.4.4.3 2020/07/20 18:32:55 martin Exp $
+.\"	$NetBSD: contents,v 1.4.4.4 2020/07/26 11:07:56 martin Exp $
 .\"
 .\" Copyright (c) 1999-2020 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -61,8 +61,6 @@ operating system for a range of 64-bit d
 A gzipped writable image containing the complete 32-bit
 .Nx
 operating system for Raspberry Pi variants only (includes RPI kernels).
-.			It Pa *.dtb.gz
-Gzipped board-specific device trees.
 .		tag) \" binary/gzimg/
 .		It Pa kernel/
 .		(tag netbsd.gz -compact \" binary/kernel
@@ -76,6 +74,8 @@ do not need board-specific kernels.
 A gzipped ARMv6 kernel which supports the Raspberry Pi 1 only.
 .			It Pa netbsd-RPI2.gz
 A gzipped ARMv6 kernel which supports the Raspberry Pi 2 only.
+.			It Pa *.dtb.gz
+Gzipped board-specific device trees.
 .		tag) \" binary/kernel/
 .
 .		It Pa sets/

Index: src/distrib/notes/evbarm/hardware
diff -u src/distrib/notes/evbarm/hardware:1.10.66.1 src/distrib/notes/evbarm/hardware:1.10.66.2
--- src/distrib/notes/evbarm/hardware:1.10.66.1	Mon Jul 20 18:32:55 2020
+++ src/distrib/notes/evbarm/hardware	Sun Jul 26 11:07:56 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: hardware,v 1.10.66.1 2020/07/20 18:32:55 martin Exp $
+.\"	$NetBSD: hardware,v 1.10.66.2 2020/07/26 11:07:56 martin Exp $
 .\"
 .\" Copyright (c) 2001-2020 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -40,6 +40,8 @@ Samsung Exynos 5422 (e.g. ODROID-XU3/XU-
 .It
 Texas Instruments OMAP3 (e.g. BeagleBoard, BeagleBone Black...)
 .It
+Xilinx Zynq (e.g. Zedboard, Parallella...)
+.It
 NVIDIA Tegra K1
 .El
 .Ss2 64-bit SoCs supported by GENERIC64 kernels
@@ -56,6 +58,8 @@ Amlogic S905 (e.g. ODROID-C2, Le Potato,
 .It
 Broadcom BCM2837 (e.g. Raspberry Pi 3)
 .It
+Marvell ThunderX
+.It
 Rockchip RK3328, RK3328 (e.g. Pinebook Pro, RockPro64, Firefly...)
 .It
 NVIDIA Tegra X1



CVS commit: [netbsd-9] src/distrib/notes/evbarm

2020-07-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jul 26 11:05:57 UTC 2020

Modified Files:
src/distrib/notes/evbarm [netbsd-9]: upgrade

Log Message:
Pull up following revision(s) (requested by nia in ticket #1029):

distrib/notes/evbarm/upgrade: revision 1.3
distrib/notes/evbarm/upgrade: revision 1.4
distrib/notes/evbarm/upgrade: revision 1.5

Initial evbarm upgrade instructions - need work

clarify

upgrades to upgrade instructions


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.50.1 src/distrib/notes/evbarm/upgrade

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

Modified files:

Index: src/distrib/notes/evbarm/upgrade
diff -u src/distrib/notes/evbarm/upgrade:1.2 src/distrib/notes/evbarm/upgrade:1.2.50.1
--- src/distrib/notes/evbarm/upgrade:1.2	Thu Apr 23 01:56:49 2009
+++ src/distrib/notes/evbarm/upgrade	Sun Jul 26 11:05:57 2020
@@ -1,3 +1,86 @@
-.\"	$NetBSD: upgrade,v 1.2 2009/04/23 01:56:49 snj Exp $
+.\"	$NetBSD: upgrade,v 1.2.50.1 2020/07/26 11:05:57 martin Exp $
+.\"
+.\" Copyright (c) 2020 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``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 FOUNDATION OR CONTRIBUTORS
+.\" 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 THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
 .
-.so ../common/upgrade
+.Pp
+The easiest way to upgrade to
+.Nx
+\*M
+\*V
+is by using the sysutils/sysupgrade package from pkgsrc.
+.Pp
+First, edit
+.Pa /usr/pkg/etc/sysupgrade.conf .
+Make sure RELEASEDIR and ARCHIVE_EXTENSION are correct:
+.Bd -literal
+# Replace evbarm-aarch64 with evbarm-earmv7hf on a 32-bit system, evbarm-earmv6hf on the original RPI
+RELEASEDIR="https://cdn.netbsd.org/pub/NetBSD/NetBSD-\*V/evbarm-aarch64/;
+ARCHIVE_EXTENSION=tar.xz
+.Ed
+.Pp
+Make sure
+.Pa /boot
+is mounted, and copy the new board-specific
+.Pa *.dts
+device tree file into place.
+Note that the device tree files are sorted into SoC-type subdirectories in
+.Pa /boot/dtb ,
+e.g. allwinner, amlogic, broadcom, freescale, nvidia, rockchip.
+.Pp
+For example, for the Allwinner-based PINE A64 LTS:
+.Bd -literal
+$ ftp https://cdn.netbsd.org/pub/NetBSD/NetBSD-\*V/evbarm-aarch64/binary/kernel/sun50i-a64-pine64-lts.dtb.gz
+$ gunzip sun50i-a64-pine64-lts.dtb.gz
+# cp sun50i-a64-pine64-lts.dtb /boot/dtb/allwinner/
+.Ed
+Also copy
+.Pa bootaa64.efi
+if applicable:
+.Bd -literal
+$ ftp https://cdn.netbsd.org/pub/NetBSD/NetBSD-\*V/evbarm-aarch64/installation/misc/bootaa64.efi
+# cp bootaa64.efi /boot/EFI/BOOT/bootaa64.efi
+.Ed
+.Pp
+Finally:
+.Bd -literal
+# sysupgrade fetch
+# sysupgrade kernel
+# sysupgrade modules
+# reboot
+# sysupgrade sets
+# sysupgrade etcupdate
+# sysupgrade postinstall
+# reboot
+.Ed
+.Pp
+This is the most careful possible path with sysupgrade that makes sure
+the kernel and userland are always fully compatible, by making sure the
+kernel and boot files are newer than the userland.
+It is also possible to:
+.Bd -literal
+# sysupgrade auto
+# reboot
+.Ed



CVS commit: src/distrib/notes/common

2020-07-26 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul 26 11:05:39 UTC 2020

Modified Files:
src/distrib/notes/common: main

Log Message:
Remove Arm OABI -> EABI change notice


To generate a diff of this commit:
cvs rdiff -u -r1.562 -r1.563 src/distrib/notes/common/main

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

Modified files:

Index: src/distrib/notes/common/main
diff -u src/distrib/notes/common/main:1.562 src/distrib/notes/common/main:1.563
--- src/distrib/notes/common/main:1.562	Thu Jan 23 23:56:07 2020
+++ src/distrib/notes/common/main	Sun Jul 26 11:05:39 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: main,v 1.562 2020/01/23 23:56:07 uwe Exp $
+.\"	$NetBSD: main,v 1.563 2020/07/26 11:05:39 jmcneill Exp $
 .\"
 .\" Copyright (c) 1999-2012 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -793,61 +793,6 @@ A number of things have been removed fro
 See the
 .Dq Components removed from NetBSD
 section near the beginning of this document for a list.
-.if \n[arm] \{\
-.Ss2 Important note regarding ABI change on ARM ports
-.Pp
-In
-.Nx
-7.0, most ARM ports (all but acorn32, and epoc32) have switched
-to the official standard ABI
-.Pq EABI5
-which is recommended by ARM for ELF binaries.
-.Pp
-Backwards compatibility is provided for binaries using the previous ABI
-.Pq oabi .
-A
-.Nx
-\*V
-kernel with the
-.Dv COMPAT_NETBSD32
-option enabled will allow you to execute oabi binaries.
-This option is enabled in the kernels distributed with this release.
-.Pp
-However, new binaries can not be mixed with old libraries, and shared
-libraries are incompatible.
-.Pp
-.Ic sysinst
-does not provide an automatic mechanism to partially upgrade an old
-installation.
-There are two ways to handle the transition:
-.(enum
-.Pp
-Do a complete update.
-.Pp
-This means updating your system with
-.Ic sysinst ,
-then deleting and recompiling all other binaries, whether they were
-installed locally or through pkgsrc.
-This is the preferred, cleanest approach.
-.It
-Move your old binaries and libraries to
-.Pa /compat/netbsd32
-and replace them one by one.
-.Pp
-For example, move all of
-.Pa /usr/pkg
-to
-.Pa /compat/netbsd32/usr/pkg
-and add
-.Pa /compat/netbsd32/usr/pkg/bin
-to the end of your PATH.
-Most binaries should still run, and can be replaced over time with
-recompiled packages, which will install to
-.Pa /usr/pkg
-again.
-.enum)
-.
-.\}
 .Ss "Using online NetBSD documentation"
 .Pp
 Documentation is available if you installed the manual



CVS commit: src/distrib/notes/evbarm

2020-07-26 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul 26 11:00:28 UTC 2020

Modified Files:
src/distrib/notes/evbarm: contents hardware install prep xfer

Log Message:
ARM -> Arm


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/distrib/notes/evbarm/contents
cvs rdiff -u -r1.22 -r1.23 src/distrib/notes/evbarm/hardware
cvs rdiff -u -r1.14 -r1.15 src/distrib/notes/evbarm/install
cvs rdiff -u -r1.12 -r1.13 src/distrib/notes/evbarm/prep
cvs rdiff -u -r1.5 -r1.6 src/distrib/notes/evbarm/xfer

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

Modified files:

Index: src/distrib/notes/evbarm/contents
diff -u src/distrib/notes/evbarm/contents:1.11 src/distrib/notes/evbarm/contents:1.12
--- src/distrib/notes/evbarm/contents:1.11	Tue Jul 21 02:21:12 2020
+++ src/distrib/notes/evbarm/contents	Sun Jul 26 11:00:28 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: contents,v 1.11 2020/07/21 02:21:12 nia Exp $
+.\"	$NetBSD: contents,v 1.12 2020/07/26 11:00:28 jmcneill Exp $
 .\"
 .\" Copyright (c) 1999-2020 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -65,15 +65,15 @@ operating system for Raspberry Pi varian
 .		It Pa kernel/
 .		(tag netbsd.gz -compact \" binary/kernel
 .			It Pa netbsd-GENERIC.gz
-A gzipped ARMv7 kernel which supports a range of 32-bit devices that
+A gzipped Armv7 kernel which supports a range of 32-bit devices that
 do not need board-specific kernels.
 .			It Pa netbsd-GENERIC64.gz
 A gzipped AArch64 kernel which supports a range of 64-bit devices that
 do not need board-specific kernels.
 .			It Pa netbsd-RPI.gz
-A gzipped ARMv6 kernel which supports the Raspberry Pi 1 only.
+A gzipped Armv6 kernel which supports the Raspberry Pi 1 only.
 .			It Pa netbsd-RPI2.gz
-A gzipped ARMv6 kernel which supports the Raspberry Pi 2 only.
+A gzipped Armv6 kernel which supports the Raspberry Pi 2 only.
 .			It Pa *.dtb.gz
 Gzipped board-specific device trees.
 .		tag) \" binary/kernel/

Index: src/distrib/notes/evbarm/hardware
diff -u src/distrib/notes/evbarm/hardware:1.22 src/distrib/notes/evbarm/hardware:1.23
--- src/distrib/notes/evbarm/hardware:1.22	Sun Jul 26 10:58:27 2020
+++ src/distrib/notes/evbarm/hardware	Sun Jul 26 11:00:28 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: hardware,v 1.22 2020/07/26 10:58:27 jmcneill Exp $
+.\"	$NetBSD: hardware,v 1.23 2020/07/26 11:00:28 jmcneill Exp $
 .\"
 .\" Copyright (c) 2001-2020 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -24,7 +24,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Ss2 32-bit SoCs supported by GENERIC kernels (ARMv7-A)
+.Ss2 32-bit SoCs supported by GENERIC kernels (Armv7-A)
 .Pp
 .Lk "https://wiki.netbsd.org/ports/evbarm/qemu_arm/; "QEMU"
 is also supported.

Index: src/distrib/notes/evbarm/install
diff -u src/distrib/notes/evbarm/install:1.14 src/distrib/notes/evbarm/install:1.15
--- src/distrib/notes/evbarm/install:1.14	Sat Jul 18 16:41:14 2020
+++ src/distrib/notes/evbarm/install	Sun Jul 26 11:00:28 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: install,v 1.14 2020/07/18 16:41:14 nia Exp $
+.\"	$NetBSD: install,v 1.15 2020/07/26 11:00:28 jmcneill Exp $
 .\"
 .\" Copyright (c) 2001-2020 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -24,7 +24,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Ss2 Installation for ARMv7 and AArch64 devices with U-Boot
+.Ss2 Installation for Armv7 and AArch64 devices with U-Boot
 .Bl -bullet -offset indent -compact
 .It
 Download or build armv7.img.gz (32-bit) or arm64.img.gz (64-bit).
@@ -73,14 +73,14 @@ If you do not want to prepare a SD card 
 Jared McNeill provides pre-prepared images on his website
 .Lk http://www.armbsd.org/arm/ "armbsd.org" .
 .Ss2 Installing NetBSD/evbarm to a SATA hard disk
-Some ARM boards offer a SATA interface, and you might want to install NetBSD
+Some Arm boards offer a SATA interface, and you might want to install NetBSD
 to a hard disk after you've got it running from an SD card.
 You can do this using 
 .Xr sysinst 8
 from within NetBSD.
 .Pp
 There are instructions for using
-.Lk https://wiki.netbsd.org/ports/evbarm/install_using_sysinst/ "sysinst on ARM"
+.Lk https://wiki.netbsd.org/ports/evbarm/install_using_sysinst/ "sysinst on Arm"
 on the NetBSD wiki.
 The main difference from installing on other ports is that a FAT32
 partition is required for /boot.

Index: src/distrib/notes/evbarm/prep
diff -u src/distrib/notes/evbarm/prep:1.12 src/distrib/notes/evbarm/prep:1.13
--- src/distrib/notes/evbarm/prep:1.12	Sat Jul 18 16:41:14 2020
+++ src/distrib/notes/evbarm/prep	Sun Jul 26 11:00:28 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: prep,v 1.12 2020/07/18 16:41:14 nia Exp $
+.\"	$NetBSD: prep,v 1.13 2020/07/26 11:00:28 jmcneill Exp $
 .\"
 .\" Copyright (c) 2001-2020 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .
 .Pp
 

CVS commit: src/usr.bin/make/unit-tests

2020-07-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul 26 10:59:56 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: varmisc.mk

Log Message:
make(1): add tests for appending to a variable


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/varmisc.mk

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/make/unit-tests/varmisc.mk
diff -u src/usr.bin/make/unit-tests/varmisc.mk:1.12 src/usr.bin/make/unit-tests/varmisc.mk:1.13
--- src/usr.bin/make/unit-tests/varmisc.mk:1.12	Sun Jul 26 10:48:21 2020
+++ src/usr.bin/make/unit-tests/varmisc.mk	Sun Jul 26 10:59:56 2020
@@ -1,4 +1,4 @@
-# $Id: varmisc.mk,v 1.12 2020/07/26 10:48:21 rillig Exp $
+# $Id: varmisc.mk,v 1.13 2020/07/26 10:59:56 rillig Exp $
 #
 # Miscellaneous variable tests.
 
@@ -98,3 +98,44 @@ save-dollars:
 .for val in ${SD_VALUES}
 	@printf '%s: %-8s = %s\n' $@ ${val} ${SD.${val}:Q}
 .endfor
+
+# Appending to an undefined variable does not add a space in front.
+.undef APPENDED
+APPENDED+=	value
+.if ${APPENDED} != "value"
+.error "${APPENDED}"
+.endif
+
+# Appending to an empty variable adds a space between the old value
+# and the additional value.
+APPENDED=	# empty
+APPENDED+=	value
+.if ${APPENDED} != " value"
+.error "${APPENDED}"
+.endif
+
+# Appending to parameterized variables works as well.
+PARAM=		param
+VAR.${PARAM}=	1
+VAR.${PARAM}+=	2
+.if ${VAR.param} != "1 2"
+.error "${VAR.param}"
+.endif
+
+# The variable name can contain arbitrary characters.
+# If the expanded variable name ends in a +, this still does not influence
+# the parser. The assignment operator is still a simple assignment.
+# Therefore, there is no need to add a space between the variable name
+# and the assignment operator.
+PARAM=		+
+VAR.${PARAM}=	1
+VAR.${PARAM}+=	2
+.if ${VAR.+} != "1 2"
+.error "${VAR.+}"
+.endif
+.for param in + ! ?
+VAR.${param}=	${param}
+.endfor
+.if ${VAR.+} != "+" || ${VAR.!} != "!" || ${VAR.?} != "?"
+.error "${VAR.+}" "${VAR.!}" "${VAR.?}"
+.endif



CVS commit: [netbsd-9] src

2020-07-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jul 26 10:59:48 UTC 2020

Modified Files:
src/external/mit/xorg/server/xorg-server.old/hw/xnest [netbsd-9]:
Makefile
src/external/mit/xorg/server/xorg-server/hw/xnest [netbsd-9]: Makefile
src/share/mk [netbsd-9]: bsd.x11.mk

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1028):

share/mk/bsd.x11.mk: revision 1.135
external/mit/xorg/server/xorg-server/hw/xnest/Makefile: revision 1.22
external/mit/xorg/server/xorg-server.old/hw/xnest/Makefile: revision 1.4

Fix typos in ${X11INCS.DIX} include paths. PR/55500
Remove extra "-I" for ${X11INCS.DIX} macro.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.12.1 \
src/external/mit/xorg/server/xorg-server.old/hw/xnest/Makefile
cvs rdiff -u -r1.21 -r1.21.2.1 \
src/external/mit/xorg/server/xorg-server/hw/xnest/Makefile
cvs rdiff -u -r1.132 -r1.132.2.1 src/share/mk/bsd.x11.mk

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

Modified files:

Index: src/external/mit/xorg/server/xorg-server.old/hw/xnest/Makefile
diff -u src/external/mit/xorg/server/xorg-server.old/hw/xnest/Makefile:1.3 src/external/mit/xorg/server/xorg-server.old/hw/xnest/Makefile:1.3.12.1
--- src/external/mit/xorg/server/xorg-server.old/hw/xnest/Makefile:1.3	Sun May 21 15:28:40 2017
+++ src/external/mit/xorg/server/xorg-server.old/hw/xnest/Makefile	Sun Jul 26 10:59:47 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.3 2017/05/21 15:28:40 riastradh Exp $
+#	$NetBSD: Makefile,v 1.3.12.1 2020/07/26 10:59:47 martin Exp $
 
 .include 
 
@@ -28,7 +28,7 @@ CPPFLAGS+=	-I${X11SRCDIR.xorg-server}/hw
 		-I${DESTDIR}${X11INCDIR}/X11/extensions \
 		-I${DESTDIR}${X11INCDIR}/pixman-1 \
 		-I${X11SRCDIR.xorg-server}/../include \
-		-I${X11INCS.DIX}
+		${X11INCS.DIX}
 
 CPPFLAGS+=	${X11FLAGS.OS_DEFINES} \
 		${X11FLAGS.EXTENSION} \

Index: src/external/mit/xorg/server/xorg-server/hw/xnest/Makefile
diff -u src/external/mit/xorg/server/xorg-server/hw/xnest/Makefile:1.21 src/external/mit/xorg/server/xorg-server/hw/xnest/Makefile:1.21.2.1
--- src/external/mit/xorg/server/xorg-server/hw/xnest/Makefile:1.21	Mon Dec 31 11:14:06 2018
+++ src/external/mit/xorg/server/xorg-server/hw/xnest/Makefile	Sun Jul 26 10:59:47 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.21 2018/12/31 11:14:06 mrg Exp $
+#	$NetBSD: Makefile,v 1.21.2.1 2020/07/26 10:59:47 martin Exp $
 
 .include 
 
@@ -30,7 +30,7 @@ CPPFLAGS+=	-I${X11SRCDIR.xorg-server}/hw
 		-I${DESTDIR}${X11INCDIR}/X11/extensions \
 		-I${DESTDIR}${X11INCDIR}/pixman-1 \
 		-I${X11SRCDIR.xorg-server}/../include \
-		-I${X11INCS.DIX}
+		${X11INCS.DIX}
 
 CPPFLAGS+=	${X11FLAGS.OS_DEFINES} \
 		${X11FLAGS.EXTENSION} \

Index: src/share/mk/bsd.x11.mk
diff -u src/share/mk/bsd.x11.mk:1.132 src/share/mk/bsd.x11.mk:1.132.2.1
--- src/share/mk/bsd.x11.mk:1.132	Wed Jul 10 21:53:35 2019
+++ src/share/mk/bsd.x11.mk	Sun Jul 26 10:59:47 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.x11.mk,v 1.132 2019/07/10 21:53:35 mrg Exp $
+#	$NetBSD: bsd.x11.mk,v 1.132.2.1 2020/07/26 10:59:47 martin Exp $
 
 .include 
 
@@ -46,8 +46,8 @@ X11FLAGS.EXTENSION=	${X11FLAGS.BASE_EXTE
 X11FLAGS.DIX=		-DHAVE_DIX_CONFIG_H -D_BSD_SOURCE -DHAS_FCHOWN \
 			-DHAS_STICKY_DIR_BIT -D_POSIX_THREAD_SAFE_FUNCTIONS=200112L \
 			-DHAVE_XORG_CONFIG_H
-X11INCS.DIX=		-I${X11INCSDIR}/freetype2  \
-			-I${X11INCSDIR}/pixman-1 \
+X11INCS.DIX=		-I${X11INCDIR}/freetype2  \
+			-I${X11INCDIR}/pixman-1 \
 			-I$(X11SRCDIR.xorg-server)/include \
 			-I$(X11SRCDIR.xorg-server)/Xext \
 			-I$(X11SRCDIR.xorg-server)/composite \



CVS commit: src/distrib/notes/evbarm

2020-07-26 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul 26 10:58:27 UTC 2020

Modified Files:
src/distrib/notes/evbarm: hardware

Log Message:
List all supported Amlogic SoCs


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/distrib/notes/evbarm/hardware

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

Modified files:

Index: src/distrib/notes/evbarm/hardware
diff -u src/distrib/notes/evbarm/hardware:1.21 src/distrib/notes/evbarm/hardware:1.22
--- src/distrib/notes/evbarm/hardware:1.21	Sun Jul 26 10:55:36 2020
+++ src/distrib/notes/evbarm/hardware	Sun Jul 26 10:58:27 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: hardware,v 1.21 2020/07/26 10:55:36 jmcneill Exp $
+.\"	$NetBSD: hardware,v 1.22 2020/07/26 10:58:27 jmcneill Exp $
 .\"
 .\" Copyright (c) 2001-2020 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -56,7 +56,7 @@ are also supported.
 .It
 Allwinner H5, H6, A64 (e.g. PINE64, Pinebook, NanoPi A64, OLinuXino...)
 .It
-Amlogic S905 (e.g. ODROID-C2, Le Potato, NanoPi K2...)
+Amlogic S905, S805X, S905D, S905W, S905X (e.g. ODROID-C2, Le Potato, NanoPi K2...)
 .It
 Broadcom BCM2837, BCM2711 (e.g. Raspberry Pi 3 and 4)
 .It



CVS commit: src/distrib/notes/evbarm

2020-07-26 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul 26 10:58:59 UTC 2020

Modified Files:
src/distrib/notes/evbarm: xfer

Log Message:
Remove duplicate word


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/distrib/notes/evbarm/xfer

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

Modified files:

Index: src/distrib/notes/evbarm/xfer
diff -u src/distrib/notes/evbarm/xfer:1.4 src/distrib/notes/evbarm/xfer:1.5
--- src/distrib/notes/evbarm/xfer:1.4	Sat Jul 18 17:10:23 2020
+++ src/distrib/notes/evbarm/xfer	Sun Jul 26 10:58:59 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: xfer,v 1.4 2020/07/18 17:10:23 nia Exp $
+.\"	$NetBSD: xfer,v 1.5 2020/07/26 10:58:59 jmcneill Exp $
 .\"
 .\" Copyright (c) 2020 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -42,7 +42,7 @@ to decompress .gz files.
 .Pp
 ARM devices generally also ship with a vendor-specific U-Boot
 bootloader, which may be replaced with a board-specific "mainline"
-U-Boot image from pkgsrc for an an optimal NetBSD experience.
+U-Boot image from pkgsrc for an optimal NetBSD experience.
 The images available from
 .Lk http://www.armbsd.org/arm/ "armbsd.org"
 come pre-prepared with a board-specific U-Boot image if one is



CVS commit: src/distrib/notes/evbarm

2020-07-26 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul 26 10:50:27 UTC 2020

Modified Files:
src/distrib/notes/evbarm: hardware

Log Message:
Clarify SBSA support


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/distrib/notes/evbarm/hardware

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

Modified files:

Index: src/distrib/notes/evbarm/hardware
diff -u src/distrib/notes/evbarm/hardware:1.17 src/distrib/notes/evbarm/hardware:1.18
--- src/distrib/notes/evbarm/hardware:1.17	Sun Jul 26 10:49:05 2020
+++ src/distrib/notes/evbarm/hardware	Sun Jul 26 10:50:26 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: hardware,v 1.17 2020/07/26 10:49:05 jmcneill Exp $
+.\"	$NetBSD: hardware,v 1.18 2020/07/26 10:50:26 jmcneill Exp $
 .\"
 .\" Copyright (c) 2001-2020 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -48,7 +48,7 @@ NVIDIA Tegra K1
 .El
 .Ss2 64-bit SoCs supported by GENERIC64 kernels
 .Pp
-Devices conforming to the Server Base System Architecture specification,
+Devices conforming to the Arm "ServerReady" (SBBR and SBSA) specifications,
 and
 .Lk "https://wiki.netbsd.org/ports/evbarm/qemu_arm/; "QEMU"
 are also supported.



CVS commit: [netbsd-9] xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k

2020-07-26 Thread Martin Husemann
Module Name:xsrc
Committed By:   martin
Date:   Sun Jul 26 10:49:52 UTC 2020

Modified Files:
xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k [netbsd-9]:
x68kInit.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1026):

external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kInit.c: revision 
1.3

Use AllocDevicePair() to initialize input devices in InitInput().

This should have been done on the initial X11R7'fied imoprt as
upstream xnest did:
 
https://cgit.freedesktop.org/xorg/xserver/commit?id=32ce5c83a504d2cafd2b19ed628b40032ef347b3

Tested and no visible regression on XM6i.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.4.1 \
xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kInit.c

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

Modified files:

Index: xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kInit.c
diff -u xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kInit.c:1.1.1.1 xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kInit.c:1.1.1.1.4.1
--- xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kInit.c:1.1.1.1	Thu Jun  9 09:07:59 2016
+++ xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kInit.c	Sun Jul 26 10:49:51 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: x68kInit.c,v 1.1.1.1 2016/06/09 09:07:59 mrg Exp $ */
+/* $NetBSD: x68kInit.c,v 1.1.1.1.4.1 2020/07/26 10:49:51 martin Exp $ */
 /*-
  * Copyright (c) 1996 Yasushi Yamasaki
  * All rights reserved.
@@ -133,8 +133,14 @@ InitOutput(ScreenInfo *pScreenInfo, int 
 void
 InitInput(int argc, char *argv[]) 
 {
-x68kPointerDevice = AddInputDevice(serverClient, x68kMouseProc, TRUE);
-x68kKeyboardDevice = AddInputDevice(serverClient, x68kKbdProc, TRUE);
+int rc;
+
+rc = AllocDevicePair(serverClient, "x68k",
+			 , ,
+			 x68kMouseProc,x68kKbdProc, FALSE);
+if (rc != Success)
+	FatalError("Failed to init x68k default input devices.\n");
+
 GetEventList();
 
 if ( !mieqInit() )



CVS commit: src/distrib/notes/evbarm

2020-07-26 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul 26 10:51:57 UTC 2020

Modified Files:
src/distrib/notes/evbarm: hardware

Log Message:
Add BCM2711


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/distrib/notes/evbarm/hardware

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

Modified files:

Index: src/distrib/notes/evbarm/hardware
diff -u src/distrib/notes/evbarm/hardware:1.18 src/distrib/notes/evbarm/hardware:1.19
--- src/distrib/notes/evbarm/hardware:1.18	Sun Jul 26 10:50:26 2020
+++ src/distrib/notes/evbarm/hardware	Sun Jul 26 10:51:57 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: hardware,v 1.18 2020/07/26 10:50:26 jmcneill Exp $
+.\"	$NetBSD: hardware,v 1.19 2020/07/26 10:51:57 jmcneill Exp $
 .\"
 .\" Copyright (c) 2001-2020 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -58,7 +58,7 @@ Allwinner H5, H6, A64 (e.g. PINE64, Pine
 .It
 Amlogic S905 (e.g. ODROID-C2, Le Potato, NanoPi K2...)
 .It
-Broadcom BCM2837 (e.g. Raspberry Pi 3)
+Broadcom BCM2837, BCM2711 (e.g. Raspberry Pi 3 and 4)
 .It
 Marvell ThunderX
 .It



CVS commit: [netbsd-9] xsrc/external/mit

2020-07-26 Thread Martin Husemann
Module Name:xsrc
Committed By:   martin
Date:   Sun Jul 26 10:56:19 UTC 2020

Modified Files:
xsrc/external/mit/xorg-server.old/dist/fb [netbsd-9]: fb.h fbcmap_mi.c
fbscreen.c
xsrc/external/mit/xorg-server/dist/fb [netbsd-9]: fb.h fbcmap_mi.c
fbscreen.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1027):

external/mit/xorg-server/dist/fb/fbcmap_mi.c: revision 1.2
external/mit/xorg-server.old/dist/fb/fbscreen.c: revision 1.2
external/mit/xorg-server.old/dist/fb/fb.h: revision 1.2
external/mit/xorg-server/dist/fb/fb.h: revision 1.2
external/mit/xorg-server/dist/fb/fbscreen.c: revision 1.2
external/mit/xorg-server.old/dist/fb/fbcmap_mi.c: revision 1.2

Fix 1bpp Xservers on "whitePixel=0, blackPixel=1" VRAMs.

- Don't override pScreen->blackPixel and pScreen->whitePixel
  (set in MD server Init functions per -filpPixels option)
  on 1bpp servers in merged fbSetupScreen() (merged one
  from cfbSetupScrenn and mfbSetupScreen() in old xsrc/xfree)
- Pull mfbCreateColormap() function from old xsrc/xfree tree
  and use it on 1bpp servers

Required by forthcoming X11R7'fied ancient Xsun and XsunMono servers:
 https://mail-index.netbsd.org/port-sun3/2020/07/17/msg000157.html

Without these fixes, mouse pointers and twm window titlebar etc. are
rendered inverted.

Pull 1bpp server fixes from xorg-server.old:
https://mail-index.netbsd.org/source-changes/2020/07/18/msg119488.html

Confirmed on luna68k 1bpp Xorg 1.20 server using xf86-video-wsfb
with "-flipPixels" option.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.4.1 \
xsrc/external/mit/xorg-server.old/dist/fb/fb.h \
xsrc/external/mit/xorg-server.old/dist/fb/fbcmap_mi.c \
xsrc/external/mit/xorg-server.old/dist/fb/fbscreen.c
cvs rdiff -u -r1.1.1.6 -r1.1.1.6.2.1 \
xsrc/external/mit/xorg-server/dist/fb/fb.h \
xsrc/external/mit/xorg-server/dist/fb/fbscreen.c
cvs rdiff -u -r1.1.1.5 -r1.1.1.5.4.1 \
xsrc/external/mit/xorg-server/dist/fb/fbcmap_mi.c

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

Modified files:

Index: xsrc/external/mit/xorg-server.old/dist/fb/fb.h
diff -u xsrc/external/mit/xorg-server.old/dist/fb/fb.h:1.1.1.1 xsrc/external/mit/xorg-server.old/dist/fb/fb.h:1.1.1.1.4.1
--- xsrc/external/mit/xorg-server.old/dist/fb/fb.h:1.1.1.1	Thu Jun  9 09:07:56 2016
+++ xsrc/external/mit/xorg-server.old/dist/fb/fb.h	Sun Jul 26 10:56:19 2020
@@ -1282,6 +1282,9 @@ fbResolveColor(unsigned short	*pred, 
 extern _X_EXPORT Bool
 fbInitializeColormap(ColormapPtr pmap);
 
+extern _X_EXPORT Bool
+mfbCreateColormap(ColormapPtr pmap);
+
 extern _X_EXPORT int
 fbExpandDirectColors (ColormapPtr   pmap, 
 		  int	ndef,
Index: xsrc/external/mit/xorg-server.old/dist/fb/fbcmap_mi.c
diff -u xsrc/external/mit/xorg-server.old/dist/fb/fbcmap_mi.c:1.1.1.1 xsrc/external/mit/xorg-server.old/dist/fb/fbcmap_mi.c:1.1.1.1.4.1
--- xsrc/external/mit/xorg-server.old/dist/fb/fbcmap_mi.c:1.1.1.1	Thu Jun  9 09:07:56 2016
+++ xsrc/external/mit/xorg-server.old/dist/fb/fbcmap_mi.c	Sun Jul 26 10:56:19 2020
@@ -69,6 +69,41 @@ fbInitializeColormap(ColormapPtr pmap)
 return miInitializeColormap(pmap);
 }
 
+Bool
+mfbCreateColormap(ColormapPtr pmap)
+{
+ScreenPtr	pScreen;
+unsigned short  red0, green0, blue0;
+unsigned short  red1, green1, blue1;
+Pixel pix;
+
+pScreen = pmap->pScreen;
+if (pScreen->whitePixel == 0)
+{
+	red0 = green0 = blue0 = ~0;
+	red1 = green1 = blue1 = 0;
+}
+else
+{
+	red0 = green0 = blue0 = 0;
+	red1 = green1 = blue1 = ~0;
+}
+
+/* this is a monochrome colormap, it only has two entries, just fill
+ * them in by hand.  If it were a more complex static map, it would be
+ * worth writing a for loop or three to initialize it */
+
+/* this will be pixel 0 */
+pix = 0;
+if (AllocColor(pmap, , , , , 0) != Success)
+	return FALSE;
+
+/* this will be pixel 1 */
+if (AllocColor(pmap, , , , , 0) != Success)
+	return FALSE;
+return TRUE;
+}
+
 int
 fbExpandDirectColors (ColormapPtr   pmap,
 		  int	ndef,
Index: xsrc/external/mit/xorg-server.old/dist/fb/fbscreen.c
diff -u xsrc/external/mit/xorg-server.old/dist/fb/fbscreen.c:1.1.1.1 xsrc/external/mit/xorg-server.old/dist/fb/fbscreen.c:1.1.1.1.4.1
--- xsrc/external/mit/xorg-server.old/dist/fb/fbscreen.c:1.1.1.1	Thu Jun  9 09:07:56 2016
+++ xsrc/external/mit/xorg-server.old/dist/fb/fbscreen.c	Sun Jul 26 10:56:19 2020
@@ -103,8 +103,10 @@ fbSetupScreen(ScreenPtr	pScreen, 
 if (!fbAllocatePrivates(pScreen, NULL))
 	return FALSE;
 pScreen->defColormap = FakeClientID(0);
-/* let CreateDefColormap do whatever it wants for pixels */ 
-pScreen->blackPixel = pScreen->whitePixel = (Pixel) 0;
+if (bpp > 1) {
+	/* let CreateDefColormap do whatever it wants for pixels */
+	pScreen->blackPixel = 

CVS commit: src/distrib/notes/evbarm

2020-07-26 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul 26 10:52:17 UTC 2020

Modified Files:
src/distrib/notes/evbarm: hardware

Log Message:
ThunderX is covered by SBBR+SBSA


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/distrib/notes/evbarm/hardware

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

Modified files:

Index: src/distrib/notes/evbarm/hardware
diff -u src/distrib/notes/evbarm/hardware:1.19 src/distrib/notes/evbarm/hardware:1.20
--- src/distrib/notes/evbarm/hardware:1.19	Sun Jul 26 10:51:57 2020
+++ src/distrib/notes/evbarm/hardware	Sun Jul 26 10:52:17 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: hardware,v 1.19 2020/07/26 10:51:57 jmcneill Exp $
+.\"	$NetBSD: hardware,v 1.20 2020/07/26 10:52:17 jmcneill Exp $
 .\"
 .\" Copyright (c) 2001-2020 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -60,8 +60,6 @@ Amlogic S905 (e.g. ODROID-C2, Le Potato,
 .It
 Broadcom BCM2837, BCM2711 (e.g. Raspberry Pi 3 and 4)
 .It
-Marvell ThunderX
-.It
 Rockchip RK3328, RK3328 (e.g. Pinebook Pro, RockPro64, Firefly...)
 .It
 NVIDIA Tegra X1



CVS commit: src/distrib/notes/evbarm

2020-07-26 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul 26 10:55:36 UTC 2020

Modified Files:
src/distrib/notes/evbarm: hardware

Log Message:
Add i.MX8MQ


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/distrib/notes/evbarm/hardware

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

Modified files:

Index: src/distrib/notes/evbarm/hardware
diff -u src/distrib/notes/evbarm/hardware:1.20 src/distrib/notes/evbarm/hardware:1.21
--- src/distrib/notes/evbarm/hardware:1.20	Sun Jul 26 10:52:17 2020
+++ src/distrib/notes/evbarm/hardware	Sun Jul 26 10:55:36 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: hardware,v 1.20 2020/07/26 10:52:17 jmcneill Exp $
+.\"	$NetBSD: hardware,v 1.21 2020/07/26 10:55:36 jmcneill Exp $
 .\"
 .\" Copyright (c) 2001-2020 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -36,7 +36,7 @@ Amlogic S805 (e.g. ODROID-C1)
 .It
 Broadcom BCM2836 (e.g. Raspberry Pi 2)
 .It
-Freescale i.MX6 Dual/DualLite/Quad, i.MX7 Dual (e.g. Wandboard, UDOO, Hummingboard...)
+Freescale/NXP i.MX6 Dual/DualLite/Quad, i.MX7 Dual (e.g. Wandboard, UDOO, Hummingboard...)
 .It
 Samsung Exynos 5422 (e.g. ODROID-XU3/XU-4)
 .It
@@ -60,6 +60,8 @@ Amlogic S905 (e.g. ODROID-C2, Le Potato,
 .It
 Broadcom BCM2837, BCM2711 (e.g. Raspberry Pi 3 and 4)
 .It
+Freescale/NXP i.MX8MQ (e.g. Hummingboard...)
+.It
 Rockchip RK3328, RK3328 (e.g. Pinebook Pro, RockPro64, Firefly...)
 .It
 NVIDIA Tegra X1



CVS commit: src/distrib/notes/evbarm

2020-07-26 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul 26 10:49:05 UTC 2020

Modified Files:
src/distrib/notes/evbarm: hardware

Log Message:
Note support for TI AM335x SoC


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/distrib/notes/evbarm/hardware

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

Modified files:

Index: src/distrib/notes/evbarm/hardware
diff -u src/distrib/notes/evbarm/hardware:1.16 src/distrib/notes/evbarm/hardware:1.17
--- src/distrib/notes/evbarm/hardware:1.16	Thu Jul 23 14:10:25 2020
+++ src/distrib/notes/evbarm/hardware	Sun Jul 26 10:49:05 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: hardware,v 1.16 2020/07/23 14:10:25 nia Exp $
+.\"	$NetBSD: hardware,v 1.17 2020/07/26 10:49:05 jmcneill Exp $
 .\"
 .\" Copyright (c) 2001-2020 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -40,7 +40,7 @@ Freescale i.MX6 Dual/DualLite/Quad, i.MX
 .It
 Samsung Exynos 5422 (e.g. ODROID-XU3/XU-4)
 .It
-Texas Instruments OMAP3 (e.g. BeagleBoard, BeagleBone Black...)
+Texas Instruments AM335x and OMAP3 (e.g. BeagleBoard, BeagleBone Black...)
 .It
 Xilinx Zynq (e.g. Zedboard, Parallella...)
 .It



CVS commit: src/usr.bin/make/unit-tests

2020-07-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul 26 10:48:21 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: varmisc.exp varmisc.mk

Log Message:
make(1): add test for .MAKE.SAVE_DOLLARS


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/varmisc.exp
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/varmisc.mk

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/make/unit-tests/varmisc.exp
diff -u src/usr.bin/make/unit-tests/varmisc.exp:1.8 src/usr.bin/make/unit-tests/varmisc.exp:1.9
--- src/usr.bin/make/unit-tests/varmisc.exp:1.8	Wed Jul  1 18:02:26 2020
+++ src/usr.bin/make/unit-tests/varmisc.exp	Sun Jul 26 10:48:21 2020
@@ -23,4 +23,21 @@ Version=123.456.789 == 123456789
 Literal=3.4.5 == 3004005
 We have target specific vars
 MAN= make.1
+save-dollars: 0= $
+save-dollars: 1= $$
+save-dollars: 2= $$
+save-dollars: False= $
+save-dollars: True = $$
+save-dollars: false= $
+save-dollars: true = $$
+save-dollars: Yes  = $$
+save-dollars: No   = $
+save-dollars: yes  = $$
+save-dollars: no   = $
+save-dollars: On   = $$
+save-dollars: Off  = $
+save-dollars: ON   = $$
+save-dollars: OFF  = $
+save-dollars: on   = $$
+save-dollars: off  = $
 exit status 0

Index: src/usr.bin/make/unit-tests/varmisc.mk
diff -u src/usr.bin/make/unit-tests/varmisc.mk:1.11 src/usr.bin/make/unit-tests/varmisc.mk:1.12
--- src/usr.bin/make/unit-tests/varmisc.mk:1.11	Sun Jul 19 20:37:57 2020
+++ src/usr.bin/make/unit-tests/varmisc.mk	Sun Jul 26 10:48:21 2020
@@ -1,9 +1,10 @@
-# $Id: varmisc.mk,v 1.11 2020/07/19 20:37:57 rillig Exp $
+# $Id: varmisc.mk,v 1.12 2020/07/26 10:48:21 rillig Exp $
 #
 # Miscellaneous variable tests.
 
 all: unmatched_var_paren D_true U_true D_false U_false Q_lhs Q_rhs NQ_none \
 	strftime cmpv manok
+all: save-dollars
 
 unmatched_var_paren:
 	@echo ${foo::=foo-text}
@@ -82,3 +83,18 @@ manok:
 VARNAME=	${VARNAME${:U1}}
 .if defined(VARNAME${:U2}) && !empty(VARNAME${:U2})
 .endif
+
+# begin .MAKE.SAVE_DOLLARS; see Var_Set_with_flags and s2Boolean.
+SD_VALUES=	0 1 2 False True false true Yes No yes no On Off ON OFF on off
+SD_4_DOLLARS=	
+
+.for val in ${SD_VALUES}
+.MAKE.SAVE_DOLLARS:=	${val}	# Must be := since a simple = has no effect.
+SD.${val}:=		${SD_4_DOLLARS}
+.endfor
+.MAKE.SAVE_DOLLARS:=	yes
+
+save-dollars:
+.for val in ${SD_VALUES}
+	@printf '%s: %-8s = %s\n' $@ ${val} ${SD.${val}:Q}
+.endfor



CVS commit: [netbsd-9] src/sys/dev/wsfb

2020-07-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jul 26 10:47:25 UTC 2020

Modified Files:
src/sys/dev/wsfb [netbsd-9]: genfb.c

Log Message:
Pull up following revision(s) (requested by jdolecek in ticket #1025):

sys/dev/wsfb/genfb.c: revision 1.73

reduce stack usage in genfb_calc_hsize()


To generate a diff of this commit:
cvs rdiff -u -r1.67.2.2 -r1.67.2.3 src/sys/dev/wsfb/genfb.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/wsfb/genfb.c
diff -u src/sys/dev/wsfb/genfb.c:1.67.2.2 src/sys/dev/wsfb/genfb.c:1.67.2.3
--- src/sys/dev/wsfb/genfb.c:1.67.2.2	Wed Apr 15 14:15:17 2020
+++ src/sys/dev/wsfb/genfb.c	Sun Jul 26 10:47:25 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: genfb.c,v 1.67.2.2 2020/04/15 14:15:17 martin Exp $ */
+/*	$NetBSD: genfb.c,v 1.67.2.3 2020/07/26 10:47:25 martin Exp $ */
 
 /*-
  * Copyright (c) 2007 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.67.2.2 2020/04/15 14:15:17 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.67.2.3 2020/07/26 10:47:25 martin Exp $");
 
 #include 
 #include 
@@ -632,18 +632,25 @@ genfb_calc_hsize(struct genfb_softc *sc)
 	device_t dev = sc->sc_dev;
 	prop_dictionary_t dict = device_properties(dev);
 	prop_data_t edid_data;
-	struct edid_info edid;
+	struct edid_info *edid;
 	const char *edid_ptr;
+	int hsize;
 
 	edid_data = prop_dictionary_get(dict, "EDID");
 	if (edid_data == NULL || prop_data_size(edid_data) < 128)
 		return 0;
 
+	edid = kmem_alloc(sizeof(*edid), KM_SLEEP);
+
 	edid_ptr = prop_data_data_nocopy(edid_data);
-	if (edid_parse(__UNCONST(edid_ptr), ) != 0)
-		return 0;
+	if (edid_parse(__UNCONST(edid_ptr), edid) == 0)
+		hsize = (int)edid->edid_max_hsize * 10;
+	else
+		hsize = 0;
+
+	kmem_free(edid, sizeof(*edid));
 
-	return (int)edid.edid_max_hsize * 10;
+	return hsize;
 }
 
 /* Return the minimum number of character columns based on DPI */



CVS commit: [netbsd-9] src/sys/dev/pci

2020-07-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jul 26 10:46:14 UTC 2020

Modified Files:
src/sys/dev/pci [netbsd-9]: pci_subr.c

Log Message:
Pull up following revision(s) (requested by jdolecek in ticket #1024):

sys/dev/pci/pci_subr.c: revision 1.224

change pci_conf_print() to allocate memory for the regs dynamically
instead of on-stack


To generate a diff of this commit:
cvs rdiff -u -r1.215.2.3 -r1.215.2.4 src/sys/dev/pci/pci_subr.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/pci_subr.c
diff -u src/sys/dev/pci/pci_subr.c:1.215.2.3 src/sys/dev/pci/pci_subr.c:1.215.2.4
--- src/sys/dev/pci/pci_subr.c:1.215.2.3	Thu Mar 19 19:05:34 2020
+++ src/sys/dev/pci/pci_subr.c	Sun Jul 26 10:46:14 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_subr.c,v 1.215.2.3 2020/03/19 19:05:34 martin Exp $	*/
+/*	$NetBSD: pci_subr.c,v 1.215.2.4 2020/07/26 10:46:14 martin Exp $	*/
 
 /*
  * Copyright (c) 1997 Zubin D. Dittia.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.215.2.3 2020/03/19 19:05:34 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.215.2.4 2020/07/26 10:46:14 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -52,6 +52,11 @@ __KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v
 #include 
 #include 
 #include 
+#include 
+
+#define MALLOC(sz)	kmem_alloc(sz, KM_SLEEP)
+#define FREE(p, sz)	kmem_free(p, sz)
+
 #else
 #include 
 #include 
@@ -59,6 +64,10 @@ __KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v
 #include 
 #include 
 #include 
+
+#define MALLOC(sz)	malloc(sz)
+#define FREE(p, sz)	free(p)
+
 #endif
 
 #include 
@@ -4811,7 +4820,7 @@ pci_conf_print(
 #endif
 )
 {
-	pcireg_t regs[o2i(PCI_EXTCONF_SIZE)];
+	pcireg_t *regs;
 	int off, capoff, endoff, hdrtype;
 	const char *type_name;
 #ifdef _KERNEL
@@ -4820,6 +4829,8 @@ pci_conf_print(
 	void (*type_printfn)(const pcireg_t *);
 #endif
 
+	regs = MALLOC(PCI_EXTCONF_SIZE);
+
 	printf("PCI configuration registers:\n");
 
 	for (off = 0; off < PCI_EXTCONF_SIZE; off += 4) {
@@ -4916,7 +4927,7 @@ pci_conf_print(
 
 	if (regs[o2i(PCI_EXTCAPLIST_BASE)] == 0x ||
 	regs[o2i(PCI_EXTCAPLIST_BASE)] == 0)
-		return;
+		goto out;
 
 	printf("\n");
 #ifdef _KERNEL
@@ -4929,4 +4940,7 @@ pci_conf_print(
 	/* Extended Configuration Space, if present */
 	printf("  Extended Configuration Space:\n");
 	pci_conf_print_regs(regs, PCI_EXTCAPLIST_BASE, PCI_EXTCONF_SIZE);
+
+out:
+	FREE(regs, PCI_EXTCONF_SIZE);
 }



CVS commit: [netbsd-9] src/external/apache2/mDNSResponder/dist

2020-07-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jul 26 10:44:29 UTC 2020

Modified Files:
src/external/apache2/mDNSResponder/dist/mDNSPosix [netbsd-9]:
PosixDaemon.c mDNSPosix.c
src/external/apache2/mDNSResponder/dist/mDNSShared [netbsd-9]:
PlatformCommon.c

Log Message:
Pull up following revision(s) (requested by roy in ticket #1023):

external/apache2/mDNSResponder/dist/mDNSShared/PlatformCommon.c: 
revision 1.6
external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c: revision 1.17
external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c: revision 
1.13
external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c: revision 
1.14

mdnsd: Treat EADDRNOTAVAIL as a transient error

mdnsd: starting and stopping are informational messages

mdnsd: Make the unable to parse resolv.conf message informative


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.12.4.1 \
src/external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c
cvs rdiff -u -r1.16 -r1.16.2.1 \
src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c
cvs rdiff -u -r1.5 -r1.5.4.1 \
src/external/apache2/mDNSResponder/dist/mDNSShared/PlatformCommon.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/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c
diff -u src/external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c:1.12 src/external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c:1.12.4.1
--- src/external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c:1.12	Wed Apr 11 18:34:18 2018
+++ src/external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c	Sun Jul 26 10:44:28 2020
@@ -92,7 +92,7 @@ static void Reconfigure(mDNS *m)
 mDNS_SetPrimaryInterfaceInfo(m, NULL, NULL, NULL);
 mDNS_Lock(m);
 if (ParseDNSServers(m, uDNS_SERVERS_FILE) < 0)
-LogMsg("Unable to parse DNS server list. Unicast DNS-SD unavailable");
+LogInfo("Unable to parse DNS server list. Unicast DNS-SD unavailable");
 mDNS_Unlock(m);
 ReadDDNSSettingsFromConfFile(m, CONFIG_FILE, , , NULL);
 mDNSPlatformSourceAddrForDest(, );
@@ -177,7 +177,7 @@ int main(int argc, char **argv)
 
 ParseCmdLinArgs(argc, argv);
 
-LogMsg("%s starting", mDNSResponderVersionString);
+LogInfo("%s starting", mDNSResponderVersionString);
 
 err = mDNS_Init(, , gRRCache, RR_CACHE_SIZE, mDNS_Init_AdvertiseLocalAddresses,
 mDNS_StatusCallback, mDNS_Init_NoInitCallbackContext);
@@ -200,7 +200,7 @@ int main(int argc, char **argv)
 if (mStatus_NoError == err)
 err = MainLoop();
 
-LogMsg("%s stopping", mDNSResponderVersionString);
+LogInfo("%s stopping", mDNSResponderVersionString);
 
 mDNS_Close();
 

Index: src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c
diff -u src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c:1.16 src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c:1.16.2.1
--- src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c:1.16	Mon Nov 19 08:14:28 2018
+++ src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c	Sun Jul 26 10:44:28 2020
@@ -195,8 +195,9 @@ mDNSexport mStatus mDNSPlatformSendUDP(c
 {
 static int MessageCount = 0;
 // Don't report EHOSTDOWN (i.e. ARP failure), ENETDOWN, or no route to host for unicast destinations
-if (!mDNSAddressIsAllDNSLinkGroup(dst))
+if (!mDNSAddressIsAllDNSLinkGroup(dst)) {
 if (errno == EHOSTDOWN || errno == ENETDOWN || errno == EHOSTUNREACH || errno == ENETUNREACH) return(mStatus_TransientErr);
+	} else if (errno == EADDRNOTAVAIL) return(mStatus_TransientErr);
 
 if (MessageCount < 1000)
 {

Index: src/external/apache2/mDNSResponder/dist/mDNSShared/PlatformCommon.c
diff -u src/external/apache2/mDNSResponder/dist/mDNSShared/PlatformCommon.c:1.5 src/external/apache2/mDNSResponder/dist/mDNSShared/PlatformCommon.c:1.5.4.1
--- src/external/apache2/mDNSResponder/dist/mDNSShared/PlatformCommon.c:1.5	Wed May  2 12:12:13 2018
+++ src/external/apache2/mDNSResponder/dist/mDNSShared/PlatformCommon.c	Sun Jul 26 10:44:28 2020
@@ -70,7 +70,11 @@ mDNSexport void mDNSPlatformSourceAddrFo
 else return;
 
 if ((connect(sock, , inner_len)) < 0)
-{ LogMsg("mDNSPlatformSourceAddrForDest: connect %#a failed errno %d (%s)", dst, errno, strerror(errno)); goto exit; }
+{
+if (errno != EADDRNOTAVAIL)
+	LogMsg("mDNSPlatformSourceAddrForDest: connect %#a failed errno %d (%s)", dst, errno, strerror(errno));
+	goto exit;
+}
 
 if ((getsockname(sock, , )) < 0)
 { LogMsg("mDNSPlatformSourceAddrForDest: getsockname failed errno %d (%s)", errno, strerror(errno)); goto exit; }



CVS commit: src/usr.bin/make

2020-07-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul 26 10:11:04 UTC 2020

Modified Files:
src/usr.bin/make: var.c
src/usr.bin/make/unit-tests: moderrs.exp

Log Message:
make(1): fix missing error message about missing @ delimiter

This had been broken since 2020-07-03, during a "refactoring".


To generate a diff of this commit:
cvs rdiff -u -r1.308 -r1.309 src/usr.bin/make/var.c
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/moderrs.exp

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/make/var.c
diff -u src/usr.bin/make/var.c:1.308 src/usr.bin/make/var.c:1.309
--- src/usr.bin/make/var.c:1.308	Fri Jul 24 08:24:23 2020
+++ src/usr.bin/make/var.c	Sun Jul 26 10:11:04 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.308 2020/07/24 08:24:23 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.309 2020/07/26 10:11:04 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.308 2020/07/24 08:24:23 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.309 2020/07/26 10:11:04 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.308 2020/07/24 08:24:23 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.309 2020/07/26 10:11:04 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -3171,7 +3171,8 @@ ApplyModifiers(char *nstr, const char *t
 		break;
 	}
 	case '@':
-	ApplyModifier_Loop(p, );
+	if (!ApplyModifier_Loop(p, ))
+		goto cleanup;
 	break;
 	case '_':
 	if (!ApplyModifier_Remember(p, ))

Index: src/usr.bin/make/unit-tests/moderrs.exp
diff -u src/usr.bin/make/unit-tests/moderrs.exp:1.2 src/usr.bin/make/unit-tests/moderrs.exp:1.3
--- src/usr.bin/make/unit-tests/moderrs.exp:1.2	Sun Jul 26 10:04:06 2020
+++ src/usr.bin/make/unit-tests/moderrs.exp	Sun Jul 26 10:11:04 2020
@@ -14,7 +14,9 @@ Expect: Unclosed substitution for VAR (,
 make: Unclosed substitution for VAR (, missing)
 VAR:S,V,v=
 Expect: errors about missing @ delimiter
+make: Unclosed substitution for UNDEF (@ missing)
 
+make: Unclosed substitution for UNDEF (@ missing)
 
 1 2 3
 exit status 0



CVS commit: src/usr.bin/make/unit-tests

2020-07-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul 26 10:04:06 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: moderrs.exp moderrs.mk

Log Message:
make(1): add test about missing delimiters in :@ modifier

These error conditions have been broken since var.c 1.236 on 2020-07-03.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/moderrs.exp \
src/usr.bin/make/unit-tests/moderrs.mk

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/make/unit-tests/moderrs.exp
diff -u src/usr.bin/make/unit-tests/moderrs.exp:1.1 src/usr.bin/make/unit-tests/moderrs.exp:1.2
--- src/usr.bin/make/unit-tests/moderrs.exp:1.1	Thu Aug 21 13:44:51 2014
+++ src/usr.bin/make/unit-tests/moderrs.exp	Sun Jul 26 10:04:06 2020
@@ -13,4 +13,8 @@ VAR:S,V,v,=Thevariable
 Expect: Unclosed substitution for VAR (, missing)
 make: Unclosed substitution for VAR (, missing)
 VAR:S,V,v=
+Expect: errors about missing @ delimiter
+
+
+1 2 3
 exit status 0
Index: src/usr.bin/make/unit-tests/moderrs.mk
diff -u src/usr.bin/make/unit-tests/moderrs.mk:1.1 src/usr.bin/make/unit-tests/moderrs.mk:1.2
--- src/usr.bin/make/unit-tests/moderrs.mk:1.1	Thu Aug 21 13:44:51 2014
+++ src/usr.bin/make/unit-tests/moderrs.mk	Sun Jul 26 10:04:06 2020
@@ -1,4 +1,4 @@
-# $Id: moderrs.mk,v 1.1 2014/08/21 13:44:51 apb Exp $
+# $Id: moderrs.mk,v 1.2 2020/07/26 10:04:06 rillig Exp $
 #
 # various modifier error tests
 
@@ -8,7 +8,7 @@ MOD_UNKN=Z
 MOD_TERM=S,V,v
 MOD_S:= ${MOD_TERM},
 
-all:	modunkn modunknV varterm vartermV modtermV
+all:	modunkn modunknV varterm vartermV modtermV modloop
 
 modunkn:
 	@echo "Expect: Unknown modifier 'Z'"
@@ -29,3 +29,9 @@ vartermV:
 modtermV:
 	@echo "Expect: Unclosed substitution for VAR (, missing)"
 	-@echo "VAR:${MOD_TERM}=${VAR:${MOD_TERM}}"
+
+modloop:
+	@echo "Expect: errors about missing @ delimiter"
+	@echo ${UNDEF:U1 2 3:@var}
+	@echo ${UNDEF:U1 2 3:@var@...}
+	@echo ${UNDEF:U1 2 3:@var@${var}@}



CVS commit: src/share/misc

2020-07-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul 26 09:22:15 UTC 2020

Modified Files:
src/share/misc: style

Log Message:
style: fix typo about enum constants being capitalized


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/share/misc/style

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

Modified files:

Index: src/share/misc/style
diff -u src/share/misc/style:1.54 src/share/misc/style:1.55
--- src/share/misc/style:1.54	Mon Jan 28 17:29:44 2019
+++ src/share/misc/style	Sun Jul 26 09:22:15 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: style,v 1.54 2019/01/28 17:29:44 christos Exp $ */
+/* $NetBSD: style,v 1.55 2020/07/26 09:22:15 rillig Exp $ */
 
 /*
  * The revision control tag appears first, with a blank line after it.
@@ -30,7 +30,7 @@
 #include 
 __COPYRIGHT("@(#) Copyright (c) 2008\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: style,v 1.54 2019/01/28 17:29:44 christos Exp $");
+__RCSID("$NetBSD: style,v 1.55 2020/07/26 09:22:15 rillig Exp $");
 
 /*
  * VERY important single-line comments look like this.
@@ -147,7 +147,7 @@ do {	\
 
 #define	DOUBLE(x) ((x) * 2)
 
-/* Enum types are capitalized.  No comma on the last element. */
+/* Enum constants are capitalized.  No comma on the last element. */
 enum enumtype {
 	ONE,
 	TWO



CVS commit: src/share/mk

2020-07-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul 26 09:22:43 UTC 2020

Modified Files:
src/share/mk: bsd.README

Log Message:
share/mk/bsd.README: fix typo


To generate a diff of this commit:
cvs rdiff -u -r1.410 -r1.411 src/share/mk/bsd.README

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

Modified files:

Index: src/share/mk/bsd.README
diff -u src/share/mk/bsd.README:1.410 src/share/mk/bsd.README:1.411
--- src/share/mk/bsd.README:1.410	Mon Jul 13 07:22:51 2020
+++ src/share/mk/bsd.README	Sun Jul 26 09:22:43 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.README,v 1.410 2020/07/13 07:22:51 mrg Exp $
+#	$NetBSD: bsd.README,v 1.411 2020/07/26 09:22:43 rillig Exp $
 #	@(#)bsd.README	8.2 (Berkeley) 4/2/94
 
 This is the README file for the make "include" files for the NetBSD
@@ -94,7 +94,7 @@ TOOL_xxx	A tool that is provided as part
 		TOOL_xxx variables should refer to tools that are
 		already installed on the host system.
 
-The following variables that control how things are made/installed that
+The following variables control how things are made/installed that
 are not set by default. These should not be set by Makefiles; they're for
 the user to define in MAKECONF (see , below, or mk.conf(5))
 or on the make(1) command line:



CVS commit: src

2020-07-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul 26 09:17:24 UTC 2020

Modified Files:
src: build.sh
src/tools/make: buildmake.sh.in

Log Message:
make(1): remove references to the removed lst.lib


To generate a diff of this commit:
cvs rdiff -u -r1.342 -r1.343 src/build.sh
cvs rdiff -u -r1.15 -r1.16 src/tools/make/buildmake.sh.in

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

Modified files:

Index: src/build.sh
diff -u src/build.sh:1.342 src/build.sh:1.343
--- src/build.sh:1.342	Tue Jun 30 21:22:19 2020
+++ src/build.sh	Sun Jul 26 09:17:24 2020
@@ -1,5 +1,5 @@
 #! /usr/bin/env sh
-#	$NetBSD: build.sh,v 1.342 2020/06/30 21:22:19 riastradh Exp $
+#	$NetBSD: build.sh,v 1.343 2020/07/26 09:17:24 rillig Exp $
 #
 # Copyright (c) 2001-2011 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1664,7 +1664,7 @@ rebuildmake()
 {
 	make="$(print_tooldir_make)"
 	if [ -n "${make}" ] && [ -x "${make}" ]; then
-		for f in usr.bin/make/*.[ch] usr.bin/make/lst.lib/*.[ch]; do
+		for f in usr.bin/make/*.[ch]; do
 			if [ "${f}" -nt "${make}" ]; then
 statusmsg "${make} outdated" \
 	"(older than ${f}), needs building."
@@ -1698,7 +1698,7 @@ rebuildmake()
 	bomb "Build of ${toolprefix}make failed"
 	make="${tmpdir}/${toolprefix}make"
 	${runcmd} cd "${TOP}"
-	${runcmd} rm -f usr.bin/make/*.o usr.bin/make/lst.lib/*.o
+	${runcmd} rm -f usr.bin/make/*.o
 	done_rebuildmake=true
 }
 
@@ -1961,7 +1961,7 @@ createmakewrapper()
 	eval cat <

CVS commit: src/sbin

2020-07-26 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Jul 26 08:20:23 UTC 2020

Modified Files:
src/sbin/mount: pathadj.c
src/sbin/mount_ados: Makefile mount_ados.c
src/sbin/mount_autofs: Makefile mount_autofs.c
src/sbin/mount_fdesc: Makefile mount_fdesc.c
src/sbin/mount_filecore: Makefile mount_filecore.c
src/sbin/mount_kernfs: Makefile mount_kernfs.c
src/sbin/mount_null: Makefile mount_null.c
src/sbin/mount_overlay: Makefile mount_overlay.c
src/sbin/mount_procfs: Makefile mount_procfs.c
src/sbin/mount_ptyfs: Makefile mount_ptyfs.c
src/sbin/mount_umap: Makefile mount_umap.c
src/sbin/mount_union: Makefile mount_union.c

Log Message:
Refactor remaining mount_* commands to use the common pathadj()
function for resolving paths.

Make pathadj() no longer warn about symlinks. Symlinks in /dev are
regularly used in several places like LVM . The warning was also
only visible when calling a mount_* command directly as mount(8)
itself would resolve the path witout warning before passing it to
a mount_* command.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sbin/mount/pathadj.c
cvs rdiff -u -r1.13 -r1.14 src/sbin/mount_ados/Makefile
cvs rdiff -u -r1.29 -r1.30 src/sbin/mount_ados/mount_ados.c
cvs rdiff -u -r1.2 -r1.3 src/sbin/mount_autofs/Makefile
cvs rdiff -u -r1.4 -r1.5 src/sbin/mount_autofs/mount_autofs.c
cvs rdiff -u -r1.13 -r1.14 src/sbin/mount_fdesc/Makefile
cvs rdiff -u -r1.26 -r1.27 src/sbin/mount_fdesc/mount_fdesc.c
cvs rdiff -u -r1.8 -r1.9 src/sbin/mount_filecore/Makefile
cvs rdiff -u -r1.20 -r1.21 src/sbin/mount_filecore/mount_filecore.c
cvs rdiff -u -r1.13 -r1.14 src/sbin/mount_kernfs/Makefile
cvs rdiff -u -r1.25 -r1.26 src/sbin/mount_kernfs/mount_kernfs.c
cvs rdiff -u -r1.12 -r1.13 src/sbin/mount_null/Makefile
cvs rdiff -u -r1.20 -r1.21 src/sbin/mount_null/mount_null.c
cvs rdiff -u -r1.5 -r1.6 src/sbin/mount_overlay/Makefile
cvs rdiff -u -r1.13 -r1.14 src/sbin/mount_overlay/mount_overlay.c
cvs rdiff -u -r1.14 -r1.15 src/sbin/mount_procfs/Makefile
cvs rdiff -u -r1.24 -r1.25 src/sbin/mount_procfs/mount_procfs.c
cvs rdiff -u -r1.5 -r1.6 src/sbin/mount_ptyfs/Makefile
cvs rdiff -u -r1.17 -r1.18 src/sbin/mount_ptyfs/mount_ptyfs.c
cvs rdiff -u -r1.11 -r1.12 src/sbin/mount_umap/Makefile
cvs rdiff -u -r1.26 -r1.27 src/sbin/mount_umap/mount_umap.c
cvs rdiff -u -r1.14 -r1.15 src/sbin/mount_union/Makefile
cvs rdiff -u -r1.22 -r1.23 src/sbin/mount_union/mount_union.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/mount/pathadj.c
diff -u src/sbin/mount/pathadj.c:1.2 src/sbin/mount/pathadj.c:1.3
--- src/sbin/mount/pathadj.c:1.2	Thu Feb 17 16:57:46 2011
+++ src/sbin/mount/pathadj.c	Sun Jul 26 08:20:22 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pathadj.c,v 1.2 2011/02/17 16:57:46 pooka Exp $	*/
+/*	$NetBSD: pathadj.c,v 1.3 2020/07/26 08:20:22 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation.  All Rights Reserved.
@@ -37,10 +37,13 @@ void
 pathadj(const char *input, char *adjusted)
 {
 
-	if (realpath(input, adjusted) == NULL)
+	if (realpath(input, adjusted) == NULL) {
 		warn("Warning: realpath %s", input);
-	if (strncmp(input, adjusted, MAXPATHLEN)) {
-		warnx("\"%s\" is a non-resolved or relative path.", input);
+		return;
+	}
+
+	if (input[0] != '/') {
+		warnx("\"%s\" is a relative path.", input);
 		warnx("using \"%s\" instead.", adjusted);
 	}
 }

Index: src/sbin/mount_ados/Makefile
diff -u src/sbin/mount_ados/Makefile:1.13 src/sbin/mount_ados/Makefile:1.14
--- src/sbin/mount_ados/Makefile:1.13	Mon Jun 27 01:00:05 2005
+++ src/sbin/mount_ados/Makefile	Sun Jul 26 08:20:22 2020
@@ -1,9 +1,9 @@
-#	$NetBSD: Makefile,v 1.13 2005/06/27 01:00:05 christos Exp $
+#	$NetBSD: Makefile,v 1.14 2020/07/26 08:20:22 mlelstv Exp $
 
 .include 
 
 PROG=	mount_ados
-SRCS=	mount_ados.c fattr.c
+SRCS=	mount_ados.c fattr.c pathadj.c
 MAN=	mount_ados.8
 
 MOUNT=	${NETBSDSRCDIR}/sbin/mount

Index: src/sbin/mount_ados/mount_ados.c
diff -u src/sbin/mount_ados/mount_ados.c:1.29 src/sbin/mount_ados/mount_ados.c:1.30
--- src/sbin/mount_ados/mount_ados.c:1.29	Mon Aug 29 14:35:00 2011
+++ src/sbin/mount_ados/mount_ados.c	Sun Jul 26 08:20:22 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: mount_ados.c,v 1.29 2011/08/29 14:35:00 joerg Exp $ */
+/* $NetBSD: mount_ados.c,v 1.30 2020/07/26 08:20:22 mlelstv Exp $ */
 
 /*
  * Copyright (c) 1994 Christopher G. Demetriou
@@ -36,7 +36,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: mount_ados.c,v 1.29 2011/08/29 14:35:00 joerg Exp $");
+__RCSID("$NetBSD: mount_ados.c,v 1.30 2020/07/26 08:20:22 mlelstv Exp $");
 #endif /* not lint */
 
 #include 
@@ -120,21 +120,11 @@ mount_ados(int argc, char **argv)
 	dev = argv[optind];
 	dir = argv[optind + 1];
 
-	if (realpath(dev, canon_dev) == NULL)/* Check device path */
-		err(1, "realpath %s", dev);
-	if (strncmp(dev, canon_dev, 

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

2020-07-26 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sun Jul 26 08:08:41 UTC 2020

Modified Files:
src/sys/arch/mips/include: asm.h bswap.h bus_dma_defs.h
bus_space_defs.h bus_space_funcs.h cache.h cache_ls2.h
cache_mipsNN.h cache_octeon.h cache_r4k.h cache_r5900.h cache_r5k.h
cachectl.h cdefs.h cpu.h cpu_counter.h cpuregs.h db_machdep.h
ecoff_machdep.h fenv.h float.h frame.h ieeefp.h int_const.h
int_fmtio.h int_limits.h int_mwgwtypes.h intr.h isa_machdep.h
kcore.h kdbparam.h limits.h locore.h math.h mcontext.h mips1_pte.h
mips3_pte.h mipsNN.h mips_opcode.h mips_param.h netbsd32_machdep.h
pci_machdep.h pmap.h proc.h profile.h pte.h ptrace.h r3900regs.h
reg.h regdef.h regnum.h reloc.h setjmp.h sljit_machdep.h sysarch.h
vmparam.h wchar_limits.h wired_map.h

Log Message:
#define
Nuke trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/mips/include/asm.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/mips/include/bswap.h \
src/sys/arch/mips/include/bus_dma_defs.h \
src/sys/arch/mips/include/cache_octeon.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/mips/include/bus_space_defs.h \
src/sys/arch/mips/include/cache_ls2.h src/sys/arch/mips/include/kcore.h \
src/sys/arch/mips/include/wchar_limits.h \
src/sys/arch/mips/include/wired_map.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/mips/include/bus_space_funcs.h \
src/sys/arch/mips/include/sljit_machdep.h
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/mips/include/cache.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/mips/include/cache_mipsNN.h \
src/sys/arch/mips/include/cache_r5k.h \
src/sys/arch/mips/include/cpu_counter.h src/sys/arch/mips/include/fenv.h \
src/sys/arch/mips/include/int_const.h \
src/sys/arch/mips/include/netbsd32_machdep.h
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/mips/include/cache_r4k.h
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/mips/include/cache_r5900.h \
src/sys/arch/mips/include/frame.h src/sys/arch/mips/include/int_limits.h \
src/sys/arch/mips/include/reloc.h src/sys/arch/mips/include/setjmp.h
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/mips/include/cachectl.h \
src/sys/arch/mips/include/ieeefp.h src/sys/arch/mips/include/intr.h \
src/sys/arch/mips/include/sysarch.h
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/mips/include/cdefs.h
cvs rdiff -u -r1.128 -r1.129 src/sys/arch/mips/include/cpu.h
cvs rdiff -u -r1.104 -r1.105 src/sys/arch/mips/include/cpuregs.h
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/mips/include/db_machdep.h
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/mips/include/ecoff_machdep.h
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/mips/include/float.h \
src/sys/arch/mips/include/ptrace.h
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/mips/include/int_fmtio.h \
src/sys/arch/mips/include/int_mwgwtypes.h
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/mips/include/isa_machdep.h \
src/sys/arch/mips/include/kdbparam.h src/sys/arch/mips/include/mipsNN.h \
src/sys/arch/mips/include/pci_machdep.h
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/mips/include/limits.h
cvs rdiff -u -r1.109 -r1.110 src/sys/arch/mips/include/locore.h
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/mips/include/math.h \
src/sys/arch/mips/include/r3900regs.h
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/mips/include/mcontext.h
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/mips/include/mips1_pte.h
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/mips/include/mips3_pte.h
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/mips/include/mips_opcode.h \
src/sys/arch/mips/include/profile.h
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/mips/include/mips_param.h
cvs rdiff -u -r1.71 -r1.72 src/sys/arch/mips/include/pmap.h
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/mips/include/proc.h
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/mips/include/pte.h
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/mips/include/reg.h
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/mips/include/regdef.h
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/mips/include/regnum.h
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/mips/include/vmparam.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/arch/mips/include/asm.h
diff -u src/sys/arch/mips/include/asm.h:1.56 src/sys/arch/mips/include/asm.h:1.57
--- src/sys/arch/mips/include/asm.h:1.56	Fri Apr 17 14:19:43 2020
+++ src/sys/arch/mips/include/asm.h	Sun Jul 26 08:08:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: asm.h,v 1.56 2020/04/17 14:19:43 joerg Exp $	*/
+/*	$NetBSD: asm.h,v 1.57 2020/07/26 08:08:41 simonb Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -267,7 +267,7 @@ _C_LABEL(x):
 	.asciz str;			\
 	.align	3
 
-#define RCSID(x)	.pushsection ".ident","MS",@progbits,1;		\
+#define	RCSID(x)	.pushsection ".ident","MS",@progbits,1;		\
 			.asciz x;	\
 			.popsection
 
@@ -515,9 +515,9 @@ _C_LABEL(x):
 
 /* CPU dependent hook for cp0 load delays */
 #if defined(MIPS1) || 

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

2020-07-26 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sun Jul 26 07:57:06 UTC 2020

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

Log Message:
Rework "machine cp0" command and support macros to use CP0 reg defines
instead of magic numbers for CP0 regs with a select number.


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/sys/arch/mips/mips/db_interface.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/db_interface.c
diff -u src/sys/arch/mips/mips/db_interface.c:1.85 src/sys/arch/mips/mips/db_interface.c:1.86
--- src/sys/arch/mips/mips/db_interface.c:1.85	Mon Jul 13 12:56:58 2020
+++ src/sys/arch/mips/mips/db_interface.c	Sun Jul 26 07:57:06 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_interface.c,v 1.85 2020/07/13 12:56:58 simonb Exp $	*/
+/*	$NetBSD: db_interface.c,v 1.86 2020/07/26 07:57:06 simonb Exp $	*/
 
 /*
  * Mach Operating System
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.85 2020/07/13 12:56:58 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.86 2020/07/26 07:57:06 simonb Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_cputype.h"	/* which mips CPUs do we support? */
@@ -301,10 +301,12 @@ db_kvtophys_cmd(db_expr_t addr, bool hav
 
 #define	FLDWIDTH	10
 
-#define SHOW32(reg, name)	SHOW32SEL(reg, 0, name)
-#define SHOW64(reg, name)	SHOW64SEL(reg, 0, name)
+#define SHOW32(reg, name)	SHOW32SELECT(reg, 0, name)
+#define SHOW64(reg, name)	SHOW64SELECT(reg, 0, name)
+#define SHOW32SEL(reg, name)	SHOW32SELECT(reg, name)
+#define SHOW64SEL(reg, name)	SHOW64SELECT(reg, name)
 
-#define	SHOW32SEL(num, sel, name)	\
+#define	SHOW32SELECT(num, sel, name)	\
 do {	\
 	uint32_t __val;			\
 	\
@@ -319,7 +321,7 @@ do {	\
 } while (0)
 
 /* XXX not 64-bit ABI safe! */
-#define	SHOW64SEL(num, sel, name)	\
+#define	SHOW64SELECT(num, sel, name)	\
 do {	\
 	uint64_t __val;			\
 	\
@@ -421,9 +423,9 @@ db_cp0dump_cmd(db_expr_t addr, bool have
 
 	if ((cp0flags & MIPS_CP0FL_USE) != 0) {
 		if ((cp0flags & MIPS_CP0FL_EIRR) != 0)
-			SHOW64SEL(9, 6, "eirr");
+			SHOW64SEL(MIPS_COP_0_EIRR, "eirr");
 		if ((cp0flags & MIPS_CP0FL_EIMR) != 0)
-			SHOW64SEL(9, 7, "eimr");
+			SHOW64SEL(MIPS_COP_0_EIMR, "eimr");
 	}
 
 	if (CPUIS64BITS) {
@@ -449,27 +451,27 @@ db_cp0dump_cmd(db_expr_t addr, bool have
 
 	if ((cp0flags & MIPS_CP0FL_USE) != 0) {
 		if ((cp0flags & MIPS_CP0FL_EBASE) != 0)
-			SHOW32SEL(15, 1, "ebase");
+			SHOW32SEL(MIPS_COP_0_EBASE, "ebase");
 		if ((cp0flags & MIPS_CP0FL_CONFIG) != 0)
 			SHOW32(MIPS_COP_0_CONFIG, "config");
 		if ((cp0flags & MIPS_CP0FL_CONFIG1) != 0)
-			SHOW32SEL(16, 1, "config1");
+			SHOW32SEL(MIPS_COP_0_CONFIG1, "config1");
 		if ((cp0flags & MIPS_CP0FL_CONFIG2) != 0)
-			SHOW32SEL(16, 2, "config2");
+			SHOW32SEL(MIPS_COP_0_CONFIG2, "config2");
 		if ((cp0flags & MIPS_CP0FL_CONFIG3) != 0)
-			SHOW32SEL(16, 3, "config3");
+			SHOW32SEL(MIPS_COP_0_CONFIG3, "config3");
 		if ((cp0flags & MIPS_CP0FL_CONFIG4) != 0)
-			SHOW32SEL(16, 4, "config4");
+			SHOW32SEL(MIPS_COP_0_CONFIG4, "config4");
 		if ((cp0flags & MIPS_CP0FL_CONFIG5) != 0)
-			SHOW32SEL(16, 5, "config5");
+			SHOW32SEL(MIPS_COP_0_CONFIG5, "config5");
 		if ((cp0flags & MIPS_CP0FL_CONFIG6) != 0)
-			SHOW32SEL(16, 6, "config6");
+			SHOW32SEL(MIPS_COP_0_CONFIG6, "config6");
 		if ((cp0flags & MIPS_CP0FL_CONFIG7) != 0)
-			SHOW32SEL(16, 7, "config7");
+			SHOW32SEL(MIPS_COP_0_CONFIG7, "config7");
 		if (CPUISMIPSNNR2)
-			SHOW32(7, "hwrena");
+			SHOW32(MIPS_COP_0_HWRENA, "hwrena");
 		if (MIPS_HAS_USERLOCAL)
-			SHOW32SEL(4, 2, "userlocal");
+			SHOW32SEL(MIPS_COP_0_USERLOCAL, "userlocal");
 	} else {
 		SHOW32(MIPS_COP_0_CONFIG, "config");
 #if (MIPS32 + MIPS32R2 + MIPS64 + MIPS64R2) > 0
@@ -508,9 +510,11 @@ db_cp0dump_cmd(db_expr_t addr, bool have
 
 	if (CPUISMIPSNN) {
 		if (CPUIS64BITS) {
-			SHOW64(MIPS_COP_0_PERFCNT, "perfcnt");
+			SHOW64(MIPS_COP_0_PERFCNT0_CTL, "perfcnt0ctl");
+			SHOW64SEL(MIPS_COP_0_PERFCNT0_CNT, "perfcnt0cnt");
 		} else {
-			SHOW32(MIPS_COP_0_PERFCNT, "perfcnt");
+			SHOW32(MIPS_COP_0_PERFCNT0_CTL, "perfcnt0ctl");
+			SHOW32SEL(MIPS_COP_0_PERFCNT0_CNT, "perfcnt0cnt");
 		}
 	}
 



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

2020-07-26 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sun Jul 26 07:52:08 UTC 2020

Modified Files:
src/sys/arch/mips/include: cpuregs.h

Log Message:
Add CP0 Config Registers 6 and 7.


To generate a diff of this commit:
cvs rdiff -u -r1.103 -r1.104 src/sys/arch/mips/include/cpuregs.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/arch/mips/include/cpuregs.h
diff -u src/sys/arch/mips/include/cpuregs.h:1.103 src/sys/arch/mips/include/cpuregs.h:1.104
--- src/sys/arch/mips/include/cpuregs.h:1.103	Sun Jul 26 07:46:21 2020
+++ src/sys/arch/mips/include/cpuregs.h	Sun Jul 26 07:52:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpuregs.h,v 1.103 2020/07/26 07:46:21 simonb Exp $	*/
+/*	$NetBSD: cpuregs.h,v 1.104 2020/07/26 07:52:07 simonb Exp $	*/
 
 /*
  * Copyright (c) 2009 Miodrag Vallat.
@@ -642,6 +642,8 @@
 #define MIPS_COP_0_CONFIG3	_(16), 3
 #define MIPS_COP_0_CONFIG4	_(16), 4
 #define MIPS_COP_0_CONFIG5	_(16), 5
+#define MIPS_COP_0_CONFIG6	_(16), 6
+#define MIPS_COP_0_CONFIG7	_(16), 7
 #define	MIPS_COP_0_OSSCRATCH	_(22)		/* RMI */
 #define	MIPS_COP_0_DIAG		_(22)		/* LOONGSON2 */
 #define	MIPS_COP_0_MCD		_(22)		/* CAVIUM */



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

2020-07-26 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sun Jul 26 07:48:07 UTC 2020

Modified Files:
src/sys/arch/mips/rmi: rmixl_spl.S rmixl_subr.S

Log Message:
Use EIMR/EIRR regs definitions from 


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/mips/rmi/rmixl_spl.S
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/mips/rmi/rmixl_subr.S

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/rmi/rmixl_spl.S
diff -u src/sys/arch/mips/rmi/rmixl_spl.S:1.4 src/sys/arch/mips/rmi/rmixl_spl.S:1.5
--- src/sys/arch/mips/rmi/rmixl_spl.S:1.4	Fri Jun 19 06:32:08 2015
+++ src/sys/arch/mips/rmi/rmixl_spl.S	Sun Jul 26 07:48:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_spl.S,v 1.4 2015/06/19 06:32:08 matt Exp $	*/
+/*	$NetBSD: rmixl_spl.S,v 1.5 2020/07/26 07:48:07 simonb Exp $	*/
 
 /*-
  * Copyright (c) 2009, 2010 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #include 
 #include 
 
-RCSID("$NetBSD: rmixl_spl.S,v 1.4 2015/06/19 06:32:08 matt Exp $");
+RCSID("$NetBSD: rmixl_spl.S,v 1.5 2020/07/26 07:48:07 simonb Exp $");
 
 #include "assym.h"
 
@@ -47,8 +47,6 @@ RCSID("$NetBSD: rmixl_spl.S,v 1.4 2015/0
 #define RMIXL_EIRR_PRESERVE	(RMIXL_INT_MASK_5 | RMIXL_SOFT_INT_MASK)
 #define RMIXL_INT_MASK_1	(MIPS_INT_MASK_1 >> 8)
 #define RMIXL_INT_MASK_5	(MIPS_INT_MASK_5 >> 8)
-#define RMIXL_COP_0_EIRR	_(9), 6
-#define RMIXL_COP_0_EIMR	_(9), 7
 
 	.set noreorder
 
@@ -89,9 +87,9 @@ LEAF_NOPROFILE(rmixl_spl_init_cpu)
 	ori	t0, MIPS_SR_INT_IE		# set IE
 	mtc0	zero, MIPS_COP_0_STATUS		## disable all ints in STATUS
 	COP0_SYNC
-	dmtc0	zero, RMIXL_COP_0_EIMR		##  "   "   "   "  EIMR
+	dmtc0	zero, MIPS_COP_0_EIMR		##  "   "   "   "  EIMR
 	COP0_SYNC
-	dmtc0	zero, RMIXL_COP_0_EIRR		## clear EIRR
+	dmtc0	zero, MIPS_COP_0_EIRR		## clear EIRR
 	COP0_SYNC
 	mtc0	t0, MIPS_COP_0_STATUS		## set STATUS | IE
 	JR_HB_RA
@@ -110,8 +108,8 @@ _splraise:
 	 * Can only use a0-a3 and v0-v1
 	 * old IPL is returned in v0
 	 */
-	dmfc0	a2, RMIXL_COP_0_EIMR		# save EIMR
-	dmtc0	zero, RMIXL_COP_0_EIMR		## disable all interrupts
+	dmfc0	a2, MIPS_COP_0_EIMR		# save EIMR
+	dmtc0	zero, MIPS_COP_0_EIMR		## disable all interrupts
 	COP0_SYNC
 	PTR_L	a3, L_CPU(MIPS_CURLWP)		##
 	INT_L	v0, CPU_INFO_CPL(a3)		## get current IPL from cpu_info
@@ -119,10 +117,10 @@ _splraise:
 	bnez	v1, 1f## yes, don't change.
 	 nop
 	INT_S	a1, CPU_INFO_CPL(a3)		## save IPL in cpu_info
-	dmtc0	a0, RMIXL_COP_0_EIMR		## set new EIMR
+	dmtc0	a0, MIPS_COP_0_EIMR		## set new EIMR
 	JR_HB_RA
 1:
-	dmtc0	a2, RMIXL_COP_0_EIMR		## restore saved EIMR
+	dmtc0	a2, MIPS_COP_0_EIMR		## restore saved EIMR
 	JR_HB_RA
 
 STATIC_LEAF(_splsw_splx)
@@ -132,17 +130,17 @@ STATIC_XLEAF(_splsw_splx_noprof)		# does
 	PTR_ADDU v1, a2# add to table addr
 	REG_L	v1, (v1)			# load EIMR bits for this IPL
 
-	dmtc0	zero, RMIXL_COP_0_EIMR		## disable all interrupts
+	dmtc0	zero, MIPS_COP_0_EIMR		## disable all interrupts
 	COP0_SYNC
 	PTR_L	a3, L_CPU(MIPS_CURLWP)		## get cpu_info
 	INT_S	a0, CPU_INFO_CPL(a3)		## save IPL in cpu_info
-	dmtc0	v1, RMIXL_COP_0_EIMR		## set new EIMR
+	dmtc0	v1, MIPS_COP_0_EIMR		## set new EIMR
 	JR_HB_RA
 END(_splsw_splx)
 
 STATIC_LEAF(_splsw_spl0)
 	REG_L	v1, _C_LABEL(ipl_eimr_map) + 8*IPL_NONE
-	dmtc0	zero, RMIXL_COP_0_EIMR		## disable all interrupts
+	dmtc0	zero, MIPS_COP_0_EIMR		## disable all interrupts
 	COP0_SYNC
 	PTR_L	a3, L_CPU(MIPS_CURLWP)		## get cpu_info
 #if IPL_NONE == 0
@@ -150,22 +148,22 @@ STATIC_LEAF(_splsw_spl0)
 #else
 #error IPL_NONE != 0
 #endif
-	dmtc0	v1, RMIXL_COP_0_EIMR		## set new EIMR
+	dmtc0	v1, MIPS_COP_0_EIMR		## set new EIMR
 	JR_HB_RA
 END(_splsw_spl0)
 
 STATIC_LEAF(_splsw_setsoftintr)
 	dsrl	a0, 8# convert CAUSE bit to EIRR bit
 	and	a0, RMIXL_SOFT_INT_MASK		# restrict to softint bits
-	dmfc0	v1, RMIXL_COP_0_EIMR		# save EIMR register
-	dmtc0	zero, RMIXL_COP_0_EIMR		## disable all interrupts
+	dmfc0	v1, MIPS_COP_0_EIMR		# save EIMR register
+	dmtc0	zero, MIPS_COP_0_EIMR		## disable all interrupts
 	COP0_SYNC
-	dmfc0	v0, RMIXL_COP_0_EIRR		## load EIRR
+	dmfc0	v0, MIPS_COP_0_EIRR		## load EIRR
 	and	v0, RMIXL_EIRR_PRESERVE		## preserve clock & softints
 	or	v0, a0## set new softint bit
-	dmtc0	v0, RMIXL_COP_0_EIRR		## store EIRR
+	dmtc0	v0, MIPS_COP_0_EIRR		## store EIRR
 	COP0_SYNC
-	dmtc0	v1, RMIXL_COP_0_EIMR		## restore EIMR
+	dmtc0	v1, MIPS_COP_0_EIMR		## restore EIMR
 	JR_HB_RA
 END(_splsw_setsoftintr)
 
@@ -173,14 +171,14 @@ STATIC_LEAF(_splsw_clrsoftintr)
 	dsrl	a0, 8# convert CAUSE bit to EIRR bit
 	and	a0, RMIXL_SOFT_INT_MASK		# restrict to softint bits
 	xor	a0, RMIXL_EIRR_PRESERVE		# clear from preserve mask
-	dmfc0	v1, RMIXL_COP_0_EIMR		# save EIMR register
-	dmtc0	zero, RMIXL_COP_0_EIMR		## disable all interrupts
+	dmfc0	v1, MIPS_COP_0_EIMR		# save EIMR register
+	dmtc0	zero, MIPS_COP_0_EIMR		## disable all interrupts
 	COP0_SYNC
-	dmfc0	v0, RMIXL_COP_0_EIRR		## load EIRR
+	dmfc0	v0, 

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

2020-07-26 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sun Jul 26 07:47:27 UTC 2020

Modified Files:
src/sys/arch/mips/mips: locore_octeon.S

Log Message:
Adjust for new CP0 reg names, comment out most of the Cavium CP0
specific functions that are unused.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/mips/mips/locore_octeon.S

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/locore_octeon.S
diff -u src/sys/arch/mips/mips/locore_octeon.S:1.11 src/sys/arch/mips/mips/locore_octeon.S:1.12
--- src/sys/arch/mips/mips/locore_octeon.S:1.11	Mon Jul 20 03:24:59 2020
+++ src/sys/arch/mips/mips/locore_octeon.S	Sun Jul 26 07:47:27 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore_octeon.S,v 1.11 2020/07/20 03:24:59 simonb Exp $	*/
+/*	$NetBSD: locore_octeon.S,v 1.12 2020/07/26 07:47:27 simonb Exp $	*/
 
 /*
  * Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-RCSID("$NetBSD: locore_octeon.S,v 1.11 2020/07/20 03:24:59 simonb Exp $")
+RCSID("$NetBSD: locore_octeon.S,v 1.12 2020/07/26 07:47:27 simonb Exp $")
 
 #include "cpunode.h"			/* for NWDOG */
 #include "opt_cputype.h"
@@ -37,7 +37,7 @@ RCSID("$NetBSD: locore_octeon.S,v 1.11 2
 #include 
 #include 
 
-RCSID("$NetBSD: locore_octeon.S,v 1.11 2020/07/20 03:24:59 simonb Exp $")
+RCSID("$NetBSD: locore_octeon.S,v 1.12 2020/07/26 07:47:27 simonb Exp $")
 
 #include "assym.h"
 
@@ -58,60 +58,62 @@ RCSID("$NetBSD: locore_octeon.S,v 1.11 2
 	.text
 
 LEAF(mips_cp0_cvmctl_read)
-	_CP0_READ64(CP0_CVMCTL)
+	_CP0_READ64(MIPS_COP_0_CVMCTL)
 END(mips_cp0_cvmctl_read)
 
+#ifdef notyet /* the rest of these aren't used (yet) */
 LEAF(mips_cp0_cvmctl_write)
-	_CP0_WRITE64(CP0_CVMCTL)
+	_CP0_WRITE64(MIPS_COP_0_CVMCTL)
 END(mips_cp0_cvmctl_write)
 
 LEAF(mips_cp0_cvmmemctl_read)
-	_CP0_READ64(CP0_CVMMEMCTL)
+	_CP0_READ64(MIPS_COP_0_CVMMEMCTL)
 END(mips_cp0_cvmmemctl_read)
 
 LEAF(mips_cp0_cvmmemctl_write)
-	_CP0_WRITE64(CP0_CVMMEMCTL)
+	_CP0_WRITE64(MIPS_COP_0_CVMMEMCTL)
 END(mips_cp0_cvmmemctl_write)
 
 LEAF(mips_cp0_cvmcnt_read)
-	_CP0_READ64(CP0_CVMCNT)
+	_CP0_READ64(MIPS_COP_0_CVMCNT)
 END(mips_cp0_cvmcnt_read)
 
 LEAF(mips_cp0_cvmcnt_write)
-	_CP0_WRITE64(CP0_CVMCNT)
+	_CP0_WRITE64(MIPS_COP_0_CVMCNT)
 END(mips_cp0_cvmcnt_write)
 
 LEAF(mips_cp0_performance_counter_control0_read)
-	_CP0_READ64(CP0_PCCTL)
+	_CP0_READ64(MIPS_COP_0_PERFCNT0_CTL)
 END(mips_cp0_performance_counter_control0_read)
 
 LEAF(mips_cp0_performance_counter_control0_write)
-	_CP0_WRITE64(CP0_PCCTL)
+	_CP0_WRITE64(MIPS_COP_0_PERFCNT0_CTL)
 END(mips_cp0_performance_counter_control0_write)
 
 LEAF(mips_cp0_performance_counter_control1_read)
-	_CP0_READ64(CP0_PCCTL1)
+	_CP0_READ64(MIPS_COP_0_PERFCNT1_CTL)
 END(mips_cp0_performance_counter_control1_read)
 
 LEAF(mips_cp0_performance_counter_control1_write)
-	_CP0_WRITE64(CP0_PCCTL1)
+	_CP0_WRITE64(MIPS_COP_0_PERFCNT1_CTL)
 END(mips_cp0_performance_counter_control1_write)
 
 LEAF(mips_cp0_performance_counter_counter0_read)
-	_CP0_READ64(CP0_PCCNT)
+	_CP0_READ64(MIPS_COP_0_PERFCNT0_CNT)
 END(mips_cp0_performance_counter_counter0_read)
 
 LEAF(mips_cp0_performance_counter_counter0_write)
-	_CP0_WRITE64(CP0_PCCNT)
+	_CP0_WRITE64(MIPS_COP_0_PERFCNT0_CNT)
 END(mips_cp0_performance_counter_counter0_write)
 
 LEAF(mips_cp0_performance_counter_counter1_read)
-	_CP0_READ64(CP0_PCCNT1)
+	_CP0_READ64(MIPS_COP_0_PERFCNT1_CNT)
 END(mips_cp0_performance_counter_counter1_read)
 
 LEAF(mips_cp0_performance_counter_counter1_write)
-	_CP0_WRITE64(CP0_PCCNT1)
+	_CP0_WRITE64(MIPS_COP_0_PERFCNT1_CNT)
 END(mips_cp0_performance_counter_counter1_write)
+#endif /* notyet */
 
 #ifdef MULTIPROCESSOR
 



CVS commit: src/sys/arch/mips

2020-07-26 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sun Jul 26 07:46:21 UTC 2020

Modified Files:
src/sys/arch/mips/cavium/dev: octeon_corereg.h
src/sys/arch/mips/include: cpuregs.h

Log Message:
Remove mostly duplicate MIPS spec CP0 regs from octeon_corereg.h, move
the Cavium specific CP0 regs to  as done for other core
specific regs.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/mips/cavium/dev/octeon_corereg.h
cvs rdiff -u -r1.102 -r1.103 src/sys/arch/mips/include/cpuregs.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/arch/mips/cavium/dev/octeon_corereg.h
diff -u src/sys/arch/mips/cavium/dev/octeon_corereg.h:1.3 src/sys/arch/mips/cavium/dev/octeon_corereg.h:1.4
--- src/sys/arch/mips/cavium/dev/octeon_corereg.h:1.3	Mon Jun 22 03:05:07 2020
+++ src/sys/arch/mips/cavium/dev/octeon_corereg.h	Sun Jul 26 07:46:21 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: octeon_corereg.h,v 1.3 2020/06/22 03:05:07 simonb Exp $	*/
+/*	$NetBSD: octeon_corereg.h,v 1.4 2020/07/26 07:46:21 simonb Exp $	*/
 
 /*
  * Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -29,345 +29,10 @@
 #ifndef _OCTEON_COREREG_H_
 #define _OCTEON_COREREG_H_
 
-/*
- * Core Coprocessor 0 Privileged Registers.
- */
-
-#ifdef _LOCORE
-#define	CP0_INDEX		$0	/* Index Register */
-#define	CP0_RANDOM		$1	/* Random Register */
-#define	CP0_ENTRYLO0		$2	/* EntryLo0 Registers */
-#define	CP0_ENTRYLO1		$3	/* EntryLo1 Registers */
-#define	CP0_CONTEXT		$4	/* Context Register */
-#define	CP0_PAGEMASK		$5	/* PageMask Register */
-#define	CP0_PAGEGRAIN		$5, 1	/* PageGrain Register */
-#define	CP0_WIRED		$6	/* Wired Register */
-#define	CP0_HWRENA		$7	/* HWREna Register */
-#define	CP0_BADVADDR		$8	/* BadVAddr Register */
-#define	CP0_COUNT		$9	/* Count Register */
-#define	CP0_ENTRYHI		$10	/* EntryHi Register */
-#define	CP0_COMPARE		$11	/* Compare Register */
-#define	CP0_STATUS		$12	/* Status Register */
-#define	CP0_INTCTL		$12, 1	/* IntCtl Register */
-#define	CP0_SRSCTL		$12, 2	/* SRSCtl Register */
-#define	CP0_CAUSE		$13	/* Cause Register */
-#define	CP0_EPC			$14	/* Exception Program Counter */
-#define	CP0_PRID		$15	/* PRId Register */
-#define	CP0_EBASE		$15, 1	/* EBase Register */
-#define	CP0_CONFIG		$16	/* Config Register */
-#define	CP0_CONFIG1		$16, 1	/* Config1 Register */
-#define	CP0_CONFIG2		$16, 2	/* Config2 Register */
-#define	CP0_CONFIG3		$16, 3	/* Config3 Register */
-#define	CP0_WATCHLO		$18	/* WatchLo Register */
-#define	CP0_WATCHLO1		$18, 1	
-#define	CP0_WATCHHI		$19	/* WatchHi Register */
-#define	CP0_WATCHHI1		$19, 1	
-#define	CP0_XCONTEXT		$20	/* XContext Register */
-#define	CP0_DEBUG		$23	/* Debug Register */
-#define	CP0_DPC			$24	/* Debug Exception Program Counter Register */
-#define	CP0_PCCTL		$25	/* Performance Counter Control Register */
-#define	CP0_PCCTL1		$25, 2	
-#define	CP0_PCCNT		$25, 1	/* Performance Counter Counter Register */
-#define	CP0_PCCNT1		$25, 3	
-#define	CP0_ERROREPC		$30	/* ErrorEPC */
-#define	CP0_DESAVE		$31	/* DESAVE Register */
-#define	CP0_CACHEERRI		$27	/* CacheErr (Icache) */
-#define	CP0_CACHEERRD		$27, 1	/* CacheErr (Dcache) */
-#define	CP0_TAGLOI		$28	/* TagLo Register (Icache) */
-#define	CP0_TAGLOD		$28, 2	/* TagLo Register (Dcache) */
-#define	CP0_DATALOI		$28, 1	/* DataLo Register (Icache) */
-#define	CP0_DATALOD		$28, 3	/* DataLo Register (Dcache) */
-#define	CP0_TAGHI		$29, 2	/* TagHi Register */
-#define	CP0_DATAHII		$29, 1	/* DataHi Register (Icache) */
-#define	CP0_DATAHID		$29, 3	/* DataHi Register (Dcache) */
-#define	CP0_CVMCTL		$9, 7	/* CvmCtl Register */
-#define	CP0_CVMMEMCTL		$11, 7	/* CvmMemCtl Register */
-#define	CP0_CVMCNT		$9, 6	/* CvmCount Register */
-#define	CP0_MCD			$22	/* Multi-Core Debug Register */
-#endif
-
 /*  register bits */
 
-/* Index Register */
-
-#define	CP0_INDEX_PUINT32_C(0x8000)
-#define	CP0_INDEX_XXX_30_5			0x7fe0
-#define	CP0_INDEX_INDEX0x001f
-
-/* Random Register */
-
-#define	CP0_RANDOM_XXX_31_5			0xffe0
-#define	CP0_RANDOM_RANDOM			0x001f
-
-/* EntryLo0, EntryLo1 Registers */
-
-#define	CP0_ENTRYLON_FILL			UINT64_C(0xf800)
-#define	CP0_ENTRYLON_PFNX			UINT64_C(0x07ffc000)
-#define	CP0_ENTRYLON_PFN			UINT64_C(0x3fc0)
-#define	CP0_ENTRYLON_CUINT64_C(0x0038)
-#define	CP0_ENTRYLON_DUINT64_C(0x0004)
-#define	CP0_ENTRYLON_VUINT64_C(0x0002)
-#define	CP0_ENTRYLON_GUINT64_C(0x0001)
-
-/* Context Register */
-
-#define	CP0_CONTEXT_PTEBASE			UINT64_C(0xff80)
-#define	CP0_CONTEXT_BADVPN2			UINT64_C(0x0070)
-#define	CP0_CONTEXT_XXX_3_0			UINT64_C(0x000f)
-
-/* PageMask Register */
-
-#define	CP0_PAGEMASK_XXX_31_29			UINT64_C(0xe000)
-#define	CP0_PAGEMASK_MASK			UINT64_C(0x1fffe000)
-#define	CP0_PAGEMASK_MASKX			UINT64_C(0x1800)

CVS commit: xsrc/external/mit/xorg-server/dist/hw/sun

2020-07-26 Thread Izumi Tsutsui
Module Name:xsrc
Committed By:   tsutsui
Date:   Sun Jul 26 07:35:37 UTC 2020

Modified Files:
xsrc/external/mit/xorg-server/dist/hw/sun: sunFbs.c

Log Message:
Explicitly initialize origColormapValid for readability.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 xsrc/external/mit/xorg-server/dist/hw/sun/sunFbs.c

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

Modified files:

Index: xsrc/external/mit/xorg-server/dist/hw/sun/sunFbs.c
diff -u xsrc/external/mit/xorg-server/dist/hw/sun/sunFbs.c:1.2 xsrc/external/mit/xorg-server/dist/hw/sun/sunFbs.c:1.3
--- xsrc/external/mit/xorg-server/dist/hw/sun/sunFbs.c:1.2	Sun Jul 26 07:20:50 2020
+++ xsrc/external/mit/xorg-server/dist/hw/sun/sunFbs.c	Sun Jul 26 07:35:37 2020
@@ -141,6 +141,7 @@ sunScreenAllocate(ScreenPtr pScreen)
 if (!pPrivate)
 	return FALSE;
 
+pPrivate->origColormapValid = FALSE;
 sunSetScreenPrivate(pScreen, pPrivate);
 return TRUE;
 }



CVS commit: src/sys/arch/aarch64/aarch64

2020-07-26 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Sun Jul 26 07:26:52 UTC 2020

Modified Files:
src/sys/arch/aarch64/aarch64: trap.c

Log Message:
add support swp,swpb instruction emulation


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/aarch64/aarch64/trap.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/aarch64/aarch64/trap.c
diff -u src/sys/arch/aarch64/aarch64/trap.c:1.32 src/sys/arch/aarch64/aarch64/trap.c:1.33
--- src/sys/arch/aarch64/aarch64/trap.c:1.32	Sun Jul 26 07:25:38 2020
+++ src/sys/arch/aarch64/aarch64/trap.c	Sun Jul 26 07:26:52 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.32 2020/07/26 07:25:38 ryo Exp $ */
+/* $NetBSD: trap.c,v 1.33 2020/07/26 07:26:52 ryo Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.32 2020/07/26 07:25:38 ryo Exp $");
+__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.33 2020/07/26 07:26:52 ryo Exp $");
 
 #include "opt_arm_intr_impl.h"
 #include "opt_compat_netbsd32.h"
@@ -588,6 +588,46 @@ arm_cond_match(uint32_t insn, uint64_t s
 	return (!match != !invert);
 }
 
+uint8_t atomic_swap_8(volatile uint8_t *, uint8_t);
+
+static int
+emul_arm_swp(uint32_t insn, struct trapframe *tf)
+{
+	struct faultbuf fb;
+	vaddr_t vaddr;
+	uint32_t val;
+	int Rn, Rd, Rm, error;
+
+	Rn = __SHIFTOUT(insn, 0x000f);
+	Rd = __SHIFTOUT(insn, 0xf000);
+	Rm = __SHIFTOUT(insn, 0x000f);
+
+	vaddr = tf->tf_reg[Rn] & 0x;
+	val = tf->tf_reg[Rm];
+
+	/* fault if insn is swp, and unaligned access */
+	if ((insn & 0x0040) == 0 && (vaddr & 3) != 0) {
+		tf->tf_far = vaddr;
+		return EFAULT;
+	}
+
+	/* vaddr will always point to userspace, since it has only 32bit */
+	if ((error = cpu_set_onfault()) == 0) {
+		if (insn & 0x0040) {
+			/* swpb */
+			val = atomic_swap_8(vaddr, val);
+		} else {
+			/* swp */
+			val = atomic_swap_32(vaddr, val);
+		}
+		cpu_unset_onfault();
+		tf->tf_reg[Rd] = val;
+	} else {
+		tf->tf_far = reg_far_el1_read();
+	}
+	return error;
+}
+
 static enum emul_arm_result
 emul_thumb_insn(struct trapframe *tf, uint32_t insn, int insn_size)
 {
@@ -635,6 +675,15 @@ emul_arm_insn(struct trapframe *tf)
 	if ((insn & 0xf000) == 0xf000)
 		goto unknown_insn;
 
+	/* swp,swpb */
+	if ((insn & 0x0fb00ff0) == 0x0190) {
+		if (arm_cond_match(insn, tf->tf_spsr)) {
+			if (emul_arm_swp(insn, tf) != 0)
+return EMUL_ARM_FAULT;
+		}
+		goto emulated;
+	}
+
 	/*
 	 * Emulate ARMv6 instructions with cache operations
 	 * register (c7), that can be used in user mode.



CVS commit: src/sys/arch/aarch64/aarch64

2020-07-26 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Sun Jul 26 07:25:38 UTC 2020

Modified Files:
src/sys/arch/aarch64/aarch64: trap.c

Log Message:
- add support conditionally execution for A32 instruction emulation
- separated the processing of ARM and THUMB emul clearly. do not confuse the 
Thumb-32bit instruction with the ARM instruction.
- use far_el1 instead of tf_pc to return correct fault address when instruction 
emulation


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/aarch64/aarch64/trap.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/aarch64/aarch64/trap.c
diff -u src/sys/arch/aarch64/aarch64/trap.c:1.31 src/sys/arch/aarch64/aarch64/trap.c:1.32
--- src/sys/arch/aarch64/aarch64/trap.c:1.31	Wed Jul  8 03:45:13 2020
+++ src/sys/arch/aarch64/aarch64/trap.c	Sun Jul 26 07:25:38 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.31 2020/07/08 03:45:13 ryo Exp $ */
+/* $NetBSD: trap.c,v 1.32 2020/07/26 07:25:38 ryo Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.31 2020/07/08 03:45:13 ryo Exp $");
+__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.32 2020/07/26 07:25:38 ryo Exp $");
 
 #include "opt_arm_intr_impl.h"
 #include "opt_compat_netbsd32.h"
@@ -374,8 +374,10 @@ emul_aarch64_insn(struct trapframe *tf)
 {
 	uint32_t insn;
 
-	if (ufetch_32((uint32_t *)tf->tf_pc, ))
+	if (ufetch_32((uint32_t *)tf->tf_pc, )) {
+		tf->tf_far = reg_far_el1_read();
 		return EMUL_ARM_FAULT;
+	}
 
 	if ((insn & 0xffe0) == 0xd53b0020) {
 		/* mrs x?,ctr_el0 */
@@ -457,7 +459,7 @@ trap_el0_sync(struct trapframe *tf)
 			goto unknown;
 		case EMUL_ARM_FAULT:
 			do_trapsignal(l, SIGSEGV, SEGV_MAPERR,
-			(void *)tf->tf_pc, esr);
+			(void *)tf->tf_far, esr);
 			break;
 		}
 		userret(l);
@@ -550,74 +552,126 @@ fetch_arm_insn(uint64_t pc, uint64_t sps
 	return 4;
 }
 
+static bool
+arm_cond_match(uint32_t insn, uint64_t spsr)
+{
+	bool invert = (insn >> 28) & 1;
+	bool match;
+
+	switch (insn >> 29) {
+	case 0:	/* EQ or NE */
+		match = spsr & SPSR_Z;
+		break;
+	case 1:	/* CS/HI or CC/LO */
+		match = spsr & SPSR_C;
+		break;
+	case 2:	/* MI or PL */
+		match = spsr & SPSR_N;
+		break;
+	case 3:	/* VS or VC */
+		match = spsr & SPSR_V;
+		break;
+	case 4:	/* HI or LS */
+		match = ((spsr & (SPSR_C | SPSR_Z)) == SPSR_C);
+		break;
+	case 5:	/* GE or LT */
+		match = (!(spsr & SPSR_N) == !(spsr & SPSR_V));
+		break;
+	case 6:	/* GT or LE */
+		match = !(spsr & SPSR_Z) &&
+		(!(spsr & SPSR_N) == !(spsr & SPSR_V));
+		break;
+	case 7:	/* AL */
+		match = true;
+		break;
+	}
+	return (!match != !invert);
+}
+
+static enum emul_arm_result
+emul_thumb_insn(struct trapframe *tf, uint32_t insn, int insn_size)
+{
+	/* T32-16bit or 32bit instructions */
+	switch (insn_size) {
+	case 2:
+		/* Breakpoint used by GDB */
+		if (insn == 0xdefe) {
+			do_trapsignal(curlwp, SIGTRAP, TRAP_BRKPT,
+			(void *)tf->tf_pc, 0);
+			return EMUL_ARM_SUCCESS;
+		}
+		/* XXX: some T32 IT instruction deprecated should be emulated */
+		break;
+	case 4:
+		break;
+	default:
+		return EMUL_ARM_FAULT;
+	}
+	return EMUL_ARM_UNKNOWN;
+}
+
 static enum emul_arm_result
 emul_arm_insn(struct trapframe *tf)
 {
-	struct lwp * const l = curlwp;
 	uint32_t insn;
 	int insn_size;
 
 	insn_size = fetch_arm_insn(tf->tf_pc, tf->tf_spsr, );
+	tf->tf_far = reg_far_el1_read();
 
-	switch (insn_size) {
-	case 2:
-		/* T32-16bit instruction */
+	if (tf->tf_spsr & SPSR_A32_T)
+		return emul_thumb_insn(tf, insn, insn_size);
+	if (insn_size != 4)
+		return EMUL_ARM_FAULT;
 
-		/*
-		 * Breakpoint used by GDB.
-		 */
-		if (insn == 0xdefe)
-			goto trap;
+	/* Breakpoint used by GDB */
+	if (insn == 0xe611 || insn == 0xe7ffdefe) {
+		do_trapsignal(curlwp, SIGTRAP, TRAP_BRKPT,
+		(void *)tf->tf_pc, 0);
+		return EMUL_ARM_SUCCESS;
+	}
 
-		/* XXX: some T32 IT instruction deprecated should be emulated */
-		break;
-	case 4:
-		/* T32-32bit instruction, or A32 instruction */
+	/* Unconditional instruction extension space? */
+	if ((insn & 0xf000) == 0xf000)
+		goto unknown_insn;
 
-		/*
-		 * Breakpoint used by GDB.
-		 */
-		if (insn == 0xe611 || insn == 0xe7ffdefe) {
- trap:
-			do_trapsignal(l, SIGTRAP, TRAP_BRKPT,
-			(void *)tf->tf_pc, 0);
-			return 0;
-		}
-
-		/*
-		 * Emulate ARMv6 instructions with cache operations
-		 * register (c7), that can be used in user mode.
-		 */
-		switch (insn & 0x0fff0fff) {
-		case 0x0e070f95:
+	/*
+	 * Emulate ARMv6 instructions with cache operations
+	 * register (c7), that can be used in user mode.
+	 */
+	switch (insn & 0x0fff0fff) {
+	case 0x0e070f95:
+		if (arm_cond_match(insn, tf->tf_spsr)) {
 			/*
 			 * mcr p15, 0, , c7, c5, 4
 			 * (flush prefetch buffer)
 			 */
 			__asm __volatile("isb sy" ::: "memory");
-			goto emulated;
-		case 0x0e070f9a:
+		}
+		goto 

CVS commit: src/usr.bin/make

2020-07-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul 26 07:24:27 UTC 2020

Modified Files:
src/usr.bin/make: lst.c

Log Message:
make(1): replace macros with functions


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/lst.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/make/lst.c
diff -u src/usr.bin/make/lst.c:1.1 src/usr.bin/make/lst.c:1.2
--- src/usr.bin/make/lst.c:1.1	Sun Jul 26 07:15:26 2020
+++ src/usr.bin/make/lst.c	Sun Jul 26 07:24:27 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: lst.c,v 1.1 2020/07/26 07:15:26 rillig Exp $ */
+/* $NetBSD: lst.c,v 1.2 2020/07/26 07:24:27 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -36,11 +36,11 @@
 #include "make_malloc.h"
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: lst.c,v 1.1 2020/07/26 07:15:26 rillig Exp $";
+static char rcsid[] = "$NetBSD: lst.c,v 1.2 2020/07/26 07:24:27 rillig Exp $";
 #else
 #include 
 #ifndef lint
-__RCSID("$NetBSD: lst.c,v 1.1 2020/07/26 07:15:26 rillig Exp $");
+__RCSID("$NetBSD: lst.c,v 1.2 2020/07/26 07:24:27 rillig Exp $");
 #endif /* not lint */
 #endif
 
@@ -85,24 +85,34 @@ typedef struct	List {
 #define	PAlloc(var,ptype)	var = (ptype) bmake_malloc(sizeof *(var))
 
 /*
- * LstValid (l) --
- *	Return TRUE if the list l is valid
+ * LstValid --
+ *	Return TRUE if the list is valid
  */
-#define LstValid(l)	((Lst)(l) != NULL)
+static Boolean
+LstValid(Lst l)
+{
+return l != NULL;
+}
 
 /*
- * LstNodeValid (ln, l) --
- *	Return TRUE if the LstNode ln is valid with respect to l
+ * LstNodeValid --
+ *	Return TRUE if the list node is valid
  */
-#define LstNodeValid(ln, l)	((ln) != NULL)
+static Boolean
+LstNodeValid(LstNode ln)
+{
+return ln != NULL;
+}
 
 /*
  * LstIsEmpty (l) --
  *	TRUE if the list l is empty.
  */
-#define LstIsEmpty(l)	(((List)(l))->firstPtr == NULL)
-
-/*	$NetBSD: lst.c,v 1.1 2020/07/26 07:15:26 rillig Exp $	*/
+static Boolean
+LstIsEmpty(Lst l)
+{
+return l->firstPtr == NULL;
+}
 
 /*-
  *---
@@ -275,7 +285,7 @@ Lst_InsertBefore(Lst l, LstNode ln, void
 if (LstValid (l) && (LstIsEmpty (l) && ln == NULL))
 	goto ok;
 
-if (!LstValid (l) || LstIsEmpty (l) || !LstNodeValid (ln, l)) {
+if (!LstValid (l) || LstIsEmpty (l) || !LstNodeValid (ln)) {
 	return FAILURE;
 }
 
@@ -341,7 +351,7 @@ Lst_InsertAfter(Lst l, LstNode ln, void 
 	goto ok;
 }
 
-if (!LstValid (l) || LstIsEmpty (l)  || ! LstNodeValid (ln, l)) {
+if (!LstValid (l) || LstIsEmpty (l)  || ! LstNodeValid (ln)) {
 	return FAILURE;
 }
 ok:
@@ -447,7 +457,7 @@ Lst_Remove(Lst l, LstNode ln)
 List 	list = l;
 ListNode	lNode = ln;
 
-if (!LstValid (l) || !LstNodeValid (ln, l)) {
+if (!LstValid (l) || !LstNodeValid (ln)) {
 	return FAILURE;
 }
 
@@ -722,7 +732,7 @@ Lst_FindFrom(Lst l, LstNode ln, const vo
 {
 ListNode	tln;
 
-if (!LstValid (l) || LstIsEmpty (l) || !LstNodeValid (ln, l)) {
+if (!LstValid (l) || LstIsEmpty (l) || !LstNodeValid (ln)) {
 	return NULL;
 }
 



CVS commit: xsrc/external/mit/xorg-server/dist/hw/sun

2020-07-26 Thread Izumi Tsutsui
Module Name:xsrc
Committed By:   tsutsui
Date:   Sun Jul 26 07:20:50 UTC 2020

Modified Files:
xsrc/external/mit/xorg-server/dist/hw/sun: sun.h sunCfb.c sunFbs.c

Log Message:
Implement functions to restore palette settings on exiting Xserver.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 xsrc/external/mit/xorg-server/dist/hw/sun/sun.h \
xsrc/external/mit/xorg-server/dist/hw/sun/sunFbs.c
cvs rdiff -u -r1.4 -r1.5 xsrc/external/mit/xorg-server/dist/hw/sun/sunCfb.c

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

Modified files:

Index: xsrc/external/mit/xorg-server/dist/hw/sun/sun.h
diff -u xsrc/external/mit/xorg-server/dist/hw/sun/sun.h:1.1 xsrc/external/mit/xorg-server/dist/hw/sun/sun.h:1.2
--- xsrc/external/mit/xorg-server/dist/hw/sun/sun.h:1.1	Wed Jul 22 20:38:29 2020
+++ xsrc/external/mit/xorg-server/dist/hw/sun/sun.h	Sun Jul 26 07:20:50 2020
@@ -247,11 +247,21 @@ typedef struct {
 CursorPtr	pCursor;		/* current cursor */
 } sunCursorRec, *sunCursorPtr;
 
+#define NCMAP	256
+typedef struct {
+u_char	origRed[NCMAP];
+u_char	origGreen[NCMAP];
+u_char	origBlue[NCMAP];
+} sunCmapRec, *sunCmapPtr;
+
 typedef struct {
 ColormapPtr	installedMap;
 CloseScreenProcPtr CloseScreen;
 void	(*UpdateColormap)(ScreenPtr, int, int, u_char *, u_char *, u_char *);
 void	(*GetColormap)(ScreenPtr, int, int, u_char *, u_char *, u_char *);
+Bool	origColormapValid;
+sunCmapRec	origColormap;
+void	(*RestoreColormap)(ScreenPtr);
 sunCursorRechardwareCursor;
 Bool	hasHardwareCursor;
 } sunScreenRec, *sunScreenPtr;
Index: xsrc/external/mit/xorg-server/dist/hw/sun/sunFbs.c
diff -u xsrc/external/mit/xorg-server/dist/hw/sun/sunFbs.c:1.1 xsrc/external/mit/xorg-server/dist/hw/sun/sunFbs.c:1.2
--- xsrc/external/mit/xorg-server/dist/hw/sun/sunFbs.c:1.1	Wed Jul 22 20:38:29 2020
+++ xsrc/external/mit/xorg-server/dist/hw/sun/sunFbs.c	Sun Jul 26 07:20:50 2020
@@ -137,7 +137,7 @@ sunScreenAllocate(ScreenPtr pScreen)
 	ErrorF("dixRegisterPrivateKey failed");
 	return FALSE;
 }
-pPrivate = malloc (sizeof (sunScreenRec));
+pPrivate = calloc(1, sizeof (sunScreenRec));
 if (!pPrivate)
 	return FALSE;
 
@@ -171,6 +171,8 @@ closeScreen(ScreenPtr pScreen)
 #if 0	/* XXX GX is disabled for now */
 sunDisableCursor (pScreen);
 #endif
+if (pPrivate->origColormapValid)
+	(*pPrivate->RestoreColormap)(pScreen);
 pScreen->CloseScreen = pPrivate->CloseScreen;
 ret = (*pScreen->CloseScreen) (pScreen);
 (void) (*pScreen->SaveScreen) (pScreen, SCREEN_SAVER_OFF);

Index: xsrc/external/mit/xorg-server/dist/hw/sun/sunCfb.c
diff -u xsrc/external/mit/xorg-server/dist/hw/sun/sunCfb.c:1.4 xsrc/external/mit/xorg-server/dist/hw/sun/sunCfb.c:1.5
--- xsrc/external/mit/xorg-server/dist/hw/sun/sunCfb.c:1.4	Sun Jul 26 07:19:09 2020
+++ xsrc/external/mit/xorg-server/dist/hw/sun/sunCfb.c	Sun Jul 26 07:20:50 2020
@@ -94,11 +94,15 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
 static void CGUpdateColormap(ScreenPtr, int, int, u_char *, u_char *, u_char *);
 static void CGGetColormap(ScreenPtr, int, int, u_char *, u_char *, u_char *);
 static void CGStoreColors(ColormapPtr, int, xColorItem *);
+static void CGSaveColormap(ScreenPtr);
+static void CGRestoreColormap(ScreenPtr);
+static void CGScreenInitCommon(ScreenPtr);
 static void CGScreenInit(ScreenPtr);
 static void checkMono(int, char **);
 #ifdef INCLUDE_CG2_HEADER
 static void CG2UpdateColormap(ScreenPtr, int, int, u_char *, u_char *, u_char *);
 static void CG2GetColormap(ScreenPtr, int, int, u_char *, u_char *, u_char *);
+static void CG2RestoreColormap(ScreenPtr);
 static Bool CG2SaveScreen(ScreenPtr, int);
 static void CG2ScreenInit(ScreenPtr pScreen);
 #endif
@@ -246,22 +250,61 @@ CGStoreColors(ColormapPtr pmap, int ndef
 }
 
 static void
-CGScreenInit(ScreenPtr pScreen)
+CGSaveColormap(ScreenPtr pScreen)
 {
-#ifndef STATIC_COLOR /* { */
 sunScreenPtr pPrivate = sunGetScreenPrivate(pScreen);
+sunCmapPtr origColormap;
+u_char *rmap, *gmap, *bmap;
+
+origColormap = >origColormap;
+rmap = origColormap->origRed;
+gmap = origColormap->origGreen;
+bmap = origColormap->origBlue;
+(*pPrivate->GetColormap)(pScreen, 0, NCMAP, rmap, gmap, bmap);
+}
+
+static void
+CGRestoreColormap(ScreenPtr pScreen)
+{
+sunScreenPtr pPrivate = sunGetScreenPrivate(pScreen);
+sunCmapPtr origColormap;
+u_char *rmap, *gmap, *bmap;
+
+if (pPrivate->origColormapValid) {
+	origColormap = >origColormap;
+	rmap = origColormap->origRed;
+	gmap = origColormap->origGreen;
+	bmap = origColormap->origBlue;
+	(*pPrivate->UpdateColormap)(pScreen, 0, NCMAP, rmap, gmap, bmap);
+}
+}
+
+static void
+CGScreenInitCommon(ScreenPtr pScreen)
+{
 pScreen->InstallColormap = sunInstallColormap;
 pScreen->UninstallColormap = sunUninstallColormap;
 

  1   2   >