CVS commit: src/usr.bin/make

2020-12-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 27 05:16:26 UTC 2020

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

Log Message:
make(1): re-export variables from the actual make process

Since make uses vfork if available, re-exporting the variables happens
in the address space of the main process anyway, so there is no point in
mentioning anything about "our client process" anywhere.


To generate a diff of this commit:
cvs rdiff -u -r1.216 -r1.217 src/usr.bin/make/compat.c
cvs rdiff -u -r1.389 -r1.390 src/usr.bin/make/job.c
cvs rdiff -u -r1.503 -r1.504 src/usr.bin/make/main.c

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

Modified files:

Index: src/usr.bin/make/compat.c
diff -u src/usr.bin/make/compat.c:1.216 src/usr.bin/make/compat.c:1.217
--- src/usr.bin/make/compat.c:1.216	Sun Dec 20 21:07:32 2020
+++ src/usr.bin/make/compat.c	Sun Dec 27 05:16:26 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat.c,v 1.216 2020/12/20 21:07:32 rillig Exp $	*/
+/*	$NetBSD: compat.c,v 1.217 2020/12/27 05:16:26 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -96,7 +96,7 @@
 #include "pathnames.h"
 
 /*	"@(#)compat.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: compat.c,v 1.216 2020/12/20 21:07:32 rillig Exp $");
+MAKE_RCSID("$NetBSD: compat.c,v 1.217 2020/12/27 05:16:26 rillig Exp $");
 
 static GNode *curTarg = NULL;
 static pid_t compatChild;
@@ -350,6 +350,8 @@ Compat_RunCommand(const char *cmdp, GNod
 	}
 #endif
 
+	Var_ReexportVars();
+
 	/*
 	 * Fork and execute the single command. If the fork fails, we abort.
 	 */
@@ -358,7 +360,6 @@ Compat_RunCommand(const char *cmdp, GNod
 		Fatal("Could not fork");
 	}
 	if (cpid == 0) {
-		Var_ReexportVars();
 #ifdef USE_META
 		if (useMeta) {
 			meta_compat_child();

Index: src/usr.bin/make/job.c
diff -u src/usr.bin/make/job.c:1.389 src/usr.bin/make/job.c:1.390
--- src/usr.bin/make/job.c:1.389	Sun Dec 20 21:07:32 2020
+++ src/usr.bin/make/job.c	Sun Dec 27 05:16:26 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.389 2020/12/20 21:07:32 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.390 2020/12/27 05:16:26 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.389 2020/12/20 21:07:32 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.390 2020/12/27 05:16:26 rillig Exp $");
 
 /*
  * A shell defines how the commands are run.  All commands for a target are
@@ -1380,6 +1380,8 @@ JobExec(Job *job, char **argv)
 	/* Pre-emptively mark job running, pid still zero though */
 	job->status = JOB_ST_RUNNING;
 
+	Var_ReexportVars();
+
 	cpid = vFork();
 	if (cpid == -1)
 		Punt("Cannot vfork: %s", strerror(errno));
@@ -1461,8 +1463,6 @@ JobExec(Job *job, char **argv)
 #  endif
 #endif
 
-		Var_ReexportVars();
-
 		(void)execv(shellPath, argv);
 		execDie("exec", shellPath);
 	}

Index: src/usr.bin/make/main.c
diff -u src/usr.bin/make/main.c:1.503 src/usr.bin/make/main.c:1.504
--- src/usr.bin/make/main.c:1.503	Sat Dec 26 03:54:48 2020
+++ src/usr.bin/make/main.c	Sun Dec 27 05:16:26 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.503 2020/12/26 03:54:48 sjg Exp $	*/
+/*	$NetBSD: main.c,v 1.504 2020/12/27 05:16:26 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
 #include "trace.h"
 
 /*	"@(#)main.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: main.c,v 1.503 2020/12/26 03:54:48 sjg Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.504 2020/12/27 05:16:26 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	"The Regents of the University of California.  "
@@ -1775,6 +1775,8 @@ Cmd_Exec(const char *cmd, const char **e
 		goto bad;
 	}
 
+	Var_ReexportVars();
+
 	/*
 	 * Fork
 	 */
@@ -1790,8 +1792,6 @@ Cmd_Exec(const char *cmd, const char **e
 		(void)dup2(pipefds[1], 1);
 		(void)close(pipefds[1]);
 
-		Var_ReexportVars();
-
 		(void)execv(shellPath, UNCONST(args));
 		_exit(1);
 		/*NOTREACHED*/



CVS commit: src

2020-12-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 27 05:11:40 UTC 2020

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

Log Message:
make(1): add test for expansion errors in jobs mode

Since compat mode and jobs mode are implemented separately and vary in
lots of small details, each of them needs to be tested on its own.


To generate a diff of this commit:
cvs rdiff -u -r1.996 -r1.997 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.256 -r1.257 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/cmd-errors-jobs.exp \
src/usr.bin/make/unit-tests/cmd-errors-jobs.mk
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/cmd-errors.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.996 src/distrib/sets/lists/tests/mi:1.997
--- src/distrib/sets/lists/tests/mi:1.996	Sat Dec 19 16:00:17 2020
+++ src/distrib/sets/lists/tests/mi	Sun Dec 27 05:11:40 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.996 2020/12/19 16:00:17 rillig Exp $
+# $NetBSD: mi,v 1.997 2020/12/27 05:11:40 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -4818,6 +4818,8 @@
 ./usr/tests/usr.bin/make/unit-tests/archive-suffix.mktests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/archive.exp	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/archive.mk	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/cmd-errors-jobs.exptests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/cmd-errors-jobs.mktests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/cmd-errors-lint.exptests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/cmd-errors-lint.mktests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/cmd-errors.exptests-usr.bin-tests	compattestfile,atf

Index: src/usr.bin/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.256 src/usr.bin/make/unit-tests/Makefile:1.257
--- src/usr.bin/make/unit-tests/Makefile:1.256	Mon Dec 21 20:47:29 2020
+++ src/usr.bin/make/unit-tests/Makefile	Sun Dec 27 05:11:40 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.256 2020/12/21 20:47:29 rillig Exp $
+# $NetBSD: Makefile,v 1.257 2020/12/27 05:11:40 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -42,6 +42,7 @@
 TESTS+=		archive
 TESTS+=		archive-suffix
 TESTS+=		cmd-errors
+TESTS+=		cmd-errors-jobs
 TESTS+=		cmd-errors-lint
 TESTS+=		cmd-interrupt
 TESTS+=		cmdline

Index: src/usr.bin/make/unit-tests/cmd-errors.mk
diff -u src/usr.bin/make/unit-tests/cmd-errors.mk:1.3 src/usr.bin/make/unit-tests/cmd-errors.mk:1.4
--- src/usr.bin/make/unit-tests/cmd-errors.mk:1.3	Mon Nov  9 23:36:34 2020
+++ src/usr.bin/make/unit-tests/cmd-errors.mk	Sun Dec 27 05:11:40 2020
@@ -1,7 +1,7 @@
-# $NetBSD: cmd-errors.mk,v 1.3 2020/11/09 23:36:34 rillig Exp $
+# $NetBSD: cmd-errors.mk,v 1.4 2020/12/27 05:11:40 rillig Exp $
 #
 # Demonstrate how errors in variable expansions affect whether the commands
-# are actually executed.
+# are actually executed in compat mode.
 
 all: undefined unclosed-variable unclosed-modifier unknown-modifier end
 

Added files:

Index: src/usr.bin/make/unit-tests/cmd-errors-jobs.exp
diff -u /dev/null src/usr.bin/make/unit-tests/cmd-errors-jobs.exp:1.1
--- /dev/null	Sun Dec 27 05:11:41 2020
+++ src/usr.bin/make/unit-tests/cmd-errors-jobs.exp	Sun Dec 27 05:11:40 2020
@@ -0,0 +1,9 @@
+: undefined  eol
+make: Unclosed variable "UNCLOSED"
+: unclosed-variable 
+make: Unclosed variable expression (expecting '}') for "UNCLOSED"
+: unclosed-modifier 
+make: Unknown modifier 'Z'
+: unknown-modifier  eol
+: end eol
+exit status 0
Index: src/usr.bin/make/unit-tests/cmd-errors-jobs.mk
diff -u /dev/null src/usr.bin/make/unit-tests/cmd-errors-jobs.mk:1.1
--- /dev/null	Sun Dec 27 05:11:41 2020
+++ src/usr.bin/make/unit-tests/cmd-errors-jobs.mk	Sun Dec 27 05:11:40 2020
@@ -0,0 +1,32 @@
+# $NetBSD: cmd-errors-jobs.mk,v 1.1 2020/12/27 05:11:40 rillig Exp $
+#
+# Demonstrate how errors in variable expansions affect whether the commands
+# are actually executed in jobs mode.
+
+.MAKEFLAGS: -j1
+
+all: undefined unclosed-variable unclosed-modifier unknown-modifier end
+
+# Undefined variables are not an error.  They expand to empty strings.
+undefined:
+	: $@ ${UNDEFINED} eol
+
+# XXX: As of 2020-11-01, this command is executed even though it contains
+# parse errors.
+unclosed-variable:
+	: $@ ${UNCLOSED
+
+# XXX: As of 2020-11-01, this command is executed even though it contains
+# parse errors.
+unclosed-modifier:
+	: $@ ${UNCLOSED:
+
+# XXX: As of 2020-11-01, this command is 

CVS commit: src/usr.bin/make

2020-12-26 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 27 05:06:18 UTC 2020

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

Log Message:
make(1): align names of VarExportMode with the directives


To generate a diff of this commit:
cvs rdiff -u -r1.181 -r1.182 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.516 -r1.517 src/usr.bin/make/parse.c
cvs rdiff -u -r1.764 -r1.765 src/usr.bin/make/var.c

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

Modified files:

Index: src/usr.bin/make/nonints.h
diff -u src/usr.bin/make/nonints.h:1.181 src/usr.bin/make/nonints.h:1.182
--- src/usr.bin/make/nonints.h:1.181	Tue Dec 22 20:10:21 2020
+++ src/usr.bin/make/nonints.h	Sun Dec 27 05:06:17 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nonints.h,v 1.181 2020/12/22 20:10:21 rillig Exp $	*/
+/*	$NetBSD: nonints.h,v 1.182 2020/12/27 05:06:17 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -387,9 +387,9 @@ typedef enum VarParseResult {
 
 typedef enum VarExportMode {
 	/* .export-env */
-	VEM_NORMAL,
+	VEM_ENV,
 	/* .export: Initial export or update an already exported variable. */
-	VEM_PARENT,
+	VEM_PLAIN,
 	/* .export-literal: Do not expand the variable value. */
 	VEM_LITERAL
 } VarExportMode;

Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.516 src/usr.bin/make/parse.c:1.517
--- src/usr.bin/make/parse.c:1.516	Wed Dec 23 14:13:49 2020
+++ src/usr.bin/make/parse.c	Sun Dec 27 05:06:17 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.516 2020/12/23 14:13:49 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.517 2020/12/27 05:06:17 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -117,7 +117,7 @@
 #include "pathnames.h"
 
 /*	"@(#)parse.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: parse.c,v 1.516 2020/12/23 14:13:49 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.517 2020/12/27 05:06:17 rillig Exp $");
 
 /* types and constants */
 
@@ -3056,10 +3056,10 @@ ParseDirective(char *line)
 		Var_Undef(cp);
 		return TRUE;
 	} else if (IsDirective(dir, dirlen, "export")) {
-		Var_Export(VEM_PARENT, arg);
+		Var_Export(VEM_PLAIN, arg);
 		return TRUE;
 	} else if (IsDirective(dir, dirlen, "export-env")) {
-		Var_Export(VEM_NORMAL, arg);
+		Var_Export(VEM_ENV, arg);
 		return TRUE;
 	} else if (IsDirective(dir, dirlen, "export-literal")) {
 		Var_Export(VEM_LITERAL, arg);

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.764 src/usr.bin/make/var.c:1.765
--- src/usr.bin/make/var.c:1.764	Wed Dec 23 13:50:54 2020
+++ src/usr.bin/make/var.c	Sun Dec 27 05:06:17 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.764 2020/12/23 13:50:54 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.765 2020/12/27 05:06:17 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -131,7 +131,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.764 2020/12/23 13:50:54 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.765 2020/12/27 05:06:17 rillig Exp $");
 
 typedef enum VarFlags {
 	VAR_NONE	= 0,
@@ -586,7 +586,11 @@ MayExport(const char *name)
 static Boolean
 ExportVar(const char *name, VarExportMode mode)
 {
-	Boolean parent = mode == VEM_PARENT;
+	/*
+	 * XXX: It sounds wrong to handle VEM_PLAIN and VEM_LITERAL
+	 * differently here.
+	 */
+	Boolean plain = mode == VEM_PLAIN;
 	Var *v;
 	char *val;
 
@@ -597,14 +601,14 @@ ExportVar(const char *name, VarExportMod
 	if (v == NULL)
 		return FALSE;
 
-	if (!parent && (v->flags & VAR_EXPORTED) && !(v->flags & VAR_REEXPORT))
+	if (!plain && (v->flags & VAR_EXPORTED) && !(v->flags & VAR_REEXPORT))
 		return FALSE;	/* nothing to do */
 
 	val = Buf_GetAll(&v->val, NULL);
 	if (mode != VEM_LITERAL && strchr(val, '$') != NULL) {
 		char *expr;
 
-		if (parent) {
+		if (plain) {
 			/*
 			 * Flag the variable as something we need to re-export.
 			 * No point actually exporting it now though,
@@ -629,21 +633,22 @@ ExportVar(const char *name, VarExportMod
 		free(val);
 		free(expr);
 	} else {
-		if (parent)
+		if (plain)
 			v->flags &= ~(unsigned)VAR_REEXPORT; /* once will do */
-		if (parent || !(v->flags & VAR_EXPORTED))
+		if (plain || !(v->flags & VAR_EXPORTED))
 			setenv(name, val, 1);
 	}
 
 	/* This is so Var_Set knows to call Var_Export again. */
-	if (parent)
+	if (plain)
 		v->flags |= VAR_EXPORTED;
 
 	return TRUE;
 }
 
 /*
- * This gets called from our child processes.
+ * Actually export the variables that have been marked as needing to be
+ * re-exported.
  */
 void
 Var_ReexportVars(void)
@@ -670,7 +675,7 @@ Var_ReexportVars(void)
 		HashIter_Init(&hi, &VAR_GLOBAL->vars);
 		while (HashIter_Next(&hi) != NULL) {
 			Var *var = hi.entry->value;
-			ExportVar(var->name.str, VEM_NORMAL);
+			ExportVar(var->name.str, VEM_ENV);
 		}
 		return;
 	}
@@ -683,7 +688,7 @@ Var_ReexportVars(void)
 		size_t i;
 
 		for (i = 0; i < words.len; i++)
-			ExportVar(words.words[i], VEM_NORMAL);
+			ExportVar(words.words[i], VEM_EN

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

2020-12-26 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Dec 26 22:28:35 UTC 2020

Removed Files:
src/sys/arch/arm/imx: imx7_ccmreg.h imx7_ccmvar.h imx7_gpcreg.h
imx7_iomuxreg.h imx7_ocotpreg.h imx7_srcreg.h imx7_usbreg.h
imx7var.h

Log Message:
G/C


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r0 src/sys/arch/arm/imx/imx7_ccmreg.h \
src/sys/arch/arm/imx/imx7_gpcreg.h src/sys/arch/arm/imx/imx7_srcreg.h \
src/sys/arch/arm/imx/imx7_usbreg.h
cvs rdiff -u -r1.1 -r0 src/sys/arch/arm/imx/imx7_ccmvar.h \
src/sys/arch/arm/imx/imx7_iomuxreg.h src/sys/arch/arm/imx/imx7_ocotpreg.h
cvs rdiff -u -r1.3 -r0 src/sys/arch/arm/imx/imx7var.h

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



CVS commit: src/sys/dev/usb

2020-12-26 Thread Jean-Yves Migeon
Module Name:src
Committed By:   jym
Date:   Sat Dec 26 22:15:37 UTC 2020

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

Log Message:
Add WayTech USB to Serial device to quirks routines, in order to prevent
uhid(4) from attaching and leave it to ugen(4) so libusb can query it.

It is used by some UPS peripherals for their management, especially the
ones from Infosec and Megatec.

Tested with Infosec E3 UPS through ups-nut-usb and `blazer_usb' driver
using the following configuration (ups.conf):

[infosec]
driver = blazer_usb
port = auto
vendorid = 0665
productid = 5161

Make sure the associated /dev/ugenXXX is accessible to `nut' user if you
use ups-nut.


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 src/sys/dev/usb/usb_quirks.c

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

Modified files:

Index: src/sys/dev/usb/usb_quirks.c
diff -u src/sys/dev/usb/usb_quirks.c:1.95 src/sys/dev/usb/usb_quirks.c:1.96
--- src/sys/dev/usb/usb_quirks.c:1.95	Sat Mar 14 03:01:36 2020
+++ src/sys/dev/usb/usb_quirks.c	Sat Dec 26 22:15:37 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb_quirks.c,v 1.95 2020/03/14 03:01:36 christos Exp $	*/
+/*	$NetBSD: usb_quirks.c,v 1.96 2020/12/26 22:15:37 jym Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/usb_quirks.c,v 1.30 2003/01/02 04:15:55 imp Exp $	*/
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usb_quirks.c,v 1.95 2020/03/14 03:01:36 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_quirks.c,v 1.96 2020/12/26 22:15:37 jym Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -206,6 +206,8 @@ Static const struct usbd_quirk_entry {
 	{ UQ_HID_IGNORE, NULL }},
  { USB_VENDOR_XRITE,		ANY,	ANY,
 	{ UQ_HID_IGNORE, NULL }},
+ { USB_VENDOR_WAYTECH,		USB_PRODUCT_WAYTECH_USB2SERIAL,		ANY,
+	{ UQ_HID_IGNORE, NULL }},
  { USB_VENDOR_KYE,		USB_PRODUCT_KYE_NICHE,			0x100,
 	{ UQ_NO_SET_PROTO, NULL }},
  { USB_VENDOR_INSIDEOUT,	USB_PRODUCT_INSIDEOUT_EDGEPORT4,	0x094,



CVS commit: src/sys/dev/usb

2020-12-26 Thread Jean-Yves Migeon
Module Name:src
Committed By:   jym
Date:   Sat Dec 26 22:09:18 UTC 2020

Modified Files:
src/sys/dev/usb: usbdevs

Log Message:
Add WayTech Development USB to Serial product.

It is used by some UPS devices, notably Infosec and Megatec.

The vendor ID (0x0665) is known differently from various mainstream OSes;
but it is officially registered by USB-IF as `WayTech Development, Inc.'. So
be it.


To generate a diff of this commit:
cvs rdiff -u -r1.786 -r1.787 src/sys/dev/usb/usbdevs

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

Modified files:

Index: src/sys/dev/usb/usbdevs
diff -u src/sys/dev/usb/usbdevs:1.786 src/sys/dev/usb/usbdevs:1.787
--- src/sys/dev/usb/usbdevs:1.786	Mon Sep  7 06:32:13 2020
+++ src/sys/dev/usb/usbdevs	Sat Dec 26 22:09:18 2020
@@ -1,4 +1,4 @@
-$NetBSD: usbdevs,v 1.786 2020/09/07 06:32:13 ryoon Exp $
+$NetBSD: usbdevs,v 1.787 2020/12/26 22:09:18 jym Exp $
 
 /*-
  * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
@@ -250,6 +250,7 @@ vendor AVISION		0x0638	Avision
 vendor TEAC		0x0644	TEAC
 vendor SGI		0x065e	Silicon Graphics
 vendor SANWASUPPLY	0x0663	Sanwa Supply
+vendor WAYTECH		0x0665	WayTech Development, Inc.
 vendor LINKSYS		0x066b	Linksys
 vendor ACERSA		0x066e	Acer Semiconductor America
 vendor SIGMATEL		0x066f	Sigmatel
@@ -2231,6 +2232,9 @@ product MCT ML_4500		0x0302	ML-4500
 /* MediaGear products */
 product MEDIAGEAR READER9IN1	0x5003	USB2.0 9 in 1 Reader
 
+/* WayTech Development, Inc. products */
+product WAYTECH USB2SERIAL	0x5161	USB to Serial
+
 /* Meinberg Funkuhren products */
 product MEINBERG USB5131	0x0301	USB 5131 DCF77 - Radio Clock
 



CVS commit: src/sys/dev/ic

2020-12-26 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Dec 26 15:40:29 UTC 2020

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

Log Message:
ahci_intr: use ffs in the port bitmask instead of looping over all 32 bits


To generate a diff of this commit:
cvs rdiff -u -r1.88 -r1.89 src/sys/dev/ic/ahcisata_core.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/ahcisata_core.c
diff -u src/sys/dev/ic/ahcisata_core.c:1.88 src/sys/dev/ic/ahcisata_core.c:1.89
--- src/sys/dev/ic/ahcisata_core.c:1.88	Sat Dec 26 10:56:25 2020
+++ src/sys/dev/ic/ahcisata_core.c	Sat Dec 26 15:40:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahcisata_core.c,v 1.88 2020/12/26 10:56:25 jmcneill Exp $	*/
+/*	$NetBSD: ahcisata_core.c,v 1.89 2020/12/26 15:40:29 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.88 2020/12/26 10:56:25 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.89 2020/12/26 15:40:29 jmcneill Exp $");
 
 #include 
 #include 
@@ -592,17 +592,20 @@ int
 ahci_intr(void *v)
 {
 	struct ahci_softc *sc = v;
-	uint32_t is;
-	int i, r = 0;
+	uint32_t is, ports;
+	int bit, r = 0;
 
 	while ((is = AHCI_READ(sc, AHCI_IS))) {
 		AHCIDEBUG_PRINT(("%s ahci_intr 0x%x\n", AHCINAME(sc), is),
 		DEBUG_INTR);
 		r = 1;
 		AHCI_WRITE(sc, AHCI_IS, is);
-		for (i = 0; i < AHCI_MAX_PORTS; i++)
-			if (is & (1U << i))
-ahci_intr_port(&sc->sc_channels[i]);
+		ports = is;
+		while ((bit = ffs(ports)) != 0) {
+			bit--;
+			ahci_intr_port(&sc->sc_channels[bit]);
+			ports &= ~(1U << bit);
+		}
 	}
 
 	return r;



CVS commit: src/tests/lib/libossaudio

2020-12-26 Thread Andreas Gustafsson
Module Name:src
Committed By:   gson
Date:   Sat Dec 26 15:28:52 UTC 2020

Modified Files:
src/tests/lib/libossaudio: t_ossaudio.c

Log Message:
Disable the lib/libossaudio/t_ossaudio:oss_dsp_trigger_read test case
on sparc until PR port-sparc/55876 gets fixed.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libossaudio/t_ossaudio.c

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

Modified files:

Index: src/tests/lib/libossaudio/t_ossaudio.c
diff -u src/tests/lib/libossaudio/t_ossaudio.c:1.2 src/tests/lib/libossaudio/t_ossaudio.c:1.3
--- src/tests/lib/libossaudio/t_ossaudio.c:1.2	Mon Dec 14 10:58:08 2020
+++ src/tests/lib/libossaudio/t_ossaudio.c	Sat Dec 26 15:28:52 2020
@@ -292,6 +292,10 @@ ATF_TC_BODY(oss_dsp_trigger_read, tc)
 	struct audio_info info;
 	int fd, bits;
 
+#if defined(__sparc__)
+	atf_tc_skip("PR port-sparc/55876");
+#endif
+
 	if ((fd = open("/dev/audio", O_RDONLY)) == -1)
 		atf_tc_skip("Audio device unavailable for recording");
 



CVS commit: src/sys/dev

2020-12-26 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Sat Dec 26 14:50:50 UTC 2020

Modified Files:
src/sys/dev: fss.c

Log Message:
Check the return value of device_lookup_private against NULL.

Reported-by: syzbot+06561ba90b6e618ce...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.109 -r1.110 src/sys/dev/fss.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/fss.c
diff -u src/sys/dev/fss.c:1.109 src/sys/dev/fss.c:1.110
--- src/sys/dev/fss.c:1.109	Sun Feb 23 15:46:39 2020
+++ src/sys/dev/fss.c	Sat Dec 26 14:50:50 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: fss.c,v 1.109 2020/02/23 15:46:39 ad Exp $	*/
+/*	$NetBSD: fss.c,v 1.110 2020/12/26 14:50:50 nia Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.109 2020/02/23 15:46:39 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.110 2020/12/26 14:50:50 nia Exp $");
 
 #include 
 #include 
@@ -240,6 +240,9 @@ fss_close(dev_t dev, int flags, int mode
 	cfdata_t cf;
 	struct fss_softc *sc = device_lookup_private(&fss_cd, minor(dev));
 
+	if (sc == NULL)
+		return ENXIO;
+
 	mflag = (mode == S_IFCHR ? FSS_CDEV_OPEN : FSS_BDEV_OPEN);
 	error = 0;
 
@@ -283,6 +286,11 @@ fss_strategy(struct buf *bp)
 	const bool write = ((bp->b_flags & B_READ) != B_READ);
 	struct fss_softc *sc = device_lookup_private(&fss_cd, minor(bp->b_dev));
 
+	if (sc == NULL) {
+		bp->b_error = ENXIO;
+		goto done;
+	}
+
 	mutex_enter(&sc->sc_slock);
 
 	if (write || sc->sc_state != FSS_ACTIVE) {
@@ -303,7 +311,8 @@ fss_strategy(struct buf *bp)
 	return;
 
 done:
-	mutex_exit(&sc->sc_slock);
+	if (sc != NULL)
+		mutex_exit(&sc->sc_slock);
 	bp->b_resid = bp->b_bcount;
 	biodone(bp);
 }
@@ -333,6 +342,9 @@ fss_ioctl(dev_t dev, u_long cmd, void *d
 	struct fss_get50 *fsg50 = (struct fss_get50 *)data;
 #endif
 
+	if (sc == NULL)
+		return ENXIO;
+
 	switch (cmd) {
 	case FSSIOCSET50:
 		fss = &_fss;



CVS commit: src/sys/dev/ic

2020-12-26 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Dec 26 10:56:25 UTC 2020

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

Log Message:
AHCI 1.3.1 specification says that it is good practice for system software
to 'zero-out' the memory allocated and referenced by PxCLB and PxFB.


To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.88 src/sys/dev/ic/ahcisata_core.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/ahcisata_core.c
diff -u src/sys/dev/ic/ahcisata_core.c:1.87 src/sys/dev/ic/ahcisata_core.c:1.88
--- src/sys/dev/ic/ahcisata_core.c:1.87	Fri Dec 25 08:57:38 2020
+++ src/sys/dev/ic/ahcisata_core.c	Sat Dec 26 10:56:25 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahcisata_core.c,v 1.87 2020/12/25 08:57:38 skrll Exp $	*/
+/*	$NetBSD: ahcisata_core.c,v 1.88 2020/12/26 10:56:25 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.87 2020/12/25 08:57:38 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.88 2020/12/26 10:56:25 jmcneill Exp $");
 
 #include 
 #include 
@@ -363,6 +363,9 @@ ahci_attach(struct ahci_softc *sc)
 		return;
 	}
 	sc->sc_cmd_hdr = cmdhp;
+	memset(cmdhp, 0, dmasize);
+	bus_dmamap_sync(sc->sc_dmat, sc->sc_cmd_hdrd, 0, dmasize,
+	BUS_DMASYNC_PREWRITE);
 
 	ahci_enable_intrs(sc);
 
@@ -429,6 +432,9 @@ ahci_attach(struct ahci_softc *sc)
 			", error=%d\n", AHCINAME(sc), error);
 			break;
 		}
+		memset(cmdtblp, 0, dmasize);
+		bus_dmamap_sync(sc->sc_dmat, achp->ahcic_cmd_tbld, 0,
+		dmasize, BUS_DMASYNC_PREWRITE);
 		achp->ahcic_cmdh  = (struct ahci_cmd_header *)
 		((char *)cmdhp + AHCI_CMDH_SIZE * port);
 		achp->ahcic_bus_cmdh = sc->sc_cmd_hdrd->dm_segs[0].ds_addr +



CVS commit: src/sys/netinet6

2020-12-26 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Sat Dec 26 10:43:39 UTC 2020

Modified Files:
src/sys/netinet6: nd6.c

Log Message:
Avoid NULL pointer dereference, noticed by KUBSAN.

"Looks fine" roy@


To generate a diff of this commit:
cvs rdiff -u -r1.274 -r1.275 src/sys/netinet6/nd6.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/netinet6/nd6.c
diff -u src/sys/netinet6/nd6.c:1.274 src/sys/netinet6/nd6.c:1.275
--- src/sys/netinet6/nd6.c:1.274	Tue Sep 15 10:05:36 2020
+++ src/sys/netinet6/nd6.c	Sat Dec 26 10:43:39 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nd6.c,v 1.274 2020/09/15 10:05:36 roy Exp $	*/
+/*	$NetBSD: nd6.c,v 1.275 2020/12/26 10:43:39 nia Exp $	*/
 /*	$KAME: nd6.c,v 1.279 2002/06/08 11:16:51 itojun Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.274 2020/09/15 10:05:36 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.275 2020/12/26 10:43:39 nia Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -384,8 +384,8 @@ nd6_llinfo_output(struct ifnet *ifp, con
 const union l3addr *hsrc)
 {
 
-	nd6_ns_output(ifp, &daddr->addr6, &taddr->addr6,
-	&hsrc->addr6, NULL);
+	nd6_ns_output(ifp, daddr != NULL ? &daddr->addr6 : NULL,
+	&taddr->addr6, &hsrc->addr6, NULL);
 }
 
 static bool



CVS commit: src/sys/dev/ic

2020-12-26 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Dec 26 08:58:03 UTC 2020

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

Log Message:
Ignore WSDISPLAYIO_PUTCMAP in WSDISPLAYIO_MODE_EMUL, i.e. text mode.

The hardware palette settings are handled by the STI ROM in STI_TEXTMODE
and changing cmap could cause mangled text colors at least on CRX on 425t.
Updating CMAP in EMUL mode isn't expected anyway.

Fixes "red or invisible text" after exiting mlterm-wscons on A1659 CRX.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/ic/sti.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/sti.c
diff -u src/sys/dev/ic/sti.c:1.24 src/sys/dev/ic/sti.c:1.25
--- src/sys/dev/ic/sti.c:1.24	Fri Dec 25 20:41:24 2020
+++ src/sys/dev/ic/sti.c	Sat Dec 26 08:58:03 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: sti.c,v 1.24 2020/12/25 20:41:24 tsutsui Exp $	*/
+/*	$NetBSD: sti.c,v 1.25 2020/12/26 08:58:03 tsutsui Exp $	*/
 
 /*	$OpenBSD: sti.c,v 1.61 2009/09/05 14:09:35 miod Exp $	*/
 
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sti.c,v 1.24 2020/12/25 20:41:24 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sti.c,v 1.25 2020/12/26 08:58:03 tsutsui Exp $");
 
 #include "wsdisplay.h"
 
@@ -1129,6 +1129,16 @@ sti_ioctl(void *v, void *vs, u_long cmd,
 	case WSDISPLAYIO_PUTCMAP:
 		if (scr->putcmap == NULL || scr->scr_bpp > 8)
 			return ENODEV;
+		if (scr->scr_wsmode == WSDISPLAYIO_MODE_EMUL) {
+			/*
+			 * The hardware palette settings are handled by
+			 * the STI ROM in STI_TEXTMODE and changing cmap
+			 * could cause mangled text colors at least on CRX.
+			 * Updating CMAP in EMUL mode isn't expected anyway
+			 * so just ignore it.
+			 */
+			return 0;
+		}
 		cmapp = (struct wsdisplay_cmap *)data;
 		idx = cmapp->index;
 		count = cmapp->count;