CVS commit: src/distrib/amd64

2021-12-30 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Dec 31 04:59:16 UTC 2021

Modified Files:
src/distrib/amd64/installimage: Makefile
src/distrib/amd64/installimage-bios: Makefile

Log Message:
Still not big enough - bump some more.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/distrib/amd64/installimage/Makefile
cvs rdiff -u -r1.3 -r1.4 src/distrib/amd64/installimage-bios/Makefile

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

Modified files:

Index: src/distrib/amd64/installimage/Makefile
diff -u src/distrib/amd64/installimage/Makefile:1.19 src/distrib/amd64/installimage/Makefile:1.20
--- src/distrib/amd64/installimage/Makefile:1.19	Thu Dec 30 15:01:55 2021
+++ src/distrib/amd64/installimage/Makefile	Fri Dec 31 04:59:16 2021
@@ -1,10 +1,10 @@
-#	$NetBSD: Makefile,v 1.19 2021/12/30 15:01:55 pgoyette Exp $
+#	$NetBSD: Makefile,v 1.20 2021/12/31 04:59:16 pgoyette Exp $
 
 .include 
 
 INSTIMGBASE=	NetBSD-${DISTRIBVER}-amd64-install	# gives ${IMGBASE}.img
 
-INSTIMAGEMB?=	2180			# for all installation binaries
+INSTIMAGEMB?=	2250			# for all installation binaries
 
 PRIMARY_BOOT=		bootxx_ffsv1
 SECONDARY_BOOT=		boot

Index: src/distrib/amd64/installimage-bios/Makefile
diff -u src/distrib/amd64/installimage-bios/Makefile:1.3 src/distrib/amd64/installimage-bios/Makefile:1.4
--- src/distrib/amd64/installimage-bios/Makefile:1.3	Thu Dec 30 15:01:55 2021
+++ src/distrib/amd64/installimage-bios/Makefile	Fri Dec 31 04:59:15 2021
@@ -1,10 +1,10 @@
-#	$NetBSD: Makefile,v 1.3 2021/12/30 15:01:55 pgoyette Exp $
+#	$NetBSD: Makefile,v 1.4 2021/12/31 04:59:15 pgoyette Exp $
 
 .include 
 
 INSTIMGBASE=	NetBSD-${DISTRIBVER}-amd64-bios-install	# gives ${IMGBASE}.img
 
-INSTIMAGEMB?=	2180			# for all installation binaries
+INSTIMAGEMB?=	2250			# for all installation binaries
 
 PRIMARY_BOOT=		bootxx_ffsv1
 SECONDARY_BOOT=		boot



CVS commit: src/distrib/amd64

2021-12-30 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Dec 31 04:59:16 UTC 2021

Modified Files:
src/distrib/amd64/installimage: Makefile
src/distrib/amd64/installimage-bios: Makefile

Log Message:
Still not big enough - bump some more.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/distrib/amd64/installimage/Makefile
cvs rdiff -u -r1.3 -r1.4 src/distrib/amd64/installimage-bios/Makefile

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



CVS commit: src/usr.bin/make

2021-12-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Dec 31 01:34:45 UTC 2021

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

Log Message:
make: sync API documentation of parse.c with latest changes


To generate a diff of this commit:
cvs rdiff -u -r1.608 -r1.609 src/usr.bin/make/parse.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/parse.c
diff -u src/usr.bin/make/parse.c:1.608 src/usr.bin/make/parse.c:1.609
--- src/usr.bin/make/parse.c:1.608	Fri Dec 31 01:08:59 2021
+++ src/usr.bin/make/parse.c	Fri Dec 31 01:34:45 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.608 2021/12/31 01:08:59 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.609 2021/12/31 01:34:45 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -86,15 +86,16 @@
  *	Parse_File	Parse a top-level makefile.  Included files are
  *			handled by IncludeFile instead.
  *
- *	Parse_IsVar	Return true if the given line is a variable
- *			assignment. Used by MainParseArgs to determine if
- *			an argument is a target or a variable assignment.
- *			Used internally for pretty much the same thing.
+ *	Parse_VarAssign
+ *			Try to parse the given line as a variable assignment.
+ *			Used by MainParseArgs to determine if an argument is
+ *			a target or a variable assignment.  Used internally
+ *			for pretty much the same thing.
  *
  *	Parse_Error	Report a parse error, a warning or an informational
  *			message.
  *
- *	Parse_MainName	Returns a list of the main target to create.
+ *	Parse_MainName	Returns a list of the single main target to create.
  */
 
 #include 
@@ -109,7 +110,7 @@
 #include "pathnames.h"
 
 /*	"@(#)parse.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: parse.c,v 1.608 2021/12/31 01:08:59 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.609 2021/12/31 01:34:45 rillig Exp $");
 
 /* types and constants */
 



CVS commit: src/usr.bin/make

2021-12-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Dec 31 01:34:45 UTC 2021

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

Log Message:
make: sync API documentation of parse.c with latest changes


To generate a diff of this commit:
cvs rdiff -u -r1.608 -r1.609 src/usr.bin/make/parse.c

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



CVS commit: src/usr.bin/make

2021-12-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Dec 31 01:08:59 UTC 2021

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

Log Message:
make: prevent out-of-bounds pointer in AdjustVarassignOp

It's a rather theoretical case that 'name' would point at the very end
of the address space and the string there would be "V=", but in that
case, the expression 'name + 3' would wrap around.


To generate a diff of this commit:
cvs rdiff -u -r1.607 -r1.608 src/usr.bin/make/parse.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/parse.c
diff -u src/usr.bin/make/parse.c:1.607 src/usr.bin/make/parse.c:1.608
--- src/usr.bin/make/parse.c:1.607	Fri Dec 31 00:45:21 2021
+++ src/usr.bin/make/parse.c	Fri Dec 31 01:08:59 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.607 2021/12/31 00:45:21 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.608 2021/12/31 01:08:59 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
 #include "pathnames.h"
 
 /*	"@(#)parse.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: parse.c,v 1.607 2021/12/31 00:45:21 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.608 2021/12/31 01:08:59 rillig Exp $");
 
 /* types and constants */
 
@@ -1672,7 +1672,7 @@ AdjustVarassignOp(const char *name, cons
 		while (op > name && ch_isspace(op[-1]))
 			op--;
 
-		if (op >= name + 3 && memcmp(op - 3, ":sh", 3) == 0) {
+		if (op - name >= 3 && memcmp(op - 3, ":sh", 3) == 0) {
 			op -= 3;
 			type = VAR_SHELL;
 		}



CVS commit: src/usr.bin/make

2021-12-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Dec 31 01:08:59 UTC 2021

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

Log Message:
make: prevent out-of-bounds pointer in AdjustVarassignOp

It's a rather theoretical case that 'name' would point at the very end
of the address space and the string there would be "V=", but in that
case, the expression 'name + 3' would wrap around.


To generate a diff of this commit:
cvs rdiff -u -r1.607 -r1.608 src/usr.bin/make/parse.c

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



CVS commit: src/doc

2021-12-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 00:57:12 UTC 2021

Modified Files:
src/doc: TODO.smpnet

Log Message:
doc: Update TODO.smpnet to reflect invention of ETHER_F_ALLMULTI.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/doc/TODO.smpnet

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

Modified files:

Index: src/doc/TODO.smpnet
diff -u src/doc/TODO.smpnet:1.44 src/doc/TODO.smpnet:1.45
--- src/doc/TODO.smpnet:1.44	Mon Aug  9 19:24:33 2021
+++ src/doc/TODO.smpnet	Fri Dec 31 00:57:12 2021
@@ -1,4 +1,4 @@
-$NetBSD: TODO.smpnet,v 1.44 2021/08/09 19:24:33 andvar Exp $
+$NetBSD: TODO.smpnet,v 1.45 2021/12/31 00:57:12 riastradh Exp $
 
 MP-safe components
 ==
@@ -261,14 +261,10 @@ avoid performance degradation by lock co
 IFF_UP and IFF_OACTIVE flags of if_flags are checked on packet processing.  If
 you make a driver MP-safe you must remove such checks.
 
-IFF_ALLMULTI can be set/unset via if_mcast_op.  To protect updates of the flag,
-we had added IFNET_LOCK around if_mcast_op.  However that was not a good
-approach because if_mcast_op is typically called in the middle of a call path
-and holding IFNET_LOCK such places is problematic.  Actually a deadlock is
-observed.  Probably we should remove IFNET_LOCK and manage IFF_ALLMULTI
-somewhere other than if_flags, for example ethercom or driver itself (or a
-common driver framework once it appears).  Such a change is feasible because
-IFF_ALLMULTI is only set/unset by a driver and not accessed from any common
-components such as network protocols.
+Drivers should not touch IFF_ALLMULTI.  They are tempted to do so when updating
+hardware multicast filters on SIOCADDMULTI/SIOCDELMULTI.  Instead, they should
+use the ETHER_F_ALLMULTI bit in struct ethercom::ec_flags, under ETHER_LOCK.
+ether_ioctl takes care of presenting IFF_ALLMULTI according to the current state
+of ETHER_F_ALLMULTI when queried with SIOCGIFFLAGS.
 
 Also IFF_PROMISC is checked in ether_input and we should get rid of it somehow.



CVS commit: src/doc

2021-12-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Dec 31 00:57:12 UTC 2021

Modified Files:
src/doc: TODO.smpnet

Log Message:
doc: Update TODO.smpnet to reflect invention of ETHER_F_ALLMULTI.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/doc/TODO.smpnet

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



CVS commit: src/usr.bin/make

2021-12-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Dec 31 00:45:21 UTC 2021

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

Log Message:
make: merge duplicate code in Parse_IsVar

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.606 -r1.607 src/usr.bin/make/parse.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/parse.c
diff -u src/usr.bin/make/parse.c:1.606 src/usr.bin/make/parse.c:1.607
--- src/usr.bin/make/parse.c:1.606	Fri Dec 31 00:37:50 2021
+++ src/usr.bin/make/parse.c	Fri Dec 31 00:45:21 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.606 2021/12/31 00:37:50 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.607 2021/12/31 00:45:21 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
 #include "pathnames.h"
 
 /*	"@(#)parse.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: parse.c,v 1.606 2021/12/31 00:37:50 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.607 2021/12/31 00:45:21 rillig Exp $");
 
 /* types and constants */
 
@@ -1751,24 +1751,21 @@ Parse_IsVar(const char *p, VarAssign *ou
 			continue;
 		}
 #endif
-		if (ch == '=') {
+		if (ch == '=')
 			eq = p - 1;
-			nameEnd = firstSpace != NULL ? firstSpace : p - 1;
-			cpp_skip_whitespace(&p);
-			*out_var = AdjustVarassignOp(nameStart, nameEnd, eq, p);
-			return true;
-		}
-		if (*p == '=' &&
-		(ch == '+' || ch == ':' || ch == '?' || ch == '!')) {
+		else if (*p == '=' &&
+		(ch == '+' || ch == ':' || ch == '?' || ch == '!'))
 			eq = p;
-			nameEnd = firstSpace != NULL ? firstSpace : p;
-			p++;
-			cpp_skip_whitespace(&p);
-			*out_var = AdjustVarassignOp(nameStart, nameEnd, eq, p);
-			return true;
-		}
-		if (firstSpace != NULL)
+		else if (firstSpace != NULL)
 			return false;
+		else
+			continue;
+
+		nameEnd = firstSpace != NULL ? firstSpace : eq;
+		p = eq + 1;
+		cpp_skip_whitespace(&p);
+		*out_var = AdjustVarassignOp(nameStart, nameEnd, eq, p);
+		return true;
 	}
 
 	return false;



CVS commit: src/usr.bin/make

2021-12-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Dec 31 00:45:21 UTC 2021

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

Log Message:
make: merge duplicate code in Parse_IsVar

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.606 -r1.607 src/usr.bin/make/parse.c

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



CVS commit: src/usr.bin/make

2021-12-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Dec 31 00:37:50 UTC 2021

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

Log Message:
make: eliminate type VarAssignParsed

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.605 -r1.606 src/usr.bin/make/parse.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/parse.c
diff -u src/usr.bin/make/parse.c:1.605 src/usr.bin/make/parse.c:1.606
--- src/usr.bin/make/parse.c:1.605	Fri Dec 31 00:18:06 2021
+++ src/usr.bin/make/parse.c	Fri Dec 31 00:37:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.605 2021/12/31 00:18:06 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.606 2021/12/31 00:37:50 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
 #include "pathnames.h"
 
 /*	"@(#)parse.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: parse.c,v 1.605 2021/12/31 00:18:06 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.606 2021/12/31 00:37:50 rillig Exp $");
 
 /* types and constants */
 
@@ -1639,23 +1639,16 @@ typedef struct VarAssign {
 	const char *value;	/* unexpanded */
 } VarAssign;
 
-typedef struct VarAssignParsed {
-	const char *nameStart;	/* unexpanded */
-	const char *nameEnd;	/* before operator adjustment */
-	const char *eq;		/* the '=' of the assignment operator */
-} VarAssignParsed;
-
 /*
  * Determine the assignment operator and adjust the end of the variable
  * name accordingly.
  */
-static void
-AdjustVarassignOp(const VarAssignParsed *pvar, const char *value,
-		  VarAssign *out_var)
+static VarAssign
+AdjustVarassignOp(const char *name, const char *nameEnd, const char *op,
+		  const char *value)
 {
-	const char *op = pvar->eq;
-	const char *const name = pvar->nameStart;
 	VarAssignOp type;
+	VarAssign va;
 
 	if (op > name && op[-1] == '+') {
 		op--;
@@ -1686,12 +1679,10 @@ AdjustVarassignOp(const VarAssignParsed 
 #endif
 	}
 
-	{
-		const char *nameEnd = pvar->nameEnd < op ? pvar->nameEnd : op;
-		out_var->varname = bmake_strsedup(pvar->nameStart, nameEnd);
-		out_var->op = type;
-		out_var->value = value;
-	}
+	va.varname = bmake_strsedup(name, nameEnd < op ? nameEnd : op);
+	va.op = type;
+	va.value = value;
+	return va;
 }
 
 /*
@@ -1710,7 +1701,9 @@ AdjustVarassignOp(const VarAssignParsed 
 static bool
 Parse_IsVar(const char *p, VarAssign *out_var)
 {
-	VarAssignParsed pvar;
+	const char *nameStart;
+	const char *nameEnd;
+	const char *eq;
 	const char *firstSpace = NULL;
 	int level = 0;
 
@@ -1722,10 +1715,10 @@ Parse_IsVar(const char *p, VarAssign *ou
 	 * ':sh' modifier. Of these two (nameEnd and op), the earlier one
 	 * determines the actual end of the variable name.
 	 */
-	pvar.nameStart = p;
+	nameStart = p;
 #ifdef CLEANUP
-	pvar.nameEnd = NULL;
-	pvar.eq = NULL;
+	nameEnd = NULL;
+	eq = NULL;
 #endif
 
 	/*
@@ -1759,19 +1752,19 @@ Parse_IsVar(const char *p, VarAssign *ou
 		}
 #endif
 		if (ch == '=') {
-			pvar.eq = p - 1;
-			pvar.nameEnd = firstSpace != NULL ? firstSpace : p - 1;
+			eq = p - 1;
+			nameEnd = firstSpace != NULL ? firstSpace : p - 1;
 			cpp_skip_whitespace(&p);
-			AdjustVarassignOp(&pvar, p, out_var);
+			*out_var = AdjustVarassignOp(nameStart, nameEnd, eq, p);
 			return true;
 		}
 		if (*p == '=' &&
 		(ch == '+' || ch == ':' || ch == '?' || ch == '!')) {
-			pvar.eq = p;
-			pvar.nameEnd = firstSpace != NULL ? firstSpace : p;
+			eq = p;
+			nameEnd = firstSpace != NULL ? firstSpace : p;
 			p++;
 			cpp_skip_whitespace(&p);
-			AdjustVarassignOp(&pvar, p, out_var);
+			*out_var = AdjustVarassignOp(nameStart, nameEnd, eq, p);
 			return true;
 		}
 		if (firstSpace != NULL)



CVS commit: src/usr.bin/make

2021-12-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Dec 31 00:37:50 UTC 2021

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

Log Message:
make: eliminate type VarAssignParsed

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.605 -r1.606 src/usr.bin/make/parse.c

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



CVS commit: src/usr.bin/make

2021-12-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Dec 31 00:18:06 UTC 2021

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

Log Message:
make: unexport types VarAssignOp and VarAssign

These types are only needed in the parsing module.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.562 -r1.563 src/usr.bin/make/main.c
cvs rdiff -u -r1.226 -r1.227 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.604 -r1.605 src/usr.bin/make/parse.c

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



CVS commit: src/usr.bin/make

2021-12-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Dec 31 00:18:06 UTC 2021

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

Log Message:
make: unexport types VarAssignOp and VarAssign

These types are only needed in the parsing module.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.562 -r1.563 src/usr.bin/make/main.c
cvs rdiff -u -r1.226 -r1.227 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.604 -r1.605 src/usr.bin/make/parse.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/main.c
diff -u src/usr.bin/make/main.c:1.562 src/usr.bin/make/main.c:1.563
--- src/usr.bin/make/main.c:1.562	Tue Dec 28 21:56:13 2021
+++ src/usr.bin/make/main.c	Fri Dec 31 00:18:06 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.562 2021/12/28 21:56:13 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.563 2021/12/31 00:18:06 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -111,7 +111,7 @@
 #include "trace.h"
 
 /*	"@(#)main.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: main.c,v 1.562 2021/12/28 21:56:13 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.563 2021/12/31 00:18:06 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	"The Regents of the University of California.  "
@@ -641,10 +641,7 @@ rearg:
 	 * on the end of the "create" list.
 	 */
 	for (; argc > 1; argv++, argc--) {
-		VarAssign var;
-		if (Parse_IsVar(argv[1], &var)) {
-			Parse_Var(&var, SCOPE_CMDLINE);
-		} else {
+		if (!Parse_VarAssign(argv[1], false, SCOPE_CMDLINE)) {
 			if (argv[1][0] == '\0')
 Punt("illegal (null) argument.");
 			if (argv[1][0] == '-' && !dashDash)

Index: src/usr.bin/make/nonints.h
diff -u src/usr.bin/make/nonints.h:1.226 src/usr.bin/make/nonints.h:1.227
--- src/usr.bin/make/nonints.h:1.226	Fri Dec 31 00:01:02 2021
+++ src/usr.bin/make/nonints.h	Fri Dec 31 00:18:06 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: nonints.h,v 1.226 2021/12/31 00:01:02 rillig Exp $	*/
+/*	$NetBSD: nonints.h,v 1.227 2021/12/31 00:18:06 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -141,25 +141,10 @@ const char *cached_realpath(const char *
 void Parse_Init(void);
 void Parse_End(void);
 
-typedef enum VarAssignOp {
-	VAR_NORMAL,		/* = */
-	VAR_APPEND,		/* += */
-	VAR_DEFAULT,		/* ?= */
-	VAR_SUBST,		/* := */
-	VAR_SHELL		/* != or :sh= */
-} VarAssignOp;
-
-typedef struct VarAssign {
-	char *varname;		/* unexpanded */
-	VarAssignOp op;
-	const char *value;	/* unexpanded */
-} VarAssign;
-
 typedef char *(*ReadMoreProc)(void *, size_t *);
 
 void Parse_Error(ParseErrorLevel, const char *, ...) MAKE_ATTR_PRINTFLIKE(2, 3);
-bool Parse_IsVar(const char *, VarAssign *out_var) MAKE_ATTR_USE;
-void Parse_Var(VarAssign *, GNode *);
+bool Parse_VarAssign(const char *, bool, GNode *) MAKE_ATTR_USE;
 void Parse_AddIncludeDir(const char *);
 void Parse_File(const char *, int);
 void Parse_PushInput(const char *, int, int, ReadMoreProc, void *);

Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.604 src/usr.bin/make/parse.c:1.605
--- src/usr.bin/make/parse.c:1.604	Wed Dec 29 05:01:35 2021
+++ src/usr.bin/make/parse.c	Fri Dec 31 00:18:06 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.604 2021/12/29 05:01:35 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.605 2021/12/31 00:18:06 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
 #include "pathnames.h"
 
 /*	"@(#)parse.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: parse.c,v 1.604 2021/12/29 05:01:35 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.605 2021/12/31 00:18:06 rillig Exp $");
 
 /* types and constants */
 
@@ -1625,6 +1625,20 @@ out:
 		Lst_Free(paths);
 }
 
+typedef enum VarAssignOp {
+	VAR_NORMAL,		/* = */
+	VAR_APPEND,		/* += */
+	VAR_DEFAULT,		/* ?= */
+	VAR_SUBST,		/* := */
+	VAR_SHELL		/* != or :sh= */
+} VarAssignOp;
+
+typedef struct VarAssign {
+	char *varname;		/* unexpanded */
+	VarAssignOp op;
+	const char *value;	/* unexpanded */
+} VarAssign;
+
 typedef struct VarAssignParsed {
 	const char *nameStart;	/* unexpanded */
 	const char *nameEnd;	/* before operator adjustment */
@@ -1693,7 +1707,7 @@ AdjustVarassignOp(const VarAssignParsed 
  *
  * Used for both lines in a file and command line arguments.
  */
-bool
+static bool
 Parse_IsVar(const char *p, VarAssign *out_var)
 {
 	VarAssignParsed pvar;
@@ -1891,7 +1905,7 @@ VarAssignSpecial(const char *name, const
 }
 
 /* Perform the variable assignment in the given scope. */
-void
+static void
 Parse_Var(VarAssign *var, GNode *scope)
 {
 	FStr avalue;		/* actual value (maybe expanded) */
@@ -2925,16 +2939,16 @@ ParseDirective(char *line)
 	return true;
 }
 
-static bool
-ParseVarassign(const char *line)
+bool
+Parse_VarAssign(const char *line, bool finishDependencyGroup, GNode *scope)
 {
 	VarAssign var;
 
 	if (!Parse_IsVar(line, &var))
 		return false;
-
-

CVS commit: src/usr.bin/make

2021-12-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Dec 31 00:01:03 UTC 2021

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

Log Message:
make: list VarAssignOp in the same order as in the manual page

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.225 -r1.226 src/usr.bin/make/nonints.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/nonints.h
diff -u src/usr.bin/make/nonints.h:1.225 src/usr.bin/make/nonints.h:1.226
--- src/usr.bin/make/nonints.h:1.225	Wed Dec 29 05:05:21 2021
+++ src/usr.bin/make/nonints.h	Fri Dec 31 00:01:02 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: nonints.h,v 1.225 2021/12/29 05:05:21 rillig Exp $	*/
+/*	$NetBSD: nonints.h,v 1.226 2021/12/31 00:01:02 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -143,10 +143,10 @@ void Parse_End(void);
 
 typedef enum VarAssignOp {
 	VAR_NORMAL,		/* = */
-	VAR_SUBST,		/* := */
-	VAR_SHELL,		/* != or :sh= */
 	VAR_APPEND,		/* += */
-	VAR_DEFAULT		/* ?= */
+	VAR_DEFAULT,		/* ?= */
+	VAR_SUBST,		/* := */
+	VAR_SHELL		/* != or :sh= */
 } VarAssignOp;
 
 typedef struct VarAssign {



CVS commit: src/usr.bin/make

2021-12-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Dec 31 00:01:03 UTC 2021

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

Log Message:
make: list VarAssignOp in the same order as in the manual page

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.225 -r1.226 src/usr.bin/make/nonints.h

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



CVS commit: src/usr.bin/make

2021-12-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Dec 30 23:56:35 UTC 2021

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

Log Message:
make: condense code in ApplyModifier_Assign

List the assignment operators in the same order as in the manual page.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.991 -r1.992 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.991 src/usr.bin/make/var.c:1.992
--- src/usr.bin/make/var.c:1.991	Wed Dec 29 05:05:21 2021
+++ src/usr.bin/make/var.c	Thu Dec 30 23:56:34 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.991 2021/12/29 05:05:21 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.992 2021/12/30 23:56:34 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -140,7 +140,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.991 2021/12/29 05:05:21 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.992 2021/12/30 23:56:34 rillig Exp $");
 
 /*
  * Variables are defined using one of the VAR=value assignments.  Their
@@ -3537,27 +3537,18 @@ ApplyModifier_Assign(const char **pp, Mo
 	const char *op = mod + 1;
 
 	if (op[0] == '=')
-		goto ok;
-	if ((op[0] == '!' || op[0] == '+' || op[0] == '?') && op[1] == '=')
-		goto ok;
+		goto found_op;
+	if ((op[0] == '+' || op[0] == '?' || op[0] == '!') && op[1] == '=')
+		goto found_op;
 	return AMR_UNKNOWN;	/* "::" */
 
-ok:
+found_op:
 	if (expr->name[0] == '\0') {
 		*pp = mod + 1;
 		return AMR_BAD;
 	}
 
-	switch (op[0]) {
-	case '+':
-	case '?':
-	case '!':
-		*pp = mod + 3;
-		break;
-	default:
-		*pp = mod + 2;
-		break;
-	}
+	*pp = mod + (op[0] == '+' || op[0] == '?' || op[0] == '!' ? 3 : 2);
 
 	res = ParseModifierPart(pp, ch->endc, expr->emode, ch, &buf);
 	if (res != VPR_OK)



CVS commit: src/usr.bin/make

2021-12-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Dec 30 23:56:35 UTC 2021

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

Log Message:
make: condense code in ApplyModifier_Assign

List the assignment operators in the same order as in the manual page.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.991 -r1.992 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.



CVS commit: src/sys/netinet

2021-12-30 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Thu Dec 30 23:03:44 UTC 2021

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

Log Message:
s/bandwith/bandwidth/


To generate a diff of this commit:
cvs rdiff -u -r1.213 -r1.214 src/sys/netinet/tcp_output.c

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

Modified files:

Index: src/sys/netinet/tcp_output.c
diff -u src/sys/netinet/tcp_output.c:1.213 src/sys/netinet/tcp_output.c:1.214
--- src/sys/netinet/tcp_output.c:1.213	Fri Jun 12 11:04:45 2020
+++ src/sys/netinet/tcp_output.c	Thu Dec 30 23:03:44 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_output.c,v 1.213 2020/06/12 11:04:45 roy Exp $	*/
+/*	$NetBSD: tcp_output.c,v 1.214 2021/12/30 23:03:44 andvar Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -135,7 +135,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tcp_output.c,v 1.213 2020/06/12 11:04:45 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_output.c,v 1.214 2021/12/30 23:03:44 andvar Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -907,9 +907,9 @@ again:
 	 * and does at most one step per received ACK.  This fast
 	 * scaling has the drawback of growing the send buffer beyond
 	 * what is strictly necessary to make full use of a given
-	 * delay*bandwith product.  However testing has shown this not
+	 * delay*bandwidth product.  However testing has shown this not
 	 * to be much of an problem.  At worst we are trading wasting
-	 * of available bandwith (the non-use of it) for wasting some
+	 * of available bandwidth (the non-use of it) for wasting some
 	 * socket buffer memory.
 	 *
 	 * TODO: Shrink send buffer during idle periods together



CVS commit: src/sys/netinet

2021-12-30 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Thu Dec 30 23:03:44 UTC 2021

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

Log Message:
s/bandwith/bandwidth/


To generate a diff of this commit:
cvs rdiff -u -r1.213 -r1.214 src/sys/netinet/tcp_output.c

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



re: CVS commit: src/sys/conf

2021-12-30 Thread matthew green
> - We only make a debuginstall rule to install netbsd-${KERNEL_CONFIG}.debug
>   if MKDEBUG=yes

this part pollutes my $DESTDIR with non-distrib kernel info still,
which also means it requires a $DESTDIR to build a kernel now.

i think that we should not do this in the kernel build but inside
the sets build, and create the set with ./netbsd and the
./usr/libdata/debug/netbsd-$KERNEL.debug path stored in some temp
dir of distrib/sets/.  that avoids issues of building stuff being
all different now, while allowing this to create sets  sanely.


.mrg.


CVS commit: src/sys/conf

2021-12-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Dec 30 18:53:35 UTC 2021

Modified Files:
src/sys/conf: Makefile.kern.inc

Log Message:
- With DEBUG=-g (which is also set when we build CTF) we build netbsd.gdb *and*
  netbsd-${KERNEL_CONFIG}.debug because it is not worth having two sets of
  rules (one that builds just netbsd.gdb and one that builds both netbsd.gdb
  and netbsd-${KERNEL_CONFIG}.debug. This maintains compatibility building
  netbsd.gdb when DEBUG=-g
- When either MKDEBUGKERNEL=yes or MKDEBUG=tes we set DEBUG=-g if DEBUG was
  not set.
- We only make a debuginstall rule to install netbsd-${KERNEL_CONFIG}.debug
  if MKDEBUG=yes


To generate a diff of this commit:
cvs rdiff -u -r1.290 -r1.291 src/sys/conf/Makefile.kern.inc

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

Modified files:

Index: src/sys/conf/Makefile.kern.inc
diff -u src/sys/conf/Makefile.kern.inc:1.290 src/sys/conf/Makefile.kern.inc:1.291
--- src/sys/conf/Makefile.kern.inc:1.290	Thu Dec 30 12:25:40 2021
+++ src/sys/conf/Makefile.kern.inc	Thu Dec 30 13:53:35 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.kern.inc,v 1.290 2021/12/30 17:25:40 christos Exp $
+#	$NetBSD: Makefile.kern.inc,v 1.291 2021/12/30 18:53:35 christos Exp $
 #
 # This file contains common `MI' targets and definitions and it is included
 # at the bottom of each `MD' ${MACHINE}/conf/Makefile.${MACHINE}.
@@ -20,6 +20,8 @@
 # Default DEBUG to -g if kernel debug info is requested by MKDEBUGKERNEL=yes
 .if ${MKDEBUGKERNEL:Uno} == "yes" || ${MKDEBUG:Uno} == "yes"
 DEBUG?=-g
+.else
+DEBUG?=
 .endif
 
 ##
@@ -255,9 +257,17 @@ SYSTEM_LD_TAIL_DEBUG?=&& set -x &&\
 LINKFLAGS_NORMAL?=	-S
 STRIPFLAGS?=	-g
 
-DEBUG?=
 .if !empty(DEBUG:M-g*)
+SYSTEM_LD_TAIL+=${SYSTEM_LD_TAIL_DEBUG}
+LINKFLAGS+=	${LINKFLAGS_DEBUG}
+EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.gdb@}
+CTFFLAGS+=	-g
+TARGETSFX=	.gdb
+.elifndef PROF
+LINKFLAGS+=	${LINKFLAGS_NORMAL}
+.endif
 
+.if ${MKDEBUG:Uno} == "yes"
 # XXX: KERNEL_DIR?
 debuginstall: install-kernel-debug
 .for k in ${KERNELS}
@@ -267,17 +277,7 @@ ${DESTDIR}${DEBUGDIR}/${k}-${KERNEL_CONF
 	${_MKTARGET_INSTALL}
 	${INSTALL_FILE} -o root -g bin -m 444 ${.ALLSRC} ${.TARGET}
 .endfor
-
-SYSTEM_LD_TAIL+=${SYSTEM_LD_TAIL_DEBUG}
-LINKFLAGS+=	${LINKFLAGS_DEBUG}
-EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.gdb@}
-CTFFLAGS+=	-g
-TARGETSFX=	.gdb
-.elifndef PROF
-LINKFLAGS+=	${LINKFLAGS_NORMAL}
-.endif
-
-.if !target(debuginstall)
+.else
 debuginstall:
 .endif
 



CVS commit: src/sys/conf

2021-12-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Dec 30 18:53:35 UTC 2021

Modified Files:
src/sys/conf: Makefile.kern.inc

Log Message:
- With DEBUG=-g (which is also set when we build CTF) we build netbsd.gdb *and*
  netbsd-${KERNEL_CONFIG}.debug because it is not worth having two sets of
  rules (one that builds just netbsd.gdb and one that builds both netbsd.gdb
  and netbsd-${KERNEL_CONFIG}.debug. This maintains compatibility building
  netbsd.gdb when DEBUG=-g
- When either MKDEBUGKERNEL=yes or MKDEBUG=tes we set DEBUG=-g if DEBUG was
  not set.
- We only make a debuginstall rule to install netbsd-${KERNEL_CONFIG}.debug
  if MKDEBUG=yes


To generate a diff of this commit:
cvs rdiff -u -r1.290 -r1.291 src/sys/conf/Makefile.kern.inc

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



CVS commit: src/sys/conf

2021-12-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Dec 30 17:25:40 UTC 2021

Modified Files:
src/sys/conf: Makefile.kern.inc

Log Message:
forgot one KERNEL_BUILD (Tobias Nygren)


To generate a diff of this commit:
cvs rdiff -u -r1.289 -r1.290 src/sys/conf/Makefile.kern.inc

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



CVS commit: src/sys/conf

2021-12-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Dec 30 17:25:40 UTC 2021

Modified Files:
src/sys/conf: Makefile.kern.inc

Log Message:
forgot one KERNEL_BUILD (Tobias Nygren)


To generate a diff of this commit:
cvs rdiff -u -r1.289 -r1.290 src/sys/conf/Makefile.kern.inc

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

Modified files:

Index: src/sys/conf/Makefile.kern.inc
diff -u src/sys/conf/Makefile.kern.inc:1.289 src/sys/conf/Makefile.kern.inc:1.290
--- src/sys/conf/Makefile.kern.inc:1.289	Thu Dec 30 12:16:32 2021
+++ src/sys/conf/Makefile.kern.inc	Thu Dec 30 12:25:40 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.kern.inc,v 1.289 2021/12/30 17:16:32 christos Exp $
+#	$NetBSD: Makefile.kern.inc,v 1.290 2021/12/30 17:25:40 christos Exp $
 #
 # This file contains common `MI' targets and definitions and it is included
 # at the bottom of each `MD' ${MACHINE}/conf/Makefile.${MACHINE}.
@@ -263,7 +263,7 @@ debuginstall: install-kernel-debug
 .for k in ${KERNELS}
 install-kernel-debug: ${DESTDIR}${DEBUGDIR}/${k}-${KERNEL_CONFIG}.debug
 
-${DESTDIR}${DEBUGDIR}/${k}-${KERNEL_BUILD}.debug: ${k}-${KERNEL_CONFIG}.debug
+${DESTDIR}${DEBUGDIR}/${k}-${KERNEL_CONFIG}.debug: ${k}-${KERNEL_CONFIG}.debug
 	${_MKTARGET_INSTALL}
 	${INSTALL_FILE} -o root -g bin -m 444 ${.ALLSRC} ${.TARGET}
 .endfor



Re: CVS commit: src

2021-12-30 Thread Ryo ONODERA
Hi,

Tobias Nygren  writes:

> On Fri, 31 Dec 2021 01:44:19 +0900
> Ryo ONODERA  wrote:
>
>> #  link  LOCKDEBUG/netbsd
>> /usr/world/9.99/amd64/tools/bin/x86_64--netbsd-ld -Map netbsd.map --cref -T 
>> netbsd.ldscript -Ttext 0x8020 -e start -z max-page-size=0x20 
>> -X -o netbsd ${SYSTEM_OBJ:[@]:Nswapnetbsd.o} ${EXTRA_OBJ} vers.o swapnetbsd.o
>> NetBSD 9.99.93 (LOCKDEBUG) #0: Fri Dec 31 01:31:35 JST 2021
>>textdata bss dec hex filename
>> 21646842 728976 1368064 2374388216a4d8a netbsd
>> + mv -f netbsd netbsd.gdb
>> + /usr/world/9.99/amd64/tools/bin/x86_64--netbsd-objcopy --only-keep-debug 
>> netbsd.gdb netbsd-/usr/src/sys/arch/amd64/conf/LOCKDEBUG.debug
>> /usr/world/9.99/amd64/tools/bin/x86_64--netbsd-objcopy: 
>> netbsd-/usr/src/sys/arch/amd64/conf/LOCKDEBUG.debug: No such file or 
>> directory
>
> Hi,
>
> Changing ${KERNEL_BUILD} to ${KERNEL_BUILD:T} mostly fixes the
> above problem. But this change is still incompatible with MKUNPRIVED:

I have never used :T modifier.
Thanks for your information. It is very useful for my task.

> aarch64--netbsd-install: 
> /work/src/../obj/destdir.evbarm/usr/libdata/debug/netbsd-GENERIC.lx2k.debug.inst.xOfGh2:
>  chown/chgrp: Operation not permitted

And I have MKUNPRIVIVED too.

> Additionally, it produces new noisy output that does not respect
> MAKEVERBOSE level 0 or 1 in the final link stage.
>
> -Tobias

Thank you.

-- 
Ryo ONODERA // r...@tetera.org
PGP fingerprint = 82A2 DC91 76E0 A10A 8ABB  FD1B F404 27FA C7D1 15F3


CVS commit: src/sys/conf

2021-12-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Dec 30 17:16:32 UTC 2021

Modified Files:
src/sys/conf: Makefile.kern.inc

Log Message:
Use the tail of KERNEL_BUILD since it can be a full path.


To generate a diff of this commit:
cvs rdiff -u -r1.288 -r1.289 src/sys/conf/Makefile.kern.inc

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

Modified files:

Index: src/sys/conf/Makefile.kern.inc
diff -u src/sys/conf/Makefile.kern.inc:1.288 src/sys/conf/Makefile.kern.inc:1.289
--- src/sys/conf/Makefile.kern.inc:1.288	Wed Dec 29 22:24:50 2021
+++ src/sys/conf/Makefile.kern.inc	Thu Dec 30 12:16:32 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.kern.inc,v 1.288 2021/12/30 03:24:50 christos Exp $
+#	$NetBSD: Makefile.kern.inc,v 1.289 2021/12/30 17:16:32 christos Exp $
 #
 # This file contains common `MI' targets and definitions and it is included
 # at the bottom of each `MD' ${MACHINE}/conf/Makefile.${MACHINE}.
@@ -240,16 +240,17 @@ LINKFLAGS?=	${LINKFORMAT} ${LINKSCRIPT} 
 		${EXTRA_LINKFLAGS}
 
 LINKFLAGS_DEBUG?=	-X
+KERNEL_CONFIG?=	${KERNEL_BUILD:T}
 
 SYSTEM_LD_TAIL?=@${TOOL_SED} '/const char sccs/!d;s/.*@(.)//;s/" "//;s/\\.*//' vers.c && \
 		${SIZE} $@ && ${SYSTEM_CTFMERGE} && chmod 755 $@
 
 SYSTEM_LD_TAIL_DEBUG?=&& set -x &&\
 	mv -f $@ $@.gdb && \
-	${OBJCOPY} --only-keep-debug $@.gdb $@-${KERNEL_BUILD}.debug && \
+	${OBJCOPY} --only-keep-debug $@.gdb $@-${KERNEL_CONFIG}.debug && \
 	${OBJCOPY} --strip-debug -p -R .gnu_debuglink \
-	--add-gnu-debuglink=$@-${KERNEL_BUILD}.debug $@.gdb $@ && \
-	chmod 755 $@ $@.gdb $@-${KERNEL_BUILD}.debug
+	--add-gnu-debuglink=$@-${KERNEL_CONFIG}.debug $@.gdb $@ && \
+	chmod 755 $@ $@.gdb $@-${KERNEL_CONFIG}.debug
 
 LINKFLAGS_NORMAL?=	-S
 STRIPFLAGS?=	-g
@@ -260,9 +261,9 @@ DEBUG?=
 # XXX: KERNEL_DIR?
 debuginstall: install-kernel-debug
 .for k in ${KERNELS}
-install-kernel-debug: ${DESTDIR}${DEBUGDIR}/${k}-${KERNEL_BUILD}.debug
+install-kernel-debug: ${DESTDIR}${DEBUGDIR}/${k}-${KERNEL_CONFIG}.debug
 
-${DESTDIR}${DEBUGDIR}/${k}-${KERNEL_BUILD}.debug: ${k}-${KERNEL_BUILD}.debug
+${DESTDIR}${DEBUGDIR}/${k}-${KERNEL_BUILD}.debug: ${k}-${KERNEL_CONFIG}.debug
 	${_MKTARGET_INSTALL}
 	${INSTALL_FILE} -o root -g bin -m 444 ${.ALLSRC} ${.TARGET}
 .endfor



CVS commit: src/sys/conf

2021-12-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Dec 30 17:16:32 UTC 2021

Modified Files:
src/sys/conf: Makefile.kern.inc

Log Message:
Use the tail of KERNEL_BUILD since it can be a full path.


To generate a diff of this commit:
cvs rdiff -u -r1.288 -r1.289 src/sys/conf/Makefile.kern.inc

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



Re: CVS commit: src

2021-12-30 Thread Ryo ONODERA
Hi,

chris...@astron.com (Christos Zoulas) writes:

> In article <875yr6ujoc@brownie.elements.tetera.org>,
> Ryo ONODERA   wrote:
>
>>My Makefile for the kernel has the following line.
>>Your code may expect BUILD_KERNEL as kernel configuration file name,
>>for example GENERIC or LOCKDEBUG in above error message.
>>However it is absolute path and not kernel configuration file name.
>>
>>KERNEL_BUILD=/usr/src/sys/arch/amd64/conf/LOCKDEBUG
>
> I will fix that.
>
>>I have 2 questions.
>>(1) In MKDEBUG=no, split-debug file for kernel is created.
>>This behavior is not consistent with your commit message.
>
> I will check that.

Thank you very much!!!

>>(2) You have added "./usr/libdata/debug/netbsd-CONFIG.debug ..." entry
>>to src/distrib/sets/lists/debug/mi. Do you intended BUILD_KERNEL
>>as constant CONFIG string?
>
> The sets.subr substitutes the real string.

I see. Thanks for your explanation.

> christos
>

-- 
Ryo ONODERA // r...@tetera.org
PGP fingerprint = 82A2 DC91 76E0 A10A 8ABB  FD1B F404 27FA C7D1 15F3


Re: CVS commit: src

2021-12-30 Thread Tobias Nygren
On Fri, 31 Dec 2021 01:44:19 +0900
Ryo ONODERA  wrote:

> #  link  LOCKDEBUG/netbsd
> /usr/world/9.99/amd64/tools/bin/x86_64--netbsd-ld -Map netbsd.map --cref -T 
> netbsd.ldscript -Ttext 0x8020 -e start -z max-page-size=0x20 
> -X -o netbsd ${SYSTEM_OBJ:[@]:Nswapnetbsd.o} ${EXTRA_OBJ} vers.o swapnetbsd.o
> NetBSD 9.99.93 (LOCKDEBUG) #0: Fri Dec 31 01:31:35 JST 2021
>textdata bss dec hex filename
> 21646842 728976 1368064 2374388216a4d8a netbsd
> + mv -f netbsd netbsd.gdb
> + /usr/world/9.99/amd64/tools/bin/x86_64--netbsd-objcopy --only-keep-debug 
> netbsd.gdb netbsd-/usr/src/sys/arch/amd64/conf/LOCKDEBUG.debug
> /usr/world/9.99/amd64/tools/bin/x86_64--netbsd-objcopy: 
> netbsd-/usr/src/sys/arch/amd64/conf/LOCKDEBUG.debug: No such file or directory

Hi,

Changing ${KERNEL_BUILD} to ${KERNEL_BUILD:T} mostly fixes the
above problem. But this change is still incompatible with MKUNPRIVED:

aarch64--netbsd-install: 
/work/src/../obj/destdir.evbarm/usr/libdata/debug/netbsd-GENERIC.lx2k.debug.inst.xOfGh2:
 chown/chgrp: Operation not permitted

Additionally, it produces new noisy output that does not respect
MAKEVERBOSE level 0 or 1 in the final link stage.

-Tobias





Re: CVS commit: src

2021-12-30 Thread Ryo ONODERA
Hi,

In MKDEBUG=yes and MKDEBUG=no cases,
./build.sh kernel=LOCKDEBUG fails as follows, for example:

(snip)
#  link  LOCKDEBUG/netbsd
/usr/world/9.99/amd64/tools/bin/x86_64--netbsd-ld -Map netbsd.map --cref -T 
netbsd.ldscript -Ttext 0x8020 -e start -z max-page-size=0x20 -X 
-o netbsd ${SYSTEM_OBJ:[@]:Nswapnetbsd.o} ${EXTRA_OBJ} vers.o swapnetbsd.o
NetBSD 9.99.93 (LOCKDEBUG) #0: Fri Dec 31 01:31:35 JST 2021
   textdata bss dec hex filename
21646842 728976 1368064 2374388216a4d8a netbsd
+ mv -f netbsd netbsd.gdb
+ /usr/world/9.99/amd64/tools/bin/x86_64--netbsd-objcopy --only-keep-debug 
netbsd.gdb netbsd-/usr/src/sys/arch/amd64/conf/LOCKDEBUG.debug
/usr/world/9.99/amd64/tools/bin/x86_64--netbsd-objcopy: 
netbsd-/usr/src/sys/arch/amd64/conf/LOCKDEBUG.debug: No such file or directory
+ exit 1

*** Failed target: netbsd
*** Failed commands:
${SYSTEM_LD_HEAD}
=> @rm -f netbsd
${SYSTEM_LD}
=> echo '#  ' "   link  LOCKDEBUG/netbsd";  echo /usr/world/9.99/amd64/t
(snip)

My Makefile for the kernel has the following line.
Your code may expect BUILD_KERNEL as kernel configuration file name,
for example GENERIC or LOCKDEBUG in above error message.
However it is absolute path and not kernel configuration file name.

KERNEL_BUILD=/usr/src/sys/arch/amd64/conf/LOCKDEBUG
(snip)

I have 2 questions.
(1) In MKDEBUG=no, split-debug file for kernel is created.
This behavior is not consistent with your commit message.
(2) You have added "./usr/libdata/debug/netbsd-CONFIG.debug ..." entry
to src/distrib/sets/lists/debug/mi. Do you intended BUILD_KERNEL
as constant CONFIG string?

Thank you.

"Christos Zoulas"  writes:

> Module Name:  src
> Committed By: christos
> Date: Wed Dec 29 22:22:13 UTC 2021
>
> Modified Files:
>   src: build.sh
>   src/distrib/sets: sets.subr
>   src/distrib/sets/lists/debug: mi
>   src/etc: Makefile
>   src/sys/conf: Makefile.kern.inc
>
> Log Message:
> Enable split-debug files for kernels. Enabled by default with MKDEBUG=yes.
>
>
> To generate a diff of this commit:
> cvs rdiff -u -r1.359 -r1.360 src/build.sh
> cvs rdiff -u -r1.197 -r1.198 src/distrib/sets/sets.subr
> cvs rdiff -u -r1.369 -r1.370 src/distrib/sets/lists/debug/mi
> cvs rdiff -u -r1.455 -r1.456 src/etc/Makefile
> cvs rdiff -u -r1.285 -r1.286 src/sys/conf/Makefile.kern.inc
>
> Please note that diffs are not public domain; they are subject to the
> copyright notices on the relevant files.

-- 
Ryo ONODERA // r...@tetera.org
PGP fingerprint = 82A2 DC91 76E0 A10A 8ABB  FD1B F404 27FA C7D1 15F3


CVS commit: src/include

2021-12-30 Thread Niclas Rosenvik
Module Name:src
Committed By:   nros
Date:   Thu Dec 30 16:20:19 UTC 2021

Modified Files:
src/include: dirent.h

Log Message:
Make fdopendir visible according to POSIX.1 spec.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/include/dirent.h

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

Modified files:

Index: src/include/dirent.h
diff -u src/include/dirent.h:1.36 src/include/dirent.h:1.37
--- src/include/dirent.h:1.36	Fri Dec 16 04:45:04 2016
+++ src/include/dirent.h	Thu Dec 30 16:20:19 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: dirent.h,v 1.36 2016/12/16 04:45:04 mrg Exp $	*/
+/*	$NetBSD: dirent.h,v 1.37 2021/12/30 16:20:19 nros Exp $	*/
 
 /*-
  * Copyright (c) 1989, 1993
@@ -104,9 +104,14 @@ int readdir_r(DIR * __restrict, struct d
 void seekdir(DIR *, long);
 long telldir(DIR *);
 #endif /* defined(_NETBSD_SOURCE) || defined(_XOPEN_SOURCE) */
-#if defined(_NETBSD_SOURCE)
+#if (_POSIX_C_SOURCE - 0) >= 200809L || (_XOPEN_SOURCE - 0) >= 700 || \
+defined(_NETBSD_SOURCE)
 #ifndef __LIBC12_SOURCE__
 DIR *fdopendir(int);
+#endif
+#endif
+#if defined(_NETBSD_SOURCE)
+#ifndef __LIBC12_SOURCE__
 DIR *__opendir2(const char *, int) __RENAME(__opendir230);
 int scandir(const char *, struct dirent ***,
 int (*)(const struct dirent *), int (*)(const struct dirent **,



CVS commit: src/include

2021-12-30 Thread Niclas Rosenvik
Module Name:src
Committed By:   nros
Date:   Thu Dec 30 16:20:19 UTC 2021

Modified Files:
src/include: dirent.h

Log Message:
Make fdopendir visible according to POSIX.1 spec.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/include/dirent.h

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



CVS commit: src/distrib/amd64

2021-12-30 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Dec 30 15:01:56 UTC 2021

Modified Files:
src/distrib/amd64/installimage: Makefile
src/distrib/amd64/installimage-bios: Makefile

Log Message:
With recent changees to debug kernel stuff from Christos we are
once again pushing the size limit.  Bump it again.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/distrib/amd64/installimage/Makefile
cvs rdiff -u -r1.2 -r1.3 src/distrib/amd64/installimage-bios/Makefile

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



CVS commit: src/distrib/amd64

2021-12-30 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Dec 30 15:01:56 UTC 2021

Modified Files:
src/distrib/amd64/installimage: Makefile
src/distrib/amd64/installimage-bios: Makefile

Log Message:
With recent changees to debug kernel stuff from Christos we are
once again pushing the size limit.  Bump it again.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/distrib/amd64/installimage/Makefile
cvs rdiff -u -r1.2 -r1.3 src/distrib/amd64/installimage-bios/Makefile

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

Modified files:

Index: src/distrib/amd64/installimage/Makefile
diff -u src/distrib/amd64/installimage/Makefile:1.18 src/distrib/amd64/installimage/Makefile:1.19
--- src/distrib/amd64/installimage/Makefile:1.18	Sun Dec 26 03:07:06 2021
+++ src/distrib/amd64/installimage/Makefile	Thu Dec 30 15:01:55 2021
@@ -1,10 +1,10 @@
-#	$NetBSD: Makefile,v 1.18 2021/12/26 03:07:06 pgoyette Exp $
+#	$NetBSD: Makefile,v 1.19 2021/12/30 15:01:55 pgoyette Exp $
 
 .include 
 
 INSTIMGBASE=	NetBSD-${DISTRIBVER}-amd64-install	# gives ${IMGBASE}.img
 
-INSTIMAGEMB?=	2150			# for all installation binaries
+INSTIMAGEMB?=	2180			# for all installation binaries
 
 PRIMARY_BOOT=		bootxx_ffsv1
 SECONDARY_BOOT=		boot

Index: src/distrib/amd64/installimage-bios/Makefile
diff -u src/distrib/amd64/installimage-bios/Makefile:1.2 src/distrib/amd64/installimage-bios/Makefile:1.3
--- src/distrib/amd64/installimage-bios/Makefile:1.2	Sun Dec 26 03:07:06 2021
+++ src/distrib/amd64/installimage-bios/Makefile	Thu Dec 30 15:01:55 2021
@@ -1,10 +1,10 @@
-#	$NetBSD: Makefile,v 1.2 2021/12/26 03:07:06 pgoyette Exp $
+#	$NetBSD: Makefile,v 1.3 2021/12/30 15:01:55 pgoyette Exp $
 
 .include 
 
 INSTIMGBASE=	NetBSD-${DISTRIBVER}-amd64-bios-install	# gives ${IMGBASE}.img
 
-INSTIMAGEMB?=	2150			# for all installation binaries
+INSTIMAGEMB?=	2180			# for all installation binaries
 
 PRIMARY_BOOT=		bootxx_ffsv1
 SECONDARY_BOOT=		boot



CVS commit: src/sys/dev/acpi

2021-12-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Dec 30 14:40:06 UTC 2021

Modified Files:
src/sys/dev/acpi: acpi_display.c

Log Message:
acpiout(4): Work around firmware that doesn't like some brightnesses.

Instead of just asking for cur - 5 or cur + 5, repeatedly ask for
that increment, check whether we actually made progress in that
direction, and if not keep going with another increment, until we hit
the bounds of brightness levels.

I can't find anything in the ACPI spec about this, but my laptop
seems to have trouble with certain levels: 15, 75, 85, 95.  It goes
in all other increments of 5 from 5 to 100, just not those ones --
acts as if the change just never happened, so with the old logic the
brightness up/down would get stuck unable to move in either
direction.

This should have no impact on machines where the first increment
actually takes.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/acpi/acpi_display.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/acpi/acpi_display.c
diff -u src/sys/dev/acpi/acpi_display.c:1.20 src/sys/dev/acpi/acpi_display.c:1.21
--- src/sys/dev/acpi/acpi_display.c:1.20	Sat Aug  7 16:19:09 2021
+++ src/sys/dev/acpi/acpi_display.c	Thu Dec 30 14:40:06 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_display.c,v 1.20 2021/08/07 16:19:09 thorpej Exp $	*/
+/*	$NetBSD: acpi_display.c,v 1.21 2021/12/30 14:40:06 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_display.c,v 1.20 2021/08/07 16:19:09 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_display.c,v 1.21 2021/12/30 14:40:06 riastradh Exp $");
 
 #include 
 #include 
@@ -1010,7 +1010,8 @@ acpidisp_out_increase_brightness_callbac
 {
 	struct acpidisp_out_softc *osc = arg;
 	struct acpidisp_brctl *bc = osc->sc_brctl;
-	uint8_t lo, up;
+	uint8_t max, lo, up;
+	int cur;
 
 	if (bc == NULL) {
 		/* Fallback to pmf(9). */
@@ -1019,16 +1020,21 @@ acpidisp_out_increase_brightness_callbac
 	}
 
 	mutex_enter(osc->sc_mtx);
-
-	(void)acpidisp_get_brightness(osc, &bc->bc_current);
-
-	acpidisp_array_search(bc->bc_level, bc->bc_level_count,
-	bc->bc_current + ACPI_DISP_BRCTL_STEP, &lo, &up);
-
-	bc->bc_current = up;
-	(void)acpidisp_set_brightness(osc, bc->bc_current);
-
-	mutex_exit(osc->sc_mtx);
+	max = bc->bc_level[bc->bc_level_count - 1];
+	if (acpidisp_get_brightness(osc, &bc->bc_current))
+		goto out;
+	for (cur = bc->bc_current; (cur += ACPI_DISP_BRCTL_STEP) <= max;) {
+		acpidisp_array_search(bc->bc_level, bc->bc_level_count, cur,
+		&lo, &up);
+		bc->bc_current = up;
+		if (acpidisp_set_brightness(osc, bc->bc_current))
+			goto out;
+		if (acpidisp_get_brightness(osc, &bc->bc_current))
+			goto out;
+		if (bc->bc_current >= cur)
+			break;
+	}
+out:	mutex_exit(osc->sc_mtx);
 }
 
 static void
@@ -1036,7 +1042,8 @@ acpidisp_out_decrease_brightness_callbac
 {
 	struct acpidisp_out_softc *osc = arg;
 	struct acpidisp_brctl *bc = osc->sc_brctl;
-	uint8_t lo, up;
+	uint8_t min, lo, up;
+	int cur;
 
 	if (bc == NULL) {
 		/* Fallback to pmf(9). */
@@ -1045,16 +1052,21 @@ acpidisp_out_decrease_brightness_callbac
 	}
 
 	mutex_enter(osc->sc_mtx);
-
-	(void)acpidisp_get_brightness(osc, &bc->bc_current);
-
-	acpidisp_array_search(bc->bc_level, bc->bc_level_count,
-	bc->bc_current - ACPI_DISP_BRCTL_STEP, &lo, &up);
-
-	bc->bc_current = lo;
-	(void)acpidisp_set_brightness(osc, bc->bc_current);
-
-	mutex_exit(osc->sc_mtx);
+	min = bc->bc_level[0];
+	if (acpidisp_get_brightness(osc, &bc->bc_current))
+		goto out;
+	for (cur = bc->bc_current; (cur -= ACPI_DISP_BRCTL_STEP) >= min;) {
+		acpidisp_array_search(bc->bc_level, bc->bc_level_count, cur,
+		&lo, &up);
+		bc->bc_current = lo;
+		if (acpidisp_set_brightness(osc, bc->bc_current))
+			goto out;
+		if (acpidisp_get_brightness(osc, &bc->bc_current))
+			goto out;
+		if (bc->bc_current <= cur)
+			break;
+	}
+out:	mutex_exit(osc->sc_mtx);
 }
 
 static void



CVS commit: src/sys/dev/acpi

2021-12-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Dec 30 14:40:06 UTC 2021

Modified Files:
src/sys/dev/acpi: acpi_display.c

Log Message:
acpiout(4): Work around firmware that doesn't like some brightnesses.

Instead of just asking for cur - 5 or cur + 5, repeatedly ask for
that increment, check whether we actually made progress in that
direction, and if not keep going with another increment, until we hit
the bounds of brightness levels.

I can't find anything in the ACPI spec about this, but my laptop
seems to have trouble with certain levels: 15, 75, 85, 95.  It goes
in all other increments of 5 from 5 to 100, just not those ones --
acts as if the change just never happened, so with the old logic the
brightness up/down would get stuck unable to move in either
direction.

This should have no impact on machines where the first increment
actually takes.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/acpi/acpi_display.c

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



CVS commit: [netbsd-8] src/doc

2021-12-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Dec 30 12:41:43 UTC 2021

Modified Files:
src/doc [netbsd-8]: CHANGES-8.3

Log Message:
Ticket #1722


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.114 -r1.1.2.115 src/doc/CHANGES-8.3

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-8.3
diff -u src/doc/CHANGES-8.3:1.1.2.114 src/doc/CHANGES-8.3:1.1.2.115
--- src/doc/CHANGES-8.3:1.1.2.114	Fri Dec 24 13:03:46 2021
+++ src/doc/CHANGES-8.3	Thu Dec 30 12:41:43 2021
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.3,v 1.1.2.114 2021/12/24 13:03:46 martin Exp $
+# $NetBSD: CHANGES-8.3,v 1.1.2.115 2021/12/30 12:41:43 martin Exp $
 
 A complete list of changes from the NetBSD 8.2 release to the NetBSD 8.3
 release:
@@ -2361,3 +2361,8 @@ sys/arch/x86/include/cpu.h			1.132
 	- Cosmetic changes to improve readability.
 	[msaitoh, ticket #1721]
 
+sys/dev/cgd.c	1.142
+
+	cgd(4): fix detach when still in use by wedges.
+	[riastradh, ticket #1722]
+



CVS commit: [netbsd-8] src/doc

2021-12-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Dec 30 12:41:43 UTC 2021

Modified Files:
src/doc [netbsd-8]: CHANGES-8.3

Log Message:
Ticket #1722


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.114 -r1.1.2.115 src/doc/CHANGES-8.3

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



CVS commit: [netbsd-8] src/sys/dev

2021-12-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Dec 30 12:40:53 UTC 2021

Modified Files:
src/sys/dev [netbsd-8]: cgd.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1722):

sys/dev/cgd.c: revision 1.142

cgd(4): Fix criterion for detach when wedgies are held.

The somewhat confusingly named DK_BUSY(dksc, pmask) answers the
following question:

Suppose I hold either the character or the block device (but
not both) of all of the partitions in pmask.  Is anyone else
using the disk, rendering it unsafe to detach?

This is useful for ioctls like CGDIOCCLR and VNDIOCCLR, which must be
issued on open file descriptors for the disk, so the question cannot
simply be answered by testing whether dk_openmask != 0.
Instead, DK_BUSY breaks the question into the following criteria:

1. Are there any _other_ partitions than those in pmask open
   at all?  If so, it must be someone else, since I only hold
   partitions in pmask -- hence the disk is busy.
2. Are any of the partitions in pmask open _both_ as a block
   device _and_ as a character device?  If so, it must be
   someone else, since I only hold _either_ the character
   _or_ the block device open but not both -- hence the disk
   is busy.

When config_detach_all runs at shutdown time, it tries to detach
cgd(4), which has DVF_DETACH_SHUTDOWN; this is important so we submit
queued writes to the underlying disk and wait for them to complete
with dk_drain.

If cgd(4) has any dk wedges with file systems mounted still
configured on it, it isn't ready to detach yet.  But asking
DK_BUSY(dksc, 1 << RAW_PART) returns false, because the dk wedges
only hold RAW_PART open as a block device -- so if nobody has
RAW_PART open as a character device, or any other partitions open,
cgd_detach blithely goes on its way to forcibly detach the wedges.

Instead, ask DK_BUSY(dksc, 0), because the caller -- cgd_detach
issued by config_detach_all -- does not, in fact, hold any partitions
open, so it doesn't need to work around them like ioctl(CGDIOCCLR)
does.  Fixes hang in zfs on dk on cgd during shutdown (and probably
also zfs on cgd without any intervening dk but I haven't tested).

(This change might have the side effect that `drvctl -d cgdN' doesn't
work, but I don't care.)

XXX pullup-9
XXX pullup-8 (...-7, -6, -5...)


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.114.6.1 src/sys/dev/cgd.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/cgd.c
diff -u src/sys/dev/cgd.c:1.114 src/sys/dev/cgd.c:1.114.6.1
--- src/sys/dev/cgd.c:1.114	Mon Feb 27 21:25:45 2017
+++ src/sys/dev/cgd.c	Thu Dec 30 12:40:53 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: cgd.c,v 1.114 2017/02/27 21:25:45 jdolecek Exp $ */
+/* $NetBSD: cgd.c,v 1.114.6.1 2021/12/30 12:40:53 martin Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.114 2017/02/27 21:25:45 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.114.6.1 2021/12/30 12:40:53 martin Exp $");
 
 #include 
 #include 
@@ -320,11 +320,10 @@ static int
 cgd_detach(device_t self, int flags)
 {
 	int ret;
-	const int pmask = 1 << RAW_PART;
 	struct cgd_softc *sc = device_private(self);
 	struct dk_softc *dksc = &sc->sc_dksc;
 
-	if (DK_BUSY(dksc, pmask))
+	if (DK_BUSY(dksc, 0))
 		return EBUSY;
 
 	if (DK_ATTACHED(dksc) &&



CVS commit: [netbsd-8] src/sys/dev

2021-12-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Dec 30 12:40:53 UTC 2021

Modified Files:
src/sys/dev [netbsd-8]: cgd.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1722):

sys/dev/cgd.c: revision 1.142

cgd(4): Fix criterion for detach when wedgies are held.

The somewhat confusingly named DK_BUSY(dksc, pmask) answers the
following question:

Suppose I hold either the character or the block device (but
not both) of all of the partitions in pmask.  Is anyone else
using the disk, rendering it unsafe to detach?

This is useful for ioctls like CGDIOCCLR and VNDIOCCLR, which must be
issued on open file descriptors for the disk, so the question cannot
simply be answered by testing whether dk_openmask != 0.
Instead, DK_BUSY breaks the question into the following criteria:

1. Are there any _other_ partitions than those in pmask open
   at all?  If so, it must be someone else, since I only hold
   partitions in pmask -- hence the disk is busy.
2. Are any of the partitions in pmask open _both_ as a block
   device _and_ as a character device?  If so, it must be
   someone else, since I only hold _either_ the character
   _or_ the block device open but not both -- hence the disk
   is busy.

When config_detach_all runs at shutdown time, it tries to detach
cgd(4), which has DVF_DETACH_SHUTDOWN; this is important so we submit
queued writes to the underlying disk and wait for them to complete
with dk_drain.

If cgd(4) has any dk wedges with file systems mounted still
configured on it, it isn't ready to detach yet.  But asking
DK_BUSY(dksc, 1 << RAW_PART) returns false, because the dk wedges
only hold RAW_PART open as a block device -- so if nobody has
RAW_PART open as a character device, or any other partitions open,
cgd_detach blithely goes on its way to forcibly detach the wedges.

Instead, ask DK_BUSY(dksc, 0), because the caller -- cgd_detach
issued by config_detach_all -- does not, in fact, hold any partitions
open, so it doesn't need to work around them like ioctl(CGDIOCCLR)
does.  Fixes hang in zfs on dk on cgd during shutdown (and probably
also zfs on cgd without any intervening dk but I haven't tested).

(This change might have the side effect that `drvctl -d cgdN' doesn't
work, but I don't care.)

XXX pullup-9
XXX pullup-8 (...-7, -6, -5...)


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.114.6.1 src/sys/dev/cgd.c

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



CVS commit: [netbsd-9] src/doc

2021-12-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Dec 30 12:40:08 UTC 2021

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

Log Message:
Tickets #1397 and #1398


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.61 -r1.1.2.62 src/doc/CHANGES-9.3

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.3
diff -u src/doc/CHANGES-9.3:1.1.2.61 src/doc/CHANGES-9.3:1.1.2.62
--- src/doc/CHANGES-9.3:1.1.2.61	Fri Dec 24 13:05:22 2021
+++ src/doc/CHANGES-9.3	Thu Dec 30 12:40:08 2021
@@ -1,4 +1,4 @@
-29~# $NetBSD: CHANGES-9.3,v 1.1.2.61 2021/12/24 13:05:22 martin Exp $
+29~# $NetBSD: CHANGES-9.3,v 1.1.2.62 2021/12/30 12:40:08 martin Exp $
 
 A complete list of changes from the NetBSD 9.2 release to the NetBSD 9.3
 release:
@@ -1139,3 +1139,14 @@ sys/arch/x86/include/cpu.h			1.132
 	- Cosmetic changes to improve readability.
 	[msaitoh, ticket #1396]
 
+sys/dev/pckbport/synaptics.c			1.71
+
+	synaptics(4): New sysctl knob hw.synaptics.debug to enable debug
+	output.
+	[riastradh, ticket #1397]
+
+sys/dev/cgd.c	1.142
+
+	cgd(4): fix detach when still in use by wedges.
+	[riastradh, ticket #1398]
+



CVS commit: [netbsd-9] src/doc

2021-12-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Dec 30 12:40:08 UTC 2021

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

Log Message:
Tickets #1397 and #1398


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.61 -r1.1.2.62 src/doc/CHANGES-9.3

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



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

2021-12-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Dec 30 12:38:22 UTC 2021

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

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1398):

sys/dev/cgd.c: revision 1.142

cgd(4): Fix criterion for detach when wedgies are held.

The somewhat confusingly named DK_BUSY(dksc, pmask) answers the
following question:

Suppose I hold either the character or the block device (but
not both) of all of the partitions in pmask.  Is anyone else
using the disk, rendering it unsafe to detach?

This is useful for ioctls like CGDIOCCLR and VNDIOCCLR, which must be
issued on open file descriptors for the disk, so the question cannot
simply be answered by testing whether dk_openmask != 0.
Instead, DK_BUSY breaks the question into the following criteria:

1. Are there any _other_ partitions than those in pmask open
   at all?  If so, it must be someone else, since I only hold
   partitions in pmask -- hence the disk is busy.
2. Are any of the partitions in pmask open _both_ as a block
   device _and_ as a character device?  If so, it must be
   someone else, since I only hold _either_ the character
   _or_ the block device open but not both -- hence the disk
   is busy.

When config_detach_all runs at shutdown time, it tries to detach
cgd(4), which has DVF_DETACH_SHUTDOWN; this is important so we submit
queued writes to the underlying disk and wait for them to complete
with dk_drain.

If cgd(4) has any dk wedges with file systems mounted still
configured on it, it isn't ready to detach yet.  But asking
DK_BUSY(dksc, 1 << RAW_PART) returns false, because the dk wedges
only hold RAW_PART open as a block device -- so if nobody has
RAW_PART open as a character device, or any other partitions open,
cgd_detach blithely goes on its way to forcibly detach the wedges.

Instead, ask DK_BUSY(dksc, 0), because the caller -- cgd_detach
issued by config_detach_all -- does not, in fact, hold any partitions
open, so it doesn't need to work around them like ioctl(CGDIOCCLR)
does.  Fixes hang in zfs on dk on cgd during shutdown (and probably
also zfs on cgd without any intervening dk but I haven't tested).

(This change might have the side effect that `drvctl -d cgdN' doesn't
work, but I don't care.)

XXX pullup-9
XXX pullup-8 (...-7, -6, -5...)


To generate a diff of this commit:
cvs rdiff -u -r1.116.10.4 -r1.116.10.5 src/sys/dev/cgd.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/cgd.c
diff -u src/sys/dev/cgd.c:1.116.10.4 src/sys/dev/cgd.c:1.116.10.5
--- src/sys/dev/cgd.c:1.116.10.4	Tue Dec 14 19:05:11 2021
+++ src/sys/dev/cgd.c	Thu Dec 30 12:38:22 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: cgd.c,v 1.116.10.4 2021/12/14 19:05:11 martin Exp $ */
+/* $NetBSD: cgd.c,v 1.116.10.5 2021/12/30 12:38:22 martin Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.116.10.4 2021/12/14 19:05:11 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.116.10.5 2021/12/30 12:38:22 martin Exp $");
 
 #include 
 #include 
@@ -354,11 +354,10 @@ static int
 cgd_detach(device_t self, int flags)
 {
 	int ret;
-	const int pmask = 1 << RAW_PART;
 	struct cgd_softc *sc = device_private(self);
 	struct dk_softc *dksc = &sc->sc_dksc;
 
-	if (DK_BUSY(dksc, pmask))
+	if (DK_BUSY(dksc, 0))
 		return EBUSY;
 
 	if (DK_ATTACHED(dksc) &&



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

2021-12-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Dec 30 12:38:22 UTC 2021

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

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1398):

sys/dev/cgd.c: revision 1.142

cgd(4): Fix criterion for detach when wedgies are held.

The somewhat confusingly named DK_BUSY(dksc, pmask) answers the
following question:

Suppose I hold either the character or the block device (but
not both) of all of the partitions in pmask.  Is anyone else
using the disk, rendering it unsafe to detach?

This is useful for ioctls like CGDIOCCLR and VNDIOCCLR, which must be
issued on open file descriptors for the disk, so the question cannot
simply be answered by testing whether dk_openmask != 0.
Instead, DK_BUSY breaks the question into the following criteria:

1. Are there any _other_ partitions than those in pmask open
   at all?  If so, it must be someone else, since I only hold
   partitions in pmask -- hence the disk is busy.
2. Are any of the partitions in pmask open _both_ as a block
   device _and_ as a character device?  If so, it must be
   someone else, since I only hold _either_ the character
   _or_ the block device open but not both -- hence the disk
   is busy.

When config_detach_all runs at shutdown time, it tries to detach
cgd(4), which has DVF_DETACH_SHUTDOWN; this is important so we submit
queued writes to the underlying disk and wait for them to complete
with dk_drain.

If cgd(4) has any dk wedges with file systems mounted still
configured on it, it isn't ready to detach yet.  But asking
DK_BUSY(dksc, 1 << RAW_PART) returns false, because the dk wedges
only hold RAW_PART open as a block device -- so if nobody has
RAW_PART open as a character device, or any other partitions open,
cgd_detach blithely goes on its way to forcibly detach the wedges.

Instead, ask DK_BUSY(dksc, 0), because the caller -- cgd_detach
issued by config_detach_all -- does not, in fact, hold any partitions
open, so it doesn't need to work around them like ioctl(CGDIOCCLR)
does.  Fixes hang in zfs on dk on cgd during shutdown (and probably
also zfs on cgd without any intervening dk but I haven't tested).

(This change might have the side effect that `drvctl -d cgdN' doesn't
work, but I don't care.)

XXX pullup-9
XXX pullup-8 (...-7, -6, -5...)


To generate a diff of this commit:
cvs rdiff -u -r1.116.10.4 -r1.116.10.5 src/sys/dev/cgd.c

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



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

2021-12-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Dec 30 12:28:56 UTC 2021

Modified Files:
src/sys/dev/pckbport [netbsd-9]: synaptics.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1397):

sys/dev/pckbport/synaptics.c: revision 1.71

synaptics(4): New sysctl knob for debug output.

Set hw.synaptics.debug=1 to re-enable it; the compile-time DIAGNOSTIC
option was inappropriate for this.


To generate a diff of this commit:
cvs rdiff -u -r1.50.2.7 -r1.50.2.8 src/sys/dev/pckbport/synaptics.c

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



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

2021-12-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Dec 30 12:28:56 UTC 2021

Modified Files:
src/sys/dev/pckbport [netbsd-9]: synaptics.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1397):

sys/dev/pckbport/synaptics.c: revision 1.71

synaptics(4): New sysctl knob for debug output.

Set hw.synaptics.debug=1 to re-enable it; the compile-time DIAGNOSTIC
option was inappropriate for this.


To generate a diff of this commit:
cvs rdiff -u -r1.50.2.7 -r1.50.2.8 src/sys/dev/pckbport/synaptics.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/pckbport/synaptics.c
diff -u src/sys/dev/pckbport/synaptics.c:1.50.2.7 src/sys/dev/pckbport/synaptics.c:1.50.2.8
--- src/sys/dev/pckbport/synaptics.c:1.50.2.7	Thu Oct  8 16:47:12 2020
+++ src/sys/dev/pckbport/synaptics.c	Thu Dec 30 12:28:56 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: synaptics.c,v 1.50.2.7 2020/10/08 16:47:12 martin Exp $	*/
+/*	$NetBSD: synaptics.c,v 1.50.2.8 2021/12/30 12:28:56 martin Exp $	*/
 
 /*
  * Copyright (c) 2005, Steve C. Woodford
@@ -48,7 +48,7 @@
 #include "opt_pms.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: synaptics.c,v 1.50.2.7 2020/10/08 16:47:12 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: synaptics.c,v 1.50.2.8 2021/12/30 12:28:56 martin Exp $");
 
 #include 
 #include 
@@ -125,6 +125,16 @@ static int synaptics_fscroll_max = 14;
 static int synaptics_dz_hold = 30;
 static int synaptics_movement_enable = 1;
 static bool synaptics_aux_mid_button_scroll = TRUE;
+static int synaptics_debug = 0;
+
+#define	DPRINTF(SC, FMT, ARGS...) do	  \
+{	  \
+	if (synaptics_debug) {		  \
+		struct pms_softc *_dprintf_psc =			  \
+		container_of((SC), struct pms_softc, u.synaptics);	  \
+		device_printf(_dprintf_psc->sc_dev, FMT, ##ARGS);	  \
+	}  \
+} while (0)
 
 /* Sysctl nodes. */
 static int synaptics_button_boundary_nodenum;
@@ -844,6 +854,17 @@ pms_sysctl_synaptics(struct sysctllog **
 		goto err;
 
 	synaptics_aux_mid_button_scroll_nodenum = node->sysctl_num;
+
+	if ((rc = sysctl_createv(clog, 0, NULL, &node,
+	CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
+	CTLTYPE_INT, "debug",
+	SYSCTL_DESCR("Enable debug output"),
+	NULL, 0,
+	&synaptics_debug,
+	0, CTL_HW, root_num, CTL_CREATE,
+	CTL_EOL)) != 0)
+		goto err;
+
 	return;
 
 err:
@@ -1400,10 +1421,10 @@ synaptics_gesture_detect(struct synaptic
 		sc->gesture_move_y = 0;
 		sc->gesture_start_packet = sc->total_packets[0];
 
-#ifdef DIAGNOSTIC
-		aprint_debug("Finger applied: gesture_start_x: %d gesture_start_y: %d\n",
-			sc->gesture_start_x, sc->gesture_start_y);
-#endif
+		DPRINTF(sc, "Finger applied:"
+		" gesture_start_x: %d"
+		" gesture_start_y: %d\n",
+		sc->gesture_start_x, sc->gesture_start_y);
 	} else
 	if (fingers == 0 && sc->prev_fingers != 0) {
 		/*
@@ -1415,14 +1436,12 @@ synaptics_gesture_detect(struct synaptic
 		 * of the fingers).
 		 */
 
-#ifdef DIAGNOSTIC
-		aprint_debug("Finger removed: gesture_len: %d (%d)\n",
-			gesture_len, synaptics_gesture_length);
-		aprint_debug("gesture_move_x: %d (%d) sp_x: %d\n",
-			sc->gesture_move_x, synaptics_gesture_move, abs(sp->sp_x));
-		aprint_debug("gesture_move_y: %d (%d) sp_y: %d\n",
-			sc->gesture_move_y, synaptics_gesture_move, abs(sp->sp_y));
-#endif
+		DPRINTF(sc, "Finger removed: gesture_len: %d (%d)\n",
+		gesture_len, synaptics_gesture_length);
+		DPRINTF(sc, "gesture_move_x: %d (%d) sp_x: %d\n",
+		sc->gesture_move_x, synaptics_gesture_move, abs(sp->sp_x));
+		DPRINTF(sc, "gesture_move_y: %d (%d) sp_y: %d\n",
+		sc->gesture_move_y, synaptics_gesture_move, abs(sp->sp_y));
 
 		if (gesture_len < synaptics_gesture_length &&
 		((sc->gesture_move_x < synaptics_gesture_move &&