CVS commit: src

2020-09-24 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Sep 25 05:56:59 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-undef-partial.exp
varparse-undef-partial.mk

Log Message:
make(1): add test for partial expansion of undefined variables


To generate a diff of this commit:
cvs rdiff -u -r1.927 -r1.928 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.148 -r1.149 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/varparse-undef-partial.exp \
src/usr.bin/make/unit-tests/varparse-undef-partial.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.927 src/distrib/sets/lists/tests/mi:1.928
--- src/distrib/sets/lists/tests/mi:1.927	Wed Sep 23 03:33:54 2020
+++ src/distrib/sets/lists/tests/mi	Fri Sep 25 05:56:59 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.927 2020/09/23 03:33:54 rillig Exp $
+# $NetBSD: mi,v 1.928 2020/09/25 05:56:59 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -5172,6 +5172,8 @@
 ./usr/tests/usr.bin/make/unit-tests/varname.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.mktests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/varparse-undef-partial.exp			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/varparse-undef-partial.mk			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/varquote.exptests-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.exptests-usr.bin-tests	compattestfile,atf

Index: src/usr.bin/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.148 src/usr.bin/make/unit-tests/Makefile:1.149
--- src/usr.bin/make/unit-tests/Makefile:1.148	Wed Sep 23 07:54:08 2020
+++ src/usr.bin/make/unit-tests/Makefile	Fri Sep 25 05:56:59 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.148 2020/09/23 07:54:08 rillig Exp $
+# $NetBSD: Makefile,v 1.149 2020/09/25 05:56:59 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -347,6 +347,7 @@ TESTS+=		varname-makeflags
 TESTS+=		varname-pwd
 TESTS+=		varname-vpath
 TESTS+=		varparse-dynamic
+TESTS+=		varparse-undef-partial
 TESTS+=		varquote
 TESTS+=		varshell
 

Added files:

Index: src/usr.bin/make/unit-tests/varparse-undef-partial.exp
diff -u /dev/null src/usr.bin/make/unit-tests/varparse-undef-partial.exp:1.1
--- /dev/null	Fri Sep 25 05:56:59 2020
+++ src/usr.bin/make/unit-tests/varparse-undef-partial.exp	Fri Sep 25 05:56:59 2020
@@ -0,0 +1 @@
+exit status 0
Index: src/usr.bin/make/unit-tests/varparse-undef-partial.mk
diff -u /dev/null src/usr.bin/make/unit-tests/varparse-undef-partial.mk:1.1
--- /dev/null	Fri Sep 25 05:56:59 2020
+++ src/usr.bin/make/unit-tests/varparse-undef-partial.mk	Fri Sep 25 05:56:59 2020
@@ -0,0 +1,64 @@
+# $NetBSD: varparse-undef-partial.mk,v 1.1 2020/09/25 05:56:59 rillig Exp $
+
+# When an undefined variable is expanded in a ':=' assignment, only the
+# initial '$' of the variable expression is skipped by the parser, while
+# the remaining expression is evaluated.  In edge cases this can lead to
+# a completely different interpretation of the partially expanded text.
+
+LIST=	${DEF} ${UNDEF} ${VAR.${PARAM}} end
+DEF=	defined
+PARAM=	:Q
+
+# The expression ${VAR.{PARAM}} refers to the variable named "VAR.:Q",
+# with the ":Q" being part of the name.  This variable is not defined,
+# therefore the initial '$' of that whole expression is skipped by the
+# parser (see Var_Subst, the Buf_AddByte in the else branch) and the rest
+# of the expression is expanded as usual.
+#
+# The resulting variable expression is ${VAR.:Q}, which means that the
+# interpretation of the ":Q" has changed from being part of the variable
+# name to being a variable modifier.  This is a classical code injection.
+EVAL:=	${LIST}
+.if ${EVAL} != "defined   end"
+.  error ${EVAL}
+.endif
+
+# Define the possible outcomes, to see which of them gets expanded.
+VAR.=		var-dot without parameter
+${:UVAR.\:Q}=	var-dot with parameter :Q
+
+# At this point, the variable "VAR." is defined, therefore the expression
+# ${VAR.:Q} is expanded as usual.
+.if ${EVAL} != "defined  var-dot\\ without\\ parameter end"
+.  error ${EVAL}
+.endif
+
+# In contrast to the previous line, evaluating the original LIST again now
+# produces a different result since the ":Q" has already been inserted
+# literally into the expression.  The variable named "VAR.:Q" is defined,
+# therefore it is resolved as usual.  The ":Q" is 

CVS commit: src/usr.bin/make

2020-09-24 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Sep 25 05:04:51 UTC 2020

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

Log Message:
make(1): rename local variables in Var_Subst

The variable name "str" did not make it clear enough that the pointer is
constantly moving, to parse the given string.  The name "p" expresses
this more clearly.


To generate a diff of this commit:
cvs rdiff -u -r1.536 -r1.537 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.536 src/usr.bin/make/var.c:1.537
--- src/usr.bin/make/var.c:1.536	Wed Sep 23 07:50:58 2020
+++ src/usr.bin/make/var.c	Fri Sep 25 05:04:51 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.536 2020/09/23 07:50:58 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.537 2020/09/25 05:04:51 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -121,7 +121,7 @@
 #include"metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.536 2020/09/23 07:50:58 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.537 2020/09/25 05:04:51 rillig Exp $");
 
 #define VAR_DEBUG_IF(cond, fmt, ...)	\
 if (!(DEBUG(VAR) && (cond)))	\
@@ -3720,6 +3720,7 @@ Var_Parse(const char **pp, GNode *ctxt, 
 VarParseResult
 Var_Subst(const char *str, GNode *ctxt, VarEvalFlags eflags, char **out_res)
 {
+const char *p = str;
 Buffer buf;			/* Buffer for forming things */
 
 /* Set true if an error has already been reported,
@@ -3729,8 +3730,8 @@ Var_Subst(const char *str, GNode *ctxt, 
 Buf_Init(, 0);
 errorReported = FALSE;
 
-while (*str) {
-	if (*str == '$' && str[1] == '$') {
+while (*p != '\0') {
+	if (p[0] == '$' && p[1] == '$') {
 	/*
 	 * A dollar sign may be escaped with another dollar sign.
 	 * In such a case, we skip over the escape character and store the
@@ -3739,22 +3740,22 @@ Var_Subst(const char *str, GNode *ctxt, 
 	if (save_dollars && (eflags & VARE_ASSIGN))
 		Buf_AddByte(, '$');
 	Buf_AddByte(, '$');
-	str += 2;
-	} else if (*str != '$') {
+	p += 2;
+	} else if (*p != '$') {
 	/*
 	 * Skip as many characters as possible -- either to the end of
 	 * the string or to the next dollar sign (variable expression).
 	 */
-	const char *cp;
+	const char *plainStart = p;
 
-	for (cp = str++; *str != '$' && *str != '\0'; str++)
+	for (p++; *p != '$' && *p != '\0'; p++)
 		continue;
-	Buf_AddBytesBetween(, cp, str);
+	Buf_AddBytesBetween(, plainStart, p);
 	} else {
-	const char *nested_str = str;
+	const char *nested_p = p;
 	void *freeIt;
 	const char *val;
-	(void)Var_Parse(_str, ctxt, eflags, , );
+	(void)Var_Parse(_p, ctxt, eflags, , );
 	/* TODO: handle errors */
 
 	if (val == var_Error || val == varUndefined) {
@@ -3765,7 +3766,7 @@ Var_Subst(const char *str, GNode *ctxt, 
 		 * the string...
 		 */
 		if (oldVars) {
-		str = nested_str;
+		p = nested_p;
 		} else if ((eflags & VARE_UNDEFERR) || val == var_Error) {
 		/*
 		 * If variable is undefined, complain and skip the
@@ -3774,16 +3775,16 @@ Var_Subst(const char *str, GNode *ctxt, 
 		 */
 		if (!errorReported) {
 			Parse_Error(PARSE_FATAL, "Undefined variable \"%.*s\"",
-(int)(size_t)(nested_str - str), str);
+(int)(size_t)(nested_p - p), p);
 		}
-		str = nested_str;
+		p = nested_p;
 		errorReported = TRUE;
 		} else {
-		Buf_AddByte(, *str);
-		str++;
+		Buf_AddByte(, *p);
+		p++;
 		}
 	} else {
-		str = nested_str;
+		p = nested_p;
 		Buf_AddStr(, val);
 	}
 	free(freeIt);



CVS commit: src/usr.bin/make

2020-09-24 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Sep 25 04:18:11 UTC 2020

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

Log Message:
make(1): fix build on Debian 9

lst.h:92:5: error: unknown type name 'uint8_t'

It had been broken since the previous commit on 2020-09-24 08:23:29.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/usr.bin/make/lst.c
cvs rdiff -u -r1.66 -r1.67 src/usr.bin/make/lst.h

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.70 src/usr.bin/make/lst.c:1.71
--- src/usr.bin/make/lst.c:1.70	Thu Sep 24 08:23:29 2020
+++ src/usr.bin/make/lst.c	Fri Sep 25 04:18:11 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: lst.c,v 1.70 2020/09/24 08:23:29 rillig Exp $ */
+/* $NetBSD: lst.c,v 1.71 2020/09/25 04:18:11 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -32,11 +32,9 @@
  * SUCH DAMAGE.
  */
 
-#include 
-
 #include "make.h"
 
-MAKE_RCSID("$NetBSD: lst.c,v 1.70 2020/09/24 08:23:29 rillig Exp $");
+MAKE_RCSID("$NetBSD: lst.c,v 1.71 2020/09/25 04:18:11 rillig Exp $");
 
 /* Allocate and initialize a list node.
  *

Index: src/usr.bin/make/lst.h
diff -u src/usr.bin/make/lst.h:1.66 src/usr.bin/make/lst.h:1.67
--- src/usr.bin/make/lst.h:1.66	Thu Sep 24 08:23:29 2020
+++ src/usr.bin/make/lst.h	Fri Sep 25 04:18:11 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: lst.h,v 1.66 2020/09/24 08:23:29 rillig Exp $	*/
+/*	$NetBSD: lst.h,v 1.67 2020/09/25 04:18:11 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -79,6 +79,7 @@
 #define MAKE_LST_H
 
 #include 
+#include 
 #include 
 
 /* A doubly-linked list of pointers. */



CVS commit: src/sys/arch/alpha

2020-09-24 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Sep 25 03:40:12 UTC 2020

Modified Files:
src/sys/arch/alpha/alpha: interrupt.c
src/sys/arch/alpha/common: shared_intr.c
src/sys/arch/alpha/include: cpu.h intr.h types.h
src/sys/arch/alpha/jensenio: com_jensenio.c jensenio_intr.c
jenseniovar.h pckbc_jensenio.c
src/sys/arch/alpha/pci: dwlpx.c pci_2100_a500.c pci_kn300.c pci_kn8ae.c
pci_machdep.c sio_pic.c
src/sys/arch/alpha/tc: tc_3000_300.c tc_3000_500.c tcasic.c

Log Message:
Changes to make interrupt {,dis}establish MP-safe on Alpha:
- Protect all of the system interrupt linkage with the cpu_lock mutex.
- Re-order some of the stores to the SCB vector table to make it safe
  in the face of lockless interrupt dispatch.
- Add a framework for routing interrupts to specific CPUs.  Interrupts
  are still funneled only to the primary CPU, but that will change for
  some systems soon.  Ensure that interrupt handler lists are manipulated
  only on the CPUs that handle that specific interrupt source.  This required
  a re-factor of the alpha_shared_intr_*() family of functions.
- Enable __HAVE_INTR_CONTROL, although interrupt redistribution is still
  a no-op.
- Reduce code duplication in the Jenson direct-SCB interrupt handlers.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/sys/arch/alpha/alpha/interrupt.c
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/alpha/common/shared_intr.c
cvs rdiff -u -r1.96 -r1.97 src/sys/arch/alpha/include/cpu.h
cvs rdiff -u -r1.80 -r1.81 src/sys/arch/alpha/include/intr.h
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/alpha/include/types.h
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/alpha/jensenio/com_jensenio.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/alpha/jensenio/jensenio_intr.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/alpha/jensenio/jenseniovar.h
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/alpha/jensenio/pckbc_jensenio.c
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/alpha/pci/dwlpx.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/alpha/pci/pci_2100_a500.c
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/alpha/pci/pci_kn300.c
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/alpha/pci/pci_kn8ae.c
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/alpha/pci/pci_machdep.c
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/alpha/pci/sio_pic.c
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/alpha/tc/tc_3000_300.c
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/alpha/tc/tc_3000_500.c
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/alpha/tc/tcasic.c

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

Modified files:

Index: src/sys/arch/alpha/alpha/interrupt.c
diff -u src/sys/arch/alpha/alpha/interrupt.c:1.89 src/sys/arch/alpha/alpha/interrupt.c:1.90
--- src/sys/arch/alpha/alpha/interrupt.c:1.89	Tue Sep 22 15:24:01 2020
+++ src/sys/arch/alpha/alpha/interrupt.c	Fri Sep 25 03:40:11 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: interrupt.c,v 1.89 2020/09/22 15:24:01 thorpej Exp $ */
+/* $NetBSD: interrupt.c,v 1.90 2020/09/25 03:40:11 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.89 2020/09/22 15:24:01 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.90 2020/09/25 03:40:11 thorpej Exp $");
 
 #include 
 #include 
@@ -88,11 +88,10 @@ __KERNEL_RCSID(0, "$NetBSD: interrupt.c,
 #include 
 #include 
 
+/* Protected by cpu_lock */
 struct scbvec scb_iovectab[SCB_VECTOIDX(SCB_SIZE - SCB_IOVECBASE)]
 			__read_mostly;
 
-void	netintr(void);
-
 void	scb_stray(void *, u_long);
 
 void
@@ -117,9 +116,8 @@ void
 scb_set(u_long vec, void (*func)(void *, u_long), void *arg)
 {
 	u_long idx;
-	int s;
 
-	s = splhigh();
+	KASSERT(mutex_owned(_lock));
 
 	if (vec < SCB_IOVECBASE || vec >= SCB_SIZE ||
 	(vec & (SCB_VECSIZE - 1)) != 0)
@@ -130,19 +128,18 @@ scb_set(u_long vec, void (*func)(void *,
 	if (scb_iovectab[idx].scb_func != scb_stray)
 		panic("scb_set: vector 0x%lx already occupied", vec);
 
-	scb_iovectab[idx].scb_func = func;
 	scb_iovectab[idx].scb_arg = arg;
-
-	splx(s);
+	alpha_mb();
+	scb_iovectab[idx].scb_func = func;
+	alpha_mb();
 }
 
 u_long
 scb_alloc(void (*func)(void *, u_long), void *arg)
 {
 	u_long vec, idx;
-	int s;
 
-	s = splhigh();
+	KASSERT(mutex_owned(_lock));
 
 	/*
 	 * Allocate "downwards", to avoid bumping into
@@ -153,15 +150,14 @@ scb_alloc(void (*func)(void *, u_long), 
 	 vec >= SCB_IOVECBASE; vec -= SCB_VECSIZE) {
 		idx = SCB_VECTOIDX(vec - SCB_IOVECBASE);
 		if (scb_iovectab[idx].scb_func == scb_stray) {
-			scb_iovectab[idx].scb_func = func;
 			scb_iovectab[idx].scb_arg = arg;
-			splx(s);
+			alpha_mb();
+			scb_iovectab[idx].scb_func = func;
+			alpha_mb();
 			return (vec);
 		}
 	}
 
-	splx(s);
-
 	return (SCB_ALLOC_FAILED);
 }
 
@@ -169,9 +165,8 @@ void
 scb_free(u_long vec)
 {
 	u_long idx;
-	int s;
 
-	s = splhigh();
+	

CVS commit: src/sys/ufs

2020-09-24 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Sep 24 17:20:53 UTC 2020

Modified Files:
src/sys/ufs: files.ufs

Log Message:
lfs: Include lfs_debug.c only if DEBUG is enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/ufs/files.ufs

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

Modified files:

Index: src/sys/ufs/files.ufs
diff -u src/sys/ufs/files.ufs:1.48 src/sys/ufs/files.ufs:1.49
--- src/sys/ufs/files.ufs:1.48	Sat May 16 18:31:53 2020
+++ src/sys/ufs/files.ufs	Thu Sep 24 17:20:53 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: files.ufs,v 1.48 2020/05/16 18:31:53 christos Exp $
+#	$NetBSD: files.ufs,v 1.49 2020/09/24 17:20:53 riastradh Exp $
 
 deffs	FFS
 deffs	EXT2FS
@@ -68,7 +68,7 @@ file	ufs/lfs/lfs_alloc.c		lfs
 file	ufs/lfs/lfs_balloc.c		lfs
 file	ufs/lfs/lfs_bio.c		lfs
 file	ufs/lfs/lfs_cksum.c		lfs
-file	ufs/lfs/lfs_debug.c		lfs
+file	ufs/lfs/lfs_debug.c		lfs & debug
 file	ufs/lfs/lfs_inode.c		lfs
 file	ufs/lfs/lfs_itimes.c		lfs
 file	ufs/lfs/lfs_pages.c		lfs



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

2020-09-24 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Sep 24 16:15:49 UTC 2020

Modified Files:
src/sys/arch/aarch64/aarch64: bus_space_asm_generic.S

Log Message:
fix *_bs_rm_4_swap(). it was only reading 2 bytes, not 4 bytes.

pointed out by skrll@ thanks.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/aarch64/aarch64/bus_space_asm_generic.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/aarch64/aarch64/bus_space_asm_generic.S
diff -u src/sys/arch/aarch64/aarch64/bus_space_asm_generic.S:1.3 src/sys/arch/aarch64/aarch64/bus_space_asm_generic.S:1.4
--- src/sys/arch/aarch64/aarch64/bus_space_asm_generic.S:1.3	Thu Sep 24 09:04:38 2020
+++ src/sys/arch/aarch64/aarch64/bus_space_asm_generic.S	Thu Sep 24 16:15:49 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_space_asm_generic.S,v 1.3 2020/09/24 09:04:38 ryo Exp $	*/
+/*	$NetBSD: bus_space_asm_generic.S,v 1.4 2020/09/24 16:15:49 ryo Exp $	*/
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -29,7 +29,7 @@
 #include 
 #include "assym.h"
 
-RCSID("$NetBSD: bus_space_asm_generic.S,v 1.3 2020/09/24 09:04:38 ryo Exp $")
+RCSID("$NetBSD: bus_space_asm_generic.S,v 1.4 2020/09/24 16:15:49 ryo Exp $")
 
 .macro generate_bsfunc funcname, dsbop
 /* uint8_t {funcname}_bs_r_1(x0:tag, x1:addr, x2:offset) */
@@ -225,7 +225,7 @@ ENTRY_NP(\funcname\()_bs_rm_4_swap)
 	ldr	w8, [x0, #BS_STRIDE]
 	lsl	x8, x2, x8	/* offset <<= tag->bs_stride */
 1:
-	ldrh	w9, [x1, x8]
+	ldr	w9, [x1, x8]
 	subs	x4, x4, #1	/* count-- */
 	rev	w9, w9
 	str	w9, [x3], #4



CVS commit: src/external/gpl3/gdb/bin/gdbserver/arch/x86_64

2020-09-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Sep 24 14:54:03 UTC 2020

Added Files:
src/external/gpl3/gdb/bin/gdbserver/arch/x86_64: version.cc

Log Message:
Add the generated version file


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 \
src/external/gpl3/gdb/bin/gdbserver/arch/x86_64/version.cc

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

Added files:

Index: src/external/gpl3/gdb/bin/gdbserver/arch/x86_64/version.cc
diff -u /dev/null src/external/gpl3/gdb/bin/gdbserver/arch/x86_64/version.cc:1.1
--- /dev/null	Thu Sep 24 10:54:03 2020
+++ src/external/gpl3/gdb/bin/gdbserver/arch/x86_64/version.cc	Thu Sep 24 10:54:03 2020
@@ -0,0 +1,8 @@
+/* This file is automatically generated.  DO NOT EDIT! */
+/* Generated from: NetBSD: mknative-gdb,v 1.13 2020/09/23 23:21:29 christos Exp  */
+/* Generated from: NetBSD: mknative.common,v 1.16 2018/04/15 15:13:37 christos Exp  */
+
+#include "gdbsupport/version.h"
+const char version[] = "11.0.50.20200914-git";
+const char host_name[] = "x86_64--netbsd";
+const char target_name[] = "x86_64--netbsd";



CVS commit: src/external/gpl3/gdb/bin/gdbserver

2020-09-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Sep 24 14:53:35 UTC 2020

Modified Files:
src/external/gpl3/gdb/bin/gdbserver: Makefile

Log Message:
Add version.cc


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/gpl3/gdb/bin/gdbserver/Makefile

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

Modified files:

Index: src/external/gpl3/gdb/bin/gdbserver/Makefile
diff -u src/external/gpl3/gdb/bin/gdbserver/Makefile:1.2 src/external/gpl3/gdb/bin/gdbserver/Makefile:1.3
--- src/external/gpl3/gdb/bin/gdbserver/Makefile:1.2	Wed Sep 23 23:06:01 2020
+++ src/external/gpl3/gdb/bin/gdbserver/Makefile	Thu Sep 24 10:53:35 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.2 2020/09/24 03:06:01 kamil Exp $
+#	$NetBSD: Makefile,v 1.3 2020/09/24 14:53:35 christos Exp $
 
 NOCTF=
 NOMAN=
@@ -9,7 +9,7 @@ PROG=		gdbserver
 
 SERVER_SRCS+=	ax.cc debug.cc dll.cc hostio.cc hostio-errno.cc inferiors.cc mem-break.cc notif.cc
 SERVER_SRCS+=	regcache.cc remote-utils.cc server.cc symbol.cc target.cc
-SERVER_SRCS+=	tdesc.cc tracepoint.cc utils.cc waitstatus.c # version.c
+SERVER_SRCS+=	tdesc.cc tracepoint.cc utils.cc waitstatus.c version.cc
 
 NETBSD_SRCS=		netbsd-low.cc fork-child.cc fork-inferior.c netbsd-nat.c
 ARCH_SRCS=		netbsd-${MACHINE}-low.cc ${MACHINE}.c
@@ -57,4 +57,5 @@ CC:=			${CXX}
 CFLAGS:=		${CXXFLAGS} -std=gnu++11 -Wno-error=stack-protector -pthread
 
 .PATH: ${DIST}/gdbserver ${DIST}/gdb/nat ${DIST}/gdb/arch ${DIST}/gdb/target \
+	${.CURDIR}/arch/${GDB_MACHINE_ARCH} \
 	${DIST}/../lib/libgdbsupport/arch/${GDB_MACHINE_ARCH}



CVS commit: src/tools/gdb

2020-09-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Sep 24 14:53:17 UTC 2020

Modified Files:
src/tools/gdb: Makefile mknative-gdb

Log Message:
grab the gdbserver version


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/tools/gdb/Makefile
cvs rdiff -u -r1.13 -r1.14 src/tools/gdb/mknative-gdb

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

Modified files:

Index: src/tools/gdb/Makefile
diff -u src/tools/gdb/Makefile:1.39 src/tools/gdb/Makefile:1.40
--- src/tools/gdb/Makefile:1.39	Wed Sep 23 19:21:29 2020
+++ src/tools/gdb/Makefile	Thu Sep 24 10:53:17 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.39 2020/09/23 23:21:29 christos Exp $
+#	$NetBSD: Makefile,v 1.40 2020/09/24 14:53:17 christos Exp $
 
 .include 
 
@@ -117,7 +117,10 @@ native-gdb: .native/.configure_done
 		(cd ${.OBJDIR}/.native/bfd && \
 			${MKENV_BUILD_MAKE} bfd.h bfdver.h) && \
 		(cd ${.OBJDIR}/.native/gdb && \
-			${MKENV_BUILD_MAKE} init.c version.c)
+			${MKENV_BUILD_MAKE} init.c version.c) && \
+		(if [ -d ${.OBJDIR}/.native/gdbserver ]; then \
+			cd ${.OBJDIR}/.native/gdbserver && \
+			${MKENV_BUILD_MAKE} version-generated.cc; fi)
 	@touch $@
 
 clean: clean.native

Index: src/tools/gdb/mknative-gdb
diff -u src/tools/gdb/mknative-gdb:1.13 src/tools/gdb/mknative-gdb:1.14
--- src/tools/gdb/mknative-gdb:1.13	Wed Sep 23 19:21:29 2020
+++ src/tools/gdb/mknative-gdb	Thu Sep 24 10:53:17 2020
@@ -1,5 +1,5 @@
 #!/bin/sh
-#	$NetBSD: mknative-gdb,v 1.13 2020/09/23 23:21:29 christos Exp $
+#	$NetBSD: mknative-gdb,v 1.14 2020/09/24 14:53:17 christos Exp $
 #
 # Shell script for generating all the constants needed for a native
 # platform build of src/external/gpl3/gdb
@@ -222,6 +222,8 @@ get_gdb_bingdbserver () {
 
 	write_c $_CTF/arch/$_MACHINE_SUBDIR/config.h \
 		<$_TMPDIR/gdbserver/config.h
+	write_c $_CTF/arch/$_MACHINE_SUBDIR/version.cc \
+		<$_TMPDIR/gdbserver/version-generated.cc
 }
 
 # main #



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

2020-09-24 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Sep 24 14:14:18 UTC 2020

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

Log Message:
As indicated at the top of the file, don't simply remove entries.  Instead
we need to mark them "obsolete" so they will get removed if already in the
$DESTDIR


To generate a diff of this commit:
cvs rdiff -u -r1.2357 -r1.2358 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.2357 src/distrib/sets/lists/comp/mi:1.2358
--- src/distrib/sets/lists/comp/mi:1.2357	Tue Sep 22 23:12:06 2020
+++ src/distrib/sets/lists/comp/mi	Thu Sep 24 14:14:18 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2357 2020/09/22 23:12:06 nia Exp $
+#	$NetBSD: mi,v 1.2358 2020/09/24 14:14:18 pgoyette Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -7408,6 +7408,7 @@
 ./usr/share/man/cat3/getdiskrawname.0		comp-c-catman		.cat
 ./usr/share/man/cat3/getdomainname.0		comp-c-catman		.cat
 ./usr/share/man/cat3/getdtablesize.0		comp-c-catman		.cat
+./usr/share/man/cat3/getentropy.0		comp-c-catman		obsolete
 ./usr/share/man/cat3/getenv.0			comp-c-catman		.cat
 ./usr/share/man/cat3/getenv_r.0			comp-c-catman		.cat
 ./usr/share/man/cat3/getfsent.0			comp-c-catman		.cat
@@ -15658,6 +15659,7 @@
 ./usr/share/man/html3/getdiskrawname.html	comp-c-htmlman		html
 ./usr/share/man/html3/getdomainname.html	comp-c-htmlman		html
 ./usr/share/man/html3/getdtablesize.html	comp-c-htmlman		html
+./usr/share/man/html3/getentropy.html		comp-c-htmlman		obsolete
 ./usr/share/man/html3/getenv.html		comp-c-htmlman		html
 ./usr/share/man/html3/getenv_r.html		comp-c-htmlman		html
 ./usr/share/man/html3/getfsent.html		comp-c-htmlman		html
@@ -23845,6 +23847,7 @@
 ./usr/share/man/man3/getdiskrawname.3		comp-c-man		.man
 ./usr/share/man/man3/getdomainname.3		comp-c-man		.man
 ./usr/share/man/man3/getdtablesize.3		comp-c-man		.man
+./usr/share/man/man3/getentropy.3		comp-c-man		obsolete
 ./usr/share/man/man3/getenv.3			comp-c-man		.man
 ./usr/share/man/man3/getenv_r.3			comp-c-man		.man
 ./usr/share/man/man3/getfsent.3			comp-c-man		.man



CVS commit: src/sys/arch/arm/arm

2020-09-24 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Sep 24 11:02:02 UTC 2020

Modified Files:
src/sys/arch/arm/arm: bus_space_asm_generic.S

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/arm/bus_space_asm_generic.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/arm/arm/bus_space_asm_generic.S
diff -u src/sys/arch/arm/arm/bus_space_asm_generic.S:1.11 src/sys/arch/arm/arm/bus_space_asm_generic.S:1.12
--- src/sys/arch/arm/arm/bus_space_asm_generic.S:1.11	Mon Oct 28 22:50:25 2013
+++ src/sys/arch/arm/arm/bus_space_asm_generic.S	Thu Sep 24 11:02:02 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_space_asm_generic.S,v 1.11 2013/10/28 22:50:25 matt Exp $	*/
+/*	$NetBSD: bus_space_asm_generic.S,v 1.12 2020/09/24 11:02:02 skrll Exp $	*/
 
 /*
  * Copyright (c) 1997 Causality Limited.
@@ -529,7 +529,7 @@ ENTRY_NP(generic_armv4_bs_c_2)
 
 	adds	r0, r0, r2
 	adds	r1, r1, r2
-	negs	r2, r2	
+	negs	r2, r2
 
 1:	ldrh	r3, [r0, r2]
 	strh	r3, [r1, r2]



CVS commit: src/sys/dev/ic

2020-09-24 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Sep 24 09:59:11 UTC 2020

Modified Files:
src/sys/dev/ic: nvme.c

Log Message:
no need to swap pt.cmd.cdwXX at nvme_set_number_of_queues(). cmd.cdwXX will be 
swapped in nvme_pt_fill().


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/dev/ic/nvme.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/ic/nvme.c
diff -u src/sys/dev/ic/nvme.c:1.50 src/sys/dev/ic/nvme.c:1.51
--- src/sys/dev/ic/nvme.c:1.50	Tue Sep 22 11:53:10 2020
+++ src/sys/dev/ic/nvme.c	Thu Sep 24 09:59:11 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvme.c,v 1.50 2020/09/22 11:53:10 kardel Exp $	*/
+/*	$NetBSD: nvme.c,v 1.51 2020/09/24 09:59:11 ryo Exp $	*/
 /*	$OpenBSD: nvme.c,v 1.49 2016/04/18 05:59:50 dlg Exp $ */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.50 2020/09/22 11:53:10 kardel Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.51 2020/09/24 09:59:11 ryo Exp $");
 
 #include 
 #include 
@@ -1624,8 +1624,8 @@ nvme_set_number_of_queues(struct nvme_so
 
 	memset(, 0, sizeof(pt));
 	pt.cmd.opcode = NVM_ADMIN_SET_FEATURES;
-	htolem32(, NVM_FEATURE_NUMBER_OF_QUEUES);
-	htolem32(, ((nq - 1) << 16) | (nq - 1));
+	pt.cmd.cdw10 = NVM_FEATURE_NUMBER_OF_QUEUES;
+	pt.cmd.cdw11 = ((nq - 1) << 16) | (nq - 1);
 
 	memset(, 0, sizeof(state));
 	state.pt = 



CVS commit: src/sys/sys

2020-09-24 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Sep 24 09:37:07 UTC 2020

Modified Files:
src/sys/sys: ksyms.h

Log Message:
apply more _KERNEL and fix the amd64 (and probably more) build.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/sys/ksyms.h

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

Modified files:

Index: src/sys/sys/ksyms.h
diff -u src/sys/sys/ksyms.h:1.38 src/sys/sys/ksyms.h:1.39
--- src/sys/sys/ksyms.h:1.38	Wed Sep 23 09:52:02 2020
+++ src/sys/sys/ksyms.h	Thu Sep 24 09:37:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ksyms.h,v 1.38 2020/09/23 09:52:02 simonb Exp $	*/
+/*	$NetBSD: ksyms.h,v 1.39 2020/09/24 09:37:07 mrg Exp $	*/
 
 /*
  * Copyright (c) 2001, 2003 Anders Magnusson (ra...@ludd.luth.se).
@@ -126,6 +126,8 @@ struct ksyms_gvalue {
 #define KSYMS_PROC	0100	/* Procedures only */
 #define KSYMS_ANY	0200	/* Also local symbols (DDB use only) */
 
+#if defined(_KERNEL)
+
 typedef int (*ksyms_callback_t)(const char *, int, void *,
 	uint32_t, int, void *);
 
@@ -150,4 +152,5 @@ void ksyms_modload(const char *, void *,
 void ksyms_modunload(const char *);
 
 #endif /* _KERNEL */
+#endif /* _KERNEL || _KMEMUSER */
 #endif /* _SYS_KSYMS_H_ */



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

2020-09-24 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Sep 24 09:04:38 UTC 2020

Modified Files:
src/sys/arch/aarch64/aarch64: bus_space_asm_generic.S

Log Message:
fix bugs in *_bs_rm_8_swap(). it was only reading 4 bytes, not 8 bytes.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/aarch64/aarch64/bus_space_asm_generic.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/aarch64/aarch64/bus_space_asm_generic.S
diff -u src/sys/arch/aarch64/aarch64/bus_space_asm_generic.S:1.2 src/sys/arch/aarch64/aarch64/bus_space_asm_generic.S:1.3
--- src/sys/arch/aarch64/aarch64/bus_space_asm_generic.S:1.2	Mon Jan 13 17:23:07 2020
+++ src/sys/arch/aarch64/aarch64/bus_space_asm_generic.S	Thu Sep 24 09:04:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_space_asm_generic.S,v 1.2 2020/01/13 17:23:07 ryo Exp $	*/
+/*	$NetBSD: bus_space_asm_generic.S,v 1.3 2020/09/24 09:04:38 ryo Exp $	*/
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -29,7 +29,7 @@
 #include 
 #include "assym.h"
 
-RCSID("$NetBSD: bus_space_asm_generic.S,v 1.2 2020/01/13 17:23:07 ryo Exp $")
+RCSID("$NetBSD: bus_space_asm_generic.S,v 1.3 2020/09/24 09:04:38 ryo Exp $")
 
 .macro generate_bsfunc funcname, dsbop
 /* uint8_t {funcname}_bs_r_1(x0:tag, x1:addr, x2:offset) */
@@ -248,7 +248,7 @@ ENTRY_NP(\funcname\()_bs_rm_8_swap)
 	ldr	w8, [x0, #BS_STRIDE]
 	lsl	x8, x2, x8	/* offset <<= tag->bs_stride */
 1:
-	ldrh	w9, [x1, x8]
+	ldr	x9, [x1, x8]
 	subs	x4, x4, #1	/* count-- */
 	rev	x9, x9
 	str	x9, [x3], #8



CVS commit: src/sys/arch/arm/cortex

2020-09-24 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Sep 24 08:50:09 UTC 2020

Modified Files:
src/sys/arch/arm/cortex: gicv3_its.c

Log Message:
need to swap on big endian machines.

"The ITS command queue uses a little endian memory order model." (GIC 
Architecture Specification)


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/arm/cortex/gicv3_its.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/arm/cortex/gicv3_its.c
diff -u src/sys/arch/arm/cortex/gicv3_its.c:1.27 src/sys/arch/arm/cortex/gicv3_its.c:1.28
--- src/sys/arch/arm/cortex/gicv3_its.c:1.27	Thu Feb 13 02:12:06 2020
+++ src/sys/arch/arm/cortex/gicv3_its.c	Thu Sep 24 08:50:09 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: gicv3_its.c,v 1.27 2020/02/13 02:12:06 jmcneill Exp $ */
+/* $NetBSD: gicv3_its.c,v 1.28 2020/09/24 08:50:09 ryo Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #define _INTR_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gicv3_its.c,v 1.27 2020/02/13 02:12:06 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gicv3_its.c,v 1.28 2020/09/24 08:50:09 ryo Exp $");
 
 #include 
 #include 
@@ -118,7 +118,13 @@ gits_command(struct gicv3_its *its, cons
 	cwriter = gits_read_8(its, GITS_CWRITER);
 	woff = cwriter & GITS_CWRITER_Offset;
 
+#if _BYTE_ORDER == _BIG_ENDIAN
+	uint64_t *dw = (uint64_t *)(its->its_cmd.base + woff);
+	for (int i = 0; i < __arraycount(cmd->dw); i++)
+		dw[i] = htole64(cmd->dw[i]);
+#else
 	memcpy(its->its_cmd.base + woff, cmd->dw, sizeof(cmd->dw));
+#endif
 	bus_dmamap_sync(its->its_dmat, its->its_cmd.map, woff, sizeof(cmd->dw), BUS_DMASYNC_PREWRITE);
 
 	woff += sizeof(cmd->dw);



CVS commit: src/usr.bin/make

2020-09-24 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Sep 24 08:23:29 UTC 2020

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

Log Message:
make(1): make the API of the List partially public

Accessing the fields List.first, List.last, ListNode.prev, ListNode.next
and ListNode.datum in read-only mode should be more efficient than a
whole function call.

All modifications to the lists or their nodes must still happen via
function calls.

This change reduces the code size, makes the code faster to execute and
allows Lst_ForEach to be written inline without the visual overhead of
function calls.


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/usr.bin/make/lst.c
cvs rdiff -u -r1.65 -r1.66 src/usr.bin/make/lst.h

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.69 src/usr.bin/make/lst.c:1.70
--- src/usr.bin/make/lst.c:1.69	Thu Sep 24 07:32:03 2020
+++ src/usr.bin/make/lst.c	Thu Sep 24 08:23:29 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: lst.c,v 1.69 2020/09/24 07:32:03 rillig Exp $ */
+/* $NetBSD: lst.c,v 1.70 2020/09/24 08:23:29 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -36,37 +36,7 @@
 
 #include "make.h"
 
-MAKE_RCSID("$NetBSD: lst.c,v 1.69 2020/09/24 07:32:03 rillig Exp $");
-
-struct ListNode {
-struct ListNode *prev;	/* previous element in list */
-struct ListNode *next;	/* next in list */
-uint8_t useCount;		/* Count of functions using the node.
- * node may not be deleted until count
- * goes to 0 */
-Boolean deleted;		/* List node should be removed when done */
-union {
-	void *datum;		/* datum associated with this element */
-	const GNode *gnode;	/* alias, just for debugging */
-	const char *str;	/* alias, just for debugging */
-};
-};
-
-typedef enum {
-Head, Middle, Tail, Unknown
-} Where;
-
-struct List {
-ListNode *first;		/* first node in list */
-ListNode *last;		/* last node in list */
-
-/* fields for sequential access */
-Boolean isOpen;		/* true if list has been Lst_Open'ed */
-Where lastAccess;		/* Where in the list the last access was */
-ListNode *curr;		/* current node, if open. NULL if
- * *just* opened */
-ListNode *prev;		/* Previous node, if open. Used by Lst_Remove */
-};
+MAKE_RCSID("$NetBSD: lst.c,v 1.70 2020/09/24 08:23:29 rillig Exp $");
 
 /* Allocate and initialize a list node.
  *
@@ -76,8 +46,8 @@ static ListNode *
 LstNodeNew(void *datum)
 {
 ListNode *node = bmake_malloc(sizeof *node);
-node->useCount = 0;
-node->deleted = FALSE;
+node->priv_useCount = 0;
+node->priv_deleted = FALSE;
 node->datum = datum;
 return node;
 }
@@ -96,8 +66,8 @@ Lst_Init(void)
 
 list->first = NULL;
 list->last = NULL;
-list->isOpen = FALSE;
-list->lastAccess = Unknown;
+list->priv_isOpen = FALSE;
+list->priv_lastAccess = Unknown;
 
 return list;
 }
@@ -269,10 +239,10 @@ Lst_Remove(List *list, ListNode *node)
  * previous one was non-existent (prev == NULL), we set the
  * end to be Unknown, since it is.
  */
-if (list->isOpen && list->curr == node) {
-	list->curr = list->prev;
-	if (list->curr == NULL) {
-	list->lastAccess = Unknown;
+if (list->priv_isOpen && list->priv_curr == node) {
+	list->priv_curr = list->priv_prev;
+	if (list->priv_curr == NULL) {
+	list->priv_lastAccess = Unknown;
 	}
 }
 
@@ -280,10 +250,10 @@ Lst_Remove(List *list, ListNode *node)
  * note that the datum is unmolested. The caller must free it as
  * necessary and as expected.
  */
-if (node->useCount == 0) {
+if (node->priv_useCount == 0) {
 	free(node);
 } else {
-	node->deleted = TRUE;
+	node->priv_deleted = TRUE;
 }
 }
 
@@ -308,66 +278,9 @@ LstNode_SetNull(ListNode *node)
 
 
 /*
- * Node-specific functions
- */
-
-/* Return the first node from the given list, or NULL if the list is empty. */
-ListNode *
-Lst_First(List *list)
-{
-assert(list != NULL);
-
-return list->first;
-}
-
-/* Return the last node from the given list, or NULL if the list is empty. */
-ListNode *
-Lst_Last(List *list)
-{
-assert(list != NULL);
-
-return list->last;
-}
-
-/* Return the successor to the given node on its list, or NULL. */
-ListNode *
-LstNode_Next(ListNode *node)
-{
-assert(node != NULL);
-
-return node->next;
-}
-
-/* Return the predecessor to the given node on its list, or NULL. */
-ListNode *
-LstNode_Prev(ListNode *node)
-{
-assert(node != NULL);
-return node->prev;
-}
-
-/* Return the datum stored in the given node. */
-void *
-LstNode_Datum(ListNode *node)
-{
-assert(node != NULL);
-return node->datum;
-}
-
-
-/*
  * Functions for entire lists
  */
 
-/* Return TRUE if the given list is empty. */
-Boolean
-Lst_IsEmpty(List *list)
-{
-assert(list != NULL);
-
-return LstIsEmpty(list);
-}
-
 /* Return the 

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

2020-09-24 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Sep 24 08:14:08 UTC 2020

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

Log Message:
fix build on non rmx or octeon systems.


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/sys/arch/mips/mips/mipsX_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/mips/mipsX_subr.S
diff -u src/sys/arch/mips/mips/mipsX_subr.S:1.110 src/sys/arch/mips/mips/mipsX_subr.S:1.111
--- src/sys/arch/mips/mips/mipsX_subr.S:1.110	Thu Sep 24 02:12:01 2020
+++ src/sys/arch/mips/mips/mipsX_subr.S	Thu Sep 24 08:14:08 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: mipsX_subr.S,v 1.110 2020/09/24 02:12:01 mrg Exp $	*/
+/*	$NetBSD: mipsX_subr.S,v 1.111 2020/09/24 08:14:08 mrg Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -117,9 +117,8 @@
  */
 
 #include 
-RCSID("$NetBSD: mipsX_subr.S,v 1.110 2020/09/24 02:12:01 mrg Exp $")
+RCSID("$NetBSD: mipsX_subr.S,v 1.111 2020/09/24 08:14:08 mrg Exp $")
 
-#include "cpunode.h"			/* for NWDOG */
 #include "opt_cputype.h"
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -138,6 +137,12 @@ RCSID("$NetBSD: mipsX_subr.S,v 1.110 202
 
 #include "assym.h"
 
+#if defined(MIPS64_OCTEON) || defined(MIPS64_XLR) || defined(MIPS64_XLS)
+#include "cpunode.h"			/* for NWDOG */
+#else
+#define NWDOG 0
+#endif
+
 #if defined(MIPS1) || defined(MIPS2)
 #error use locore_mips1.S
 #endif



CVS commit: src/usr.bin/make

2020-09-24 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Sep 24 08:02:32 UTC 2020

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

Log Message:
make(1): remove redundant function prototypes in suff.c


To generate a diff of this commit:
cvs rdiff -u -r1.159 -r1.160 src/usr.bin/make/suff.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/suff.c
diff -u src/usr.bin/make/suff.c:1.159 src/usr.bin/make/suff.c:1.160
--- src/usr.bin/make/suff.c:1.159	Thu Sep 24 07:11:29 2020
+++ src/usr.bin/make/suff.c	Thu Sep 24 08:02:32 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.159 2020/09/24 07:11:29 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.160 2020/09/24 08:02:32 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -126,7 +126,7 @@
 #include	  "dir.h"
 
 /*	"@(#)suff.c	8.4 (Berkeley) 3/21/94"	*/
-MAKE_RCSID("$NetBSD: suff.c,v 1.159 2020/09/24 07:11:29 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.160 2020/09/24 08:02:32 rillig Exp $");
 
 #define SUFF_DEBUG0(fmt) \
 if (!DEBUG(SUFF)) (void) 0; else fprintf(debug_file, fmt)
@@ -219,24 +219,8 @@ static Suff 	*emptySuff;	/* The empt
  * single-suffix transformation rules */
 
 
-static void SuffUnRef(void *, void *);
-static void SuffFree(void *);
-static void SuffInsert(SuffList *, Suff *);
-static void SuffRemove(SuffList *, Suff *);
-static Boolean SuffParseTransform(char *, Suff **, Suff **);
-static int SuffRebuildGraph(void *, void *);
-static int SuffScanTargets(void *, void *);
-static int SuffAddSrc(void *, void *);
-static void SuffAddLevel(SrcList *, Src *);
-static void SuffExpandChildren(GNodeListNode *, GNode *);
-static void SuffExpandWildcards(GNodeListNode *, GNode *);
-static Boolean SuffApplyTransform(GNode *, GNode *, Suff *, Suff *);
 static void SuffFindDeps(GNode *, SrcList *);
-static void SuffFindArchiveDeps(GNode *, SrcList *);
-static void SuffFindNormalDeps(GNode *, SrcList *);
-static int SuffPrintName(void *, void *);
-static int SuffPrintSuff(void *, void *);
-static int SuffPrintTrans(void *, void *);
+static void SuffExpandWildcards(GNodeListNode *, GNode *);
 
 	/*** Lst Predicates /
 /*-



CVS commit: src/sys/dev/pci

2020-09-24 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Sep 24 08:00:59 UTC 2020

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

Log Message:
Small fixes from knakahara:

- Check return value correctly in wm_lv_jumbo_workaround_ich8lan().
- Fix comment.


To generate a diff of this commit:
cvs rdiff -u -r1.689 -r1.690 src/sys/dev/pci/if_wm.c

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

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.689 src/sys/dev/pci/if_wm.c:1.690
--- src/sys/dev/pci/if_wm.c:1.689	Wed Sep 16 15:04:57 2020
+++ src/sys/dev/pci/if_wm.c	Thu Sep 24 08:00:59 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.689 2020/09/16 15:04:57 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.690 2020/09/24 08:00:59 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.689 2020/09/16 15:04:57 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.690 2020/09/24 08:00:59 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -9074,7 +9074,7 @@ wm_rxeof(struct wm_rxqueue *rxq, u_int l
 
 		/*
 		 * Okay, we have the entire packet now. The chip is
-		 * configured to include the FCS except I35[05], I21[01].
+		 * configured to include the FCS except I35[04], I21[01].
 		 * (not all chips can be configured to strip it), so we need
 		 * to trim it. Those chips have an eratta, the RCTL_SECRC bit
 		 * in RCTL register is always set, so we don't trim it.
@@ -15969,7 +15969,7 @@ wm_lv_jumbo_workaround_ich8lan(struct wm
 		return rv;
 
 	/* Disable Rx path while enabling/disabling workaround */
-	sc->phy.readreg_locked(dev, 2, I82579_DFT_CTRL, _ctrl);
+	rv = sc->phy.readreg_locked(dev, 2, I82579_DFT_CTRL, _ctrl);
 	if (rv != 0)
 		goto out;
 	rv = sc->phy.writereg_locked(dev, 2, I82579_DFT_CTRL,



CVS commit: src/usr.bin/make

2020-09-24 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Sep 24 07:59:33 UTC 2020

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

Log Message:
make(1): inline Lst_ForEach in Targ_PrintCmds


To generate a diff of this commit:
cvs rdiff -u -r1.92 -r1.93 src/usr.bin/make/targ.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/targ.c
diff -u src/usr.bin/make/targ.c:1.92 src/usr.bin/make/targ.c:1.93
--- src/usr.bin/make/targ.c:1.92	Thu Sep 24 07:11:29 2020
+++ src/usr.bin/make/targ.c	Thu Sep 24 07:59:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: targ.c,v 1.92 2020/09/24 07:11:29 rillig Exp $	*/
+/*	$NetBSD: targ.c,v 1.93 2020/09/24 07:59:33 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -122,7 +122,7 @@
 #include	  "dir.h"
 
 /*	"@(#)targ.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: targ.c,v 1.92 2020/09/24 07:11:29 rillig Exp $");
+MAKE_RCSID("$NetBSD: targ.c,v 1.93 2020/09/24 07:59:33 rillig Exp $");
 
 static GNodeList *allTargets;	/* the list of all targets found so far */
 #ifdef CLEANUP
@@ -385,17 +385,14 @@ PrintNodeNamesLine(const char *label, GN
 fprintf(debug_file, "\n");
 }
 
-static int
-TargPrintCmd(void *cmd, void *dummy MAKE_ATTR_UNUSED)
-{
-fprintf(debug_file, "\t%s\n", (char *)cmd);
-return 0;
-}
-
 void
 Targ_PrintCmds(GNode *gn)
 {
-Lst_ForEachUntil(gn->commands, TargPrintCmd, NULL);
+StringListNode *node = Lst_First(gn->commands);
+for (; node != NULL; node = LstNode_Next(node)) {
+	const char *cmd = LstNode_Datum(node);
+	fprintf(debug_file, "\t%s\n", cmd);
+}
 }
 
 /* Format a modification time in some reasonable way and return it.



CVS commit: src/usr.bin/make

2020-09-24 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Sep 24 07:53:32 UTC 2020

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

Log Message:
make(1): migrate printCMD in meta mode to Lst_ForEach


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/usr.bin/make/meta.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/meta.c
diff -u src/usr.bin/make/meta.c:1.118 src/usr.bin/make/meta.c:1.119
--- src/usr.bin/make/meta.c:1.118	Thu Sep 24 07:11:29 2020
+++ src/usr.bin/make/meta.c	Thu Sep 24 07:53:32 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: meta.c,v 1.118 2020/09/24 07:11:29 rillig Exp $ */
+/*  $NetBSD: meta.c,v 1.119 2020/09/24 07:53:32 rillig Exp $ */
 
 /*
  * Implement 'meta' mode.
@@ -365,7 +365,7 @@ typedef struct meta_file_s {
 GNode *gn;
 } meta_file_t;
 
-static int
+static void
 printCMD(void *cmdp, void *mfpp)
 {
 meta_file_t *mfp = mfpp;
@@ -379,7 +379,6 @@ printCMD(void *cmdp, void *mfpp)
 }
 fprintf(mfp->fp, "CMD %s\n", cmd);
 free(cmd_freeIt);
-return 0;
 }
 
 /*
@@ -522,7 +521,7 @@ meta_create(BuildMon *pbm, GNode *gn)
 
 mf.gn = gn;
 
-Lst_ForEachUntil(gn->commands, printCMD, );
+Lst_ForEach(gn->commands, printCMD, );
 
 fprintf(mf.fp, "CWD %s\n", getcwd(buf, sizeof(buf)));
 fprintf(mf.fp, "TARGET %s\n", tname);



CVS commit: src/usr.bin/make

2020-09-24 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Sep 24 07:49:58 UTC 2020

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

Log Message:
make(1): inline Lst_ForEach for debugging output in search paths


To generate a diff of this commit:
cvs rdiff -u -r1.145 -r1.146 src/usr.bin/make/dir.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/dir.c
diff -u src/usr.bin/make/dir.c:1.145 src/usr.bin/make/dir.c:1.146
--- src/usr.bin/make/dir.c:1.145	Thu Sep 24 07:11:29 2020
+++ src/usr.bin/make/dir.c	Thu Sep 24 07:49:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: dir.c,v 1.145 2020/09/24 07:11:29 rillig Exp $	*/
+/*	$NetBSD: dir.c,v 1.146 2020/09/24 07:49:58 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -134,7 +134,7 @@
 #include "job.h"
 
 /*	"@(#)dir.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: dir.c,v 1.145 2020/09/24 07:11:29 rillig Exp $");
+MAKE_RCSID("$NetBSD: dir.c,v 1.146 2020/09/24 07:49:58 rillig Exp $");
 
 #define DIR_DEBUG0(fmt) \
 if (!DEBUG(DIR)) (void) 0; else fprintf(debug_file, fmt)
@@ -251,8 +251,6 @@ static Hash_Table mtimes;
 static Hash_Table lmtimes;	/* same as mtimes but for lstat */
 
 static void DirExpandInt(const char *, SearchPath *, StringList *);
-static int DirPrintWord(void *, void *);
-static int DirPrintDir(void *, void *);
 static char *DirLookup(CachedDir *, const char *, const char *, Boolean);
 static char *DirLookupSubdir(CachedDir *, const char *);
 static char *DirFindDot(Boolean, const char *, const char *);
@@ -758,14 +756,15 @@ DirExpandInt(const char *word, SearchPat
 Lst_Close(path);
 }
 
-/* Print a word in the list of expansions.
- * Callback for Dir_Expand when DEBUG(DIR), via Lst_ForEachUntil. */
-static int
-DirPrintWord(void *word, void *dummy MAKE_ATTR_UNUSED)
+static void
+DirPrintExpansions(StringList *words)
 {
-fprintf(debug_file, "%s ", (char *)word);
-
-return 0;
+StringListNode *node;
+for (node = Lst_First(words); node != NULL; node = LstNode_Next(node)) {
+	const char *word = LstNode_Datum(node);
+	fprintf(debug_file, "%s ", word);
+}
+fprintf(debug_file, "\n");
 }
 
 /*-
@@ -878,10 +877,8 @@ Dir_Expand(const char *word, SearchPath 
 	DirExpandInt(word, path, expansions);
 	}
 }
-if (DEBUG(DIR)) {
-	Lst_ForEachUntil(expansions, DirPrintWord, NULL);
-	fprintf(debug_file, "\n");
-}
+if (DEBUG(DIR))
+	DirPrintExpansions(expansions);
 }
 
 /*-
@@ -1752,16 +1749,12 @@ Dir_PrintDirectories(void)
 Lst_Close(openDirectories);
 }
 
-static int
-DirPrintDir(void *p, void *dummy MAKE_ATTR_UNUSED)
-{
-const CachedDir *dir = p;
-fprintf(debug_file, "%s ", dir->name);
-return 0;
-}
-
 void
 Dir_PrintPath(SearchPath *path)
 {
-Lst_ForEachUntil(path, DirPrintDir, NULL);
+SearchPathNode *node;
+for (node = Lst_First(path); node != NULL; node = LstNode_Next(node)) {
+	const CachedDir *dir = LstNode_Datum(node);
+	fprintf(debug_file, "%s ", dir->name);
+}
 }



CVS commit: src/usr.bin/make

2020-09-24 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Sep 24 07:37:42 UTC 2020

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

Log Message:
make(1): migrate MakeTimeStamp and MakeUnmark to Lst_ForEach


To generate a diff of this commit:
cvs rdiff -u -r1.142 -r1.143 src/usr.bin/make/make.c
cvs rdiff -u -r1.145 -r1.146 src/usr.bin/make/make.h

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/make.c
diff -u src/usr.bin/make/make.c:1.142 src/usr.bin/make/make.c:1.143
--- src/usr.bin/make/make.c:1.142	Thu Sep 24 07:34:35 2020
+++ src/usr.bin/make/make.c	Thu Sep 24 07:37:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.c,v 1.142 2020/09/24 07:34:35 rillig Exp $	*/
+/*	$NetBSD: make.c,v 1.143 2020/09/24 07:37:42 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -107,7 +107,7 @@
 #include"job.h"
 
 /*	"@(#)make.c	8.1 (Berkeley) 6/6/93"	*/
-MAKE_RCSID("$NetBSD: make.c,v 1.142 2020/09/24 07:34:35 rillig Exp $");
+MAKE_RCSID("$NetBSD: make.c,v 1.143 2020/09/24 07:37:42 rillig Exp $");
 
 static unsigned int checked = 1;/* Sequence # to detect recursion */
 static GNodeList *toBeMade;	/* The current fringe of the graph. These
@@ -118,8 +118,6 @@ static GNodeList *toBeMade;	/* The curre
 
 static int MakeAddChild(void *, void *);
 static int MakeFindChild(void *, void *);
-static int MakeUnmark(void *, void *);
-static int MakeTimeStamp(void *, void *);
 static int MakeHandleUse(void *, void *);
 static Boolean MakeStartJobs(void);
 static int MakePrintStatus(void *, void *);
@@ -184,21 +182,17 @@ GNode_FprintDetails(FILE *f, const char 
  *	pgn		the current parent
  *	cgn		the child we've just examined
  *
- * Results:
- *	Always returns 0.
- *
  * Side Effects:
  *	The cmgn of the parent node will be changed if the mtime
  *	field of the child is greater than it.
  *---
  */
-int
+void
 Make_TimeStamp(GNode *pgn, GNode *cgn)
 {
 if (pgn->cmgn == NULL || cgn->mtime > pgn->cmgn->mtime) {
 	pgn->cmgn = cgn;
 }
-return 0;
 }
 
 /*
@@ -207,10 +201,10 @@ Make_TimeStamp(GNode *pgn, GNode *cgn)
  *	cgn		the child we've just examined
  *
  */
-static int
+static void
 MakeTimeStamp(void *pgn, void *cgn)
 {
-return Make_TimeStamp((GNode *)pgn, (GNode *)cgn);
+Make_TimeStamp(pgn, cgn);
 }
 
 /*-
@@ -368,7 +362,7 @@ Make_OODate(GNode *gn)
  * thinking they're out-of-date.
  */
 if (!oodate) {
-	Lst_ForEachUntil(gn->parents, MakeTimeStamp, gn);
+	Lst_ForEach(gn->parents, MakeTimeStamp, gn);
 }
 
 return oodate;
@@ -841,13 +835,12 @@ Make_Update(GNode *cgn)
 }
 }
 
-static int
+static void
 MakeUnmark(void *cgnp, void *pgnp MAKE_ATTR_UNUSED)
 {
 GNode	*cgn = (GNode *)cgnp;
 
 cgn->type &= ~OP_MARK;
-return 0;
 }
 
 /*-
@@ -957,7 +950,7 @@ Make_DoAllVar(GNode *gn)
 if (gn->flags & DONE_ALLSRC)
 	return;
 
-Lst_ForEachUntil(gn->children, MakeUnmark, gn);
+Lst_ForEach(gn->children, MakeUnmark, gn);
 Lst_ForEach(gn->children, MakeAddAllSrc, gn);
 
 if (!Var_Exists (OODATE, gn)) {
@@ -1322,7 +1315,7 @@ Make_ExpandUse(GNodeList *targs)
 
 	(void)Dir_MTime(gn, 0);
 	Var_Set(TARGET, gn->path ? gn->path : gn->name, gn);
-	Lst_ForEachUntil(gn->children, MakeUnmark, gn);
+	Lst_ForEach(gn->children, MakeUnmark, gn);
 	Lst_ForEachUntil(gn->children, MakeHandleUse, gn);
 
 	if ((gn->type & OP_MADE) == 0)

Index: src/usr.bin/make/make.h
diff -u src/usr.bin/make/make.h:1.145 src/usr.bin/make/make.h:1.146
--- src/usr.bin/make/make.h:1.145	Wed Sep 23 03:06:38 2020
+++ src/usr.bin/make/make.h	Thu Sep 24 07:37:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.145 2020/09/23 03:06:38 rillig Exp $	*/
+/*	$NetBSD: make.h,v 1.146 2020/09/24 07:37:42 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -535,7 +535,7 @@ extern int debug;
 
 #include "nonints.h"
 
-int Make_TimeStamp(GNode *, GNode *);
+void Make_TimeStamp(GNode *, GNode *);
 Boolean Make_OODate(GNode *);
 void Make_ExpandUse(GNodeList *);
 time_t Make_Recheck(GNode *);



CVS commit: src/usr.bin/make

2020-09-24 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Sep 24 07:34:35 UTC 2020

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

Log Message:
make(1): migrate MakeAddAllSrc to Lst_ForEach


To generate a diff of this commit:
cvs rdiff -u -r1.141 -r1.142 src/usr.bin/make/make.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/make.c
diff -u src/usr.bin/make/make.c:1.141 src/usr.bin/make/make.c:1.142
--- src/usr.bin/make/make.c:1.141	Thu Sep 24 07:32:03 2020
+++ src/usr.bin/make/make.c	Thu Sep 24 07:34:35 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.c,v 1.141 2020/09/24 07:32:03 rillig Exp $	*/
+/*	$NetBSD: make.c,v 1.142 2020/09/24 07:34:35 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -107,7 +107,7 @@
 #include"job.h"
 
 /*	"@(#)make.c	8.1 (Berkeley) 6/6/93"	*/
-MAKE_RCSID("$NetBSD: make.c,v 1.141 2020/09/24 07:32:03 rillig Exp $");
+MAKE_RCSID("$NetBSD: make.c,v 1.142 2020/09/24 07:34:35 rillig Exp $");
 
 static unsigned int checked = 1;/* Sequence # to detect recursion */
 static GNodeList *toBeMade;	/* The current fringe of the graph. These
@@ -119,7 +119,6 @@ static GNodeList *toBeMade;	/* The curre
 static int MakeAddChild(void *, void *);
 static int MakeFindChild(void *, void *);
 static int MakeUnmark(void *, void *);
-static int MakeAddAllSrc(void *, void *);
 static int MakeTimeStamp(void *, void *);
 static int MakeHandleUse(void *, void *);
 static Boolean MakeStartJobs(void);
@@ -871,21 +870,18 @@ MakeUnmark(void *cgnp, void *pgnp MAKE_A
  *	pgnp		The parent to whose ALLSRC variable it should
  *			be added
  *
- * Results:
- *	Always returns 0
- *
  * Side Effects:
  *	The ALLSRC variable for the given node is extended.
  *---
  */
-static int
+static void
 MakeAddAllSrc(void *cgnp, void *pgnp)
 {
 GNode	*cgn = (GNode *)cgnp;
 GNode	*pgn = (GNode *)pgnp;
 
 if (cgn->type & OP_MARK)
-	return 0;
+	return;
 cgn->type |= OP_MARK;
 
 if ((cgn->type & (OP_EXEC|OP_USE|OP_USEBEFORE|OP_INVISIBLE)) == 0) {
@@ -931,7 +927,6 @@ MakeAddAllSrc(void *cgnp, void *pgnp)
 	}
 	bmake_free(p1);
 }
-return 0;
 }
 
 /*-
@@ -963,7 +958,7 @@ Make_DoAllVar(GNode *gn)
 	return;
 
 Lst_ForEachUntil(gn->children, MakeUnmark, gn);
-Lst_ForEachUntil(gn->children, MakeAddAllSrc, gn);
+Lst_ForEach(gn->children, MakeAddAllSrc, gn);
 
 if (!Var_Exists (OODATE, gn)) {
 	Var_Set(OODATE, "", gn);
@@ -1043,7 +1038,7 @@ MakeBuildChild(void *v_cn, void *toBeMad
 	Lst_ForEachUntil(cn->cohorts, MakeBuildChild, toBeMade_next);
 
 /*
- * If this node is a .WAIT node with unmade chlidren
+ * If this node is a .WAIT node with unmade children
  * then don't add the next sibling.
  */
 return cn->type & OP_WAIT && cn->unmade > 0;



CVS commit: src/usr.bin/make

2020-09-24 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Sep 24 07:32:04 UTC 2020

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

Log Message:
make(1): move documentation for MakeAddAllSrc to its correct place


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/usr.bin/make/lst.c
cvs rdiff -u -r1.64 -r1.65 src/usr.bin/make/lst.h
cvs rdiff -u -r1.140 -r1.141 src/usr.bin/make/make.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.68 src/usr.bin/make/lst.c:1.69
--- src/usr.bin/make/lst.c:1.68	Thu Sep 24 07:23:26 2020
+++ src/usr.bin/make/lst.c	Thu Sep 24 07:32:03 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: lst.c,v 1.68 2020/09/24 07:23:26 rillig Exp $ */
+/* $NetBSD: lst.c,v 1.69 2020/09/24 07:32:03 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -36,7 +36,7 @@
 
 #include "make.h"
 
-MAKE_RCSID("$NetBSD: lst.c,v 1.68 2020/09/24 07:23:26 rillig Exp $");
+MAKE_RCSID("$NetBSD: lst.c,v 1.69 2020/09/24 07:32:03 rillig Exp $");
 
 struct ListNode {
 struct ListNode *prev;	/* previous element in list */
@@ -415,6 +415,14 @@ Lst_FindDatum(List *list, const void *da
 return NULL;
 }
 
+void
+Lst_ForEach(List *list, LstActionProc proc, void *procData)
+{
+ListNode *node;
+for (node = list->first; node != NULL; node = node->next)
+proc(node->datum, procData);
+}
+
 /* Apply the given function to each element of the given list. The function
  * should return 0 if traversal should continue and non-zero if it should
  * abort. */

Index: src/usr.bin/make/lst.h
diff -u src/usr.bin/make/lst.h:1.64 src/usr.bin/make/lst.h:1.65
--- src/usr.bin/make/lst.h:1.64	Thu Sep 24 07:11:29 2020
+++ src/usr.bin/make/lst.h	Thu Sep 24 07:32:03 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: lst.h,v 1.64 2020/09/24 07:11:29 rillig Exp $	*/
+/*	$NetBSD: lst.h,v 1.65 2020/09/24 07:32:03 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -94,6 +94,8 @@ typedef void *LstCopyProc(void *);
 typedef void LstFreeProc(void *);
 /* Return TRUE if the datum matches the args, for Lst_Find. */
 typedef Boolean LstFindProc(const void *datum, const void *args);
+/* An action for Lst_ForEach. */
+typedef void LstActionProc(void *datum, void *args);
 /* An action for Lst_ForEachUntil. */
 typedef int LstActionUntilProc(void *datum, void *args);
 
@@ -152,6 +154,10 @@ void LstNode_SetNull(ListNode *);
 
 /* Iterating over a list, using a callback function */
 
+/* Apply a function to each datum of the list.
+ * The function must not modify the structure of the list, for example by
+ * adding or removing nodes. */
+void Lst_ForEach(List *, LstActionProc, void *);
 /* Apply a function to each datum of the list, until the callback function
  * returns non-zero. */
 int Lst_ForEachUntil(List *, LstActionUntilProc, void *);

Index: src/usr.bin/make/make.c
diff -u src/usr.bin/make/make.c:1.140 src/usr.bin/make/make.c:1.141
--- src/usr.bin/make/make.c:1.140	Thu Sep 24 07:11:29 2020
+++ src/usr.bin/make/make.c	Thu Sep 24 07:32:03 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.c,v 1.140 2020/09/24 07:11:29 rillig Exp $	*/
+/*	$NetBSD: make.c,v 1.141 2020/09/24 07:32:03 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -107,7 +107,7 @@
 #include"job.h"
 
 /*	"@(#)make.c	8.1 (Berkeley) 6/6/93"	*/
-MAKE_RCSID("$NetBSD: make.c,v 1.140 2020/09/24 07:11:29 rillig Exp $");
+MAKE_RCSID("$NetBSD: make.c,v 1.141 2020/09/24 07:32:03 rillig Exp $");
 
 static unsigned int checked = 1;/* Sequence # to detect recursion */
 static GNodeList *toBeMade;	/* The current fringe of the graph. These
@@ -842,6 +842,15 @@ Make_Update(GNode *cgn)
 }
 }
 
+static int
+MakeUnmark(void *cgnp, void *pgnp MAKE_ATTR_UNUSED)
+{
+GNode	*cgn = (GNode *)cgnp;
+
+cgn->type &= ~OP_MARK;
+return 0;
+}
+
 /*-
  *---
  * MakeAddAllSrc --
@@ -857,6 +866,11 @@ Make_Update(GNode *cgn)
  *	variable if it was actually made (since .JOIN nodes don't have
  *	modification times, the comparison is rather unfair...)..
  *
+ * Input:
+ *	cgnp		The child to add
+ *	pgnp		The parent to whose ALLSRC variable it should
+ *			be added
+ *
  * Results:
  *	Always returns 0
  *
@@ -865,22 +879,6 @@ Make_Update(GNode *cgn)
  *---
  */
 static int
-MakeUnmark(void *cgnp, void *pgnp MAKE_ATTR_UNUSED)
-{
-GNode	*cgn = (GNode *)cgnp;
-
-cgn->type &= ~OP_MARK;
-return 0;
-}
-
-/*
- * Input:
- *	cgnp		The child to add
- *	pgnp		The parent to whose ALLSRC variable it should
- *			be added
- *
- */
-static int
 MakeAddAllSrc(void *cgnp, void *pgnp)
 {
 GNode	*cgn = (GNode *)cgnp;



CVS commit: src/usr.bin/make

2020-09-24 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Sep 24 07:23:26 UTC 2020

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

Log Message:
make(1): merge Lst_ForEachFrom into Lst_ForEachUntil


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 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.67 src/usr.bin/make/lst.c:1.68
--- src/usr.bin/make/lst.c:1.67	Thu Sep 24 07:11:29 2020
+++ src/usr.bin/make/lst.c	Thu Sep 24 07:23:26 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: lst.c,v 1.67 2020/09/24 07:11:29 rillig Exp $ */
+/* $NetBSD: lst.c,v 1.68 2020/09/24 07:23:26 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -36,7 +36,7 @@
 
 #include "make.h"
 
-MAKE_RCSID("$NetBSD: lst.c,v 1.67 2020/09/24 07:11:29 rillig Exp $");
+MAKE_RCSID("$NetBSD: lst.c,v 1.68 2020/09/24 07:23:26 rillig Exp $");
 
 struct ListNode {
 struct ListNode *prev;	/* previous element in list */
@@ -415,42 +415,21 @@ Lst_FindDatum(List *list, const void *da
 return NULL;
 }
 
-static int Lst_ForEachFrom(List *, ListNode *, LstActionUntilProc, void *);
-
 /* Apply the given function to each element of the given list. The function
  * should return 0 if traversal should continue and non-zero if it should
  * abort. */
 int
 Lst_ForEachUntil(List *list, LstActionUntilProc proc, void *procData)
 {
-if (LstIsEmpty(list))
-	return 0;		/* XXX: Document what this value means. */
-return Lst_ForEachFrom(list, Lst_First(list), proc, procData);
-}
-
-/* Apply the given function to each element of the given list, starting from
- * the given node. The function should return 0 if traversal should continue,
- * and non-zero if it should abort. */
-int
-Lst_ForEachFrom(List *list, ListNode *node,
-		 LstActionUntilProc proc, void *procData)
-{
-ListNode *tln = node;
-ListNode *next;
-Boolean done;
-int result;
+ListNode *tln = list->first;
+int result = 0;
 
-assert(list != NULL);
-assert(node != NULL);
-assert(proc != NULL);
-
-do {
+while (tln != NULL) {
 	/*
 	 * Take care of having the current element deleted out from under
 	 * us.
 	 */
-
-	next = tln->next;
+	ListNode *next = tln->next;
 
 	/*
 	 * We're done with the traversal if
@@ -458,7 +437,7 @@ Lst_ForEachFrom(List *list, ListNode *no
 	 *  - nothing's been added after the current node (check this
 	 *after proc() has been called).
 	 */
-	done = next == NULL;
+	Boolean done = next == NULL;
 
 	tln->useCount++;
 	result = (*proc)(tln->datum, procData);
@@ -478,7 +457,9 @@ Lst_ForEachFrom(List *list, ListNode *no
 	free((char *)tln);
 	}
 	tln = next;
-} while (!result && !LstIsEmpty(list) && !done);
+	if (result || LstIsEmpty(list) || done)
+	break;
+}
 
 return result;
 }



CVS commit: src/usr.bin/make

2020-09-24 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Sep 24 07:11:29 UTC 2020

Modified Files:
src/usr.bin/make: compat.c dir.c job.c lst.c lst.h main.c make.c meta.c
parse.c suff.c targ.c

Log Message:
make(1): rename Lst_ForEach to Lst_ForEachUntil

Since the callback function returns a terminating condition, this is not
really a foreach loop.

Many of the calls to Lst_ForEachUntil don't make use of the terminating
condition, and several don't modify the list structurally, which means
they don't need this complicated implementation.

In a follow-up commit, Lst_ForEach will be added back with a much
simpler implementation that iterates over the list naively, without a
terminating condition and without taking the iteration state from
Lst_Open/Lst_Next/Lst_Close into account.  The migration to this simpler
implementation will be done step by step since each callback function
needs to be examined closely.


To generate a diff of this commit:
cvs rdiff -u -r1.149 -r1.150 src/usr.bin/make/compat.c
cvs rdiff -u -r1.144 -r1.145 src/usr.bin/make/dir.c
cvs rdiff -u -r1.236 -r1.237 src/usr.bin/make/job.c
cvs rdiff -u -r1.66 -r1.67 src/usr.bin/make/lst.c
cvs rdiff -u -r1.63 -r1.64 src/usr.bin/make/lst.h
cvs rdiff -u -r1.341 -r1.342 src/usr.bin/make/main.c
cvs rdiff -u -r1.139 -r1.140 src/usr.bin/make/make.c
cvs rdiff -u -r1.117 -r1.118 src/usr.bin/make/meta.c
cvs rdiff -u -r1.323 -r1.324 src/usr.bin/make/parse.c
cvs rdiff -u -r1.158 -r1.159 src/usr.bin/make/suff.c
cvs rdiff -u -r1.91 -r1.92 src/usr.bin/make/targ.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/compat.c
diff -u src/usr.bin/make/compat.c:1.149 src/usr.bin/make/compat.c:1.150
--- src/usr.bin/make/compat.c:1.149	Wed Sep 23 03:06:38 2020
+++ src/usr.bin/make/compat.c	Thu Sep 24 07:11:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat.c,v 1.149 2020/09/23 03:06:38 rillig Exp $	*/
+/*	$NetBSD: compat.c,v 1.150 2020/09/24 07:11:29 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -99,7 +99,7 @@
 #include"pathnames.h"
 
 /*	"@(#)compat.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: compat.c,v 1.149 2020/09/23 03:06:38 rillig Exp $");
+MAKE_RCSID("$NetBSD: compat.c,v 1.150 2020/09/24 07:11:29 rillig Exp $");
 
 static GNode	*curTarg = NULL;
 static void CompatInterrupt(int);
@@ -512,7 +512,7 @@ Compat_Make(GNode *gn, GNode *pgn)
 	gn->made = BEINGMADE;
 	if ((gn->type & OP_MADE) == 0)
 	Suff_FindDeps(gn);
-	Lst_ForEach(gn->children, CompatMake, gn);
+	Lst_ForEachUntil(gn->children, CompatMake, gn);
 	if ((gn->flags & REMAKE) == 0) {
 	gn->made = ABORTED;
 	pgn->flags &= ~(unsigned)REMAKE;
@@ -582,7 +582,7 @@ Compat_Make(GNode *gn, GNode *pgn)
 		meta_job_start(NULL, gn);
 		}
 #endif
-		Lst_ForEach(gn->commands, CompatRunCommand, gn);
+		Lst_ForEachUntil(gn->commands, CompatRunCommand, gn);
 		curTarg = NULL;
 	} else {
 		Job_Touch(gn, (gn->type & OP_SILENT) != 0);
@@ -652,7 +652,7 @@ Compat_Make(GNode *gn, GNode *pgn)
 }
 
 cohorts:
-Lst_ForEach(gn->cohorts, CompatMake, pgn);
+Lst_ForEachUntil(gn->cohorts, CompatMake, pgn);
 return 0;
 }
 

Index: src/usr.bin/make/dir.c
diff -u src/usr.bin/make/dir.c:1.144 src/usr.bin/make/dir.c:1.145
--- src/usr.bin/make/dir.c:1.144	Tue Sep 22 04:05:41 2020
+++ src/usr.bin/make/dir.c	Thu Sep 24 07:11:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: dir.c,v 1.144 2020/09/22 04:05:41 rillig Exp $	*/
+/*	$NetBSD: dir.c,v 1.145 2020/09/24 07:11:29 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -134,7 +134,7 @@
 #include "job.h"
 
 /*	"@(#)dir.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: dir.c,v 1.144 2020/09/22 04:05:41 rillig Exp $");
+MAKE_RCSID("$NetBSD: dir.c,v 1.145 2020/09/24 07:11:29 rillig Exp $");
 
 #define DIR_DEBUG0(fmt) \
 if (!DEBUG(DIR)) (void) 0; else fprintf(debug_file, fmt)
@@ -759,7 +759,7 @@ DirExpandInt(const char *word, SearchPat
 }
 
 /* Print a word in the list of expansions.
- * Callback for Dir_Expand when DEBUG(DIR), via Lst_ForEach. */
+ * Callback for Dir_Expand when DEBUG(DIR), via Lst_ForEachUntil. */
 static int
 DirPrintWord(void *word, void *dummy MAKE_ATTR_UNUSED)
 {
@@ -879,7 +879,7 @@ Dir_Expand(const char *word, SearchPath 
 	}
 }
 if (DEBUG(DIR)) {
-	Lst_ForEach(expansions, DirPrintWord, NULL);
+	Lst_ForEachUntil(expansions, DirPrintWord, NULL);
 	fprintf(debug_file, "\n");
 }
 }
@@ -1489,7 +1489,7 @@ Dir_MTime(GNode *gn, Boolean recheck)
  * Dir_AddDir --
  *	Add the given name to the end of the given path. The order of
  *	the arguments is backwards so ParseDoDependency can do a
- *	Lst_ForEach of its list of paths...
+ *	Lst_ForEachUntil of its list of paths...
  *
  * Input:
  *	path		the path to which the directory should be
@@ -1763,5 +1763,5 @@ DirPrintDir(void *p, void *dummy MAKE_AT
 

CVS commit: src/external/mit/ctwm

2020-09-24 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Thu Sep 24 06:52:48 UTC 2020

Modified Files:
src/external/mit/ctwm: Makefile
src/external/mit/ctwm/bin/ctwm: Makefile

Log Message:
revert; use system.ctwmrc from xsrc until I understand why the build fails


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/mit/ctwm/Makefile
cvs rdiff -u -r1.6 -r1.7 src/external/mit/ctwm/bin/ctwm/Makefile

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

Modified files:

Index: src/external/mit/ctwm/Makefile
diff -u src/external/mit/ctwm/Makefile:1.3 src/external/mit/ctwm/Makefile:1.4
--- src/external/mit/ctwm/Makefile:1.3	Thu Sep 24 05:43:30 2020
+++ src/external/mit/ctwm/Makefile	Thu Sep 24 06:52:48 2020
@@ -1,10 +1,10 @@
-#	$NetBSD: Makefile,v 1.3 2020/09/24 05:43:30 nia Exp $
+#	$NetBSD: Makefile,v 1.4 2020/09/24 06:52:48 nia Exp $
 
 # Top level Makefile to cross build xorg inside the NetBSD tree.
 
 .include 
 
-SUBDIR=		bin etc libexec
+SUBDIR=		bin libexec
 
 .if ${MKUPDATE} == "no" && !defined(NOCLEANDIR)
 BUILDTARGETS+=  cleandir

Index: src/external/mit/ctwm/bin/ctwm/Makefile
diff -u src/external/mit/ctwm/bin/ctwm/Makefile:1.6 src/external/mit/ctwm/bin/ctwm/Makefile:1.7
--- src/external/mit/ctwm/bin/ctwm/Makefile:1.6	Thu Sep 24 05:43:29 2020
+++ src/external/mit/ctwm/bin/ctwm/Makefile	Thu Sep 24 06:52:48 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.6 2020/09/24 05:43:29 nia Exp $
+#	$NetBSD: Makefile,v 1.7 2020/09/24 06:52:48 nia Exp $
 
 .include 
 
@@ -44,7 +44,9 @@ FILES=			3D_Expand15.xpm 3D_Iconify15.xp
 			xedit.xpm xftp.xpm xgopher.xpm xgrab.xpm xhpcalc.xpm \
 			xirc.xpm xmail.xpm xman.xpm xmosaic.xpm xnomail.xpm \
 			xrn-compose.xpm xrn.goodnews.xpm xrn.nonews.xpm xrn.xpm \
-			xterm.xpm
+			xterm.xpm system.ctwmrc
+
+FILESDIR_system.ctwmrc = ${CTWMCONFIGDIR}
 
 LDADD+=	-lXpm  -lXmu -lXt -lSM -lICE -lXext -lX11
 DPADD+=	${LIBXPM} ${LIBXMU} ${LIBXT} ${LIBSM} ${LIBICE} ${LIBXEXT} ${LIBX11}



CVS commit: src/usr.bin/make

2020-09-24 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Sep 24 06:45:59 UTC 2020

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

Log Message:
make(1): refactor add_wait_dep to not use Lst_ForEachFrom anymore

It was the last remaining use of that function outside of lst.c.

While here, clean up the code of add_wait_dep by removing unreachable
code (the GNode lists never contain NULL, only the GNode.commands lists
do that).


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/usr.bin/make/lst.c
cvs rdiff -u -r1.62 -r1.63 src/usr.bin/make/lst.h
cvs rdiff -u -r1.138 -r1.139 src/usr.bin/make/make.c
cvs rdiff -u -r1.90 -r1.91 src/usr.bin/make/targ.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.65 src/usr.bin/make/lst.c:1.66
--- src/usr.bin/make/lst.c:1.65	Tue Sep 22 04:05:41 2020
+++ src/usr.bin/make/lst.c	Thu Sep 24 06:45:59 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: lst.c,v 1.65 2020/09/22 04:05:41 rillig Exp $ */
+/* $NetBSD: lst.c,v 1.66 2020/09/24 06:45:59 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -36,7 +36,7 @@
 
 #include "make.h"
 
-MAKE_RCSID("$NetBSD: lst.c,v 1.65 2020/09/22 04:05:41 rillig Exp $");
+MAKE_RCSID("$NetBSD: lst.c,v 1.66 2020/09/24 06:45:59 rillig Exp $");
 
 struct ListNode {
 struct ListNode *prev;	/* previous element in list */
@@ -415,6 +415,8 @@ Lst_FindDatum(List *list, const void *da
 return NULL;
 }
 
+static int Lst_ForEachFrom(List *, ListNode *, LstActionProc, void *);
+
 /* Apply the given function to each element of the given list. The function
  * should return 0 if traversal should continue and non-zero if it should
  * abort. */

Index: src/usr.bin/make/lst.h
diff -u src/usr.bin/make/lst.h:1.62 src/usr.bin/make/lst.h:1.63
--- src/usr.bin/make/lst.h:1.62	Tue Sep 22 04:05:41 2020
+++ src/usr.bin/make/lst.h	Thu Sep 24 06:45:59 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: lst.h,v 1.62 2020/09/22 04:05:41 rillig Exp $	*/
+/*	$NetBSD: lst.h,v 1.63 2020/09/24 06:45:59 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -155,9 +155,6 @@ void LstNode_SetNull(ListNode *);
 /* Apply a function to each datum of the list, until the callback function
  * returns non-zero. */
 int Lst_ForEach(List *, LstActionProc, void *);
-/* Apply a function to each datum of the list, starting at the node,
- * until the callback function returns non-zero. */
-int Lst_ForEachFrom(List *, ListNode *, LstActionProc, void *);
 
 /* Iterating over a list while keeping track of the current node and possible
  * concurrent modifications */

Index: src/usr.bin/make/make.c
diff -u src/usr.bin/make/make.c:1.138 src/usr.bin/make/make.c:1.139
--- src/usr.bin/make/make.c:1.138	Tue Sep 22 20:19:46 2020
+++ src/usr.bin/make/make.c	Thu Sep 24 06:45:59 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.c,v 1.138 2020/09/22 20:19:46 rillig Exp $	*/
+/*	$NetBSD: make.c,v 1.139 2020/09/24 06:45:59 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -107,7 +107,7 @@
 #include"job.h"
 
 /*	"@(#)make.c	8.1 (Berkeley) 6/6/93"	*/
-MAKE_RCSID("$NetBSD: make.c,v 1.138 2020/09/22 20:19:46 rillig Exp $");
+MAKE_RCSID("$NetBSD: make.c,v 1.139 2020/09/24 06:45:59 rillig Exp $");
 
 static unsigned int checked = 1;/* Sequence # to detect recursion */
 static GNodeList *toBeMade;	/* The current fringe of the graph. These
@@ -1372,27 +1372,23 @@ link_parent(void *cnp, void *pnp)
 return 0;
 }
 
-static int
-add_wait_dep(void *v_cn, void *v_wn)
+/* Make the .WAIT node depend on the previous children */
+static void
+add_wait_dependency(GNodeListNode *owln, GNode *wn)
 {
-GNode *cn = v_cn;
-GNode *wn = v_wn;
+GNodeListNode *cln;
+GNode *cn;
 
-if (cn == wn)
-	return 1;
+for (cln = owln; (cn = LstNode_Datum(cln)) != wn; cln = LstNode_Next(cln)) {
+	if (DEBUG(MAKE))
+	fprintf(debug_file, ".WAIT: add dependency %s%s -> %s\n",
+		cn->name, cn->cohort_num, wn->name);
 
-if (cn == NULL || wn == NULL) {
-	printf("bad wait dep %p %p\n", cn, wn);
-	exit(4);
+	/* XXX: This pattern should be factored out, it repeats often */
+	Lst_Append(wn->children, cn);
+	wn->unmade++;
+	Lst_Append(cn->parents, wn);
 }
-if (DEBUG(MAKE))
-	 fprintf(debug_file, ".WAIT: add dependency %s%s -> %s\n",
-		cn->name, cn->cohort_num, wn->name);
-
-Lst_Append(wn->children, cn);
-wn->unmade++;
-Lst_Append(cn->parents, wn);
-return 0;
 }
 
 static void
@@ -1442,8 +1438,7 @@ Make_ProcessWait(GNodeList *targs)
 	for (; (ln = Lst_Next(pgn->children)) != NULL; ) {
 	cgn = LstNode_Datum(ln);
 	if (cgn->type & OP_WAIT) {
-		/* Make the .WAIT node depend on the previous children */
-		Lst_ForEachFrom(pgn->children, owln, add_wait_dep, cgn);
+		add_wait_dependency(owln, cgn);
 		owln = ln;
 	} else {
 		Lst_Append(examine, cgn);

Index: 

CVS commit: src/sys/uvm/pmap

2020-09-24 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Sep 24 06:45:58 UTC 2020

Modified Files:
src/sys/uvm/pmap: pmap.c pmap_segtab.c pmap_tlb.c

Log Message:
Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/uvm/pmap/pmap.c
cvs rdiff -u -r1.24 -r1.25 src/sys/uvm/pmap/pmap_segtab.c
cvs rdiff -u -r1.40 -r1.41 src/sys/uvm/pmap/pmap_tlb.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/uvm/pmap/pmap.c
diff -u src/sys/uvm/pmap/pmap.c:1.55 src/sys/uvm/pmap/pmap.c:1.56
--- src/sys/uvm/pmap/pmap.c:1.55	Thu Aug 20 05:54:32 2020
+++ src/sys/uvm/pmap/pmap.c	Thu Sep 24 06:45:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.55 2020/08/20 05:54:32 mrg Exp $	*/
+/*	$NetBSD: pmap.c,v 1.56 2020/09/24 06:45:58 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.55 2020/08/20 05:54:32 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.56 2020/09/24 06:45:58 skrll Exp $");
 
 /*
  *	Manages physical address maps.
@@ -408,7 +408,7 @@ pmap_page_syncicache(struct vm_page *pg)
 	pmap_pvlist_check(mdpg);
 
 	UVMHIST_LOG(pmaphist, "pv %jx pv_pmap %jx", (uintptr_t)pv,
-	 (uintptr_t)pv->pv_pmap, 0, 0);
+	(uintptr_t)pv->pv_pmap, 0, 0);
 
 	if (pv->pv_pmap != NULL) {
 		for (; pv != NULL; pv = pv->pv_next) {

Index: src/sys/uvm/pmap/pmap_segtab.c
diff -u src/sys/uvm/pmap/pmap_segtab.c:1.24 src/sys/uvm/pmap/pmap_segtab.c:1.25
--- src/sys/uvm/pmap/pmap_segtab.c:1.24	Thu Sep 10 02:12:57 2020
+++ src/sys/uvm/pmap/pmap_segtab.c	Thu Sep 24 06:45:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_segtab.c,v 1.24 2020/09/10 02:12:57 rin Exp $	*/
+/*	$NetBSD: pmap_segtab.c,v 1.25 2020/09/24 06:45:58 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap_segtab.c,v 1.24 2020/09/10 02:12:57 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_segtab.c,v 1.25 2020/09/24 06:45:58 skrll Exp $");
 
 /*
  *	Manages physical address maps.
@@ -192,7 +192,7 @@ pmap_check_ptes(pt_entry_t *pte, const c
 	j, pte_value(pte[j]), 0, 0);
 #endif
 			panic("%s: pte[%zu] entry at %p not 0 (%#"PRIxPTE")",
-			  caller, i, [i], pte_value(pte[i]));
+			caller, i, [i], pte_value(pte[i]));
 		}
 #endif
 }

Index: src/sys/uvm/pmap/pmap_tlb.c
diff -u src/sys/uvm/pmap/pmap_tlb.c:1.40 src/sys/uvm/pmap/pmap_tlb.c:1.41
--- src/sys/uvm/pmap/pmap_tlb.c:1.40	Sat Aug 22 14:51:44 2020
+++ src/sys/uvm/pmap/pmap_tlb.c	Thu Sep 24 06:45:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_tlb.c,v 1.40 2020/08/22 14:51:44 skrll Exp $	*/
+/*	$NetBSD: pmap_tlb.c,v 1.41 2020/09/24 06:45:58 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.40 2020/08/22 14:51:44 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.41 2020/09/24 06:45:58 skrll Exp $");
 
 /*
  * Manages address spaces in a TLB.
@@ -757,8 +757,8 @@ pmap_tlb_update_addr(pmap_t pm, vaddr_t 
 		(flags & PMAP_TLB_INSERT) != 0);
 		pmap_tlb_asid_check();
 		UVMHIST_LOG(maphist,
-		 "   %jd <-- tlb_update_addr(%#jx, %#jx, %#jx, ...)",
-		 rv, va, pai->pai_asid, pte_value(pte));
+		"   %jd <-- tlb_update_addr(%#jx, %#jx, %#jx, ...)",
+		rv, va, pai->pai_asid, pte_value(pte));
 		KASSERTMSG((flags & PMAP_TLB_INSERT) == 0 || rv == 1,
 		"pmap %p (asid %u) va %#"PRIxVADDR" pte %#"PRIxPTE" rv %d",
 		pm, pai->pai_asid, va, pte_value(pte), rv);



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

2020-09-24 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Sep 24 06:03:45 UTC 2020

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

Log Message:
make(1): extend documentation in the varname-empty test


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/varname-empty.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/varname-empty.mk
diff -u src/usr.bin/make/unit-tests/varname-empty.mk:1.5 src/usr.bin/make/unit-tests/varname-empty.mk:1.6
--- src/usr.bin/make/unit-tests/varname-empty.mk:1.5	Sat Aug 22 21:22:24 2020
+++ src/usr.bin/make/unit-tests/varname-empty.mk	Thu Sep 24 06:03:44 2020
@@ -1,13 +1,32 @@
-# $NetBSD: varname-empty.mk,v 1.5 2020/08/22 21:22:24 rillig Exp $
+# $NetBSD: varname-empty.mk,v 1.6 2020/09/24 06:03:44 rillig Exp $
 #
 # Tests for the special variable with the empty name.
 #
-# The variable "" is not supposed to be assigned any value.
+# There is no variable named "" at all, and this fact is used a lot in
+# variable expressions of the form ${:Ufallback}.  These expressions are
+# based on the variable named "" and use the :U modifier to assign a
+# fallback value to the expression (but not to the variable).
+#
+# This form of expressions is used to implement value substitution in the
+# .for loops.  Another use case is in a variable assignment of the form
+# ${:Uvarname}=value, which allows for characters in the variable name that
+# would otherwise be interpreted by the parser, such as whitespace, ':',
+# '=', '$', backslash.
+#
+# The only places where a variable is assigned a value are Var_Set and
+# Var_Append, and these places protect the variable named "" from being
+# defined.  This is different from read-only variables, as that flag can
+# only apply to variables that are defined.
+#
 # This is because it is heavily used in the .for loop expansion,
 # as well as to generate arbitrary strings, as in ${:Ufallback}.
 
 # Until 2020-08-22 it was possible to assign a value to the variable with
 # the empty name, leading to all kinds of unexpected effects.
+#
+# Before 2020-08-22, the simple assignment operator '=' had an off-by-one
+# bug that caused unrelated memory to be read in Parse_DoVar, invoking
+# undefined behavior.
 ?=	default
 =	assigned	# undefined behavior until 2020-08-22
 +=	appended