CVS commit: src/sys/dev/pci

2020-12-07 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Tue Dec  8 07:53:20 UTC 2020

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

Log Message:
Change the default interrupt-affinity of iavf(4)


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/pci/if_iavf.c

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

Modified files:

Index: src/sys/dev/pci/if_iavf.c
diff -u src/sys/dev/pci/if_iavf.c:1.7 src/sys/dev/pci/if_iavf.c:1.8
--- src/sys/dev/pci/if_iavf.c:1.7	Tue Dec  1 04:39:03 2020
+++ src/sys/dev/pci/if_iavf.c	Tue Dec  8 07:53:20 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_iavf.c,v 1.7 2020/12/01 04:39:03 yamaguchi Exp $	*/
+/*	$NetBSD: if_iavf.c,v 1.8 2020/12/08 07:53:20 yamaguchi Exp $	*/
 
 /*
  * Copyright (c) 2013-2015, Intel Corporation
@@ -75,7 +75,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_iavf.c,v 1.7 2020/12/01 04:39:03 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iavf.c,v 1.8 2020/12/08 07:53:20 yamaguchi Exp $");
 
 #include 
 #include 
@@ -1813,7 +1813,7 @@ iavf_setup_interrupts(struct iavf_softc 
 	}
 
 	kcpuset_create(, false);
-	affinity_to = ((int)num <= ncpu) ? 1 : 0;
+	affinity_to = 0;
 	qid = 0;
 	for (vector = 1; vector < num; vector++) {
 		pci_intr_setattr(pa->pa_pc, >sc_ihp[vector],
@@ -1851,6 +1851,21 @@ iavf_setup_interrupts(struct iavf_softc 
 		affinity_to = (affinity_to + 1) % ncpu;
 	}
 
+	vector = 0;
+	kcpuset_zero(affinity);
+	kcpuset_set(affinity, affinity_to);
+	intrstr = pci_intr_string(pa->pa_pc, sc->sc_ihp[vector],
+	intrbuf, sizeof(intrbuf));
+	error = interrupt_distribute(sc->sc_ihs[vector], affinity, NULL);
+	if (error == 0) {
+		IAVF_LOG(sc, LOG_INFO,
+		"for Misc interrupt at %s, affinity to %d\n",
+		intrstr, affinity_to);
+	} else {
+		IAVF_LOG(sc, LOG_INFO,
+		"for MISC interrupt at %s\n", intrstr);
+	}
+
 	kcpuset_destroy(affinity);
 
 	sc->sc_nintrs = num;



CVS commit: src/sys

2020-12-07 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Dec  8 04:09:38 UTC 2020

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

Log Message:
A couple of tweaks to the previous re-factor:

- Some of what was defined as "generic itimer" behavior turned out to be
  ptimer-specific.  As such, everything related to the "fired timer queue"
  is now specific to ptimers, and the queue and softint handle fields of
  itimer_ops are not needed.

- Split itimer_fini() into 2 parts: itimer_poision() marks the timer as
  dead and attempts to cancel it.  itimer_fini() is then just responsible
  for freeing itimer resources and releasing the lock.  They are split
  into two parts, as ptimers require an addition processing step between
  those two operations, but other kinds of itimers do not necessarily require
  that.

- Export a few more itimer-related symbols that other itimer types will
  need.

Riding previous kernel version bump since there are no external uses of
this code since the version bump that accompanied the original change.


To generate a diff of this commit:
cvs rdiff -u -r1.209 -r1.210 src/sys/kern/kern_time.c
cvs rdiff -u -r1.45 -r1.46 src/sys/sys/timevar.h

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

Modified files:

Index: src/sys/kern/kern_time.c
diff -u src/sys/kern/kern_time.c:1.209 src/sys/kern/kern_time.c:1.210
--- src/sys/kern/kern_time.c:1.209	Mon Dec  7 03:01:15 2020
+++ src/sys/kern/kern_time.c	Tue Dec  8 04:09:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_time.c,v 1.209 2020/12/07 03:01:15 christos Exp $	*/
+/*	$NetBSD: kern_time.c,v 1.210 2020/12/08 04:09:38 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2004, 2005, 2007, 2008, 2009, 2020
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.209 2020/12/07 03:01:15 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.210 2020/12/08 04:09:38 thorpej Exp $");
 
 #include 
 #include 
@@ -79,12 +79,12 @@ __KERNEL_RCSID(0, "$NetBSD: kern_time.c,
 #include 
 #include 
 
-static kmutex_t	itimer_mutex __cacheline_aligned;
+kmutex_t	itimer_mutex __cacheline_aligned;	/* XXX static */
 static struct itlist itimer_realtime_changed_notify;
 
 static void	ptimer_intr(void *);
 static void	*ptimer_sih __read_mostly;
-static struct itqueue ptimer_queue;
+static TAILQ_HEAD(, ptimer) ptimer_queue;
 
 #define	CLOCK_VIRTUAL_P(clockid)	\
 	((clockid) == CLOCK_VIRTUAL || (clockid) == CLOCK_PROF)
@@ -165,7 +165,7 @@ itimer_unlock(void)
  *	Check that the interval timer lock is held for diagnostic
  *	assertions.
  */
-static inline bool __diagused
+inline bool __diagused
 itimer_lock_held(void)
 {
 	return mutex_owned(_mutex);
@@ -652,7 +652,7 @@ adjtime1(const struct timeval *delta, st
  *
  *	Initialize the common data for an interval timer.
  */
-static void
+void
 itimer_init(struct itimer * const it, const struct itimer_ops * const ops,
 clockid_t const id, struct itlist * const itl)
 {
@@ -664,7 +664,6 @@ itimer_init(struct itimer * const it, co
 	it->it_ops = ops;
 	it->it_clockid = id;
 	it->it_overruns = 0;
-	it->it_queued = false;
 	it->it_dying = false;
 	if (!CLOCK_VIRTUAL_P(id)) {
 		KASSERT(itl == NULL);
@@ -681,14 +680,13 @@ itimer_init(struct itimer * const it, co
 }
 
 /*
- * itimer_fini:
+ * itimer_poison:
  *
- *	Release resources used by an interval timer.
- *
- *	N.B. itimer_lock must be held on entry, and is released on exit.
+ *	Poison an interval timer, preventing it from being scheduled
+ *	or processed, in preparation for freeing the timer.
  */
-static void
-itimer_fini(struct itimer * const it)
+void
+itimer_poison(struct itimer * const it)
 {
 
 	KASSERT(itimer_lock_held());
@@ -710,14 +708,22 @@ itimer_fini(struct itimer * const it)
 			LIST_REMOVE(it, it_rtchgq);
 		}
 	}
+}
 
-	/* Remove it from the queue to be signalled.  */
-	if (it->it_queued) {
-		TAILQ_REMOVE(it->it_ops->ito_queue, it, it_chain);
-		it->it_queued = false;
-	}
+/*
+ * itimer_fini:
+ *
+ *	Release resources used by an interval timer.
+ *
+ *	N.B. itimer_lock must be held on entry, and is released on exit.
+ */
+void
+itimer_fini(struct itimer * const it)
+{
 
-	/* All done with the global state.  */
+	KASSERT(itimer_lock_held());
+
+	/* All done with the global state. */
 	itimer_unlock();
 
 	/* Destroy the callout, if needed. */
@@ -776,25 +782,6 @@ itimer_decr(struct itimer *it, int nsec)
 	return true;
 }
 
-/*
- * itimer_fire:
- *
- *	An interval timer has fired.  Enqueue it for processing, if
- *	needed.
- */
-void
-itimer_fire(struct itimer * const it)
-{
-
-	KASSERT(itimer_lock_held());
-
-	if (!it->it_queued) {
-		TAILQ_INSERT_TAIL(it->it_ops->ito_queue, it, it_chain);
-		it->it_queued = true;
-		softint_schedule(*it->it_ops->ito_sihp);
-	}
-}
-
 static void itimer_callout(void *);
 
 /*
@@ -1024,6 +1011,18 @@ ptimer_free(struct ptimers *pts, int ind
 	it = pts->pts_timers[index];
 	pt = container_of(it, 

CVS commit: src/usr.bin/make

2020-12-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Dec  8 00:50:05 UTC 2020

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

Log Message:
make(1): split JobPrintSpecials into manageable pieces


To generate a diff of this commit:
cvs rdiff -u -r1.345 -r1.346 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.345 src/usr.bin/make/job.c:1.346
--- src/usr.bin/make/job.c:1.345	Tue Dec  8 00:23:30 2020
+++ src/usr.bin/make/job.c	Tue Dec  8 00:50:04 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.345 2020/12/08 00:23:30 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.346 2020/12/08 00:50:04 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.345 2020/12/08 00:23:30 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.346 2020/12/08 00:50:04 rillig Exp $");
 
 /*
  * A shell defines how the commands are run.  All commands for a target are
@@ -730,76 +730,71 @@ JobPrintln(Job *job, const char *line)
 	JobPrintf(job, "%s\n", line);
 }
 
+/*
+ * We don't want the error-control commands showing up either, so we turn
+ * off echoing while executing them. We could put another field in the shell
+ * structure to tell JobDoOutput to look for this string too, but why make
+ * it any more complex than it already is?
+ */
+static void
+JobPrintSpecialsErrCtl(Job *job, Boolean shutUp)
+{
+	if (!(job->flags & JOB_SILENT) && !shutUp && commandShell->hasEchoCtl) {
+		JobPrintln(job, commandShell->echoOff);
+		JobPrintln(job, commandShell->errOffOrExecIgnore);
+		JobPrintln(job, commandShell->echoOn);
+	} else {
+		JobPrintln(job, commandShell->errOffOrExecIgnore);
+	}
+}
+
+/*
+ * The shell has no error control, so we need to be weird to get it to
+ * ignore any errors from the command. If echoing is turned on, we turn it
+ * off and use the errOnOrEcho template to echo the command. Leave echoing
+ * off so the user doesn't see the weirdness we go through to ignore errors.
+ * Set cmdTemplate to use the weirdness instead of the simple "%s\n" template.
+ */
+static void
+JobPrintSpecialsEchoCtl(Job *job, Boolean *inout_shutUp, const char *escCmd,
+			const char **inout_cmdTemplate, Boolean *out_errOff)
+{
+	job->flags |= JOB_IGNERR;
+
+	if (!(job->flags & JOB_SILENT) && !*inout_shutUp) {
+		if (commandShell->hasEchoCtl)
+			JobPrintln(job, commandShell->echoOff);
+		JobPrintf(job, commandShell->errOnOrEcho, escCmd);
+		*inout_shutUp = TRUE;
+	} else {
+		if (!*inout_shutUp)
+			JobPrintf(job, commandShell->errOnOrEcho, escCmd);
+	}
+	*inout_cmdTemplate = commandShell->errOffOrExecIgnore;
+
+	/*
+	 * The error ignoration (hee hee) is already taken care of by the
+	 * errOffOrExecIgnore template, so pretend error checking is still on.
+	 */
+	*out_errOff = FALSE;
+}
+
 static void
 JobPrintSpecials(Job *const job, const char *const escCmd,
 		 Boolean const noSpecials, Boolean *const inout_shutUp,
 		 const char **const inout_cmdTemplate,
 		 Boolean *const inout_errOff)
 {
-	if (!noSpecials) {
-		if (commandShell->hasErrCtl) {
-			/*
-			 * we don't want the error-control commands
-			 * showing up either, so we turn off echoing
-			 * while executing them. We could put another
-			 * field in the shell structure to tell
-			 * JobDoOutput to look for this string too,
-			 * but why make it any more complex than
-			 * it already is?
-			 */
-			if (!(job->flags & JOB_SILENT) && !*inout_shutUp &&
-			(commandShell->hasEchoCtl)) {
-JobPrintln(job, commandShell->echoOff);
-JobPrintln(job,
-commandShell->errOffOrExecIgnore);
-JobPrintln(job, commandShell->echoOn);
-			} else {
-JobPrintln(job,
-commandShell->errOffOrExecIgnore);
-			}
-		} else if (commandShell->errOffOrExecIgnore &&
-			   commandShell->errOffOrExecIgnore[0] !=
-			   '\0') {
-			/*
-			 * The shell has no error control, so we need
-			 * to be weird to get it to ignore any errors
-			 * from the command. If echoing is turned on,
-			 * we turn it off and use the errOnOrEcho
-			 * template to echo the command. Leave echoing
-			 * off so the user doesn't see the weirdness
-			 * we go through to ignore errors. Set
-			 * cmdTemplate to use the weirdness instead
-			 * of the simple "%s\n" template.
-			 */
-			job->flags |= JOB_IGNERR;
-			if (!(job->flags & JOB_SILENT) && !*inout_shutUp) {
-if (commandShell->hasEchoCtl) {
-	JobPrintln(job,
-	commandShell->echoOff);
-}
-JobPrintf(job,
-commandShell->errOnOrEcho, escCmd);
-*inout_shutUp = TRUE;
-			} else {
-if (!*inout_shutUp)
-	JobPrintf(job,
-	commandShell->errOnOrEcho,
-	escCmd);
-			}
-			*inout_cmdTemplate = commandShell->errOffOrExecIgnore;
-			/*
-			 * The error ignoration (hee hee) is 

CVS commit: src/usr.bin/make

2020-12-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Dec  8 00:23:31 UTC 2020

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

Log Message:
make(1): extract JobPrintSpecials from JobPrintCommand


To generate a diff of this commit:
cvs rdiff -u -r1.344 -r1.345 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.344 src/usr.bin/make/job.c:1.345
--- src/usr.bin/make/job.c:1.344	Tue Dec  8 00:09:51 2020
+++ src/usr.bin/make/job.c	Tue Dec  8 00:23:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.344 2020/12/08 00:09:51 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.345 2020/12/08 00:23:30 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.344 2020/12/08 00:09:51 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.345 2020/12/08 00:23:30 rillig Exp $");
 
 /*
  * A shell defines how the commands are run.  All commands for a target are
@@ -730,6 +730,78 @@ JobPrintln(Job *job, const char *line)
 	JobPrintf(job, "%s\n", line);
 }
 
+static void
+JobPrintSpecials(Job *const job, const char *const escCmd,
+		 Boolean const noSpecials, Boolean *const inout_shutUp,
+		 const char **const inout_cmdTemplate,
+		 Boolean *const inout_errOff)
+{
+	if (!noSpecials) {
+		if (commandShell->hasErrCtl) {
+			/*
+			 * we don't want the error-control commands
+			 * showing up either, so we turn off echoing
+			 * while executing them. We could put another
+			 * field in the shell structure to tell
+			 * JobDoOutput to look for this string too,
+			 * but why make it any more complex than
+			 * it already is?
+			 */
+			if (!(job->flags & JOB_SILENT) && !*inout_shutUp &&
+			(commandShell->hasEchoCtl)) {
+JobPrintln(job, commandShell->echoOff);
+JobPrintln(job,
+commandShell->errOffOrExecIgnore);
+JobPrintln(job, commandShell->echoOn);
+			} else {
+JobPrintln(job,
+commandShell->errOffOrExecIgnore);
+			}
+		} else if (commandShell->errOffOrExecIgnore &&
+			   commandShell->errOffOrExecIgnore[0] !=
+			   '\0') {
+			/*
+			 * The shell has no error control, so we need
+			 * to be weird to get it to ignore any errors
+			 * from the command. If echoing is turned on,
+			 * we turn it off and use the errOnOrEcho
+			 * template to echo the command. Leave echoing
+			 * off so the user doesn't see the weirdness
+			 * we go through to ignore errors. Set
+			 * cmdTemplate to use the weirdness instead
+			 * of the simple "%s\n" template.
+			 */
+			job->flags |= JOB_IGNERR;
+			if (!(job->flags & JOB_SILENT) && !*inout_shutUp) {
+if (commandShell->hasEchoCtl) {
+	JobPrintln(job,
+	commandShell->echoOff);
+}
+JobPrintf(job,
+commandShell->errOnOrEcho, escCmd);
+*inout_shutUp = TRUE;
+			} else {
+if (!*inout_shutUp)
+	JobPrintf(job,
+	commandShell->errOnOrEcho,
+	escCmd);
+			}
+			*inout_cmdTemplate = commandShell->errOffOrExecIgnore;
+			/*
+			 * The error ignoration (hee hee) is already
+			 * taken care of by the errOffOrExecIgnore
+			 * template, so pretend error checking is
+			 * still on.
+			 */
+			*inout_errOff = FALSE;
+		} else {
+			*inout_errOff = FALSE;
+		}
+	} else {
+		*inout_errOff = FALSE;
+	}
+}
+
 /*
  * Put out another command for the given job. If the command starts with an
  * '@' or a '-' we process it specially. In the former case, so long as the
@@ -803,7 +875,7 @@ JobPrintCommand(Job *job, char *cmd)
 
 	if (shutUp) {
 		if (!(job->flags & JOB_SILENT) && !noSpecials &&
-		(commandShell->hasEchoCtl)) {
+		commandShell->hasEchoCtl) {
 			JobPrintln(job, commandShell->echoOff);
 		} else {
 			if (commandShell->hasErrCtl)
@@ -812,70 +884,8 @@ JobPrintCommand(Job *job, char *cmd)
 	}
 
 	if (errOff) {
-		if (!noSpecials) {
-			if (commandShell->hasErrCtl) {
-/*
- * we don't want the error-control commands
- * showing up either, so we turn off echoing
- * while executing them. We could put another
- * field in the shell structure to tell
- * JobDoOutput to look for this string too,
- * but why make it any more complex than
- * it already is?
- */
-if (!(job->flags & JOB_SILENT) && !shutUp &&
-(commandShell->hasEchoCtl)) {
-	JobPrintln(job, commandShell->echoOff);
-	JobPrintln(job,
-	commandShell->errOffOrExecIgnore);
-	JobPrintln(job, commandShell->echoOn);
-} else {
-	JobPrintln(job,
-	commandShell->errOffOrExecIgnore);
-}
-			} else if (commandShell->errOffOrExecIgnore &&
-   commandShell->errOffOrExecIgnore[0] !=
-   '\0') {
-/*
- * The shell has no error control, so we need
- * to be weird to get it to ignore any errors
- * from the command. If echoing is 

CVS commit: src/usr.bin/make

2020-12-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Dec  8 00:09:51 UTC 2020

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

Log Message:
make(1): extract InitShellNameAndPath from Shell_Init

This gets rid of the ugly "else #endif".


To generate a diff of this commit:
cvs rdiff -u -r1.343 -r1.344 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.343 src/usr.bin/make/job.c:1.344
--- src/usr.bin/make/job.c:1.343	Mon Dec  7 23:59:59 2020
+++ src/usr.bin/make/job.c	Tue Dec  8 00:09:51 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.343 2020/12/07 23:59:59 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.344 2020/12/08 00:09:51 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.343 2020/12/07 23:59:59 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.344 2020/12/08 00:09:51 rillig Exp $");
 
 /*
  * A shell defines how the commands are run.  All commands for a target are
@@ -2047,25 +2047,28 @@ Job_Make(GNode *gn)
 	(void)JobStart(gn, JOB_NONE);
 }
 
-void
-Shell_Init(void)
+static void
+InitShellNameAndPath(void)
 {
-	if (shellPath == NULL) {
-		/*
-		 * We are using the default shell, which may be an absolute
-		 * path if DEFSHELL_CUSTOM is defined.
-		 */
-		shellName = commandShell->name;
+	shellName = commandShell->name;
+
 #ifdef DEFSHELL_CUSTOM
-		if (*shellName == '/') {
-			shellPath = shellName;
-			shellName = strrchr(shellPath, '/');
-			shellName++;
-		} else /* XXX: else #endif breaks automatic formatting. */
-#endif
-		shellPath = str_concat3(_PATH_DEFSHELLDIR, "/",
-		shellName);
+	if (shellName[0] == '/') {
+		shellPath = shellName;
+		shellName = strrchr(shellPath, '/') + 1;
+		return;
 	}
+#endif
+
+	shellPath = str_concat3(_PATH_DEFSHELLDIR, "/", shellName);
+}
+
+void
+Shell_Init(void)
+{
+	if (shellPath == NULL)
+		InitShellNameAndPath();
+
 	Var_SetWithFlags(".SHELL", shellPath, VAR_CMDLINE, VAR_SET_READONLY);
 	if (commandShell->exit == NULL) {
 		commandShell->exit = "";



CVS commit: src/usr.bin/make

2020-12-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Dec  7 23:59:59 UTC 2020

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

Log Message:
make(1): clean up debug logging


To generate a diff of this commit:
cvs rdiff -u -r1.342 -r1.343 src/usr.bin/make/job.c
cvs rdiff -u -r1.153 -r1.154 src/usr.bin/make/targ.c

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

Modified files:

Index: src/usr.bin/make/job.c
diff -u src/usr.bin/make/job.c:1.342 src/usr.bin/make/job.c:1.343
--- src/usr.bin/make/job.c:1.342	Mon Dec  7 23:53:09 2020
+++ src/usr.bin/make/job.c	Mon Dec  7 23:59:59 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.342 2020/12/07 23:53:09 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.343 2020/12/07 23:59:59 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.342 2020/12/07 23:53:09 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.343 2020/12/07 23:59:59 rillig Exp $");
 
 /*
  * A shell defines how the commands are run.  All commands for a target are
@@ -626,8 +626,7 @@ JobPassSig_suspend(int signo)
 	act.sa_flags = 0;
 	(void)sigaction(signo, , NULL);
 
-	if (DEBUG(JOB))
-		debug_printf("JobPassSig passing signal %d to self.\n", signo);
+	DEBUG1(JOB, "JobPassSig passing signal %d to self.\n", signo);
 
 	(void)kill(getpid(), signo);
 
@@ -719,8 +718,7 @@ EscapeShellDblQuot(const char *cmd)
 static void
 JobPrintf(Job *job, const char *fmt, const char *arg)
 {
-	if (DEBUG(JOB))
-		debug_printf(fmt, arg);
+	DEBUG1(JOB, fmt, arg);
 
 	(void)fprintf(job->cmdFILE, fmt, arg);
 	(void)fflush(job->cmdFILE);

Index: src/usr.bin/make/targ.c
diff -u src/usr.bin/make/targ.c:1.153 src/usr.bin/make/targ.c:1.154
--- src/usr.bin/make/targ.c:1.153	Sun Dec  6 10:49:02 2020
+++ src/usr.bin/make/targ.c	Mon Dec  7 23:59:59 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: targ.c,v 1.153 2020/12/06 10:49:02 rillig Exp $	*/
+/*	$NetBSD: targ.c,v 1.154 2020/12/07 23:59:59 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -119,7 +119,7 @@
 #include "dir.h"
 
 /*	"@(#)targ.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: targ.c,v 1.153 2020/12/06 10:49:02 rillig Exp $");
+MAKE_RCSID("$NetBSD: targ.c,v 1.154 2020/12/07 23:59:59 rillig Exp $");
 
 /*
  * All target nodes that appeared on the left-hand side of one of the
@@ -452,7 +452,7 @@ Targ_PrintType(int type)
 
 		switch (tbit) {
 #define PRINTBIT(bit, attr) case bit: debug_printf(" " attr); break
-#define PRINTDBIT(bit, attr) case bit: if (DEBUG(TARG)) debug_printf(" " attr); break
+#define PRINTDBIT(bit, attr) case bit: DEBUG0(TARG, " " attr); break
 		PRINTBIT(OP_OPTIONAL, ".OPTIONAL");
 		PRINTBIT(OP_USE, ".USE");
 		PRINTBIT(OP_EXEC, ".EXEC");



CVS commit: src/usr.bin/make

2020-12-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Dec  7 23:53:09 UTC 2020

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

Log Message:
make(1): replace signal handling macros with local functions


To generate a diff of this commit:
cvs rdiff -u -r1.341 -r1.342 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.341 src/usr.bin/make/job.c:1.342
--- src/usr.bin/make/job.c:1.341	Mon Dec  7 23:48:04 2020
+++ src/usr.bin/make/job.c	Mon Dec  7 23:53:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.341 2020/12/07 23:48:04 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.342 2020/12/07 23:53:09 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.341 2020/12/07 23:48:04 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.342 2020/12/07 23:53:09 rillig Exp $");
 
 /*
  * A shell defines how the commands are run.  All commands for a target are
@@ -2120,6 +2120,15 @@ Job_SetPrefix(void)
 	/* TODO: handle errors */
 }
 
+static void
+AddSig(int sig, SignalProc handler)
+{
+	if (bmake_signal(sig, SIG_IGN) != SIG_IGN) {
+		sigaddset(_signals, sig);
+		(void)bmake_signal(sig, handler);
+	}
+}
+
 /* Initialize the process module. */
 void
 Job_Init(void)
@@ -2174,20 +2183,14 @@ Job_Init(void)
 	(void)bmake_signal(SIGCHLD, JobChildSig);
 	sigaddset(_signals, SIGCHLD);
 
-#define ADDSIG(s, h)	\
-	if (bmake_signal(s, SIG_IGN) != SIG_IGN) {	\
-		sigaddset(_signals, s);		\
-		(void)bmake_signal(s, h);		\
-	}
-
 	/*
 	 * Catch the four signals that POSIX specifies if they aren't ignored.
 	 * JobPassSig will take care of calling JobInterrupt if appropriate.
 	 */
-	ADDSIG(SIGINT, JobPassSig_int)
-	ADDSIG(SIGHUP, JobPassSig_term)
-	ADDSIG(SIGTERM, JobPassSig_term)
-	ADDSIG(SIGQUIT, JobPassSig_term)
+	AddSig(SIGINT, JobPassSig_int);
+	AddSig(SIGHUP, JobPassSig_term);
+	AddSig(SIGTERM, JobPassSig_term);
+	AddSig(SIGQUIT, JobPassSig_term);
 
 	/*
 	 * There are additional signals that need to be caught and passed if
@@ -2195,12 +2198,11 @@ Job_Init(void)
 	 * we're giving each job its own process group (since then it won't get
 	 * signals from the terminal driver as we own the terminal)
 	 */
-	ADDSIG(SIGTSTP, JobPassSig_suspend)
-	ADDSIG(SIGTTOU, JobPassSig_suspend)
-	ADDSIG(SIGTTIN, JobPassSig_suspend)
-	ADDSIG(SIGWINCH, JobCondPassSig)
-	ADDSIG(SIGCONT, JobContinueSig)
-#undef ADDSIG
+	AddSig(SIGTSTP, JobPassSig_suspend);
+	AddSig(SIGTTOU, JobPassSig_suspend);
+	AddSig(SIGTTIN, JobPassSig_suspend);
+	AddSig(SIGWINCH, JobCondPassSig);
+	AddSig(SIGCONT, JobContinueSig);
 
 	(void)Job_RunTarget(".BEGIN", NULL);
 	/* Create the .END node now, even though no code in the unit tests
@@ -2208,23 +2210,24 @@ Job_Init(void)
 	(void)Targ_GetEndNode();
 }
 
-static void JobSigReset(void)
+static void
+DelSig(int sig)
 {
-#define DELSIG(s)	\
-	if (sigismember(_signals, s)) {		\
-		(void)bmake_signal(s, SIG_DFL);		\
-	}
+	if (sigismember(_signals, sig))
+		(void)bmake_signal(sig, SIG_DFL);
+}
 
-	DELSIG(SIGINT)
-	DELSIG(SIGHUP)
-	DELSIG(SIGQUIT)
-	DELSIG(SIGTERM)
-	DELSIG(SIGTSTP)
-	DELSIG(SIGTTOU)
-	DELSIG(SIGTTIN)
-	DELSIG(SIGWINCH)
-	DELSIG(SIGCONT)
-#undef DELSIG
+static void JobSigReset(void)
+{
+	DelSig(SIGINT);
+	DelSig(SIGHUP);
+	DelSig(SIGQUIT);
+	DelSig(SIGTERM);
+	DelSig(SIGTSTP);
+	DelSig(SIGTTOU);
+	DelSig(SIGTTIN);
+	DelSig(SIGWINCH);
+	DelSig(SIGCONT);
 	(void)bmake_signal(SIGCHLD, SIG_DFL);
 }
 



CVS commit: src/usr.bin/make

2020-12-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Dec  7 23:48:04 UTC 2020

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

Log Message:
make(1): indent job.c with tabs instead of spaces


To generate a diff of this commit:
cvs rdiff -u -r1.340 -r1.341 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.340 src/usr.bin/make/job.c:1.341
--- src/usr.bin/make/job.c:1.340	Mon Dec  7 22:55:01 2020
+++ src/usr.bin/make/job.c	Mon Dec  7 23:48:04 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.340 2020/12/07 22:55:01 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.341 2020/12/07 23:48:04 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -143,9 +143,10 @@
 #include "trace.h"
 
 /*	"@(#)job.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: job.c,v 1.340 2020/12/07 22:55:01 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.341 2020/12/07 23:48:04 rillig Exp $");
 
-/* A shell defines how the commands are run.  All commands for a target are
+/*
+ * 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
  * the commands from it.  The commands are written to the file using a few
  * templates for echo control and error control.
@@ -180,36 +181,42 @@ MAKE_RCSID("$NetBSD: job.c,v 1.340 2020/
  */
 typedef struct Shell {
 
-/* The name of the shell. For Bourne and C shells, this is used only to
- * find the shell description when used as the single source of a .SHELL
- * target. For user-defined shells, this is the full path of the shell. */
-const char *name;
-
-Boolean hasEchoCtl;		/* True if both echoOff and echoOn defined */
-const char *echoOff;	/* command to turn off echo */
-const char *echoOn;		/* command to turn it back on again */
-const char *noPrint;	/* text to skip when printing output from
+	/*
+	 * The name of the shell. For Bourne and C shells, this is used only
+	 * to find the shell description when used as the single source of a
+	 * .SHELL target. For user-defined shells, this is the full path of
+	 * the shell.
+	 */
+	const char *name;
+
+	Boolean hasEchoCtl;	/* True if both echoOff and echoOn defined */
+	const char *echoOff;	/* command to turn off echo */
+	const char *echoOn;	/* command to turn it back on again */
+	const char *noPrint;	/* text to skip when printing output from
  * shell. This is usually the same as echoOff */
-size_t noPrintLen;		/* length of noPrint command */
+	size_t noPrintLen;	/* length of noPrint command */
 
-Boolean hasErrCtl;		/* set if can control error checking for
+	Boolean hasErrCtl;	/* set if can control error checking for
  * individual commands */
-/* XXX: split into errOn and echoCmd */
-const char *errOnOrEcho;	/* template to turn on error checking */
-/* XXX: split into errOff and execIgnore */
-const char *errOffOrExecIgnore; /* template to turn off error checking */
-const char *errExit;	/* template to use for testing exit code */
-
-/* string literal that results in a newline character when it appears
- * outside of any 'quote' or "quote" characters */
-const char *newline;
-char commentChar;		/* character used by shell for comment lines */
+	/* XXX: split into errOn and echoCmd */
+	const char *errOnOrEcho; /* template to turn on error checking */
+	/*
+	 * template to turn off error checking
+	 * XXX: split into errOff and execIgnore
+	 */
+	const char *errOffOrExecIgnore;
+	const char *errExit;	/* template to use for testing exit code */
 
-/*
- * command-line flags
- */
-const char *echo;		/* echo commands */
-const char *exit;		/* exit on error */
+	/* string literal that results in a newline character when it appears
+	 * outside of any 'quote' or "quote" characters */
+	const char *newline;
+	char commentChar;	/* character used by shell for comment lines */
+
+	/*
+	 * command-line flags
+	 */
+	const char *echo;	/* echo commands */
+	const char *exit;	/* exit on error */
 } Shell;
 
 /*
@@ -217,13 +224,13 @@ typedef struct Shell {
  */
 static int job_errors = 0;	/* number of errors reported */
 typedef enum AbortReason {	/* why is the make aborting? */
-ABORT_NONE,
-ABORT_ERROR,		/* Because of an error */
-ABORT_INTERRUPT,		/* Because it was interrupted */
-ABORT_WAIT			/* Waiting for jobs to finish */
+	ABORT_NONE,
+	ABORT_ERROR,		/* Because of an error */
+	ABORT_INTERRUPT,	/* Because it was interrupted */
+	ABORT_WAIT		/* Waiting for jobs to finish */
 } AbortReason;
 static AbortReason aborting = ABORT_NONE;
-#define JOB_TOKENS	"+EI+"	/* Token to requeue for each abort state */
+#define JOB_TOKENS "+EI+"	/* Token to requeue for each abort state */
 
 /*
  * this tracks the number of tokens currently "out" to build jobs.

CVS commit: src/usr.bin/make

2020-12-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Dec  7 22:55:01 UTC 2020

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

Log Message:
make(1): remove duplicate code for job output


To generate a diff of this commit:
cvs rdiff -u -r1.339 -r1.340 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.339 src/usr.bin/make/job.c:1.340
--- src/usr.bin/make/job.c:1.339	Mon Dec  7 22:47:03 2020
+++ src/usr.bin/make/job.c	Mon Dec  7 22:55:01 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.339 2020/12/07 22:47:03 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.340 2020/12/07 22:55:01 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.339 2020/12/07 22:47:03 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.340 2020/12/07 22:55:01 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
@@ -389,8 +389,6 @@ static void watchfd(Job *);
 static void clearfd(Job *);
 static int readyfd(Job *);
 
-static GNode *lastNode;		/* The node for which output was most recently
- * produced. */
 static char *targPrefix = NULL; /* To identify a job change in the output. */
 static Job tokenWaitJob;	/* token wait pseudo-job */
 
@@ -408,8 +406,15 @@ static void JobRestartJobs(void);
 static void JobSigReset(void);
 
 static void
-Message(GNode *gn)
+SwitchOutputTo(GNode *gn)
 {
+	/* The node for which output was most recently produced. */
+	static GNode *lastNode = NULL;
+
+	if (gn == lastNode)
+		return;
+	lastNode = gn;
+
 	if (opts.maxJobs != 1 && targPrefix != NULL && targPrefix[0] != '\0')
 		(void)fprintf(stdout, "%s %s ---\n", targPrefix, gn->name);
 }
@@ -1004,10 +1009,7 @@ JobFinish(Job *job, int status)
 	DEBUG2(JOB, "Process %d [%s] exited.\n",
 		   job->pid, job->node->name);
 	if (WEXITSTATUS(status) != 0) {
-		if (job->node != lastNode) {
-		Message(job->node);
-		lastNode = job->node;
-		}
+		SwitchOutputTo(job->node);
 #ifdef USE_META
 		if (useMeta) {
 		meta_job_error(job, job->node, job->flags, WEXITSTATUS(status));
@@ -1027,18 +1029,12 @@ JobFinish(Job *job, int status)
 		PrintOnError(job->node, NULL);
 		}
 	} else if (DEBUG(JOB)) {
-		if (job->node != lastNode) {
-		Message(job->node);
-		lastNode = job->node;
-		}
+		SwitchOutputTo(job->node);
 		(void)printf("*** [%s] Completed successfully\n",
 job->node->name);
 	}
 	} else {
-	if (job->node != lastNode) {
-		Message(job->node);
-		lastNode = job->node;
-	}
+	SwitchOutputTo(job->node);
 	(void)printf("*** [%s] Signal %d\n",
 			job->node->name, WTERMSIG(status));
 	if (deleteOnError) {
@@ -1264,10 +1260,8 @@ JobExec(Job *job, char **argv)
  * banner with their name in it never appears). This is an attempt to
  * provide that feedback, even if nothing follows it.
  */
-if ((lastNode != job->node) && !(job->flags & JOB_SILENT)) {
-	Message(job->node);
-	lastNode = job->node;
-}
+if (!(job->flags & JOB_SILENT))
+	SwitchOutputTo(job->node);
 
 /* No interruptions until this job is on the `jobs' list */
 JobSigLock();
@@ -1559,10 +1553,7 @@ JobStart(GNode *gn, JobFlags flags)
 	 * Not executing anything -- just print all the commands to stdout
 	 * in one fell swoop. This will still set up job->tailCmds correctly.
 	 */
-	if (lastNode != gn) {
-	Message(gn);
-	lastNode = gn;
-	}
+	SwitchOutputTo(gn);
 	job->cmdFILE = stdout;
 	/*
 	 * Only print the commands if they're ok, but don't die if they're
@@ -1778,10 +1769,8 @@ again:
 	 * our own free will.
 	 */
 	if (*cp != '\0') {
-		if (!opts.beSilent && job->node != lastNode) {
-		Message(job->node);
-		lastNode = job->node;
-		}
+		if (!opts.beSilent)
+		SwitchOutputTo(job->node);
 #ifdef USE_META
 		if (useMeta) {
 		meta_job_output(job, cp, gotNL ? "\n" : "");
@@ -2080,8 +2069,6 @@ Job_Init(void)
 aborting = ABORT_NONE;
 job_errors = 0;
 
-lastNode = NULL;
-
 /*
  * There is a non-zero chance that we already have children.
  * eg after 'make -f- <

CVS commit: src/usr.bin/make

2020-12-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Dec  7 22:47:03 UTC 2020

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

Log Message:
make(1): replace macro MESSAGE with local function

The first parameter of the macro was always stdout, and there was no
apparent reason to pass anything else there.

Let the compiler decide whether to inline this or not, it's not
time-critical.


To generate a diff of this commit:
cvs rdiff -u -r1.338 -r1.339 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.338 src/usr.bin/make/job.c:1.339
--- src/usr.bin/make/job.c:1.338	Sun Dec  6 18:13:17 2020
+++ src/usr.bin/make/job.c	Mon Dec  7 22:47:03 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.338 2020/12/06 18:13:17 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.339 2020/12/07 22:47:03 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.338 2020/12/06 18:13:17 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.339 2020/12/07 22:47:03 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
@@ -391,7 +391,7 @@ static int readyfd(Job *);
 
 static GNode *lastNode;		/* The node for which output was most recently
  * produced. */
-static char *targPrefix = NULL; /* What we print at the start of TARG_FMT */
+static char *targPrefix = NULL; /* To identify a job change in the output. */
 static Job tokenWaitJob;	/* token wait pseudo-job */
 
 static Job childExitJob;	/* child exit pseudo-job */
@@ -400,11 +400,6 @@ static Job childExitJob;	/* child exit p
 
 enum { npseudojobs = 2 };	/* number of pseudo-jobs */
 
-#define TARG_FMT  "%s %s ---\n" /* Default format */
-#define MESSAGE(fp, gn) \
-	if (opts.maxJobs != 1 && targPrefix && *targPrefix) \
-	(void)fprintf(fp, TARG_FMT, targPrefix, gn->name)
-
 static sigset_t caught_signals;	/* Set of signals we handle */
 
 static void JobDoOutput(Job *, Boolean);
@@ -412,6 +407,13 @@ static void JobInterrupt(int, int) MAKE_
 static void JobRestartJobs(void);
 static void JobSigReset(void);
 
+static void
+Message(GNode *gn)
+{
+	if (opts.maxJobs != 1 && targPrefix != NULL && targPrefix[0] != '\0')
+		(void)fprintf(stdout, "%s %s ---\n", targPrefix, gn->name);
+}
+
 static unsigned
 nfds_per_job(void)
 {
@@ -1003,7 +1005,7 @@ JobFinish(Job *job, int status)
 		   job->pid, job->node->name);
 	if (WEXITSTATUS(status) != 0) {
 		if (job->node != lastNode) {
-		MESSAGE(stdout, job->node);
+		Message(job->node);
 		lastNode = job->node;
 		}
 #ifdef USE_META
@@ -1026,7 +1028,7 @@ JobFinish(Job *job, int status)
 		}
 	} else if (DEBUG(JOB)) {
 		if (job->node != lastNode) {
-		MESSAGE(stdout, job->node);
+		Message(job->node);
 		lastNode = job->node;
 		}
 		(void)printf("*** [%s] Completed successfully\n",
@@ -1034,7 +1036,7 @@ JobFinish(Job *job, int status)
 	}
 	} else {
 	if (job->node != lastNode) {
-		MESSAGE(stdout, job->node);
+		Message(job->node);
 		lastNode = job->node;
 	}
 	(void)printf("*** [%s] Signal %d\n",
@@ -1263,7 +1265,7 @@ JobExec(Job *job, char **argv)
  * provide that feedback, even if nothing follows it.
  */
 if ((lastNode != job->node) && !(job->flags & JOB_SILENT)) {
-	MESSAGE(stdout, job->node);
+	Message(job->node);
 	lastNode = job->node;
 }
 
@@ -1558,7 +1560,7 @@ JobStart(GNode *gn, JobFlags flags)
 	 * in one fell swoop. This will still set up job->tailCmds correctly.
 	 */
 	if (lastNode != gn) {
-	MESSAGE(stdout, gn);
+	Message(gn);
 	lastNode = gn;
 	}
 	job->cmdFILE = stdout;
@@ -1777,7 +1779,7 @@ again:
 	 */
 	if (*cp != '\0') {
 		if (!opts.beSilent && job->node != lastNode) {
-		MESSAGE(stdout, job->node);
+		Message(job->node);
 		lastNode = job->node;
 		}
 #ifdef USE_META



CVS commit: src/usr.bin/make

2020-12-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Dec  7 22:37:18 UTC 2020

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

Log Message:
make(1): remove duplicate code from bmake_strdup

Inlining is the job of the compiler, not of humans.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/usr.bin/make/make_malloc.c

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

Modified files:

Index: src/usr.bin/make/make_malloc.c
diff -u src/usr.bin/make/make_malloc.c:1.23 src/usr.bin/make/make_malloc.c:1.24
--- src/usr.bin/make/make_malloc.c:1.23	Mon Oct  5 19:27:47 2020
+++ src/usr.bin/make/make_malloc.c	Mon Dec  7 22:37:18 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make_malloc.c,v 1.23 2020/10/05 19:27:47 rillig Exp $	*/
+/*	$NetBSD: make_malloc.c,v 1.24 2020/12/07 22:37:18 rillig Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
 
 #include "make.h"
 
-MAKE_RCSID("$NetBSD: make_malloc.c,v 1.23 2020/10/05 19:27:47 rillig Exp $");
+MAKE_RCSID("$NetBSD: make_malloc.c,v 1.24 2020/12/07 22:37:18 rillig Exp $");
 
 #ifndef USE_EMALLOC
 
@@ -61,8 +61,7 @@ bmake_strdup(const char *str)
 	char *p;
 
 	len = strlen(str) + 1;
-	if ((p = malloc(len)) == NULL)
-		enomem();
+	p = bmake_malloc(len);
 	return memcpy(p, str, len);
 }
 



CVS commit: src/usr.bin/make

2020-12-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Dec  7 22:27:56 UTC 2020

Modified Files:
src/usr.bin/make: test-variants.sh
src/usr.bin/make/unit-tests: Makefile sh-dots.exp sh-meta-chars.mk

Log Message:
make(1): normalize output of test sh-dots for non-native mode


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/test-variants.sh
cvs rdiff -u -r1.239 -r1.240 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/sh-dots.exp
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/sh-meta-chars.mk

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

Modified files:

Index: src/usr.bin/make/test-variants.sh
diff -u src/usr.bin/make/test-variants.sh:1.7 src/usr.bin/make/test-variants.sh:1.8
--- src/usr.bin/make/test-variants.sh:1.7	Sun Nov 29 21:27:08 2020
+++ src/usr.bin/make/test-variants.sh	Mon Dec  7 22:27:56 2020
@@ -1,5 +1,5 @@
 #! /bin/sh
-# $NetBSD: test-variants.sh,v 1.7 2020/11/29 21:27:08 rillig Exp $
+# $NetBSD: test-variants.sh,v 1.8 2020/12/07 22:27:56 rillig Exp $
 #
 # Build several variants of make and run the tests on them.
 #
@@ -149,6 +149,12 @@ testcase USER_CFLAGS="-ansi" USER_CPPFLA
 #
 testcase USER_CPPFLAGS="-DNDEBUG"
 
+# Only in native mode, make dares to use a shortcut in Compat_RunCommand
+# that circumvents the shell and instead calls execvp directly.
+# Another effect is that the shell is run with -q, which prevents the
+# -x and -v flags from echoing the commands from profile files.
+testcase USER_CPPFLAGS="-UMAKE_NATIVE -DHAVE_STRERROR -DHAVE_SETENV -DHAVE_VSNPRINTF"
+
 # Running the code coverage using gcov takes a long time.  Most of this
 # time is spent in gcov_read_unsigned because gcov_open sets the .gcda
 # file to unbuffered, which means that every single byte needs its own

Index: src/usr.bin/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.239 src/usr.bin/make/unit-tests/Makefile:1.240
--- src/usr.bin/make/unit-tests/Makefile:1.239	Mon Dec  7 21:35:43 2020
+++ src/usr.bin/make/unit-tests/Makefile	Mon Dec  7 22:27:56 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.239 2020/12/07 21:35:43 rillig Exp $
+# $NetBSD: Makefile,v 1.240 2020/12/07 22:27:56 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -474,7 +474,11 @@ SED_CMDS.opt-debug-jobs+=	-e 's,JobFinis
 SED_CMDS.opt-debug-jobs+=	-e 's,Command: ${.SHELL:T},Command: ,'
 # The "-q" may be there or not, see jobs.c, variable shells.
 SED_CMDS.opt-debug-jobs+=	-e 's,^\(.Command: \) -q,\1,'
-SED_CMDS.sh-dots=		-e 's,^.*\.\.\.:.*,,'
+# For Compat_RunCommand, useShell == FALSE.
+SED_CMDS.sh-dots=		-e 's,^.*\.\.\.:.*,,'
+# For Compat_RunCommand, useShell == TRUE.
+SED_CMDS.sh-dots+=		-e 's,^make: exec(\(.*\)) failed (.*)$$,,'
+SED_CMDS.sh-dots+=		-e 's,^\(\*\*\* Error code \)[1-9][0-9]*,\1,'
 SED_CMDS.suff-main+=		${STD_SED_CMDS.dg1}
 SED_CMDS.suff-main-several+=	${STD_SED_CMDS.dg1}
 SED_CMDS.suff-transform-debug+=	${STD_SED_CMDS.dg1}

Index: src/usr.bin/make/unit-tests/sh-dots.exp
diff -u src/usr.bin/make/unit-tests/sh-dots.exp:1.4 src/usr.bin/make/unit-tests/sh-dots.exp:1.5
--- src/usr.bin/make/unit-tests/sh-dots.exp:1.4	Sun Oct 25 22:04:24 2020
+++ src/usr.bin/make/unit-tests/sh-dots.exp	Mon Dec  7 22:27:56 2020
@@ -1,19 +1,19 @@
 first first
 hidden hidden
-make: exec(...) failed (No such file or directory)
-*** Error code 1 (ignored)
+
+*** Error code  (ignored)
 hidden delayed hidden
 repeated repeated
 commented commented
 ...	# Run the below commands later
-
-*** Error code 127 (ignored)
+
+*** Error code  (ignored)
 commented delayed commented
 indirect regular
 indirect-space regular
 ... 
-make: exec(...) failed (No such file or directory)
-*** Error code 1 (ignored)
+
+*** Error code  (ignored)
 indirect-space deferred
 first delayed first
 repeated delayed repeated

Index: src/usr.bin/make/unit-tests/sh-meta-chars.mk
diff -u src/usr.bin/make/unit-tests/sh-meta-chars.mk:1.3 src/usr.bin/make/unit-tests/sh-meta-chars.mk:1.4
--- src/usr.bin/make/unit-tests/sh-meta-chars.mk:1.3	Sun Nov 15 20:20:58 2020
+++ src/usr.bin/make/unit-tests/sh-meta-chars.mk	Mon Dec  7 22:27:56 2020
@@ -1,4 +1,4 @@
-# $NetBSD: sh-meta-chars.mk,v 1.3 2020/11/15 20:20:58 rillig Exp $
+# $NetBSD: sh-meta-chars.mk,v 1.4 2020/12/07 22:27:56 rillig Exp $
 #
 # Tests for running shell commands that contain meta-characters.
 #
@@ -9,7 +9,16 @@
 # See also:
 #	Compat_RunCommand, useShell
 
-# TODO: Implementation
-
 all:
-	@:;
+
+# The command "exit 0" contains no special characters, therefore it is
+# run directly via execv, but only if MAKE_NATIVE is defined.
+USING_EXEC!=	{ echo 'all:; exit 0' | ${MAKE} -r -f - 1>/dev/null 2>&1; } \
+		&& echo yes || echo no
+
+# It's hard to do any useful tests that result in the same output.
+# See SED_CMDS.sh-dots, which normalizes the test output for the specific
+# case of the special command '...'.
+.if ${USING_EXEC} != "yes" && 

CVS commit: src

2020-12-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Dec  7 21:35:43 UTC 2020

Modified Files:
src/distrib/sets/lists/tests: mi
src/usr.bin/make/unit-tests: Makefile var-op-default.mk
Removed Files:
src/usr.bin/make/unit-tests: qequals.exp qequals.mk

Log Message:
make(1): add tests and tutorial for the ?= assignment operator


To generate a diff of this commit:
cvs rdiff -u -r1.984 -r1.985 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.238 -r1.239 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r1.1 -r0 src/usr.bin/make/unit-tests/qequals.exp
cvs rdiff -u -r1.3 -r0 src/usr.bin/make/unit-tests/qequals.mk
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/var-op-default.mk

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.984 src/distrib/sets/lists/tests/mi:1.985
--- src/distrib/sets/lists/tests/mi:1.984	Mon Dec  7 07:51:25 2020
+++ src/distrib/sets/lists/tests/mi	Mon Dec  7 21:35:43 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.984 2020/12/07 07:51:25 rillig Exp $
+# $NetBSD: mi,v 1.985 2020/12/07 21:35:43 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -5263,8 +5263,8 @@
 ./usr/tests/usr.bin/make/unit-tests/posix.mk	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/posix1.exp	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/posix1.mk	tests-usr.bin-tests	compattestfile,atf
-./usr/tests/usr.bin/make/unit-tests/qequals.exp	tests-usr.bin-tests	compattestfile,atf
-./usr/tests/usr.bin/make/unit-tests/qequals.mk	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/qequals.exp	tests-obsolete		obsolete,atf
+./usr/tests/usr.bin/make/unit-tests/qequals.mk	tests-obsolete		obsolete,atf
 ./usr/tests/usr.bin/make/unit-tests/recursive.exptests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/recursive.mktests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/sh-dots.exp	tests-usr.bin-tests	compattestfile,atf

Index: src/usr.bin/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.238 src/usr.bin/make/unit-tests/Makefile:1.239
--- src/usr.bin/make/unit-tests/Makefile:1.238	Mon Dec  7 01:32:04 2020
+++ src/usr.bin/make/unit-tests/Makefile	Mon Dec  7 21:35:43 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.238 2020/12/07 01:32:04 rillig Exp $
+# $NetBSD: Makefile,v 1.239 2020/12/07 21:35:43 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -257,7 +257,6 @@ TESTS+=		parse-var
 TESTS+=		phony-end
 TESTS+=		posix
 TESTS+=		# posix1	# broken by reverting POSIX changes
-TESTS+=		qequals
 TESTS+=		recursive
 TESTS+=		sh
 TESTS+=		sh-dots

Index: src/usr.bin/make/unit-tests/var-op-default.mk
diff -u src/usr.bin/make/unit-tests/var-op-default.mk:1.2 src/usr.bin/make/unit-tests/var-op-default.mk:1.3
--- src/usr.bin/make/unit-tests/var-op-default.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/var-op-default.mk	Mon Dec  7 21:35:43 2020
@@ -1,9 +1,77 @@
-# $NetBSD: var-op-default.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: var-op-default.mk,v 1.3 2020/12/07 21:35:43 rillig Exp $
 #
 # Tests for the ?= variable assignment operator, which only assigns
 # if the variable is still undefined.
 
-# TODO: Implementation
+# The variable VAR is not defined yet.  Therefore it gets the default value
+# from the variable assignment.
+VAR?=		default value
+.if ${VAR} != "default value"
+.  error
+.endif
+
+# At this point, the variable 'VAR' is already defined.  The '?=' therefore
+# ignores the new variable value, preserving the previous "default value".
+VAR?=		ignored
+.if ${VAR} != "default value"
+.  error
+.endif
+
+# The '?=' operator only checks whether the variable is defined or not.
+# An empty variable is defined, therefore the '?=' operator does nothing.
+EMPTY=		# empty
+EMPTY?=		ignored
+.if ${EMPTY} != ""
+.  error
+.endif
+
+# The .for loop is described in the manual page as if it would operate on
+# variables.  This is not entirely true.  Instead, each occurrence of an
+# expression $i or ${i} or ${i:...} is substituted with ${:Uloop-value}.
+# This comes very close to the description, the only difference is that
+# there is never an actual variable named 'i' involved.
+#
+# Because there is not really a variable named 'i', the '?=' operator
+# performs the variable assignment, resulting in $i == "default".
+.for i in loop-value
+i?=		default
+.endfor
+.if ${i} != "default"
+.  error
+.endif
+
+# At the point where the '?=' operator checks whether the variable exists,
+# it expands the variable name exactly once.  Therefore both 'VAR.param'
+# and 'VAR.${param}' expand to 'VAR.param', and the second '?=' assignment
+# has no effect.
+#
+# Since 2000.05.11.07.43.42 it has been possible to use 

CVS commit: src/external/gpl3/gdb/dist/gdb

2020-12-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Dec  7 20:28:53 UTC 2020

Modified Files:
src/external/gpl3/gdb/dist/gdb: sparc-nbsd-tdep.c

Log Message:
make function static (fixes crossgdb build, reported by martin@)


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/gpl3/gdb/dist/gdb/sparc-nbsd-tdep.c

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

Modified files:

Index: src/external/gpl3/gdb/dist/gdb/sparc-nbsd-tdep.c
diff -u src/external/gpl3/gdb/dist/gdb/sparc-nbsd-tdep.c:1.6 src/external/gpl3/gdb/dist/gdb/sparc-nbsd-tdep.c:1.7
--- src/external/gpl3/gdb/dist/gdb/sparc-nbsd-tdep.c:1.6	Mon Sep 14 22:05:19 2020
+++ src/external/gpl3/gdb/dist/gdb/sparc-nbsd-tdep.c	Mon Dec  7 15:28:53 2020
@@ -315,7 +315,7 @@ sparc32nbsd_init_abi (struct gdbarch_inf
   frame_unwind_append_unwinder (gdbarch, _sigcontext_frame_unwind);
 }
 
-void
+static void
 sparc32nbsd_elf_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 {
   sparc32nbsd_init_abi (info, gdbarch);



CVS commit: [netbsd-8] src/doc

2020-12-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Dec  7 20:24:05 UTC 2020

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

Log Message:
Tickets #1628 - #1634


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.53 -r1.1.2.54 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.53 src/doc/CHANGES-8.3:1.1.2.54
--- src/doc/CHANGES-8.3:1.1.2.53	Sun Dec  6 10:28:28 2020
+++ src/doc/CHANGES-8.3	Mon Dec  7 20:24:05 2020
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.3,v 1.1.2.53 2020/12/06 10:28:28 martin Exp $
+# $NetBSD: CHANGES-8.3,v 1.1.2.54 2020/12/07 20:24:05 martin Exp $
 
 A complete list of changes from the NetBSD 8.2 release to the NetBSD 8.3
 release:
@@ -1345,3 +1345,74 @@ xsrc/external/mit/xorg-server/dist/xkb/x
 	   Overflow
 	[mrg, ticket #1627]
 
+xsrc/external/mit/xorg-server.old/dist/xkb/xkb.c	1.2
+
+	Apply upstream patches for:
+	 * CVE-2020-14360 / ZDI CAN 11572 XkbSetMap Out-Of-Bounds Access
+	 * CVE-2020-25712 / ZDI-CAN-11839 XkbSetDeviceInfo Heap-based Buffer
+	   Overflow
+	[mrg, ticket #1628]
+
+bin/sh/exec.c	1.54
+
+	PR bin/55526: fix "command foo" when a function "foo" exists.
+	[kre, ticket #1629]
+
+sbin/dump/dump.h1.59
+sbin/dump/main.c1.78
+
+	PR 55834: fix status updates for files larger than 2TiB.
+	[kre, ticket #1630]
+
+external/public-domain/tz/dist/systemv  delete
+external/public-domain/tz/dist/pacificnew   delete
+external/public-domain/tz/dist/yearistype.shdelete
+external/public-domain/tz/dist/Makefile up to 1.1.1.29
+external/public-domain/tz/dist/NEWS up to 1.1.1.32
+external/public-domain/tz/dist/README   up to 1.1.1.9
+external/public-domain/tz/dist/TZDATA_VERSION   up to 1.22
+external/public-domain/tz/dist/africa   up to 1.1.1.23
+external/public-domain/tz/dist/antarctica   up to 1.1.1.13
+external/public-domain/tz/dist/asia up to 1.1.1.27
+external/public-domain/tz/dist/australasia  up to 1.1.1.20
+external/public-domain/tz/dist/backward up to 1.1.1.11
+external/public-domain/tz/dist/backzone up to 1.1.1.19
+external/public-domain/tz/dist/checktab.awk up to 1.1.1.10
+external/public-domain/tz/dist/etcetera up to 1.1.1.4
+external/public-domain/tz/dist/europe   up to 1.1.1.29
+external/public-domain/tz/dist/factory  up to 1.1.1.4
+external/public-domain/tz/dist/iso3166.tab  up to 1.1.1.6
+external/public-domain/tz/dist/leap-seconds.list up to 1.1.1.14
+external/public-domain/tz/dist/leapseconds  up to 1.1.1.16
+external/public-domain/tz/dist/leapseconds.awk  up to 1.1.1.11
+external/public-domain/tz/dist/northamerica up to 1.1.1.26
+external/public-domain/tz/dist/southamerica up to 1.1.1.17
+external/public-domain/tz/dist/theory.html  up to 1.1.1.11
+external/public-domain/tz/dist/version  up to 1.1.1.19
+external/public-domain/tz/dist/ziguard.awk  up to 1.1.1.5
+external/public-domain/tz/dist/zishrink.awk up to 1.1.1.7
+external/public-domain/tz/dist/zone.tab up to 1.1.1.18
+external/public-domain/tz/dist/zone1970.tab up to 1.1.1.20
+external/public-domain/tz/dist/zoneinfo2tdf.pl  up to 1.1.1.4
+distrib/sets/lists/base/mi			(apply patch)
+doc/3RDPARTY	(apply patch)
+external/public-domain/tz/share/zoneinfo/Makefile	(apply patch)
+
+	Update timezone data to 2020d.
+	[kre, ticket #1631]
+
+sys/netinet/ip_mroute.c1.164 (patch)
+
+	PR 55779: restore non-desctructive guarantee of ip_mforward() mbuf
+	argument.
+	[kardel, ticket #1632]
+
+sys/dev/ic/nvme.c1.53
+
+	PR 55839: avoid mulitple bus rescans when loading the module.
+	[kardel, ticket #1633]
+
+xsrc/external/mit/libX11/dist/modules/im/ximcp/imRmAttr.c(patch)
+
+	PR 55640: fix off by one in X Input Method.
+	[maya, ticket #1634]



CVS commit: [netbsd-9] src/doc

2020-12-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Dec  7 20:22:13 UTC 2020

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

Log Message:
Tickets #1142 - #1145


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.17 -r1.1.2.18 src/doc/CHANGES-9.2

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.2
diff -u src/doc/CHANGES-9.2:1.1.2.17 src/doc/CHANGES-9.2:1.1.2.18
--- src/doc/CHANGES-9.2:1.1.2.17	Sun Dec  6 10:31:48 2020
+++ src/doc/CHANGES-9.2	Mon Dec  7 20:22:12 2020
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.2,v 1.1.2.17 2020/12/06 10:31:48 martin Exp $
+# $NetBSD: CHANGES-9.2,v 1.1.2.18 2020/12/07 20:22:12 martin Exp $
 
 A complete list of changes from the NetBSD 9.1 release to the NetBSD 9.2
 release:
@@ -1143,3 +1143,26 @@ sbin/dump/main.c1.78
 	PR 55834: fix status updates for files larger than 2TiB.
 	[kre, ticket #1139]
 
+xsrc/external/mit/xorg-server.old/dist/xkb/xkb.c	1.2
+
+	Apply upstream patches for:
+	 * CVE-2020-14360 / ZDI CAN 11572 XkbSetMap Out-Of-Bounds Access
+	 * CVE-2020-25712 / ZDI-CAN-11839 XkbSetDeviceInfo Heap-based Buffer
+	   Overflow
+	[mrg, ticket #1142]
+
+sys/netinet/ip_mroute.c1.164
+
+	PR 55779: restore non-desctructive guarantee of ip_mforward() mbuf
+	argument.
+	[kardel, ticket #1143]
+
+sys/dev/ic/nvme.c1.53
+
+	PR 55839: avoid mulitple bus rescans when loading the module.
+	[kardel, ticket #1144]
+
+xsrc/external/mit/libX11/dist/modules/im/ximcp/imRmAttr.c(patch)
+
+	PR 55640: fix off by one in X Input Method.
+	[maya, ticket #1145]



CVS commit: [netbsd-8] xsrc/external/mit/libX11/dist/modules/im/ximcp

2020-12-07 Thread Martin Husemann
Module Name:xsrc
Committed By:   martin
Date:   Mon Dec  7 20:20:15 UTC 2020

Modified Files:
xsrc/external/mit/libX11/dist/modules/im/ximcp [netbsd-8]: imRmAttr.c

Log Message:
Apply patch, requested by maya in ticket #1634:

external/mit/libX11/dist/modules/im/ximcp/imRmAttr.c(patch)

PR 55640: fix off by one in X Input Method.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.8.2.1 -r1.1.1.8.2.2 \
xsrc/external/mit/libX11/dist/modules/im/ximcp/imRmAttr.c

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

Modified files:

Index: xsrc/external/mit/libX11/dist/modules/im/ximcp/imRmAttr.c
diff -u xsrc/external/mit/libX11/dist/modules/im/ximcp/imRmAttr.c:1.1.1.8.2.1 xsrc/external/mit/libX11/dist/modules/im/ximcp/imRmAttr.c:1.1.1.8.2.2
--- xsrc/external/mit/libX11/dist/modules/im/ximcp/imRmAttr.c:1.1.1.8.2.1	Wed Aug  5 14:10:16 2020
+++ xsrc/external/mit/libX11/dist/modules/im/ximcp/imRmAttr.c	Mon Dec  7 20:20:15 2020
@@ -1407,7 +1407,7 @@ _XimCountNumberOfAttr(
 *names_len = 0;
 while (total > min_len) {
 	len = attr[2];
-	if (len >= (total - min_len)) {
+	if (len > (total - min_len)) {
 	return 0;
 	}
 	*names_len += (len + 1);



CVS commit: [netbsd-9] xsrc/external/mit/libX11/dist/modules/im/ximcp

2020-12-07 Thread Martin Husemann
Module Name:xsrc
Committed By:   martin
Date:   Mon Dec  7 20:18:55 UTC 2020

Modified Files:
xsrc/external/mit/libX11/dist/modules/im/ximcp [netbsd-9]: imRmAttr.c

Log Message:
Apply patch, requested by maya in ticket #1145:

external/mit/libX11/dist/modules/im/ximcp/imRmAttr.c(patch)

PR 55640: fix off by one in X Input Method.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.8.4.1 -r1.1.1.8.4.2 \
xsrc/external/mit/libX11/dist/modules/im/ximcp/imRmAttr.c

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

Modified files:

Index: xsrc/external/mit/libX11/dist/modules/im/ximcp/imRmAttr.c
diff -u xsrc/external/mit/libX11/dist/modules/im/ximcp/imRmAttr.c:1.1.1.8.4.1 xsrc/external/mit/libX11/dist/modules/im/ximcp/imRmAttr.c:1.1.1.8.4.2
--- xsrc/external/mit/libX11/dist/modules/im/ximcp/imRmAttr.c:1.1.1.8.4.1	Wed Aug  5 13:44:39 2020
+++ xsrc/external/mit/libX11/dist/modules/im/ximcp/imRmAttr.c	Mon Dec  7 20:18:55 2020
@@ -1407,7 +1407,7 @@ _XimCountNumberOfAttr(
 *names_len = 0;
 while (total > min_len) {
 	len = attr[2];
-	if (len >= (total - min_len)) {
+	if (len > (total - min_len)) {
 	return 0;
 	}
 	*names_len += (len + 1);



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

2020-12-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Dec  7 20:05:36 UTC 2020

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

Log Message:
Pull up following revision(s) (requested by kardel in ticket #1633):

sys/dev/ic/nvme.c: revision 1.53

PR kern/55839:

handle multiple nvme_rescan()s correctly by doing the
name-space identify only once per nsid.
fixes issue where modloading triggers multiple
rescans.


To generate a diff of this commit:
cvs rdiff -u -r1.30.2.8 -r1.30.2.9 src/sys/dev/ic/nvme.c

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

Modified files:

Index: src/sys/dev/ic/nvme.c
diff -u src/sys/dev/ic/nvme.c:1.30.2.8 src/sys/dev/ic/nvme.c:1.30.2.9
--- src/sys/dev/ic/nvme.c:1.30.2.8	Sun Sep 27 10:33:45 2020
+++ src/sys/dev/ic/nvme.c	Mon Dec  7 20:05:36 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvme.c,v 1.30.2.8 2020/09/27 10:33:45 martin Exp $	*/
+/*	$NetBSD: nvme.c,v 1.30.2.9 2020/12/07 20:05:36 martin Exp $	*/
 /*	$OpenBSD: nvme.c,v 1.49 2016/04/18 05:59:50 dlg Exp $ */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.30.2.8 2020/09/27 10:33:45 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.30.2.9 2020/12/07 20:05:36 martin Exp $");
 
 #include 
 #include 
@@ -625,6 +625,12 @@ nvme_ns_identify(struct nvme_softc *sc, 
 
 	KASSERT(nsid > 0);
 
+	ns = nvme_ns_get(sc, nsid);
+	KASSERT(ns);
+
+	if (ns->ident != NULL)
+		return 0;
+
 	ccb = nvme_ccb_get(sc->sc_admin_q, false);
 	KASSERT(ccb != NULL); /* it's a bug if we don't have spare ccb here */
 
@@ -662,9 +668,6 @@ nvme_ns_identify(struct nvme_softc *sc, 
 	/* Convert data to host endian */
 	nvme_identify_namespace_swapbytes(identify);
 
-	ns = nvme_ns_get(sc, nsid);
-	KASSERT(ns);
-	KASSERT(ns->ident == NULL);
 	ns->ident = identify;
 
 done:



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

2020-12-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Dec  7 20:04:07 UTC 2020

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

Log Message:
Pull up following revision(s) (requested by kardel in ticket #1144):

sys/dev/ic/nvme.c: revision 1.53

PR kern/55839:

handle multiple nvme_rescan()s correctly by doing the
name-space identify only once per nsid.
fixes issue where modloading triggers multiple
rescans.


To generate a diff of this commit:
cvs rdiff -u -r1.44.2.4 -r1.44.2.5 src/sys/dev/ic/nvme.c

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

Modified files:

Index: src/sys/dev/ic/nvme.c
diff -u src/sys/dev/ic/nvme.c:1.44.2.4 src/sys/dev/ic/nvme.c:1.44.2.5
--- src/sys/dev/ic/nvme.c:1.44.2.4	Sun Sep 27 10:30:16 2020
+++ src/sys/dev/ic/nvme.c	Mon Dec  7 20:04:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvme.c,v 1.44.2.4 2020/09/27 10:30:16 martin Exp $	*/
+/*	$NetBSD: nvme.c,v 1.44.2.5 2020/12/07 20:04:07 martin Exp $	*/
 /*	$OpenBSD: nvme.c,v 1.49 2016/04/18 05:59:50 dlg Exp $ */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.44.2.4 2020/09/27 10:30:16 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.44.2.5 2020/12/07 20:04:07 martin Exp $");
 
 #include 
 #include 
@@ -628,6 +628,12 @@ nvme_ns_identify(struct nvme_softc *sc, 
 
 	KASSERT(nsid > 0);
 
+	ns = nvme_ns_get(sc, nsid);
+	KASSERT(ns);
+
+	if (ns->ident != NULL)
+		return 0;
+
 	ccb = nvme_ccb_get(sc->sc_admin_q, false);
 	KASSERT(ccb != NULL); /* it's a bug if we don't have spare ccb here */
 
@@ -665,9 +671,6 @@ nvme_ns_identify(struct nvme_softc *sc, 
 	/* Convert data to host endian */
 	nvme_identify_namespace_swapbytes(identify);
 
-	ns = nvme_ns_get(sc, nsid);
-	KASSERT(ns);
-	KASSERT(ns->ident == NULL);
 	ns->ident = identify;
 
 done:



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

2020-12-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Dec  7 20:01:02 UTC 2020

Modified Files:
src/sys/netinet [netbsd-8]: ip_mroute.c

Log Message:
Pull up following revision(s) (requested by kardel in ticket #1632):

sys/netinet/ip_mroute.c: revision 1.164 (patch)

PR kern/55779:

restore non-desctructive guarantee of ip_mforward() mbuf
argument. This avoids generation invalid UDP checksums
on multicast packets in ip_output().

XXX the root cause of the misguided fix in 2008 should be
XXX investigated


To generate a diff of this commit:
cvs rdiff -u -r1.146.6.4 -r1.146.6.5 src/sys/netinet/ip_mroute.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/ip_mroute.c
diff -u src/sys/netinet/ip_mroute.c:1.146.6.4 src/sys/netinet/ip_mroute.c:1.146.6.5
--- src/sys/netinet/ip_mroute.c:1.146.6.4	Fri Jul 13 14:26:47 2018
+++ src/sys/netinet/ip_mroute.c	Mon Dec  7 20:01:01 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_mroute.c,v 1.146.6.4 2018/07/13 14:26:47 martin Exp $	*/
+/*	$NetBSD: ip_mroute.c,v 1.146.6.5 2020/12/07 20:01:01 martin Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -93,7 +93,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_mroute.c,v 1.146.6.4 2018/07/13 14:26:47 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_mroute.c,v 1.146.6.5 2020/12/07 20:01:01 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -239,6 +239,8 @@ static int tbf_dq_sel(struct vif *, stru
 static void tbf_send_packet(struct vif *, struct mbuf *);
 static void tbf_update_tokens(struct vif *);
 static int priority(struct vif *, struct ip *);
+static int ip_mforward_real(struct mbuf *, struct ifnet *);
+
 
 /*
  * Bandwidth monitoring
@@ -1309,6 +1311,34 @@ ip_mforward(struct mbuf *m, struct ifnet
 ip_mforward(struct mbuf *m, struct ifnet *ifp)
 #endif /* RSVP_ISI */
 {
+	int rc;
+	/*
+	 * save csum_flags to uphold the 
+	 * "unscathed" guarantee.
+	 * ip_output() relies on that and
+	 * without it we send out
+	 * multicast packets with an invalid
+	 * checksum
+	 *
+	 * see PR kern/55779
+	 */
+	int csum_flags = m->m_pkthdr.csum_flags;
+
+	/*
+	 * Temporarily clear any in-bound checksum flags for this packet.
+	 */
+	m->m_pkthdr.csum_flags = 0;
+
+	rc = ip_mforward_real(m, ifp);
+
+	m->m_pkthdr.csum_flags = csum_flags;
+
+	return rc;
+}
+
+static int
+ip_mforward_real(struct mbuf *m, struct ifnet *ifp)
+{
 	struct ip *ip = mtod(m, struct ip *);
 	struct mfc *rt;
 	static int srctun = 0;
@@ -1340,11 +1370,6 @@ ip_mforward(struct mbuf *m, struct ifnet
 		return (1);
 	}
 
-	/*
-	 * Clear any in-bound checksum flags for this packet.
-	 */
-	m->m_pkthdr.csum_flags = 0;
-
 #ifdef RSVP_ISI
 	if (imo && ((vifi = imo->imo_multicast_vif) < numvifs)) {
 		if (ip->ip_ttl < MAXTTL)



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

2020-12-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Dec  7 19:58:04 UTC 2020

Modified Files:
src/sys/netinet [netbsd-9]: ip_mroute.c

Log Message:
Pull up following revision(s) (requested by kardel in ticket #1143):

sys/netinet/ip_mroute.c: revision 1.164

PR kern/55779:

restore non-desctructive guarantee of ip_mforward() mbuf
argument. This avoids generation invalid UDP checksums
on multicast packets in ip_output().

XXX the root cause of the misguided fix in 2008 should be
XXX investigated


To generate a diff of this commit:
cvs rdiff -u -r1.163 -r1.163.4.1 src/sys/netinet/ip_mroute.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/ip_mroute.c
diff -u src/sys/netinet/ip_mroute.c:1.163 src/sys/netinet/ip_mroute.c:1.163.4.1
--- src/sys/netinet/ip_mroute.c:1.163	Fri Sep 14 05:09:51 2018
+++ src/sys/netinet/ip_mroute.c	Mon Dec  7 19:58:04 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_mroute.c,v 1.163 2018/09/14 05:09:51 maxv Exp $	*/
+/*	$NetBSD: ip_mroute.c,v 1.163.4.1 2020/12/07 19:58:04 martin Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -93,7 +93,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_mroute.c,v 1.163 2018/09/14 05:09:51 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_mroute.c,v 1.163.4.1 2020/12/07 19:58:04 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -225,6 +225,8 @@ static int tbf_dq_sel(struct vif *, stru
 static void tbf_send_packet(struct vif *, struct mbuf *);
 static void tbf_update_tokens(struct vif *);
 static int priority(struct vif *, struct ip *);
+static int ip_mforward_real(struct mbuf *, struct ifnet *);
+
 
 /*
  * Bandwidth monitoring
@@ -1268,6 +1270,34 @@ socket_send(struct socket *s, struct mbu
 int
 ip_mforward(struct mbuf *m, struct ifnet *ifp)
 {
+	int rc;
+	/*
+	 * save csum_flags to uphold the 
+	 * "unscathed" guarantee.
+	 * ip_output() relies on that and
+	 * without it we send out
+	 * multicast packets with an invalid
+	 * checksum
+	 *
+	 * see PR kern/55779
+	 */
+	int csum_flags = m->m_pkthdr.csum_flags;
+
+	/*
+	 * Temporarily clear any in-bound checksum flags for this packet.
+	 */
+	m->m_pkthdr.csum_flags = 0;
+
+	rc = ip_mforward_real(m, ifp);
+
+	m->m_pkthdr.csum_flags = csum_flags;
+
+	return rc;
+}
+
+static int
+ip_mforward_real(struct mbuf *m, struct ifnet *ifp)
+{
 	struct ip *ip = mtod(m, struct ip *);
 	struct mfc *rt;
 	static int srctun = 0;
@@ -1305,11 +1335,6 @@ ip_mforward(struct mbuf *m, struct ifnet
 	}
 
 	/*
-	 * Clear any in-bound checksum flags for this packet.
-	 */
-	m->m_pkthdr.csum_flags = 0;
-
-	/*
 	 * Don't forward a packet with time-to-live of zero or one,
 	 * or a packet destined to a local-only group.
 	 */



CVS commit: [netbsd-8] src/bin/sh

2020-12-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Dec  7 19:39:09 UTC 2020

Modified Files:
src/bin/sh [netbsd-8]: exec.c

Log Message:
Pull up following revision(s) (requested by kre in ticket #1629):

bin/sh/exec.c: revision 1.54

PR bin/55526

Fix a bug that has existed since the "command" command was added in
2003.   "command foo" would cause the definition of a function "foo"
to be lost (not freed, simply discarded) if "foo" is (in addition to
being a function) a filesystem command.   The case where "foo" is
a builtin was handled.

For now, when a function exists with the same name as a filesystem
command, the latter can never appear in the command hash table, and
when used (which can only be via "command foo", just "foo" finds
the function) will always result in a full PATH search.

XXX pullup everything (from NetBSD 2.0 onwards).   (really -8 and -9)


To generate a diff of this commit:
cvs rdiff -u -r1.47.2.4 -r1.47.2.5 src/bin/sh/exec.c

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

Modified files:

Index: src/bin/sh/exec.c
diff -u src/bin/sh/exec.c:1.47.2.4 src/bin/sh/exec.c:1.47.2.5
--- src/bin/sh/exec.c:1.47.2.4	Sat Aug 25 14:48:22 2018
+++ src/bin/sh/exec.c	Mon Dec  7 19:39:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec.c,v 1.47.2.4 2018/08/25 14:48:22 martin Exp $	*/
+/*	$NetBSD: exec.c,v 1.47.2.5 2020/12/07 19:39:09 martin Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)exec.c	8.4 (Berkeley) 6/8/95";
 #else
-__RCSID("$NetBSD: exec.c,v 1.47.2.4 2018/08/25 14:48:22 martin Exp $");
+__RCSID("$NetBSD: exec.c,v 1.47.2.5 2020/12/07 19:39:09 martin Exp $");
 #endif
 #endif /* not lint */
 
@@ -667,6 +667,10 @@ loop:
 			cmdp = _cmd;
 		} else
 			cmdp = cmdlookup(name, 1);
+
+		if (cmdp->cmdtype == CMDFUNCTION)
+			cmdp = _cmd;
+
 		cmdp->cmdtype = CMDNORMAL;
 		cmdp->param.index = idx;
 		INTON;



CVS commit: [netbsd-8] src/sbin/dump

2020-12-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Dec  7 19:35:50 UTC 2020

Modified Files:
src/sbin/dump [netbsd-8]: dump.h main.c

Log Message:
Pull up following revision(s) (requested by kre in ticket #1630):

sbin/dump/dump.h: revision 1.59
sbin/dump/main.c: revision 1.78

PR bin/55834

count blocks written in unsigned 64 bit counter
rather than signed int which overflows after 2^31-1
blocks (2TiB) after which neither the 5 minute
status updates or SIGINFO (^T) reports are issued
until the negative numbers increase past 0 and
wildly inaccurate reports would be written.


To generate a diff of this commit:
cvs rdiff -u -r1.54.8.1 -r1.54.8.2 src/sbin/dump/dump.h
cvs rdiff -u -r1.73.8.1 -r1.73.8.2 src/sbin/dump/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/sbin/dump/dump.h
diff -u src/sbin/dump/dump.h:1.54.8.1 src/sbin/dump/dump.h:1.54.8.2
--- src/sbin/dump/dump.h:1.54.8.1	Fri Mar 29 19:43:28 2019
+++ src/sbin/dump/dump.h	Mon Dec  7 19:35:50 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: dump.h,v 1.54.8.1 2019/03/29 19:43:28 martin Exp $	*/
+/*	$NetBSD: dump.h,v 1.54.8.2 2020/12/07 19:35:50 martin Exp $	*/
 
 /*-
  * Copyright (c) 1980, 1993
@@ -134,7 +134,7 @@ int	unlimited;	/* if set, write to end o
 extern int	density;	/* density in 0.1" units */
 extern int	notify;		/* notify operator flag */
 extern int	timestamp;	/* timestamp messages */
-extern int	blockswritten;	/* number of blocks written on current tape */
+extern u_int64_t	blockswritten;	/* blocks written on current tape */
 extern int	tapeno;		/* current tape number */
 extern int	is_ufs2;
 

Index: src/sbin/dump/main.c
diff -u src/sbin/dump/main.c:1.73.8.1 src/sbin/dump/main.c:1.73.8.2
--- src/sbin/dump/main.c:1.73.8.1	Fri Mar 29 19:43:28 2019
+++ src/sbin/dump/main.c	Mon Dec  7 19:35:50 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.73.8.1 2019/03/29 19:43:28 martin Exp $	*/
+/*	$NetBSD: main.c,v 1.73.8.2 2020/12/07 19:35:50 martin Exp $	*/
 
 /*-
  * Copyright (c) 1980, 1991, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "@(#)main.c	8.6 (Berkeley) 5/1/95";
 #else
-__RCSID("$NetBSD: main.c,v 1.73.8.1 2019/03/29 19:43:28 martin Exp $");
+__RCSID("$NetBSD: main.c,v 1.73.8.2 2020/12/07 19:35:50 martin Exp $");
 #endif
 #endif /* not lint */
 
@@ -71,7 +71,7 @@ __RCSID("$NetBSD: main.c,v 1.73.8.1 2019
 
 int	timestamp;		/* print message timestamps */
 int	notify;			/* notify operator flag */
-int	blockswritten;		/* number of blocks written on current tape */
+u_int64_t	blockswritten;	/* number of blocks written on current tape */
 int	tapeno;			/* current tape number */
 int	density;		/* density in bytes/0.1" */
 int	ntrec = NTREC;		/* # tape blocks in each tape record */



CVS commit: [netbsd-8] xsrc/external/mit/xorg-server.old/dist/xkb

2020-12-07 Thread Martin Husemann
Module Name:xsrc
Committed By:   martin
Date:   Mon Dec  7 19:29:26 UTC 2020

Modified Files:
xsrc/external/mit/xorg-server.old/dist/xkb [netbsd-8]: xkb.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1628):

external/mit/xorg-server.old/dist/xkb/xkb.c: revision 1.2

merge security fixes for xkb, as found in these xserver gitlab
commits:

270e439739e023463e7e0719a4eede69d45f7a3f - xkb: only swap once in XkbSetMap
446ff2d3177087b8173fa779fa5b77a2a128988b - Check SetMap request length carefully
87c64fc5b0db9f62f4e361444f4b60501ebf67b9 - Fix XkbSetDeviceInfo() and 
SetDeviceIndicators() heap overflows
de940e06f8733d87bbb857aef85d830053442cfe - xkb: fix key type index check in 
_XkbSetMapChecks
f7cd1276bbd4fe3a9700096dec33b52b8440788d - Correct bounds checking in 
XkbSetNames()

i haven't tested these run OK, and it was a 33 out of 34 hunks
did not apply cleanly, but they merge was still largely the
same (patch failed due to whitespace changes mostly), and i am
able to build-test successfully.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.2.1 \
xsrc/external/mit/xorg-server.old/dist/xkb/xkb.c

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

Modified files:

Index: xsrc/external/mit/xorg-server.old/dist/xkb/xkb.c
diff -u xsrc/external/mit/xorg-server.old/dist/xkb/xkb.c:1.1.1.1 xsrc/external/mit/xorg-server.old/dist/xkb/xkb.c:1.1.1.1.2.1
--- xsrc/external/mit/xorg-server.old/dist/xkb/xkb.c:1.1.1.1	Thu Jun  9 09:08:01 2016
+++ xsrc/external/mit/xorg-server.old/dist/xkb/xkb.c	Mon Dec  7 19:29:26 2020
@@ -151,6 +151,19 @@ static RESTYPE	RT_XKBCLIENT;
 #define	CHK_REQ_KEY_RANGE(err,first,num,r)  \
 	CHK_REQ_KEY_RANGE2(err,first,num,r,client->errorValue,BadValue)
 
+static Bool
+_XkbCheckRequestBounds(ClientPtr client, void *stuff, void *from, void *to) {
+char *cstuff = (char *)stuff;
+char *cfrom = (char *)from;
+char *cto = (char *)to;
+
+return cfrom < cto &&
+   cfrom >= cstuff &&
+   cfrom < cstuff + ((size_t)client->req_len << 2) &&
+   cto >= cstuff &&
+   cto <= cstuff + ((size_t)client->req_len << 2);
+}
+
 /******/
 
 int
@@ -1550,7 +1563,8 @@ CheckKeyTypes(	ClientPtr	client,
 		xkbSetMapReq *	req,
 		xkbKeyTypeWireDesc **wireRtrn,
 		int	 *	nMapsRtrn,
-		CARD8 *		mapWidthRtrn)
+		CARD8 *		mapWidthRtrn,
+		Bool doswap)
 {
 unsigned		nMaps;
 register unsigned	i,n;
@@ -1588,7 +1602,7 @@ register xkbKeyTypeWireDesc	*wire = *wir
 }
 for (i=0;inTypes;i++) {
 	unsigned	width;
-	if (client->swapped) {
+if (client->swapped && doswap) {
 	register int s;
 	swaps(>virtualMods,s);
 	}
@@ -1615,7 +1629,7 @@ register xkbKeyTypeWireDesc	*wire = *wir
 	mapWire= (xkbKTSetMapEntryWireDesc *)[1];
 	preWire= (xkbModsWireDesc *)[wire->nMapEntries];
 	for (n=0;nnMapEntries;n++) {
-		if (client->swapped) {
+if (client->swapped && doswap) {
 		register int s;
 		swaps([n].virtualMods,s);
 		}
@@ -1634,7 +1648,7 @@ register xkbKeyTypeWireDesc	*wire = *wir
 		return 0;
 		}
 		if (wire->preserve) {
-		if (client->swapped) {
+		if (client->swapped && doswap) {
 			register int s;
 			swaps([n].virtualMods,s);
 		}
@@ -1673,7 +1687,8 @@ CheckKeySyms(	ClientPtr		client,
 		CARD8 *	 		mapWidths,
 		CARD16 *	 	symsPerKey,
 		xkbSymMapWireDesc **	wireRtrn,
-		int *			errorRtrn)
+		int *			errorRtrn,
+		Bool			doswap)
 {
 register unsigned	i;
 XkbSymMapPtr		map;
@@ -1685,7 +1700,7 @@ xkbSymMapWireDesc*	wire = *wireRtrn;
 for (i=0;inKeySyms;i++) {
 	KeySym *pSyms;
 	register unsigned nG;
-	if (client->swapped) {
+	if (client->swapped && doswap) {
 	swaps(>nSyms,nG);
 	}
 	nG = XkbNumGroups(wire->groupInfo);
@@ -2322,13 +2337,99 @@ XkbServerMapPtr		srv = xkbi->desc->serve
 }
 return (char *)wire;
 }
+ 
+#define _add_check_len(new) \
+if (len > UINT32_MAX - (new) || len > req_len - (new)) goto bad; \
+else len += new
+
+/**
+ * Check the length of the SetMap request
+ */
+static int
+_XkbSetMapCheckLength(xkbSetMapReq *req)
+{
+size_t len = sz_xkbSetMapReq, req_len = req->length << 2;
+xkbKeyTypeWireDesc *keytype;
+xkbSymMapWireDesc *symmap;
+BOOL preserve;
+int i, map_count, nSyms;
+
+if (req_len < len)
+goto bad;
+/* types */
+if (req->present & XkbKeyTypesMask) {
+keytype = (xkbKeyTypeWireDesc *)(req + 1);
+for (i = 0; i < req->nTypes; i++) {
+_add_check_len(XkbPaddedSize(sz_xkbKeyTypeWireDesc));
+if (req->flags & XkbSetMapResizeTypes) {
+_add_check_len(keytype->nMapEntries
+   * sz_xkbKTSetMapEntryWireDesc);
+preserve = keytype->preserve;
+map_count = keytype->nMapEntries;
+if (preserve) {
+

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

2020-12-07 Thread Martin Husemann
Module Name:xsrc
Committed By:   martin
Date:   Mon Dec  7 19:27:20 UTC 2020

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

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1142):

external/mit/xorg-server.old/dist/xkb/xkb.c: revision 1.2

merge security fixes for xkb, as found in these xserver gitlab
commits:

270e439739e023463e7e0719a4eede69d45f7a3f - xkb: only swap once in XkbSetMap
446ff2d3177087b8173fa779fa5b77a2a128988b - Check SetMap request length carefully
87c64fc5b0db9f62f4e361444f4b60501ebf67b9 - Fix XkbSetDeviceInfo() and 
SetDeviceIndicators() heap overflows
de940e06f8733d87bbb857aef85d830053442cfe - xkb: fix key type index check in 
_XkbSetMapChecks
f7cd1276bbd4fe3a9700096dec33b52b8440788d - Correct bounds checking in 
XkbSetNames()

i haven't tested these run OK, and it was a 33 out of 34 hunks
did not apply cleanly, but they merge was still largely the
same (patch failed due to whitespace changes mostly), and i am
able to build-test successfully.


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

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

Modified files:

Index: xsrc/external/mit/xorg-server.old/dist/xkb/xkb.c
diff -u xsrc/external/mit/xorg-server.old/dist/xkb/xkb.c:1.1.1.1 xsrc/external/mit/xorg-server.old/dist/xkb/xkb.c:1.1.1.1.4.1
--- xsrc/external/mit/xorg-server.old/dist/xkb/xkb.c:1.1.1.1	Thu Jun  9 09:08:01 2016
+++ xsrc/external/mit/xorg-server.old/dist/xkb/xkb.c	Mon Dec  7 19:27:20 2020
@@ -151,6 +151,19 @@ static RESTYPE	RT_XKBCLIENT;
 #define	CHK_REQ_KEY_RANGE(err,first,num,r)  \
 	CHK_REQ_KEY_RANGE2(err,first,num,r,client->errorValue,BadValue)
 
+static Bool
+_XkbCheckRequestBounds(ClientPtr client, void *stuff, void *from, void *to) {
+char *cstuff = (char *)stuff;
+char *cfrom = (char *)from;
+char *cto = (char *)to;
+
+return cfrom < cto &&
+   cfrom >= cstuff &&
+   cfrom < cstuff + ((size_t)client->req_len << 2) &&
+   cto >= cstuff &&
+   cto <= cstuff + ((size_t)client->req_len << 2);
+}
+
 /******/
 
 int
@@ -1550,7 +1563,8 @@ CheckKeyTypes(	ClientPtr	client,
 		xkbSetMapReq *	req,
 		xkbKeyTypeWireDesc **wireRtrn,
 		int	 *	nMapsRtrn,
-		CARD8 *		mapWidthRtrn)
+		CARD8 *		mapWidthRtrn,
+		Bool doswap)
 {
 unsigned		nMaps;
 register unsigned	i,n;
@@ -1588,7 +1602,7 @@ register xkbKeyTypeWireDesc	*wire = *wir
 }
 for (i=0;inTypes;i++) {
 	unsigned	width;
-	if (client->swapped) {
+if (client->swapped && doswap) {
 	register int s;
 	swaps(>virtualMods,s);
 	}
@@ -1615,7 +1629,7 @@ register xkbKeyTypeWireDesc	*wire = *wir
 	mapWire= (xkbKTSetMapEntryWireDesc *)[1];
 	preWire= (xkbModsWireDesc *)[wire->nMapEntries];
 	for (n=0;nnMapEntries;n++) {
-		if (client->swapped) {
+if (client->swapped && doswap) {
 		register int s;
 		swaps([n].virtualMods,s);
 		}
@@ -1634,7 +1648,7 @@ register xkbKeyTypeWireDesc	*wire = *wir
 		return 0;
 		}
 		if (wire->preserve) {
-		if (client->swapped) {
+		if (client->swapped && doswap) {
 			register int s;
 			swaps([n].virtualMods,s);
 		}
@@ -1673,7 +1687,8 @@ CheckKeySyms(	ClientPtr		client,
 		CARD8 *	 		mapWidths,
 		CARD16 *	 	symsPerKey,
 		xkbSymMapWireDesc **	wireRtrn,
-		int *			errorRtrn)
+		int *			errorRtrn,
+		Bool			doswap)
 {
 register unsigned	i;
 XkbSymMapPtr		map;
@@ -1685,7 +1700,7 @@ xkbSymMapWireDesc*	wire = *wireRtrn;
 for (i=0;inKeySyms;i++) {
 	KeySym *pSyms;
 	register unsigned nG;
-	if (client->swapped) {
+	if (client->swapped && doswap) {
 	swaps(>nSyms,nG);
 	}
 	nG = XkbNumGroups(wire->groupInfo);
@@ -2322,13 +2337,99 @@ XkbServerMapPtr		srv = xkbi->desc->serve
 }
 return (char *)wire;
 }
+ 
+#define _add_check_len(new) \
+if (len > UINT32_MAX - (new) || len > req_len - (new)) goto bad; \
+else len += new
+
+/**
+ * Check the length of the SetMap request
+ */
+static int
+_XkbSetMapCheckLength(xkbSetMapReq *req)
+{
+size_t len = sz_xkbSetMapReq, req_len = req->length << 2;
+xkbKeyTypeWireDesc *keytype;
+xkbSymMapWireDesc *symmap;
+BOOL preserve;
+int i, map_count, nSyms;
+
+if (req_len < len)
+goto bad;
+/* types */
+if (req->present & XkbKeyTypesMask) {
+keytype = (xkbKeyTypeWireDesc *)(req + 1);
+for (i = 0; i < req->nTypes; i++) {
+_add_check_len(XkbPaddedSize(sz_xkbKeyTypeWireDesc));
+if (req->flags & XkbSetMapResizeTypes) {
+_add_check_len(keytype->nMapEntries
+   * sz_xkbKTSetMapEntryWireDesc);
+preserve = keytype->preserve;
+map_count = keytype->nMapEntries;
+if (preserve) {
+

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

2020-12-07 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Mon Dec  7 13:24:15 UTC 2020

Modified Files:
src/sys/arch/sparc64/dev: pcf8591_envctrl.c

Log Message:
Add some debugging output to check sensor addition and refresh.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/sparc64/dev/pcf8591_envctrl.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/sparc64/dev/pcf8591_envctrl.c
diff -u src/sys/arch/sparc64/dev/pcf8591_envctrl.c:1.13 src/sys/arch/sparc64/dev/pcf8591_envctrl.c:1.14
--- src/sys/arch/sparc64/dev/pcf8591_envctrl.c:1.13	Sun Dec  6 10:06:15 2020
+++ src/sys/arch/sparc64/dev/pcf8591_envctrl.c	Mon Dec  7 13:24:15 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcf8591_envctrl.c,v 1.13 2020/12/06 10:06:15 jdc Exp $	*/
+/*	$NetBSD: pcf8591_envctrl.c,v 1.14 2020/12/07 13:24:15 jdc Exp $	*/
 /*	$OpenBSD: pcf8591_envctrl.c,v 1.6 2007/10/25 21:17:20 kettenis Exp $ */
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pcf8591_envctrl.c,v 1.13 2020/12/06 10:06:15 jdc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pcf8591_envctrl.c,v 1.14 2020/12/07 13:24:15 jdc Exp $");
 
 #include 
 #include 
@@ -34,6 +34,12 @@ __KERNEL_RCSID(0, "$NetBSD: pcf8591_envc
 #include 
 #include 
 
+#ifdef ECADC_DEBUG
+#define DPRINTF printf
+#else
+#define DPRINTF if (0) printf
+#endif
+
 /* Translation tables contain 254 entries */
 #define XLATE_SIZE		256
 #define XLATE_MAX		(XLATE_SIZE - 2)
@@ -126,6 +132,7 @@ ecadc_attach(device_t parent, device_t s
 	sc->sc_nchan = 0;
 	sc->sc_hastimer = 0;
 
+	DPRINTF("\n");
 	if ((len = OF_getprop(node, "thermisters", term,
 	sizeof(term))) < 0) {
 		aprint_error(": couldn't find \"thermisters\" property\n");
@@ -170,15 +177,25 @@ ecadc_attach(device_t parent, device_t s
 		sensor->state = ENVSYS_SINVALID;
 		strlcpy(sensor->desc, desc, sizeof(sensor->desc));
 
-		if (strncmp(desc, "CPU", 3) == 0)
+		if (strncmp(desc, "CPU", 3) == 0) {
 			sc->sc_channels[sc->sc_nchan].chan_xlate =
 			sc->sc_cpu_xlate;
-		else if (strncmp(desc, "PS", 2) == 0)
+			DPRINTF("%s: "
+			"added %s sensor (chan %d) with cpu_xlate\n",
+			device_xname(sc->sc_dev), desc, chan);
+		} else if (strncmp(desc, "PS", 2) == 0) {
 			sc->sc_channels[sc->sc_nchan].chan_xlate =
 			sc->sc_ps_xlate;
-		else
+			DPRINTF("%s: "
+			"added %s sensor (chan %d) with ps_xlate\n",
+			device_xname(sc->sc_dev), desc, chan);
+		} else {
 			sc->sc_channels[sc->sc_nchan].chan_factor =
 			(100 * num) / den;
+			DPRINTF("%s: "
+			"added %s sensor (chan %d) without xlate\n",
+			device_xname(sc->sc_dev), desc, chan);
+		}
 		sc->sc_channels[sc->sc_nchan].chan_min =
 		27315 + 100 * minv;
 		sc->sc_channels[sc->sc_nchan].chan_warn =
@@ -204,6 +221,10 @@ ecadc_attach(device_t parent, device_t s
 		sensor->state = ENVSYS_SINVALID;
 		strlcpy(sensor->desc, "CPUFAN", sizeof(sensor->desc));
 		sc->sc_channels[sc->sc_nchan].chan_xlate = sc->sc_cpu_fan_spd;
+		DPRINTF("%s: "
+		"added CPUFAN sensor (chan %d) with cpu-fan xlate\n",
+		device_xname(sc->sc_dev),
+		sc->sc_channels[sc->sc_nchan].chan_num);
 		sc->sc_nchan++;
 
 		sc->sc_hastimer = 1;
@@ -312,9 +333,21 @@ ecadc_refresh(struct sysmon_envsys *sme,
 temp &= ~0xff;
 temp += data[1 + chp->chan_num];
 chp->chan_sensor.value_cur = temp;
-			} else
+DPRINTF("%s: xlate %s sensor = %d"
+" (0x%x > 0x%x)\n",
+device_xname(sc->sc_dev),
+chp->chan_sensor.desc, temp,
+data[1 + chp->chan_num],
+chp->chan_xlate[data[1 + chp->chan_num]]);
+			} else {
 chp->chan_sensor.value_cur = 27315 +
 chp->chan_factor * data[1 + chp->chan_num];
+DPRINTF("%s: read %s sensor = %d (0x%x)\n",
+device_xname(sc->sc_dev),
+chp->chan_sensor.desc,
+chp->chan_sensor.value_cur,
+data[1 + chp->chan_num]);
+			}
 			chp->chan_sensor.flags |= ENVSYS_FMONLIMITS;
 		}
 		if (chp->chan_type == PCF8591_CPU_FAN_CTRL ||
@@ -382,8 +415,8 @@ ecadc_set_fan_speed(struct ecadc_softc *
 		aprint_error_dev(sc->sc_dev,
 		"error changing fan speed (ch %d)\n", chan);
 	else
-		aprint_debug_dev(sc->sc_dev,
-		"changed fan speed (ch %d) to 0x%x\n", chan, val);
+		DPRINTF("%s changed fan speed (ch %d) to 0x%x\n",
+		device_xname(sc->sc_dev), chan, val);
 	iic_release_bus(sc->sc_tag, 0);
 	return ret;
 }



CVS commit: src/doc

2020-12-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Dec  7 10:59:27 UTC 2020

Modified Files:
src/doc: CHANGES

Log Message:
acpicpu(4): Add support for Arm CPUs.


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

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2763 src/doc/CHANGES:1.2764
--- src/doc/CHANGES:1.2763	Sat Dec  5 16:23:08 2020
+++ src/doc/CHANGES	Mon Dec  7 10:59:26 2020
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2763 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2764 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -313,3 +313,4 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	libfido2: Update to 1.5.0 for OpenSSH 8.4 support [christos 20201204]
 	OpenSSH: Import 8.4. [christos 20201204]
 	pkg_install: Updated to 20201205. [wiz 20201205]
+	acpicpu(4): Add support for Arm CPUs. [jmcneill 20201207]



CVS commit: src/sys

2020-12-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Dec  7 10:57:41 UTC 2020

Modified Files:
src/sys/arch/arm/acpi: files.acpi
src/sys/arch/evbarm/conf: GENERIC64
src/sys/dev/acpi: acpi.c acpi_cpu.c acpi_cpu.h acpi_cpu_cstate.c
acpi_cpu_pstate.c acpi_cpu_tstate.c files.acpi
Added Files:
src/sys/arch/arm/acpi: acpi_cpu_md.c
src/sys/dev/acpi: acpi_pcd.c

Log Message:
acpicpu: Add support for ACPI P-states and T-states on Arm.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/acpi/acpi_cpu_md.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/acpi/files.acpi
cvs rdiff -u -r1.165 -r1.166 src/sys/arch/evbarm/conf/GENERIC64
cvs rdiff -u -r1.286 -r1.287 src/sys/dev/acpi/acpi.c
cvs rdiff -u -r1.52 -r1.53 src/sys/dev/acpi/acpi_cpu.c
cvs rdiff -u -r1.44 -r1.45 src/sys/dev/acpi/acpi_cpu.h
cvs rdiff -u -r1.62 -r1.63 src/sys/dev/acpi/acpi_cpu_cstate.c
cvs rdiff -u -r1.53 -r1.54 src/sys/dev/acpi/acpi_cpu_pstate.c
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/acpi/acpi_cpu_tstate.c
cvs rdiff -u -r0 -r1.1 src/sys/dev/acpi/acpi_pcd.c
cvs rdiff -u -r1.116 -r1.117 src/sys/dev/acpi/files.acpi

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/acpi/files.acpi
diff -u src/sys/arch/arm/acpi/files.acpi:1.11 src/sys/arch/arm/acpi/files.acpi:1.12
--- src/sys/arch/arm/acpi/files.acpi:1.11	Sat Oct 10 15:25:31 2020
+++ src/sys/arch/arm/acpi/files.acpi	Mon Dec  7 10:57:41 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: files.acpi,v 1.11 2020/10/10 15:25:31 jmcneill Exp $
+#	$NetBSD: files.acpi,v 1.12 2020/12/07 10:57:41 jmcneill Exp $
 #
 # Configuration info for ACPI compliant ARM boards.
 #
@@ -40,6 +40,14 @@ file	arch/arm/acpi/sbsawdt_acpi.c		sbsaw
 attach	plcom at acpinodebus with plcom_acpi
 file	arch/arm/acpi/plcom_acpi.c		plcom_acpi
 
+device	acpicpu: acpi
+attach	acpicpu at acpinodebus
+file	dev/acpi/acpi_cpu.c			acpicpu
+file	dev/acpi/acpi_cpu_cstate.c		acpicpu
+file	dev/acpi/acpi_cpu_pstate.c		acpicpu
+file	dev/acpi/acpi_cpu_tstate.c		acpicpu
+file	arch/arm/acpi/acpi_cpu_md.c		acpicpu
+
 device	acpipchb: pcibus
 attach	acpipchb at acpinodebus
 file	arch/arm/acpi/acpipchb.c		acpipchb

Index: src/sys/arch/evbarm/conf/GENERIC64
diff -u src/sys/arch/evbarm/conf/GENERIC64:1.165 src/sys/arch/evbarm/conf/GENERIC64:1.166
--- src/sys/arch/evbarm/conf/GENERIC64:1.165	Wed Oct 28 07:36:17 2020
+++ src/sys/arch/evbarm/conf/GENERIC64	Mon Dec  7 10:57:41 2020
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC64,v 1.165 2020/10/28 07:36:17 rin Exp $
+#	$NetBSD: GENERIC64,v 1.166 2020/12/07 10:57:41 jmcneill Exp $
 #
 #	GENERIC ARM (aarch64) kernel
 #
@@ -90,6 +90,8 @@ acpi*		at acpifdt?
 acpiacad*	at acpi?
 acpibat*	at acpi?
 acpibut*	at acpi?
+acpipcd*	at acpi?
+acpicpu*	at acpi?
 acpifan*	at acpi?
 acpiged*	at acpi?
 acpilid*	at acpi?

Index: src/sys/dev/acpi/acpi.c
diff -u src/sys/dev/acpi/acpi.c:1.286 src/sys/dev/acpi/acpi.c:1.287
--- src/sys/dev/acpi/acpi.c:1.286	Sun Nov  8 14:16:59 2020
+++ src/sys/dev/acpi/acpi.c	Mon Dec  7 10:57:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi.c,v 1.286 2020/11/08 14:16:59 jmcneill Exp $	*/
+/*	$NetBSD: acpi.c,v 1.287 2020/12/07 10:57:41 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@@ -100,7 +100,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.286 2020/11/08 14:16:59 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.287 2020/12/07 10:57:41 jmcneill Exp $");
 
 #include "pci.h"
 #include "opt_acpi.h"
@@ -178,7 +178,6 @@ static const char * const acpi_ignored_i
 #endif
 #if defined(__aarch64__)
 	"ACPI0004",	/* ACPI module devices are handled internally */
-	"ACPI0007",	/* ACPI CPUs are attached via MADT GICC subtables */
 	"PNP0C0F",	/* ACPI PCI link devices are handled internally */
 #endif
 	NULL

Index: src/sys/dev/acpi/acpi_cpu.c
diff -u src/sys/dev/acpi/acpi_cpu.c:1.52 src/sys/dev/acpi/acpi_cpu.c:1.53
--- src/sys/dev/acpi/acpi_cpu.c:1.52	Mon Mar 16 21:20:09 2020
+++ src/sys/dev/acpi/acpi_cpu.c	Mon Dec  7 10:57:41 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu.c,v 1.52 2020/03/16 21:20:09 pgoyette Exp $ */
+/* $NetBSD: acpi_cpu.c,v 1.53 2020/12/07 10:57:41 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2010, 2011 Jukka Ruohonen 
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_cpu.c,v 1.52 2020/03/16 21:20:09 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cpu.c,v 1.53 2020/12/07 10:57:41 jmcneill Exp $");
 
 #include 
 #include 
@@ -44,7 +44,10 @@ __KERNEL_RCSID(0, "$NetBSD: acpi_cpu.c,v
 #include 
 
 #include 
+
+#if defined(__i386__) || defined(__x86_64__)
 #include 
+#endif
 
 #define _COMPONENT	  ACPI_BUS_COMPONENT
 ACPI_MODULE_NAME	  ("acpi_cpu")
@@ -171,7 +174,7 @@ acpicpu_attach(device_t parent, device_t
 
 	rv = acpicpu_object(sc->sc_node->ad_handle, >sc_object);
 
-	if (ACPI_FAILURE(rv))
+	if (ACPI_FAILURE(rv) && rv != AE_TYPE)
 		

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

2020-12-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Dec  7 10:56:12 UTC 2020

Modified Files:
src/sys/arch/aarch64/include: cpu.h

Log Message:
ACPI Processor UID is 32-bits (ci_acpiid).


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/aarch64/include/cpu.h

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

Modified files:

Index: src/sys/arch/aarch64/include/cpu.h
diff -u src/sys/arch/aarch64/include/cpu.h:1.29 src/sys/arch/aarch64/include/cpu.h:1.30
--- src/sys/arch/aarch64/include/cpu.h:1.29	Sat Nov 21 11:43:59 2020
+++ src/sys/arch/aarch64/include/cpu.h	Mon Dec  7 10:56:12 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.29 2020/11/21 11:43:59 jmcneill Exp $ */
+/* $NetBSD: cpu.h,v 1.30 2020/12/07 10:56:12 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2014, 2020 The NetBSD Foundation, Inc.
@@ -122,7 +122,7 @@ struct cpu_info {
 	uint64_t ci_gic_sgir;	/* GICv3 SGIR target */
 
 	/* ACPI */
-	uint64_t ci_acpiid;	/* ACPI Processor Unique ID */
+	uint32_t ci_acpiid;	/* ACPI Processor Unique ID */
 
 	struct aarch64_sysctl_cpu_id ci_id;
 



CVS commit: src/sbin/atactl

2020-12-07 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Dec  7 10:36:19 UTC 2020

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

Log Message:
micron SMART 202 is percent lifetime used not remaining.

almost gave myself a heart attack when my server said 7% remaining!


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/sbin/atactl/atactl.c

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

Modified files:

Index: src/sbin/atactl/atactl.c
diff -u src/sbin/atactl/atactl.c:1.83 src/sbin/atactl/atactl.c:1.84
--- src/sbin/atactl/atactl.c:1.83	Thu May 30 21:32:08 2019
+++ src/sbin/atactl/atactl.c	Mon Dec  7 10:36:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: atactl.c,v 1.83 2019/05/30 21:32:08 mlelstv Exp $	*/
+/*	$NetBSD: atactl.c,v 1.84 2020/12/07 10:36:19 mrg Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2019 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: atactl.c,v 1.83 2019/05/30 21:32:08 mlelstv Exp $");
+__RCSID("$NetBSD: atactl.c,v 1.84 2020/12/07 10:36:19 mrg Exp $");
 #endif
 
 
@@ -418,7 +418,7 @@ static const struct attr_table micron_sm
 	{ 189,  "Factory bad block count", NULL },
 	{ 197,		"Current pending ECC count", NULL },
 	{ 198,		"SMART offline scan uncorrectable error count", NULL },
-	{ 202,		"Percent lifetime remaining", NULL },
+	{ 202,		"Percent lifetime used", NULL },
 	{ 206,		"Write error rate", NULL },
 	{ 247,		"Number of NAND pages of data written by the host", NULL },
 	{ 248,		"Number of NAND pages written by the FTL", NULL },



CVS commit: src/sys/dev/acpi

2020-12-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Dec  7 10:02:51 UTC 2020

Modified Files:
src/sys/dev/acpi: ahcisata_acpi.c amdccp_acpi.c atppc_acpi.c
dwiic_acpi.c ehci_acpi.c fdc_acpi.c genet_acpi.c lpt_acpi.c
mpu_acpi.c plgpio_acpi.c spic_acpi.c virtio_acpi.c wb_acpi.c
xhci_acpi.c

Log Message:
Fix 32-bit build.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/acpi/ahcisata_acpi.c \
src/sys/dev/acpi/plgpio_acpi.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/acpi/amdccp_acpi.c \
src/sys/dev/acpi/dwiic_acpi.c src/sys/dev/acpi/ehci_acpi.c \
src/sys/dev/acpi/virtio_acpi.c
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/acpi/atppc_acpi.c
cvs rdiff -u -r1.44 -r1.45 src/sys/dev/acpi/fdc_acpi.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/acpi/genet_acpi.c
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/acpi/lpt_acpi.c
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/acpi/mpu_acpi.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/acpi/spic_acpi.c
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/acpi/wb_acpi.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/acpi/xhci_acpi.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/ahcisata_acpi.c
diff -u src/sys/dev/acpi/ahcisata_acpi.c:1.5 src/sys/dev/acpi/ahcisata_acpi.c:1.6
--- src/sys/dev/acpi/ahcisata_acpi.c:1.5	Wed Apr 15 19:26:51 2020
+++ src/sys/dev/acpi/ahcisata_acpi.c	Mon Dec  7 10:02:51 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ahcisata_acpi.c,v 1.5 2020/04/15 19:26:51 jmcneill Exp $ */
+/* $NetBSD: ahcisata_acpi.c,v 1.6 2020/12/07 10:02:51 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ahcisata_acpi.c,v 1.5 2020/04/15 19:26:51 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahcisata_acpi.c,v 1.6 2020/12/07 10:02:51 jmcneill Exp $");
 
 #include 
 #include 
@@ -112,7 +112,8 @@ ahcisata_acpi_attach(device_t parent, de
 		sc->sc_dmat = aa->aa_dmat;
 	}
 
-	ih = acpi_intr_establish(self, (uint64_t)aa->aa_node->ad_handle,
+	ih = acpi_intr_establish(self,
+	(uint64_t)(uintptr_t)aa->aa_node->ad_handle,
 	IPL_BIO, false, ahci_intr, sc, device_xname(self));
 	if (ih == NULL) {
 		aprint_error_dev(self, "couldn't install interrupt handler\n");
Index: src/sys/dev/acpi/plgpio_acpi.c
diff -u src/sys/dev/acpi/plgpio_acpi.c:1.5 src/sys/dev/acpi/plgpio_acpi.c:1.6
--- src/sys/dev/acpi/plgpio_acpi.c:1.5	Fri Nov 23 14:08:40 2018
+++ src/sys/dev/acpi/plgpio_acpi.c	Mon Dec  7 10:02:51 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: plgpio_acpi.c,v 1.5 2018/11/23 14:08:40 jmcneill Exp $ */
+/* $NetBSD: plgpio_acpi.c,v 1.6 2020/12/07 10:02:51 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: plgpio_acpi.c,v 1.5 2018/11/23 14:08:40 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: plgpio_acpi.c,v 1.6 2020/12/07 10:02:51 jmcneill Exp $");
 
 #include 
 #include 
@@ -131,7 +131,8 @@ plgpio_acpi_attach(device_t parent, devi
 		goto done;
 	}
 
-	ih = acpi_intr_establish(self, (uint64_t)asc->sc_handle,
+	ih = acpi_intr_establish(self,
+	(uint64_t)(uintptr_t)asc->sc_handle,
 	IPL_VM, false, plgpio_acpi_intr, asc, device_xname(self));
 	if (ih == NULL)
 		aprint_error_dev(self, "couldn't establish interrupt\n");

Index: src/sys/dev/acpi/amdccp_acpi.c
diff -u src/sys/dev/acpi/amdccp_acpi.c:1.3 src/sys/dev/acpi/amdccp_acpi.c:1.4
--- src/sys/dev/acpi/amdccp_acpi.c:1.3	Sun Dec  6 12:23:13 2020
+++ src/sys/dev/acpi/amdccp_acpi.c	Mon Dec  7 10:02:51 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: amdccp_acpi.c,v 1.3 2020/12/06 12:23:13 jmcneill Exp $ */
+/* $NetBSD: amdccp_acpi.c,v 1.4 2020/12/07 10:02:51 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2018 Jonathan A. Kollasch
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amdccp_acpi.c,v 1.3 2020/12/06 12:23:13 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdccp_acpi.c,v 1.4 2020/12/07 10:02:51 jmcneill Exp $");
 
 #include 
 #include 
@@ -95,7 +95,8 @@ amdccp_acpi_attach(device_t parent, devi
 	}
 
 #if notyet
-	ih = acpi_intr_establish(self, (uint64_t)aa->aa_node->ad_handle,
+	ih = acpi_intr_establish(self,
+	(uint64_t)(uintptr_t)aa->aa_node->ad_handle,
 	IPL_VM, true, amdccp_intr, sc, device_xname(self));
 	if (ih == NULL) {
 		aprint_error_dev(self, "couldn't install interrupt handler\n");
Index: src/sys/dev/acpi/dwiic_acpi.c
diff -u src/sys/dev/acpi/dwiic_acpi.c:1.3 src/sys/dev/acpi/dwiic_acpi.c:1.4
--- src/sys/dev/acpi/dwiic_acpi.c:1.3	Mon Sep 23 08:50:52 2019
+++ src/sys/dev/acpi/dwiic_acpi.c	Mon Dec  7 10:02:51 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: dwiic_acpi.c,v 1.3 2019/09/23 08:50:52 jmcneill Exp $ */
+/* $NetBSD: dwiic_acpi.c,v 1.4 2020/12/07 10:02:51 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwiic_acpi.c,v 1.3 2019/09/23 08:50:52 

CVS commit: src/external/gpl3/gdb/lib

2020-12-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Dec  7 08:31:07 UTC 2020

Added Files:
src/external/gpl3/gdb/lib/libbfd/arch/aarch64eb: bfd-in3.h bfd.h
bfd_stdint.h bfdver.h config.h defs.mk targmatch.h
src/external/gpl3/gdb/lib/libctf/arch/aarch64eb: config.h defs.mk
src/external/gpl3/gdb/lib/libdecnumber/arch/aarch64eb: config.h defs.mk
gstdint.h
src/external/gpl3/gdb/lib/libgdb/arch/aarch64eb: config.h defs.mk
init.c jit-reader.h version.c xml-builtin.c
src/external/gpl3/gdb/lib/libgdbsupport/arch/aarch64eb: defs.mk
src/external/gpl3/gdb/lib/libgdbsupport/arch/aarch64eb/gdbsupport:
config.h
src/external/gpl3/gdb/lib/libgnulib/arch/aarch64eb: defs.mk
src/external/gpl3/gdb/lib/libgnulib/arch/aarch64eb/gnulib: config.h
src/external/gpl3/gdb/lib/libgnulib/arch/aarch64eb/gnulib/import:
alloca.h ctype.h dirent.h fcntl.h fnmatch.h glob.h inttypes.h
limits.h locale.h math.h signal.h stdint.h stdio.h stdlib.h
string.h time.h unistd.h wchar.h wctype.h
src/external/gpl3/gdb/lib/libiberty/arch/aarch64eb: config.h defs.mk
src/external/gpl3/gdb/lib/libopcodes/arch/aarch64eb: config.h defs.mk
src/external/gpl3/gdb/lib/libreadline/arch/aarch64eb: config.h defs.mk

Log Message:
mknative for aarch64eb.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 \
src/external/gpl3/gdb/lib/libbfd/arch/aarch64eb/bfd-in3.h \
src/external/gpl3/gdb/lib/libbfd/arch/aarch64eb/bfd.h \
src/external/gpl3/gdb/lib/libbfd/arch/aarch64eb/bfd_stdint.h \
src/external/gpl3/gdb/lib/libbfd/arch/aarch64eb/bfdver.h \
src/external/gpl3/gdb/lib/libbfd/arch/aarch64eb/config.h \
src/external/gpl3/gdb/lib/libbfd/arch/aarch64eb/defs.mk \
src/external/gpl3/gdb/lib/libbfd/arch/aarch64eb/targmatch.h
cvs rdiff -u -r0 -r1.1 \
src/external/gpl3/gdb/lib/libctf/arch/aarch64eb/config.h \
src/external/gpl3/gdb/lib/libctf/arch/aarch64eb/defs.mk
cvs rdiff -u -r0 -r1.1 \
src/external/gpl3/gdb/lib/libdecnumber/arch/aarch64eb/config.h \
src/external/gpl3/gdb/lib/libdecnumber/arch/aarch64eb/defs.mk \
src/external/gpl3/gdb/lib/libdecnumber/arch/aarch64eb/gstdint.h
cvs rdiff -u -r0 -r1.1 \
src/external/gpl3/gdb/lib/libgdb/arch/aarch64eb/config.h \
src/external/gpl3/gdb/lib/libgdb/arch/aarch64eb/defs.mk \
src/external/gpl3/gdb/lib/libgdb/arch/aarch64eb/init.c \
src/external/gpl3/gdb/lib/libgdb/arch/aarch64eb/jit-reader.h \
src/external/gpl3/gdb/lib/libgdb/arch/aarch64eb/version.c \
src/external/gpl3/gdb/lib/libgdb/arch/aarch64eb/xml-builtin.c
cvs rdiff -u -r0 -r1.1 \
src/external/gpl3/gdb/lib/libgdbsupport/arch/aarch64eb/defs.mk
cvs rdiff -u -r0 -r1.1 \
src/external/gpl3/gdb/lib/libgdbsupport/arch/aarch64eb/gdbsupport/config.h
cvs rdiff -u -r0 -r1.1 \
src/external/gpl3/gdb/lib/libgnulib/arch/aarch64eb/defs.mk
cvs rdiff -u -r0 -r1.1 \
src/external/gpl3/gdb/lib/libgnulib/arch/aarch64eb/gnulib/config.h
cvs rdiff -u -r0 -r1.1 \
src/external/gpl3/gdb/lib/libgnulib/arch/aarch64eb/gnulib/import/alloca.h \
src/external/gpl3/gdb/lib/libgnulib/arch/aarch64eb/gnulib/import/ctype.h \
src/external/gpl3/gdb/lib/libgnulib/arch/aarch64eb/gnulib/import/dirent.h \
src/external/gpl3/gdb/lib/libgnulib/arch/aarch64eb/gnulib/import/fcntl.h \
src/external/gpl3/gdb/lib/libgnulib/arch/aarch64eb/gnulib/import/fnmatch.h \
src/external/gpl3/gdb/lib/libgnulib/arch/aarch64eb/gnulib/import/glob.h \
src/external/gpl3/gdb/lib/libgnulib/arch/aarch64eb/gnulib/import/inttypes.h 
\
src/external/gpl3/gdb/lib/libgnulib/arch/aarch64eb/gnulib/import/limits.h \
src/external/gpl3/gdb/lib/libgnulib/arch/aarch64eb/gnulib/import/locale.h \
src/external/gpl3/gdb/lib/libgnulib/arch/aarch64eb/gnulib/import/math.h \
src/external/gpl3/gdb/lib/libgnulib/arch/aarch64eb/gnulib/import/signal.h \
src/external/gpl3/gdb/lib/libgnulib/arch/aarch64eb/gnulib/import/stdint.h \
src/external/gpl3/gdb/lib/libgnulib/arch/aarch64eb/gnulib/import/stdio.h \
src/external/gpl3/gdb/lib/libgnulib/arch/aarch64eb/gnulib/import/stdlib.h \
src/external/gpl3/gdb/lib/libgnulib/arch/aarch64eb/gnulib/import/string.h \
src/external/gpl3/gdb/lib/libgnulib/arch/aarch64eb/gnulib/import/time.h \
src/external/gpl3/gdb/lib/libgnulib/arch/aarch64eb/gnulib/import/unistd.h \
src/external/gpl3/gdb/lib/libgnulib/arch/aarch64eb/gnulib/import/wchar.h \
src/external/gpl3/gdb/lib/libgnulib/arch/aarch64eb/gnulib/import/wctype.h
cvs rdiff -u -r0 -r1.1 \
src/external/gpl3/gdb/lib/libiberty/arch/aarch64eb/config.h \
src/external/gpl3/gdb/lib/libiberty/arch/aarch64eb/defs.mk
cvs rdiff -u -r0 -r1.1 \
src/external/gpl3/gdb/lib/libopcodes/arch/aarch64eb/config.h \
src/external/gpl3/gdb/lib/libopcodes/arch/aarch64eb/defs.mk
cvs rdiff -u -r0 -r1.1 \

CVS commit: src/external/gpl3/gdb/lib/libbfd

2020-12-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Dec  7 08:24:09 UTC 2020

Modified Files:
src/external/gpl3/gdb/lib/libbfd: Makefile

Log Message:
Add elf32-aarch64.c to DPSRCS and CLEANFILES.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/external/gpl3/gdb/lib/libbfd/Makefile

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

Modified files:

Index: src/external/gpl3/gdb/lib/libbfd/Makefile
diff -u src/external/gpl3/gdb/lib/libbfd/Makefile:1.11 src/external/gpl3/gdb/lib/libbfd/Makefile:1.12
--- src/external/gpl3/gdb/lib/libbfd/Makefile:1.11	Sat Dec  5 21:27:06 2020
+++ src/external/gpl3/gdb/lib/libbfd/Makefile	Mon Dec  7 08:24:09 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.11 2020/12/05 21:27:06 christos Exp $
+#	$NetBSD: Makefile,v 1.12 2020/12/07 08:24:09 rin Exp $
 
 .include 
 .include "../Makefile.inc"
@@ -20,10 +20,10 @@ GSRCS=		${G_libbfd_la_OBJECTS:libbfd.lo=
 SRCS=		${GSRCS:.lo=.c}
 
 DPSRCS+=	elf32-target.h elf64-target.h targmatch.h \
-		elf32-ia64.c elf64-ia64.c elf64-aarch64.c \
+		elf32-ia64.c elf64-ia64.c elf64-aarch64.c elf32-aarch64.c \
 		peigen.c pex64igen.c
 CLEANFILES+=	elf32-target.h elf64-target.h targmatch.h \
-		elf32-ia64.c elf64-ia64.c elf64-aarch64.c \
+		elf32-ia64.c elf64-ia64.c elf64-aarch64.c elf32-aarch64.c \
 		peigen.c pex64igen.c
 
 .PATH: ${DIST}/bfd