CVS commit: src/sys/kern

2020-10-26 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Tue Oct 27 00:07:18 UTC 2020

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

Log Message:
kern_time: prevent the system clock from being set too low or high

currently doing this will drive KUBSAN haywire and possibly cause
system lock-ups, so more testing should probably be performed before
we let the clock be set too many thousands of years into the future.

ditto for negative values, which were being passed by chrony for
some reason while my internet connection was being unreliable.
this also triggered some interesting KUBSAN reports.


To generate a diff of this commit:
cvs rdiff -u -r1.205 -r1.206 src/sys/kern/kern_time.c

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

Modified files:

Index: src/sys/kern/kern_time.c
diff -u src/sys/kern/kern_time.c:1.205 src/sys/kern/kern_time.c:1.206
--- src/sys/kern/kern_time.c:1.205	Sat May 23 23:42:43 2020
+++ src/sys/kern/kern_time.c	Tue Oct 27 00:07:18 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_time.c,v 1.205 2020/05/23 23:42:43 ad Exp $	*/
+/*	$NetBSD: kern_time.c,v 1.206 2020/10/27 00:07:18 nia Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2004, 2005, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.205 2020/05/23 23:42:43 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.206 2020/10/27 00:07:18 nia Exp $");
 
 #include 
 #include 
@@ -137,6 +137,13 @@ settime1(struct proc *p, const struct ti
 {
 	struct timespec delta, now;
 
+	/*
+	 * The time being set to an unreasonable value will cause
+	 * unreasonable system behaviour.
+	 */
+	if (ts->tv_sec < 0 || ts->tv_sec > (1LL << 36))
+		return (EINVAL);
+
 	/* WHAT DO WE DO ABOUT PENDING REAL-TIME TIMEOUTS??? */
 	nanotime();
 	timespecsub(ts, , );



CVS commit: src/usr.bin/make

2020-10-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Oct 26 23:28:53 UTC 2020

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

Log Message:
make(1): remove "Results: none" from the documentation of void functions


To generate a diff of this commit:
cvs rdiff -u -r1.189 -r1.190 src/usr.bin/make/dir.c
cvs rdiff -u -r1.292 -r1.293 src/usr.bin/make/job.c
cvs rdiff -u -r1.391 -r1.392 src/usr.bin/make/main.c

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

Modified files:

Index: src/usr.bin/make/dir.c
diff -u src/usr.bin/make/dir.c:1.189 src/usr.bin/make/dir.c:1.190
--- src/usr.bin/make/dir.c:1.189	Sun Oct 25 21:51:48 2020
+++ src/usr.bin/make/dir.c	Mon Oct 26 23:28:52 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: dir.c,v 1.189 2020/10/25 21:51:48 rillig Exp $	*/
+/*	$NetBSD: dir.c,v 1.190 2020/10/26 23:28:52 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -135,7 +135,7 @@
 #include "job.h"
 
 /*	"@(#)dir.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: dir.c,v 1.189 2020/10/25 21:51:48 rillig Exp $");
+MAKE_RCSID("$NetBSD: dir.c,v 1.190 2020/10/26 23:28:52 rillig Exp $");
 
 #define DIR_DEBUG0(text) DEBUG0(DIR, text)
 #define DIR_DEBUG1(fmt, arg1) DEBUG1(DIR, fmt, arg1)
@@ -1503,23 +1503,11 @@ Dir_MakeFlags(const char *flag, SearchPa
 return Buf_Destroy(, FALSE);
 }
 
-/*-
- *---
- * Dir_Destroy --
- *	Nuke a directory descriptor, if possible. Callback procedure
- *	for the suffixes module when destroying a search path.
+/* Nuke a directory descriptor, if possible. Callback procedure for the
+ * suffixes module when destroying a search path.
  *
  * Input:
  *	dirp		The directory descriptor to nuke
- *
- * Results:
- *	None.
- *
- * Side Effects:
- *	If no other path references this directory (refCount == 0),
- *	the CachedDir and all its data are freed.
- *
- *---
  */
 void
 Dir_Destroy(void *dirp)
@@ -1536,23 +1524,8 @@ Dir_Destroy(void *dirp)
 }
 }
 
-/*-
- *---
- * Dir_ClearPath --
- *	Clear out all elements of the given search path. This is different
- *	from destroying the list, notice.
- *
- * Input:
- *	path		Path to clear
- *
- * Results:
- *	None.
- *
- * Side Effects:
- *	The path is set to the empty list.
- *
- *---
- */
+/* Clear out all elements from the given search path.
+ * The path is set to the empty list but is not destroyed. */
 void
 Dir_ClearPath(SearchPath *path)
 {
@@ -1563,34 +1536,18 @@ Dir_ClearPath(SearchPath *path)
 }
 
 
-/*-
- *---
- * Dir_Concat --
- *	Concatenate two paths, adding the second to the end of the first.
- *	Makes sure to avoid duplicates.
- *
- * Input:
- *	path1		Dest
- *	path2		Source
- *
- * Results:
- *	None
- *
- * Side Effects:
- *	Reference counts for added dirs are upped.
- *
- *---
- */
+/* Concatenate two paths, adding the second to the end of the first,
+ * skipping duplicates. */
 void
-Dir_Concat(SearchPath *path1, SearchPath *path2)
+Dir_Concat(SearchPath *dst, SearchPath *src)
 {
 SearchPathNode *ln;
 
-for (ln = path2->first; ln != NULL; ln = ln->next) {
+for (ln = src->first; ln != NULL; ln = ln->next) {
 	CachedDir *dir = ln->datum;
-	if (Lst_FindDatum(path1, dir) == NULL) {
+	if (Lst_FindDatum(dst, dir) == NULL) {
 	dir->refCount++;
-	Lst_Append(path1, dir);
+	Lst_Append(dst, dir);
 	}
 }
 }

Index: src/usr.bin/make/job.c
diff -u src/usr.bin/make/job.c:1.292 src/usr.bin/make/job.c:1.293
--- src/usr.bin/make/job.c:1.292	Mon Oct 26 23:19:17 2020
+++ src/usr.bin/make/job.c	Mon Oct 26 23:28:52 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.292 2020/10/26 23:19:17 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.293 2020/10/26 23:28:52 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -143,7 +143,7 @@
 #include "trace.h"
 
 /*	"@(#)job.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: job.c,v 1.292 2020/10/26 23:19:17 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.293 2020/10/26 23:28:52 rillig Exp $");
 
 /* A shell defines how the commands are run.  All commands for a target are
  * written into a single file, which is then given to the shell to execute
@@ -1721,9 +1721,6 @@ JobOutput(Job *job, char *cp, char *endp
  *	finish		TRUE if this is the last time we'll be called
  *			for this job
  *
- * Results:
- *	None
- *
  * Side Effects:
  *	curPos may be shifted as may the contents of outBuf.
  *---

Index: src/usr.bin/make/main.c
diff -u src/usr.bin/make/main.c:1.391 

CVS commit: src/usr.bin/make

2020-10-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Oct 26 23:19:17 UTC 2020

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

Log Message:
make(1): use proper enum constants for aborting, instead of 0


To generate a diff of this commit:
cvs rdiff -u -r1.291 -r1.292 src/usr.bin/make/job.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/job.c
diff -u src/usr.bin/make/job.c:1.291 src/usr.bin/make/job.c:1.292
--- src/usr.bin/make/job.c:1.291	Mon Oct 26 22:51:56 2020
+++ src/usr.bin/make/job.c	Mon Oct 26 23:19:17 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.291 2020/10/26 22:51:56 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.292 2020/10/26 23:19:17 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -143,7 +143,7 @@
 #include "trace.h"
 
 /*	"@(#)job.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: job.c,v 1.291 2020/10/26 22:51:56 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.292 2020/10/26 23:19:17 rillig Exp $");
 
 /* A shell defines how the commands are run.  All commands for a target are
  * written into a single file, which is then given to the shell to execute
@@ -1637,7 +1637,7 @@ JobStart(GNode *gn, int flags)
 	 * We only want to work our way up the graph if we aren't here because
 	 * the commands for the job were no good.
 	 */
-	if (cmdsOK && aborting == 0) {
+	if (cmdsOK && aborting == ABORT_NONE) {
 	JobSaveCommands(job);
 	job->node->made = MADE;
 	Make_Update(job->node);
@@ -2122,7 +2122,7 @@ Job_Init(void)
 job_table_end = job_table + opts.maxJobs;
 wantToken =	0;
 
-aborting = 0;
+aborting = ABORT_NONE;
 errors = 0;
 
 lastNode = NULL;
@@ -2168,7 +2168,7 @@ Job_Init(void)
 #define ADDSIG(s,h)\
 if (bmake_signal(s, SIG_IGN) != SIG_IGN) {	\
 	sigaddset(_signals, s);		\
-	(void)bmake_signal(s, h);			\
+	(void)bmake_signal(s, h);		\
 }
 
 /*
@@ -2520,7 +2520,7 @@ Job_Wait(void)
 while (jobTokensRunning != 0) {
 	Job_CatchOutput();
 }
-aborting = 0;
+aborting = ABORT_NONE;
 }
 
 /* Abort all currently running jobs without handling output or anything.
@@ -2730,7 +2730,7 @@ Job_TokenWithdraw(void)
 DEBUG3(JOB, "Job_TokenWithdraw(%d): aborting %d, running %d\n",
 	   getpid(), aborting, jobTokensRunning);
 
-if (aborting || (jobTokensRunning >= opts.maxJobs))
+if (aborting != ABORT_NONE || (jobTokensRunning >= opts.maxJobs))
 	return FALSE;
 
 count = read(tokenWaitJob.inPipe, , 1);



CVS commit: src/usr.bin/make

2020-10-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Oct 26 22:51:56 UTC 2020

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

Log Message:
make(1): remove unnecessary double negation in Job_ParseShell


To generate a diff of this commit:
cvs rdiff -u -r1.290 -r1.291 src/usr.bin/make/job.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/job.c
diff -u src/usr.bin/make/job.c:1.290 src/usr.bin/make/job.c:1.291
--- src/usr.bin/make/job.c:1.290	Mon Oct 26 21:34:10 2020
+++ src/usr.bin/make/job.c	Mon Oct 26 22:51:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.290 2020/10/26 21:34:10 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.291 2020/10/26 22:51:56 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -143,7 +143,7 @@
 #include "trace.h"
 
 /*	"@(#)job.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: job.c,v 1.290 2020/10/26 21:34:10 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.291 2020/10/26 22:51:56 rillig Exp $");
 
 /* A shell defines how the commands are run.  All commands for a target are
  * written into a single file, which is then given to the shell to execute
@@ -2331,8 +2331,8 @@ Job_ParseShell(char *line)
 		newShell.exit = arg + 8;
 	} else if (strncmp(arg, "hasErrCtl=", 10) == 0) {
 		char c = arg[10];
-		newShell.hasErrCtl = !((c != 'Y') && (c != 'y') &&
-   (c != 'T') && (c != 't'));
+		newShell.hasErrCtl = c == 'Y' || c == 'y' ||
+ c == 'T' || c == 't';
 	} else if (strncmp(arg, "newline=", 8) == 0) {
 		newShell.newline = arg + 8;
 	} else if (strncmp(arg, "check=", 6) == 0) {



CVS commit: src/usr.bin/make

2020-10-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Oct 26 21:34:10 UTC 2020

Modified Files:
src/usr.bin/make: compat.c cond.c job.c job.h main.c make.c make.h
parse.c targ.c var.c

Log Message:
make(1): group the command line options and arguments

By having a single struct that holds all command line options and
arguments, it is easy to see in the code when such a command line
argument is modified.  It also cleans up the namespace since the command
line options don't follow a common naming style.  Having them in a
struct also means that there is a single place for putting the
documentation, not two as before.

The struct also suggests to extract the initialization code out of main,
which is still too large, having more than 400 lines of code and
covering far too many topics.


To generate a diff of this commit:
cvs rdiff -u -r1.168 -r1.169 src/usr.bin/make/compat.c \
src/usr.bin/make/cond.c
cvs rdiff -u -r1.289 -r1.290 src/usr.bin/make/job.c
cvs rdiff -u -r1.57 -r1.58 src/usr.bin/make/job.h
cvs rdiff -u -r1.390 -r1.391 src/usr.bin/make/main.c
cvs rdiff -u -r1.180 -r1.181 src/usr.bin/make/make.c
cvs rdiff -u -r1.172 -r1.173 src/usr.bin/make/make.h
cvs rdiff -u -r1.400 -r1.401 src/usr.bin/make/parse.c
cvs rdiff -u -r1.124 -r1.125 src/usr.bin/make/targ.c
cvs rdiff -u -r1.589 -r1.590 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/compat.c
diff -u src/usr.bin/make/compat.c:1.168 src/usr.bin/make/compat.c:1.169
--- src/usr.bin/make/compat.c:1.168	Sat Oct 24 04:40:45 2020
+++ src/usr.bin/make/compat.c	Mon Oct 26 21:34:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat.c,v 1.168 2020/10/24 04:40:45 rillig Exp $	*/
+/*	$NetBSD: compat.c,v 1.169 2020/10/26 21:34:10 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -96,7 +96,7 @@
 #include "pathnames.h"
 
 /*	"@(#)compat.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: compat.c,v 1.168 2020/10/24 04:40:45 rillig Exp $");
+MAKE_RCSID("$NetBSD: compat.c,v 1.169 2020/10/26 21:34:10 rillig Exp $");
 
 static GNode *curTarg = NULL;
 static pid_t compatChild;
@@ -113,7 +113,7 @@ CompatDeleteTarget(GNode *gn)
 	char *file_freeIt;
 	const char *file = Var_Value(TARGET, gn, _freeIt);
 
-	if (!noExecute && eunlink(file) != -1) {
+	if (!opts.noExecute && eunlink(file) != -1) {
 	Error("*** %s removed", file);
 	}
 
@@ -420,7 +420,7 @@ Compat_RunCommand(const char *cmdp, GNod
 	}
 #endif
 	gn->made = ERROR;
-	if (keepgoing) {
+	if (opts.keepgoing) {
 		/* Abort the current target, but let others continue. */
 		printf(" (continuing)\n");
 	} else {
@@ -526,7 +526,7 @@ Compat_Make(GNode *gn, GNode *pgn)
 	 * If the user is just seeing if something is out-of-date, exit now
 	 * to tell him/her "yes".
 	 */
-	if (queryFlag) {
+	if (opts.queryFlag) {
 	exit(1);
 	}
 
@@ -551,7 +551,7 @@ Compat_Make(GNode *gn, GNode *pgn)
 	 * Our commands are ok, but we still have to worry about the -t
 	 * flag...
 	 */
-	if (!touchFlag || (gn->type & OP_MAKE)) {
+	if (!opts.touchFlag || (gn->type & OP_MAKE)) {
 		curTarg = gn;
 #ifdef USE_META
 		if (useMeta && !NoExecute(gn)) {
@@ -586,7 +586,7 @@ Compat_Make(GNode *gn, GNode *pgn)
 		pgn->flags |= CHILDMADE;
 		Make_TimeStamp(pgn, gn);
 	}
-	} else if (keepgoing) {
+	} else if (opts.keepgoing) {
 	pgn->flags &= ~(unsigned)REMAKE;
 	} else {
 	PrintOnError(gn, "\nStop.");
@@ -659,7 +659,7 @@ Compat_Run(GNodeList *targs)
  * If the user has defined a .BEGIN target, execute the commands attached
  * to it.
  */
-if (!queryFlag) {
+if (!opts.queryFlag) {
 	gn = Targ_FindNode(".BEGIN");
 	if (gn != NULL) {
 	Compat_Make(gn, gn);
Index: src/usr.bin/make/cond.c
diff -u src/usr.bin/make/cond.c:1.168 src/usr.bin/make/cond.c:1.169
--- src/usr.bin/make/cond.c:1.168	Sat Oct 24 04:51:19 2020
+++ src/usr.bin/make/cond.c	Mon Oct 26 21:34:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.168 2020/10/24 04:51:19 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.169 2020/10/26 21:34:10 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -93,7 +93,7 @@
 #include "dir.h"
 
 /*	"@(#)cond.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: cond.c,v 1.168 2020/10/24 04:51:19 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.169 2020/10/26 21:34:10 rillig Exp $");
 
 /*
  * The parsing of conditional expressions is based on this grammar:
@@ -294,7 +294,7 @@ FuncMake(size_t argLen MAKE_ATTR_UNUSED,
 {
 StringListNode *ln;
 
-for (ln = create->first; ln != NULL; ln = ln->next)
+for (ln = opts.create->first; ln != NULL; ln = ln->next)
 	if (Str_Match(ln->datum, arg))
 	return TRUE;
 return FALSE;

Index: src/usr.bin/make/job.c
diff -u src/usr.bin/make/job.c:1.289 src/usr.bin/make/job.c:1.290
--- 

CVS commit: src/usr.sbin/sysinst

2020-10-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Oct 26 20:18:33 UTC 2020

Modified Files:
src/usr.sbin/sysinst: util.c

Log Message:
PR 55752: relax an assertion, the first getvfsstat() call may overestimate
the file systems visible to us.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/usr.sbin/sysinst/util.c

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

Modified files:

Index: src/usr.sbin/sysinst/util.c
diff -u src/usr.sbin/sysinst/util.c:1.50 src/usr.sbin/sysinst/util.c:1.51
--- src/usr.sbin/sysinst/util.c:1.50	Sun Oct 25 08:50:32 2020
+++ src/usr.sbin/sysinst/util.c	Mon Oct 26 20:18:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: util.c,v 1.50 2020/10/25 08:50:32 martin Exp $	*/
+/*	$NetBSD: util.c,v 1.51 2020/10/26 20:18:33 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -515,7 +515,7 @@ static int
 get_available_cds(void)
 {
 	struct get_available_cds_state data;
-	int n, __diagused e;
+	int n, m;
 
 	memset(, 0, sizeof data);
 	data.info = cds;
@@ -523,10 +523,10 @@ get_available_cds(void)
 	n = getvfsstat(NULL, 0, ST_NOWAIT);
 	if (n > 0) {
 		data.mounted = calloc(n, sizeof(*data.mounted));
-		e = getvfsstat(data.mounted, n*sizeof(*data.mounted),
+		m = getvfsstat(data.mounted, n*sizeof(*data.mounted),
 		ST_NOWAIT);
-		assert(e == n);
-		data.num_mounted = n;
+		assert(m >= 0 && m <= n);
+		data.num_mounted = m;
 	}
 
 	enumerate_disks(, get_available_cds_helper);



CVS commit: src/usr.bin/make

2020-10-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Oct 26 20:14:27 UTC 2020

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

Log Message:
make(1): convert a few strings to const strings in suff.c


To generate a diff of this commit:
cvs rdiff -u -r1.226 -r1.227 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.226 src/usr.bin/make/suff.c:1.227
--- src/usr.bin/make/suff.c:1.226	Sun Oct 25 22:13:53 2020
+++ src/usr.bin/make/suff.c	Mon Oct 26 20:14:27 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.226 2020/10/25 22:13:53 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.227 2020/10/26 20:14:27 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -129,7 +129,7 @@
 #include "dir.h"
 
 /*	"@(#)suff.c	8.4 (Berkeley) 3/21/94"	*/
-MAKE_RCSID("$NetBSD: suff.c,v 1.226 2020/10/25 22:13:53 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.227 2020/10/26 20:14:27 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -266,7 +266,7 @@ SuffSuffGetSuffix(const Suff *s, size_t 
 }
 
 static Boolean
-SuffSuffIsSuffix(const Suff *suff, size_t nameLen, char *nameEnd)
+SuffSuffIsSuffix(const Suff *suff, size_t nameLen, const char *nameEnd)
 {
 return SuffSuffGetSuffix(suff, nameLen, nameEnd) != NULL;
 }
@@ -1580,7 +1580,7 @@ SuffFindArchiveDeps(GNode *gn, SrcList *
 }
 
 static void
-SuffFindNormalDepsKnown(char *name, size_t nameLen, GNode *gn,
+SuffFindNormalDepsKnown(const char *name, size_t nameLen, GNode *gn,
 			SrcList *srcs, SrcList *targs)
 {
 SuffListNode *ln;
@@ -1723,7 +1723,7 @@ SuffFindNormalDeps(GNode *gn, SrcList *s
 char *pref;			/* Prefix to use */
 Src *targ;			/* General Src target pointer */
 
-char *name = gn->name;
+const char *name = gn->name;
 size_t nameLen = strlen(name);
 
 /*



CVS commit: src/usr.bin/make

2020-10-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Oct 26 20:11:03 UTC 2020

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

Log Message:
make(1): fix comments in job.c


To generate a diff of this commit:
cvs rdiff -u -r1.288 -r1.289 src/usr.bin/make/job.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/job.c
diff -u src/usr.bin/make/job.c:1.288 src/usr.bin/make/job.c:1.289
--- src/usr.bin/make/job.c:1.288	Sun Oct 25 22:05:00 2020
+++ src/usr.bin/make/job.c	Mon Oct 26 20:11:02 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.288 2020/10/25 22:05:00 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.289 2020/10/26 20:11:02 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -143,7 +143,7 @@
 #include "trace.h"
 
 /*	"@(#)job.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: job.c,v 1.288 2020/10/25 22:05:00 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.289 2020/10/26 20:11:02 rillig Exp $");
 
 /* A shell defines how the commands are run.  All commands for a target are
  * written into a single file, which is then given to the shell to execute
@@ -230,10 +230,8 @@ static AbortReason aborting = ABORT_NONE
  */
 int jobTokensRunning = 0;
 
-/* The number of commands actually printed for a target.
- * XXX: Why printed? Shouldn't that be run/printed instead, depending on the
- * command line options?
- * Should this number be 0, no shell will be executed. */
+/* The number of commands actually printed to the shell commands file for
+ * the current job.  Should this number be 0, no shell will be executed. */
 static int numCommands;
 
 typedef enum JobStartResult {
@@ -254,7 +252,7 @@ typedef enum JobStartResult {
  * the default shell.
  *
  * ".SHELL" lines in Makefiles can choose the default shell from the
- # set defined here, or add additional shells.
+ * set defined here, or add additional shells.
  */
 
 #ifdef DEFSHELL_CUSTOM



CVS commit: src/sys/kern

2020-10-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Oct 26 17:35:39 UTC 2020

Modified Files:
src/sys/kern: kern_core.c kern_sig.c

Log Message:
Depend directly on EXEC_ELF{32,64} to determine which versions of the coredump
code are available.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/kern/kern_core.c
cvs rdiff -u -r1.392 -r1.393 src/sys/kern/kern_sig.c

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

Modified files:

Index: src/sys/kern/kern_core.c
diff -u src/sys/kern/kern_core.c:1.32 src/sys/kern/kern_core.c:1.33
--- src/sys/kern/kern_core.c:1.32	Tue Oct 20 09:47:30 2020
+++ src/sys/kern/kern_core.c	Mon Oct 26 13:35:39 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_core.c,v 1.32 2020/10/20 13:47:30 christos Exp $	*/
+/*	$NetBSD: kern_core.c,v 1.33 2020/10/26 17:35:39 christos Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1991, 1993
@@ -37,9 +37,10 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_core.c,v 1.32 2020/10/20 13:47:30 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_core.c,v 1.33 2020/10/26 17:35:39 christos Exp $");
 
 #ifdef _KERNEL_OPT
+#include "opt_execfmt.h"
 #include "opt_compat_netbsd32.h"
 #endif
 
@@ -88,10 +89,10 @@ coredump_modcmd(modcmd_t cmd, void *arg)
 		MODULE_HOOK_SET(coredump_write_hook, coredump_write);
 		MODULE_HOOK_SET(coredump_offset_hook, coredump_offset);
 		MODULE_HOOK_SET(coredump_netbsd_hook, real_coredump_netbsd);
-#if !defined(_LP64) || defined(COMPAT_NETBSD32)
+#ifdef EXEC_ELF32
 		MODULE_HOOK_SET(coredump_elf32_hook, real_coredump_elf32);
 #endif
-#ifdef _LP64
+#ifdef EXEC_ELF64
 		MODULE_HOOK_SET(coredump_elf64_hook, real_coredump_elf64);
 #endif
 		MODULE_HOOK_SET(uvm_coredump_walkmap_hook,
@@ -102,10 +103,10 @@ coredump_modcmd(modcmd_t cmd, void *arg)
 	case MODULE_CMD_FINI:
 		MODULE_HOOK_UNSET(uvm_coredump_count_segs_hook);
 		MODULE_HOOK_UNSET(uvm_coredump_walkmap_hook);
-#ifdef _LP64
+#ifdef EXEC_ELF64
 		MODULE_HOOK_UNSET(coredump_elf64_hook);
 #endif
-#if !defined(_LP64) || defined(COMPAT_NETBSD32)
+#ifdef EXEC_ELF32
 		MODULE_HOOK_UNSET(coredump_elf32_hook);
 #endif
 		MODULE_HOOK_UNSET(coredump_netbsd_hook);

Index: src/sys/kern/kern_sig.c
diff -u src/sys/kern/kern_sig.c:1.392 src/sys/kern/kern_sig.c:1.393
--- src/sys/kern/kern_sig.c:1.392	Tue Oct 20 09:16:26 2020
+++ src/sys/kern/kern_sig.c	Mon Oct 26 13:35:39 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_sig.c,v 1.392 2020/10/20 13:16:26 christos Exp $	*/
+/*	$NetBSD: kern_sig.c,v 1.393 2020/10/26 17:35:39 christos Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008, 2019 The NetBSD Foundation, Inc.
@@ -70,8 +70,9 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.392 2020/10/20 13:16:26 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.393 2020/10/26 17:35:39 christos Exp $");
 
+#include "opt_execfmt.h"
 #include "opt_ptrace.h"
 #include "opt_dtrace.h"
 #include "opt_compat_sunos.h"
@@ -2356,7 +2357,7 @@ coredump_netbsd(struct lwp *l, struct co
 	return retval;
 }
 
-#if !defined(_LP64) || defined(COMPAT_NETBSD32)
+#ifdef EXEC_ELF32
 int
 coredump_elf32(struct lwp *l, struct coredump_iostate *iocookie)
 {
@@ -2367,7 +2368,7 @@ coredump_elf32(struct lwp *l, struct cor
 }
 #endif
 
-#ifdef _LP64
+#ifdef EXEC_ELF64
 int
 coredump_elf64(struct lwp *l, struct coredump_iostate *iocookie)
 {



CVS commit: src/external/mit/xorg/bin/xdm/config

2020-10-26 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Mon Oct 26 16:24:09 UTC 2020

Modified Files:
src/external/mit/xorg/bin/xdm/config: Xresources.in

Log Message:
xdm(8): fix definitions of truetype fonts in the default resource file

we don't ship with a truetype helvetica.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/mit/xorg/bin/xdm/config/Xresources.in

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

Modified files:

Index: src/external/mit/xorg/bin/xdm/config/Xresources.in
diff -u src/external/mit/xorg/bin/xdm/config/Xresources.in:1.4 src/external/mit/xorg/bin/xdm/config/Xresources.in:1.5
--- src/external/mit/xorg/bin/xdm/config/Xresources.in:1.4	Fri Mar 29 16:07:01 2019
+++ src/external/mit/xorg/bin/xdm/config/Xresources.in	Mon Oct 26 16:24:09 2020
@@ -22,19 +22,19 @@ xlogin*greetFont: -adobe-helvetica-bold-
 xlogin*font: -adobe-helvetica-medium-o-normal-*-14-*-*-*-*-*-iso8859-1
 xlogin*promptFont: -adobe-helvetica-medium-r-normal-*-14-*-*-*-*-*-iso8859-1
 xlogin*failFont: -adobe-helvetica-medium-r-normal-*-14-*-*-*-*-*-iso8859-1
-xlogin*greetFace:	Serif-24:bold:italic
-xlogin*face: 		Helvetica-14
-xlogin*promptFace: 	Helvetica-14:bold
-xlogin*failFace: 	Helvetica-14:bold
+xlogin*greetFace:	Sans-24
+xlogin*face: 		Sans-14
+xlogin*promptFace: 	Sans-14:bold
+xlogin*failFace: 	Sans-14:bold
 XHASHelse
 xlogin*greetFont: -adobe-helvetica-bold-o-normal--17-120-100-100-p-92-iso8859-1
 xlogin*font: -adobe-helvetica-medium-r-normal--12-120-75-75-p-67-iso8859-1
 xlogin*promptFont: -adobe-helvetica-bold-r-normal--12-120-75-75-p-70-iso8859-1
 xlogin*failFont: -adobe-helvetica-bold-o-normal--14-140-75-75-p-82-iso8859-1
-xlogin*greetFace:	Serif-18:bold:italic
-xlogin*face:		Helvetica-12
-xlogin*promptFace:	Helvetica-12:bold
-xlogin*failFace:	Helvetica-14:bold
+xlogin*greetFace:	Sans-18
+xlogin*face:		Sans-12
+xlogin*promptFace:	Sans-12:bold
+xlogin*failFace:	Sans-14:bold
 XHASHendif
 
 XHASHifdef COLOR



CVS commit: src/sys/dev/usb

2020-10-26 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Oct 26 12:24:10 UTC 2020

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

Log Message:
properly wait for refcounts to drain.
fixes panic at detach that jmnceill saw.

XXX: pullup-[89].


To generate a diff of this commit:
cvs rdiff -u -r1.127 -r1.128 src/sys/dev/usb/ucom.c

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

Modified files:

Index: src/sys/dev/usb/ucom.c
diff -u src/sys/dev/usb/ucom.c:1.127 src/sys/dev/usb/ucom.c:1.128
--- src/sys/dev/usb/ucom.c:1.127	Sat Mar 14 02:35:33 2020
+++ src/sys/dev/usb/ucom.c	Mon Oct 26 12:24:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ucom.c,v 1.127 2020/03/14 02:35:33 christos Exp $	*/
+/*	$NetBSD: ucom.c,v 1.128 2020/10/26 12:24:10 mrg Exp $	*/
 
 /*
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.127 2020/03/14 02:35:33 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.128 2020/10/26 12:24:10 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -434,7 +434,7 @@ ucom_detach(device_t self, int flags)
 	}
 
 	sc->sc_refcnt--;
-	while (sc->sc_refcnt > 0) {
+	while (sc->sc_refcnt >= 0) {
 		/* Wake up anyone waiting */
 		if (tp != NULL) {
 			mutex_spin_enter(_lock);



CVS commit: src/sys/arch/sparc64/conf

2020-10-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Oct 26 11:49:45 UTC 2020

Modified Files:
src/sys/arch/sparc64/conf: GENERIC

Log Message:
Backout previous, PR 54810 has been fixed.


To generate a diff of this commit:
cvs rdiff -u -r1.231 -r1.232 src/sys/arch/sparc64/conf/GENERIC

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/sparc64/conf/GENERIC
diff -u src/sys/arch/sparc64/conf/GENERIC:1.231 src/sys/arch/sparc64/conf/GENERIC:1.232
--- src/sys/arch/sparc64/conf/GENERIC:1.231	Sun Oct 25 18:53:11 2020
+++ src/sys/arch/sparc64/conf/GENERIC	Mon Oct 26 11:49:45 2020
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.231 2020/10/25 18:53:11 martin Exp $
+# $NetBSD: GENERIC,v 1.232 2020/10/26 11:49:45 martin Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/sparc64/conf/std.sparc64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.231 $"
+#ident		"GENERIC-$Revision: 1.232 $"
 
 maxusers	64
 
@@ -861,6 +861,3 @@ options 	PAX_SEGVGUARD=0		# PaX Segmenta
 # options 	PAX_MPROTECT=0		# PaX mprotect(2) restrictions
 # options 	PAX_MPROTECT_DEBUG=1	# PaX mprotect debug
 options 	PAX_ASLR=1		# PaX Address Space Layout Randomization
-
-# Temporary workaround while analyzing memory corruption when booting from CD
-no file-system NTFS



CVS commit: src/sys/dev/scsipi

2020-10-26 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Oct 26 11:39:48 UTC 2020

Modified Files:
src/sys/dev/scsipi: cd.c

Log Message:
Avoid buffer overflow when copying from bounce buffer.
Fixes PR 54810

Don't use uninitialized pointer in split bounce buffer case and
free a partially allocated bounce buffer on error.


To generate a diff of this commit:
cvs rdiff -u -r1.348 -r1.349 src/sys/dev/scsipi/cd.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/scsipi/cd.c
diff -u src/sys/dev/scsipi/cd.c:1.348 src/sys/dev/scsipi/cd.c:1.349
--- src/sys/dev/scsipi/cd.c:1.348	Tue Sep 29 03:04:03 2020
+++ src/sys/dev/scsipi/cd.c	Mon Oct 26 11:39:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cd.c,v 1.348 2020/09/29 03:04:03 msaitoh Exp $	*/
+/*	$NetBSD: cd.c,v 1.349 2020/10/26 11:39:48 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001, 2003, 2004, 2005, 2008 The NetBSD Foundation,
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.348 2020/09/29 03:04:03 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.349 2020/10/26 11:39:48 mlelstv Exp $");
 
 #include 
 #include 
@@ -667,7 +667,7 @@ cd_make_bounce(struct cd_softc *cd, stru
 	cd_iosize(dksc->sc_dev, );
 
 	bounce->head = skip * DEV_BSIZE;
-	bounce->lcount = count - bounce->head;
+	bounce->lcount = imin(count - bounce->head, bp->b_bcount);
 	bounce->rcount = bp->b_bcount - bounce->lcount;
 
 	error = cd_make_bounce_buffer(cd, bp, blkno, count, , bounce);
@@ -678,10 +678,10 @@ cd_make_bounce(struct cd_softc *cd, stru
 	count = total - count;
 
 	if (count > 0) {
-		bounce->lbp->b_private = bounce;
 		error = cd_make_bounce_buffer(cd, bp, blkno, count, , bounce);
 		if (error) {
-			putiobuf(bounce->lbp);
+			free(lbp->b_data, M_DEVBUF);
+			putiobuf(lbp);
 			goto bad;
 		}
 	} else



CVS commit: src/usr.bin/make

2020-10-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Oct 26 07:37:52 UTC 2020

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

Log Message:
make(1): remove stray closing brace from comment


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/usr.bin/make/for.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/for.c
diff -u src/usr.bin/make/for.c:1.110 src/usr.bin/make/for.c:1.111
--- src/usr.bin/make/for.c:1.110	Mon Oct 26 07:33:48 2020
+++ src/usr.bin/make/for.c	Mon Oct 26 07:37:52 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: for.c,v 1.110 2020/10/26 07:33:48 rillig Exp $	*/
+/*	$NetBSD: for.c,v 1.111 2020/10/26 07:37:52 rillig Exp $	*/
 
 /*
  * Copyright (c) 1992, The Regents of the University of California.
@@ -60,7 +60,7 @@
 #include"make.h"
 
 /*	"@(#)for.c	8.1 (Berkeley) 6/6/93"	*/
-MAKE_RCSID("$NetBSD: for.c,v 1.110 2020/10/26 07:33:48 rillig Exp $");
+MAKE_RCSID("$NetBSD: for.c,v 1.111 2020/10/26 07:37:52 rillig Exp $");
 
 /* The .for loop substitutes the items as ${:U...}, which means
  * that characters that break this syntax must be backslash-escaped. */
@@ -400,7 +400,7 @@ SubstVarShort(For *f, char const ch, con
 const char *p = *pp;
 size_t i;
 
-/* Probably a single character name, ignore $$ and stupid ones. {*/
+/* Probably a single character name, ignore $$ and stupid ones. */
 if (!f->short_var || strchr("}):$", ch) != NULL) {
 	p++;
 	*pp = p;



CVS commit: src/usr.bin/make

2020-10-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Oct 26 07:33:48 UTC 2020

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

Log Message:
make(1): clean up variable substitution in .for loops

The variable name cmd_cp was not really helpful for understanding the
code.


To generate a diff of this commit:
cvs rdiff -u -r1.109 -r1.110 src/usr.bin/make/for.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/for.c
diff -u src/usr.bin/make/for.c:1.109 src/usr.bin/make/for.c:1.110
--- src/usr.bin/make/for.c:1.109	Mon Oct 26 07:03:47 2020
+++ src/usr.bin/make/for.c	Mon Oct 26 07:33:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: for.c,v 1.109 2020/10/26 07:03:47 rillig Exp $	*/
+/*	$NetBSD: for.c,v 1.110 2020/10/26 07:33:48 rillig Exp $	*/
 
 /*
  * Copyright (c) 1992, The Regents of the University of California.
@@ -60,7 +60,7 @@
 #include"make.h"
 
 /*	"@(#)for.c	8.1 (Berkeley) 6/6/93"	*/
-MAKE_RCSID("$NetBSD: for.c,v 1.109 2020/10/26 07:03:47 rillig Exp $");
+MAKE_RCSID("$NetBSD: for.c,v 1.110 2020/10/26 07:33:48 rillig Exp $");
 
 /* The .for loop substitutes the items as ${:U...}, which means
  * that characters that break this syntax must be backslash-escaped. */
@@ -326,8 +326,10 @@ for_var_len(const char *var)
 return 0;
 }
 
+/* While expanding the body of a .for loop, write the item in the ${:U...}
+ * expression, escaping characters as needed. See ApplyModifier_Defined. */
 static void
-for_substitute(Buffer *cmds, const char *item, char ech)
+Buf_AddEscaped(Buffer *cmds, const char *item, char ech)
 {
 ForEscapes escapes = GetEscapes(item);
 char ch;
@@ -360,71 +362,68 @@ for_substitute(Buffer *cmds, const char 
 /* While expanding the body of a .for loop, replace expressions like
  * ${i}, ${i:...}, $(i) or $(i:...) with their ${:U...} expansion. */
 static void
-SubstVarLong(For *f, const char **inout_cp, const char **inout_cmd_cp, char ech)
+SubstVarLong(For *f, const char **pp, const char **inout_mark, char ech)
 {
 size_t i;
-const char *cp = *inout_cp;
-const char *cmd_cp = *inout_cmd_cp;
+const char *p = *pp;
 
 for (i = 0; i < f->vars.len; i++) {
 	ForVar *forVar = Vector_Get(>vars, i);
 	char *var = forVar->name;
 	size_t vlen = forVar->len;
 
-	/* XXX: undefined behavior for cp if vlen is longer than cp? */
-	if (memcmp(cp, var, vlen) != 0)
+	/* XXX: undefined behavior for p if vlen is longer than p? */
+	if (memcmp(p, var, vlen) != 0)
 	continue;
 	/* XXX: why test for backslash here? */
-	if (cp[vlen] != ':' && cp[vlen] != ech && cp[vlen] != '\\')
+	if (p[vlen] != ':' && p[vlen] != ech && p[vlen] != '\\')
 	continue;
 
 	/* Found a variable match. Replace with :U */
-	Buf_AddBytesBetween(>curBody, cmd_cp, cp);
+	Buf_AddBytesBetween(>curBody, *inout_mark, p);
 	Buf_AddStr(>curBody, ":U");
-	cp += vlen;
-	cmd_cp = cp;
-	for_substitute(>curBody, f->items.words[f->sub_next + i], ech);
+	Buf_AddEscaped(>curBody, f->items.words[f->sub_next + i], ech);
+
+	p += vlen;
+	*inout_mark = p;
 	break;
 }
 
-*inout_cp = cp;
-*inout_cmd_cp = cmd_cp;
+*pp = p;
 }
 
 /* While expanding the body of a .for loop, replace single-character
  * variable expressions like $i with their ${:U...} expansion. */
 static void
-SubstVarShort(For *f, char const ch,
-	  const char **inout_cp, const char **input_cmd_cp)
+SubstVarShort(For *f, char const ch, const char **pp, const char **inout_mark)
 {
-const char *cp = *inout_cp;
-const char *cmd_cp = *input_cmd_cp;
+const char *p = *pp;
 size_t i;
 
 /* Probably a single character name, ignore $$ and stupid ones. {*/
 if (!f->short_var || strchr("}):$", ch) != NULL) {
-	cp++;
-	*inout_cp = cp;
+	p++;
+	*pp = p;
 	return;
 }
 
 for (i = 0; i < f->vars.len; i++) {
 	ForVar *var = Vector_Get(>vars, i);
-	char *varname = var->name;
+	const char *varname = var->name;
 	if (varname[0] != ch || varname[1] != '\0')
 	continue;
 
 	/* Found a variable match. Replace with ${:U} */
-	Buf_AddBytesBetween(>curBody, cmd_cp, cp);
+	Buf_AddBytesBetween(>curBody, *inout_mark, p);
 	Buf_AddStr(>curBody, "{:U");
-	cmd_cp = ++cp;
-	for_substitute(>curBody, f->items.words[f->sub_next + i], '}');
+	Buf_AddEscaped(>curBody, f->items.words[f->sub_next + i], '}');
 	Buf_AddByte(>curBody, '}');
+
+	*inout_mark = ++p;
 	break;
 }
 
-*inout_cp = cp;
-*input_cmd_cp = cmd_cp;
+*pp = p;
 }
 
 /*
@@ -443,11 +442,10 @@ static char *
 ForIterate(void *v_arg, size_t *out_len)
 {
 For *f = v_arg;
-const char *cp;
-const char *cmd_cp;
+const char *p;
+const char *mark;		/* where the last replacement left off */
 const char *body_end;
 char *cmds_str;
-size_t cmd_len;
 
 if (f->sub_next + f->vars.len > f->items.len) {
 	/* No more iterations */
@@ -457,23 +455,23 @@ ForIterate(void *v_arg, size_t *out_len)
 
 Buf_Empty(>curBody);
 
-cmd_cp = 

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

2020-10-26 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Oct 26 07:16:41 UTC 2020

Modified Files:
src/sys/arch/arm/pic: pic.c

Log Message:
Improve a comment


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/arm/pic/pic.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/pic/pic.c
diff -u src/sys/arch/arm/pic/pic.c:1.59 src/sys/arch/arm/pic/pic.c:1.60
--- src/sys/arch/arm/pic/pic.c:1.59	Mon Oct 26 07:14:42 2020
+++ src/sys/arch/arm/pic/pic.c	Mon Oct 26 07:16:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pic.c,v 1.59 2020/10/26 07:14:42 skrll Exp $	*/
+/*	$NetBSD: pic.c,v 1.60 2020/10/26 07:16:41 skrll Exp $	*/
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -33,7 +33,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pic.c,v 1.59 2020/10/26 07:14:42 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pic.c,v 1.60 2020/10/26 07:16:41 skrll Exp $");
 
 #include 
 #include 
@@ -203,11 +203,19 @@ intr_ipi_send(const kcpuset_t *kcp, u_lo
 		if (pic == NULL || pic->pic_cpus == NULL)
 			continue;
 		if (kcp == NULL || kcpuset_intersecting_p(kcp, pic->pic_cpus)) {
-			// never send to ourself
+			/*
+			 * Never send to ourself.
+			 *
+			 * This test uses pointer comparison for systems
+			 * that have a pic per cpu, e.g. RPI[23].  GIC sets
+			 * pic_cpus to kcpuset_running and handles "not for
+			 * self" internally.
+			 */
 			if (pic->pic_cpus == ci->ci_kcpuset)
 continue;
 
 			(*pic->pic_ops->pic_ipi_send)(pic, kcp, ipi);
+
 			/*
 			 * If we were targeting a single CPU or this pic
 			 * handles all cpus, we're done.



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

2020-10-26 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Oct 26 07:14:42 UTC 2020

Modified Files:
src/sys/arch/arm/pic: pic.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/arm/pic/pic.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/pic/pic.c
diff -u src/sys/arch/arm/pic/pic.c:1.58 src/sys/arch/arm/pic/pic.c:1.59
--- src/sys/arch/arm/pic/pic.c:1.58	Sun Oct 25 08:29:30 2020
+++ src/sys/arch/arm/pic/pic.c	Mon Oct 26 07:14:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pic.c,v 1.58 2020/10/25 08:29:30 skrll Exp $	*/
+/*	$NetBSD: pic.c,v 1.59 2020/10/26 07:14:42 skrll Exp $	*/
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -33,7 +33,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pic.c,v 1.58 2020/10/25 08:29:30 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pic.c,v 1.59 2020/10/26 07:14:42 skrll Exp $");
 
 #include 
 #include 
@@ -208,8 +208,10 @@ intr_ipi_send(const kcpuset_t *kcp, u_lo
 continue;
 
 			(*pic->pic_ops->pic_ipi_send)(pic, kcp, ipi);
-			// If we were targeting a single CPU or this pic
-			// handles all cpus, we're done.
+			/*
+			 * If we were targeting a single CPU or this pic
+			 * handles all cpus, we're done.
+			 */
 			if (kcp != NULL || pic->pic_cpus == kcpuset_running)
 return;
 			sent_p = true;



CVS commit: src/usr.bin/make

2020-10-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Oct 26 07:03:47 UTC 2020

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

Log Message:
make(1): use consistent variable names in for.c


To generate a diff of this commit:
cvs rdiff -u -r1.108 -r1.109 src/usr.bin/make/for.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/for.c
diff -u src/usr.bin/make/for.c:1.108 src/usr.bin/make/for.c:1.109
--- src/usr.bin/make/for.c:1.108	Sun Oct 25 16:18:02 2020
+++ src/usr.bin/make/for.c	Mon Oct 26 07:03:47 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: for.c,v 1.108 2020/10/25 16:18:02 rillig Exp $	*/
+/*	$NetBSD: for.c,v 1.109 2020/10/26 07:03:47 rillig Exp $	*/
 
 /*
  * Copyright (c) 1992, The Regents of the University of California.
@@ -60,7 +60,7 @@
 #include"make.h"
 
 /*	"@(#)for.c	8.1 (Berkeley) 6/6/93"	*/
-MAKE_RCSID("$NetBSD: for.c,v 1.108 2020/10/25 16:18:02 rillig Exp $");
+MAKE_RCSID("$NetBSD: for.c,v 1.109 2020/10/26 07:03:47 rillig Exp $");
 
 /* The .for loop substitutes the items as ${:U...}, which means
  * that characters that break this syntax must be backslash-escaped. */
@@ -104,24 +104,20 @@ ForAddVar(For *f, const char *name, size
 }
 
 static void
-ForVarDone(ForVar *var)
+For_Free(For *f)
 {
-free(var->name);
-}
-
-static void
-For_Free(For *arg)
-{
-Buf_Destroy(>body, TRUE);
+Buf_Destroy(>body, TRUE);
 
-while (arg->vars.len > 0)
-ForVarDone(Vector_Pop(>vars));
-Vector_Done(>vars);
+while (f->vars.len > 0) {
+	ForVar *var = Vector_Pop(>vars);
+	free(var->name);
+}
+Vector_Done(>vars);
 
-Words_Free(arg->items);
-Buf_Destroy(>curBody, TRUE);
+Words_Free(f->items);
+Buf_Destroy(>curBody, TRUE);
 
-free(arg);
+free(f);
 }
 
 static ForEscapes
@@ -175,7 +171,7 @@ IsEndfor(const char *p)
 int
 For_Eval(const char *line)
 {
-For *new_for;
+For *f;
 const char *p;
 
 p = line + 1;		/* skip the '.' */
@@ -194,14 +190,14 @@ For_Eval(const char *line)
  * we found a for loop, and now we are going to parse it.
  */
 
-new_for = bmake_malloc(sizeof *new_for);
-Buf_Init(_for->body, 0);
-Vector_Init(_for->vars, sizeof(ForVar));
-new_for->items.words = NULL;
-new_for->items.freeIt = NULL;
-Buf_Init(_for->curBody, 0);
-new_for->short_var = FALSE;
-new_for->sub_next = 0;
+f = bmake_malloc(sizeof *f);
+Buf_Init(>body, 0);
+Vector_Init(>vars, sizeof(ForVar));
+f->items.words = NULL;
+f->items.freeIt = NULL;
+Buf_Init(>curBody, 0);
+f->short_var = FALSE;
+f->sub_next = 0;
 
 /* Grab the variables. Terminate on "in". */
 for (;;) {
@@ -210,7 +206,7 @@ For_Eval(const char *line)
 	cpp_skip_whitespace();
 	if (*p == '\0') {
 	Parse_Error(PARSE_FATAL, "missing `in' in for");
-	For_Free(new_for);
+	For_Free(f);
 	return -1;
 	}
 
@@ -223,15 +219,15 @@ For_Eval(const char *line)
 	break;
 	}
 	if (len == 1)
-	new_for->short_var = TRUE;
+	f->short_var = TRUE;
 
-	ForAddVar(new_for, p, len);
+	ForAddVar(f, p, len);
 	p += len;
 }
 
-if (new_for->vars.len == 0) {
+if (f->vars.len == 0) {
 	Parse_Error(PARSE_FATAL, "no iteration variables in for");
-	For_Free(new_for);
+	For_Free(f);
 	return -1;
 }
 
@@ -241,18 +237,17 @@ For_Eval(const char *line)
 	char *items;
 	(void)Var_Subst(p, VAR_GLOBAL, VARE_WANTRES, );
 	/* TODO: handle errors */
-	new_for->items = Str_Words(items, FALSE);
+	f->items = Str_Words(items, FALSE);
 	free(items);
 
-	if (new_for->items.len == 1 && new_for->items.words[0][0] == '\0')
-	new_for->items.len = 0;	/* .for var in ${:U} */
+	if (f->items.len == 1 && f->items.words[0][0] == '\0')
+	f->items.len = 0;	/* .for var in ${:U} */
 }
 
 {
 	size_t nitems, nvars;
 
-	if ((nitems = new_for->items.len) > 0 &&
-	nitems % (nvars = new_for->vars.len)) {
+	if ((nitems = f->items.len) > 0 && nitems % (nvars = f->vars.len)) {
 	Parse_Error(PARSE_FATAL,
 			"Wrong number of words (%zu) in .for substitution list"
 			" with %zu variables", nitems, nvars);
@@ -261,11 +256,11 @@ For_Eval(const char *line)
 	 * accumulated.
 	 * Remove all items so that the loop doesn't iterate.
 	 */
-	new_for->items.len = 0;
+	f->items.len = 0;
 	}
 }
 
-accumFor = new_for;
+accumFor = f;
 forLevel = 1;
 return 1;
 }
@@ -362,16 +357,17 @@ for_substitute(Buffer *cmds, const char 
 }
 }
 
+/* While expanding the body of a .for loop, replace expressions like
+ * ${i}, ${i:...}, $(i) or $(i:...) with their ${:U...} expansion. */
 static void
-SubstVarLong(For *arg, const char **inout_cp, const char **inout_cmd_cp,
-	 char ech)
+SubstVarLong(For *f, const char **inout_cp, const char **inout_cmd_cp, char ech)
 {
 size_t i;
 const char *cp = *inout_cp;
 const char *cmd_cp = *inout_cmd_cp;
 
-for (i = 0; i < arg->vars.len; i++) {
-	ForVar 

CVS commit: src/sys/arch/amiga/conf

2020-10-26 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Oct 26 06:22:28 UTC 2020

Modified Files:
src/sys/arch/amiga/conf: DRACO GENERIC INSTALL

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.195 -r1.196 src/sys/arch/amiga/conf/DRACO
cvs rdiff -u -r1.330 -r1.331 src/sys/arch/amiga/conf/GENERIC
cvs rdiff -u -r1.136 -r1.137 src/sys/arch/amiga/conf/INSTALL

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/amiga/conf/DRACO
diff -u src/sys/arch/amiga/conf/DRACO:1.195 src/sys/arch/amiga/conf/DRACO:1.196
--- src/sys/arch/amiga/conf/DRACO:1.195	Sun Sep 27 13:48:49 2020
+++ src/sys/arch/amiga/conf/DRACO	Mon Oct 26 06:22:28 2020
@@ -1,9 +1,9 @@
-# $NetBSD: DRACO,v 1.195 2020/09/27 13:48:49 roy Exp $
+# $NetBSD: DRACO,v 1.196 2020/10/26 06:22:28 rin Exp $
 #
 # This file was automatically created.
 # Changes will be lost when make is run in this directory.
 #
-# Created from: # NetBSD: GENERIC.in,v 1.145 2020/08/10 06:32:57 rin Exp $
+# Created from: # NetBSD: GENERIC.in,v 1.147 2020/10/26 06:21:49 rin Exp $
 #
 ##
 # GENERIC machine description file
@@ -29,7 +29,7 @@ include "arch/amiga/conf/std.amiga"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.195 $"
+#ident 		"GENERIC-$Revision: 1.196 $"
 
 makeoptions	COPTS="-O2 -fno-reorder-blocks -fno-omit-frame-pointer"
 	# See share/mk/sys.mk. -fno-omit-frame-pointer is necessary for
@@ -162,6 +162,7 @@ options 	DDB		# Kernel debugger
 #options 	DDB_HISTORY_SIZE=100	# Enable history editing in DDB
 #options 	DIAGNOSTIC	# Extra kernel sanity checks
 #options 	DEBUG		# Enable misc. kernel debugging code
+makeoptions	DEBUG="-g"	# compile full symbol table
 #options 	SYSCALL_DEBUG	# debug all syscalls.
 #options 	SCSIDEBUG	# Add SCSI debugging statements
 #options 	PANICBUTTON	# Forced crash via keypress (?)

Index: src/sys/arch/amiga/conf/GENERIC
diff -u src/sys/arch/amiga/conf/GENERIC:1.330 src/sys/arch/amiga/conf/GENERIC:1.331
--- src/sys/arch/amiga/conf/GENERIC:1.330	Sun Sep 27 13:48:49 2020
+++ src/sys/arch/amiga/conf/GENERIC	Mon Oct 26 06:22:28 2020
@@ -1,9 +1,9 @@
-# $NetBSD: GENERIC,v 1.330 2020/09/27 13:48:49 roy Exp $
+# $NetBSD: GENERIC,v 1.331 2020/10/26 06:22:28 rin Exp $
 #
 # This file was automatically created.
 # Changes will be lost when make is run in this directory.
 #
-# Created from: # NetBSD: GENERIC.in,v 1.145 2020/08/10 06:32:57 rin Exp $
+# Created from: # NetBSD: GENERIC.in,v 1.147 2020/10/26 06:21:49 rin Exp $
 #
 ##
 # GENERIC machine description file
@@ -29,7 +29,7 @@ include "arch/amiga/conf/std.amiga"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.330 $"
+#ident 		"GENERIC-$Revision: 1.331 $"
 
 makeoptions	COPTS="-O2 -fno-reorder-blocks -fno-omit-frame-pointer"
 	# See share/mk/sys.mk. -fno-omit-frame-pointer is necessary for
@@ -174,6 +174,7 @@ options 	DDB		# Kernel debugger
 #options 	DDB_HISTORY_SIZE=100	# Enable history editing in DDB
 #options 	DIAGNOSTIC	# Extra kernel sanity checks
 #options 	DEBUG		# Enable misc. kernel debugging code
+makeoptions	DEBUG="-g"	# compile full symbol table
 #options 	SYSCALL_DEBUG	# debug all syscalls.
 #options 	SCSIDEBUG	# Add SCSI debugging statements
 #options 	PANICBUTTON	# Forced crash via keypress (?)

Index: src/sys/arch/amiga/conf/INSTALL
diff -u src/sys/arch/amiga/conf/INSTALL:1.136 src/sys/arch/amiga/conf/INSTALL:1.137
--- src/sys/arch/amiga/conf/INSTALL:1.136	Sun Sep 27 13:48:49 2020
+++ src/sys/arch/amiga/conf/INSTALL	Mon Oct 26 06:22:28 2020
@@ -1,9 +1,9 @@
-# $NetBSD: INSTALL,v 1.136 2020/09/27 13:48:49 roy Exp $
+# $NetBSD: INSTALL,v 1.137 2020/10/26 06:22:28 rin Exp $
 #
 # This file was automatically created.
 # Changes will be lost when make is run in this directory.
 #
-# Created from: # NetBSD: GENERIC.in,v 1.145 2020/08/10 06:32:57 rin Exp $
+# Created from: # NetBSD: GENERIC.in,v 1.147 2020/10/26 06:21:49 rin Exp $
 #
 ##
 # GENERIC machine description file
@@ -29,7 +29,7 @@ include "arch/amiga/conf/std.amiga"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.136 $"
+#ident 		"GENERIC-$Revision: 1.137 $"
 
 makeoptions	COPTS="-Os -fno-omit-frame-pointer"
 
@@ -139,6 +139,7 @@ options 	DDB		# Kernel debugger
 #options 	DDB_HISTORY_SIZE=100	# Enable history editing in DDB
 #options 	DIAGNOSTIC	# Extra kernel sanity checks
 #options 	DEBUG		# Enable misc. kernel debugging code
+makeoptions	DEBUG="-g"	# compile full symbol table
 #options 	SYSCALL_DEBUG	# debug all syscalls.
 #options 	SCSIDEBUG	# Add SCSI debugging statements
 #options 	PANICBUTTON	# Forced crash via keypress (?)



CVS commit: src/sys/arch/amiga/conf

2020-10-26 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Oct 26 06:21:50 UTC 2020

Modified Files:
src/sys/arch/amiga/conf: GENERIC.in

Log Message:
Build in full debug symbols by default.


To generate a diff of this commit:
cvs rdiff -u -r1.146 -r1.147 src/sys/arch/amiga/conf/GENERIC.in

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/amiga/conf/GENERIC.in
diff -u src/sys/arch/amiga/conf/GENERIC.in:1.146 src/sys/arch/amiga/conf/GENERIC.in:1.147
--- src/sys/arch/amiga/conf/GENERIC.in:1.146	Sun Sep 27 13:48:49 2020
+++ src/sys/arch/amiga/conf/GENERIC.in	Mon Oct 26 06:21:49 2020
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC.in,v 1.146 2020/09/27 13:48:49 roy Exp $
+# $NetBSD: GENERIC.in,v 1.147 2020/10/26 06:21:49 rin Exp $
 #
 ##
 # GENERIC machine description file
@@ -52,7 +52,7 @@ include "arch/amiga/conf/std.amiga"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.146 $"
+#ident 		"GENERIC-$Revision: 1.147 $"
 
 m4_ifdef(`INSTALL_CONFIGURATION', `m4_dnl
 makeoptions	COPTS="-Os -fno-omit-frame-pointer"
@@ -226,6 +226,7 @@ options 	DDB		# Kernel debugger
 #options 	DDB_HISTORY_SIZE=100	# Enable history editing in DDB
 #options 	DIAGNOSTIC	# Extra kernel sanity checks
 #options 	DEBUG		# Enable misc. kernel debugging code
+makeoptions	DEBUG="-g"	# compile full symbol table
 #options 	SYSCALL_DEBUG	# debug all syscalls.
 #options 	SCSIDEBUG	# Add SCSI debugging statements
 #options 	PANICBUTTON	# Forced crash via keypress (?)