CVS commit: src/usr.bin/make

2020-11-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Nov  5 00:40:31 UTC 2020

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

Log Message:
make(1): extend documentation for GNodeType constants


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

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

Modified files:

Index: src/usr.bin/make/make.h
diff -u src/usr.bin/make/make.h:1.188 src/usr.bin/make/make.h:1.189
--- src/usr.bin/make/make.h:1.188	Wed Nov  4 13:40:20 2020
+++ src/usr.bin/make/make.h	Thu Nov  5 00:40:31 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.188 2020/11/04 13:40:20 rillig Exp $	*/
+/*	$NetBSD: make.h,v 1.189 2020/11/05 00:40:31 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -230,7 +230,7 @@ typedef enum GNodeType {
 /* Like .USE, only prepend commands */
 OP_USEBEFORE	= 1 << 13,
 /* The node is invisible to its parents. I.e. it doesn't show up in the
- * parents' local variables. */
+ * parents' local variables (.IMPSRC, .ALLSRC). */
 OP_INVISIBLE	= 1 << 14,
 /* The node is exempt from normal 'main target' processing in parse.c */
 OP_NOTMAIN		= 1 << 15,
@@ -238,7 +238,10 @@ typedef enum GNodeType {
 OP_PHONY		= 1 << 16,
 /* Don't search for file in the path */
 OP_NOPATH		= 1 << 17,
-/* .WAIT phony node */
+/* In a dependency line "target: source1 .WAIT source2", source1 is made
+ * first, including its children.  Once that is finished, source2 is made,
+ * including its children.  The .WAIT keyword may appear more than once in
+ * a single dependency declaration. */
 OP_WAIT		= 1 << 18,
 /* .NOMETA do not create a .meta file */
 OP_NOMETA		= 1 << 19,
@@ -251,7 +254,7 @@ typedef enum GNodeType {
 
 /* Attributes applied by PMake */
 
-/* The node is a transformation rule */
+/* The node is a transformation rule, such as ".c.o". */
 OP_TRANSFORM	= 1 << 31,
 /* Target is a member of an archive */
 /* XXX: How does this differ from OP_ARCHV? */



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

2020-11-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Nov  5 00:41:04 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: use-inference.mk

Log Message:
make(1): add remark for exit status 0 despite error


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/use-inference.mk

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

Modified files:

Index: src/usr.bin/make/unit-tests/use-inference.mk
diff -u src/usr.bin/make/unit-tests/use-inference.mk:1.1 src/usr.bin/make/unit-tests/use-inference.mk:1.2
--- src/usr.bin/make/unit-tests/use-inference.mk:1.1	Sun Aug  9 16:32:28 2020
+++ src/usr.bin/make/unit-tests/use-inference.mk	Thu Nov  5 00:41:04 2020
@@ -1,4 +1,4 @@
-# $NetBSD: use-inference.mk,v 1.1 2020/08/09 16:32:28 rillig Exp $
+# $NetBSD: use-inference.mk,v 1.2 2020/11/05 00:41:04 rillig Exp $
 #
 # Demonstrate that .USE rules do not have an effect on inference rules.
 # At least not in the special case where the inference rule does not
@@ -33,3 +33,6 @@ use-inference.from:		# assume it exists
 # This is strange since make definitely knows about the .from.to suffix
 # inference rule.  But it seems to ignore it, maybe because it doesn't
 # have any associated commands.
+
+# XXX: Despite the error message "don't know how to make", the exit status
+# is 0.  This is inconsistent.



CVS commit: src/lib/libossaudio

2020-11-04 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Wed Nov  4 22:59:24 UTC 2020

Modified Files:
src/lib/libossaudio: ossaudio.c

Log Message:
ossaudio(3): Set errno and return -1 rather than returning errno.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/lib/libossaudio/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/lib/libossaudio/ossaudio.c
diff -u src/lib/libossaudio/ossaudio.c:1.62 src/lib/libossaudio/ossaudio.c:1.63
--- src/lib/libossaudio/ossaudio.c:1.62	Tue Nov  3 09:46:00 2020
+++ src/lib/libossaudio/ossaudio.c	Wed Nov  4 22:59:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ossaudio.c,v 1.62 2020/11/03 09:46:00 nia Exp $	*/
+/*	$NetBSD: ossaudio.c,v 1.63 2020/11/04 22:59:24 nia Exp $	*/
 
 /*-
  * Copyright (c) 1997, 2020 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: ossaudio.c,v 1.62 2020/11/03 09:46:00 nia Exp $");
+__RCSID("$NetBSD: ossaudio.c,v 1.63 2020/11/04 22:59:24 nia Exp $");
 
 /*
  * This is an Open Sound System compatibility layer, which provides
@@ -146,8 +146,10 @@ audio_ioctl(int fd, unsigned long com, v
 		break;
 	case SNDCTL_DSP_GETERROR:
 		tmperrinfo = (struct audio_errinfo *)argp;
-		if (tmperrinfo == NULL)
-			return EINVAL;
+		if (tmperrinfo == NULL) {
+			errno = EINVAL;
+			return -1;
+		}
 		memset(tmperrinfo, 0, sizeof(struct audio_errinfo));
 		if ((retval = ioctl(fd, AUDIO_GETBUFINFO, )) < 0)
 			return retval;
@@ -413,8 +415,10 @@ audio_ioctl(int fd, unsigned long com, v
 	case SNDCTL_DSP_SETFRAGMENT:
 		AUDIO_INITINFO();
 		idat = INTARG;
-		if ((idat & 0x) < 4 || (idat & 0x) > 17)
-			return EINVAL;
+		if ((idat & 0x) < 4 || (idat & 0x) > 17) {
+			errno = EINVAL;
+			return -1;
+		}
 		tmpinfo.blocksize = 1 << (idat & 0x);
 		tmpinfo.hiwat = ((unsigned)idat >> 16) & 0x7fff;
 		if (tmpinfo.hiwat == 0)	/* 0 means set to max */
@@ -613,8 +617,9 @@ audio_ioctl(int fd, unsigned long com, v
 		INTARG = getvol(tmpinfo.record.gain, tmpinfo.record.balance);
 		break;
 	case SNDCTL_DSP_SKIP:
-	case SNDCTL_DSP_SILENCE:
-		return EINVAL;
+	case SNDCTL_DSP_SILENCE: 
+		errno = EINVAL;
+		return -1;
 	case SNDCTL_DSP_SETDUPLEX:
 		idat = 1;
 		retval = ioctl(fd, AUDIO_SETFD, );
@@ -865,8 +870,10 @@ mixer_oss3_ioctl(int fd, unsigned long c
 		strlcpy(omi->name, adev.name, sizeof omi->name);
 		return 0;
 	case SOUND_MIXER_READ_RECSRC:
-		if (di->source == -1)
-			return EINVAL;
+		if (di->source == -1) {
+			errno = EINVAL;
+			return -1;
+		}
 		mc.dev = di->source;
 		if (di->caps & SOUND_CAP_EXCL_INPUT) {
 			mc.type = AUDIO_MIXER_ENUM;
@@ -900,8 +907,10 @@ mixer_oss3_ioctl(int fd, unsigned long c
 		break;
 	case SOUND_MIXER_WRITE_RECSRC:
 	case SOUND_MIXER_WRITE_R_RECSRC:
-		if (di->source == -1)
-			return EINVAL;
+		if (di->source == -1) {
+			errno = EINVAL;
+			return -1;
+		}
 		mc.dev = di->source;
 		idat = INTARG;
 		if (di->caps & SOUND_CAP_EXCL_INPUT) {
@@ -910,16 +919,20 @@ mixer_oss3_ioctl(int fd, unsigned long c
 if (idat & (1 << i))
 	break;
 			if (i >= SOUND_MIXER_NRDEVICES ||
-			di->devmap[i] == -1)
-return EINVAL;
+			di->devmap[i] == -1) {
+errno = EINVAL;
+return -1;
+			}
 			mc.un.ord = enum_to_ord(di, di->devmap[i]);
 		} else {
 			mc.type = AUDIO_MIXER_SET;
 			mc.un.mask = 0;
 			for(i = 0; i < SOUND_MIXER_NRDEVICES; i++) {
 if (idat & (1 << i)) {
-	if (di->devmap[i] == -1)
-		return EINVAL;
+	if (di->devmap[i] == -1) {
+		errno = EINVAL;
+		return -1;
+	}
 	mc.un.mask |=
 	enum_to_mask(di, di->devmap[i]);
 }
@@ -930,8 +943,10 @@ mixer_oss3_ioctl(int fd, unsigned long c
 		if (MIXER_READ(SOUND_MIXER_FIRST) <= com &&
 		com < MIXER_READ(SOUND_MIXER_NRDEVICES)) {
 			n = GET_DEV(com);
-			if (di->devmap[n] == -1)
-return EINVAL;
+			if (di->devmap[n] == -1) {
+errno = EINVAL;
+return -1;
+			}
 			mc.dev = di->devmap[n];
 			mc.type = AUDIO_MIXER_VALUE;
 		doread:
@@ -940,8 +955,10 @@ mixer_oss3_ioctl(int fd, unsigned long c
 			retval = ioctl(fd, AUDIO_MIXER_READ, );
 			if (retval < 0)
 return retval;
-			if (mc.type != AUDIO_MIXER_VALUE)
-return EINVAL;
+			if (mc.type != AUDIO_MIXER_VALUE) {
+errno = EINVAL;
+return -1;
+			}
 			if (mc.un.value.num_channels != 2) {
 l = r =
 mc.un.value.level[AUDIO_MIXER_LEVEL_MONO];
@@ -956,8 +973,10 @@ mixer_oss3_ioctl(int fd, unsigned long c
 			   (MIXER_WRITE(SOUND_MIXER_FIRST) <= com &&
 			   com < MIXER_WRITE(SOUND_MIXER_NRDEVICES))) {
 			n = GET_DEV(com);
-			if (di->devmap[n] == -1)
-return EINVAL;
+			if (di->devmap[n] == -1) {
+errno = EINVAL;
+return -1;
+			}
 			idat = INTARG;
 			l = FROM_OSSVOL((u_int)idat & 0xff);
 			r = FROM_OSSVOL(((u_int)idat >> 8) & 0xff);
@@ -1114,8 +1133,10 @@ mixer_oss4_ioctl(int fd, unsigned long c
 		break;
 	case SNDCTL_CARDINFO:
 		cardinfo = 

CVS commit: xsrc/external/mit/libepoxy/src

2020-11-04 Thread Christos Zoulas
Module Name:xsrc
Committed By:   christos
Date:   Wed Nov  4 22:46:20 UTC 2020

Modified Files:
xsrc/external/mit/libepoxy/src: egl_generated_dispatch.c
gl_generated_dispatch.c glx_generated_dispatch.c

Log Message:
fix lint build


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 \
xsrc/external/mit/libepoxy/src/egl_generated_dispatch.c
cvs rdiff -u -r1.6 -r1.7 \
xsrc/external/mit/libepoxy/src/gl_generated_dispatch.c \
xsrc/external/mit/libepoxy/src/glx_generated_dispatch.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/libepoxy/src/egl_generated_dispatch.c
diff -u xsrc/external/mit/libepoxy/src/egl_generated_dispatch.c:1.5 xsrc/external/mit/libepoxy/src/egl_generated_dispatch.c:1.6
--- xsrc/external/mit/libepoxy/src/egl_generated_dispatch.c:1.5	Sun Nov  1 23:47:22 2020
+++ xsrc/external/mit/libepoxy/src/egl_generated_dispatch.c	Wed Nov  4 17:46:20 2020
@@ -11,7 +11,7 @@
 #include "dispatch_common.h"
 #include "epoxy/egl.h"
 
-#ifdef __GNUC__
+#if defined(__GNUC__) || defined(__lint__)
 #define EPOXY_NOINLINE __attribute__((noinline))
 #elif defined (_MSC_VER)
 #define EPOXY_NOINLINE __declspec(noinline)

Index: xsrc/external/mit/libepoxy/src/gl_generated_dispatch.c
diff -u xsrc/external/mit/libepoxy/src/gl_generated_dispatch.c:1.6 xsrc/external/mit/libepoxy/src/gl_generated_dispatch.c:1.7
--- xsrc/external/mit/libepoxy/src/gl_generated_dispatch.c:1.6	Sun Nov  1 23:47:22 2020
+++ xsrc/external/mit/libepoxy/src/gl_generated_dispatch.c	Wed Nov  4 17:46:20 2020
@@ -26,7 +26,7 @@
 #include "dispatch_common.h"
 #include "epoxy/gl.h"
 
-#ifdef __GNUC__
+#if defined(__GNUC__) || defined(__lint__)
 #define EPOXY_NOINLINE __attribute__((noinline))
 #elif defined (_MSC_VER)
 #define EPOXY_NOINLINE __declspec(noinline)
Index: xsrc/external/mit/libepoxy/src/glx_generated_dispatch.c
diff -u xsrc/external/mit/libepoxy/src/glx_generated_dispatch.c:1.6 xsrc/external/mit/libepoxy/src/glx_generated_dispatch.c:1.7
--- xsrc/external/mit/libepoxy/src/glx_generated_dispatch.c:1.6	Sun Nov  1 23:47:22 2020
+++ xsrc/external/mit/libepoxy/src/glx_generated_dispatch.c	Wed Nov  4 17:46:20 2020
@@ -26,7 +26,7 @@
 #include "dispatch_common.h"
 #include "epoxy/glx.h"
 
-#ifdef __GNUC__
+#if defined(__GNUC__) || defined(__lint__)
 #define EPOXY_NOINLINE __attribute__((noinline))
 #elif defined (_MSC_VER)
 #define EPOXY_NOINLINE __declspec(noinline)



CVS commit: src/sys/rump

2020-11-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Nov  4 22:06:39 UTC 2020

Modified Files:
src/sys/rump/include/rump: rump.h
src/sys/rump/librump/rumpkern: rump.c

Log Message:
PR/55781: Ruslan Nikolaev: rump_init() does differentiate when all CPUs are
initialized


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/sys/rump/include/rump/rump.h
cvs rdiff -u -r1.349 -r1.350 src/sys/rump/librump/rumpkern/rump.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/rump/include/rump/rump.h
diff -u src/sys/rump/include/rump/rump.h:1.72 src/sys/rump/include/rump/rump.h:1.73
--- src/sys/rump/include/rump/rump.h:1.72	Sun Jun 14 19:38:25 2020
+++ src/sys/rump/include/rump/rump.h	Wed Nov  4 17:06:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump.h,v 1.72 2020/06/14 23:38:25 kamil Exp $	*/
+/*	$NetBSD: rump.h,v 1.73 2020/11/04 22:06:38 christos Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -118,6 +118,7 @@ void	rump_unschedule(void);
 void	rump_printevcnts(void);
 
 int	rump_daemonize_begin(void);
+int	rump_init_callback(void (*)(void));
 int	rump_init(void);
 int	rump_init_server(const char *);
 int	rump_daemonize_done(int);

Index: src/sys/rump/librump/rumpkern/rump.c
diff -u src/sys/rump/librump/rumpkern/rump.c:1.349 src/sys/rump/librump/rumpkern/rump.c:1.350
--- src/sys/rump/librump/rumpkern/rump.c:1.349	Wed Jun 10 20:33:30 2020
+++ src/sys/rump/librump/rumpkern/rump.c	Wed Nov  4 17:06:39 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump.c,v 1.349 2020/06/11 00:33:30 kamil Exp $	*/
+/*	$NetBSD: rump.c,v 1.350 2020/11/04 22:06:39 christos Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.349 2020/06/11 00:33:30 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.350 2020/11/04 22:06:39 christos Exp $");
 
 #include 
 #define ELFSIZE ARCH_ELFSIZE
@@ -218,7 +218,7 @@ RUMP_COMPONENT(RUMP_COMPONENT_POSTINIT)
 #endif /* RUMP_USE_CTOR */
 
 int
-rump_init(void)
+rump_init_callback(void (*cpuinit_callback) (void))
 {
 	char buf[256];
 	struct timespec bts;
@@ -231,7 +231,7 @@ rump_init(void)
 	if (rump_inited)
 		return 0;
 	else if (rump_inited == -1)
-		panic("rump_init: host process restart required");
+		panic("%s: host process restart required", __func__);
 	else
 		rump_inited = 1;
 
@@ -257,11 +257,12 @@ rump_init(void)
 	}
 
 	if (rumpuser_getparam(RUMPUSER_PARAM_NCPU, buf, sizeof(buf)) != 0)
-		panic("mandatory hypervisor configuration (NCPU) missing");
+		panic("%s: mandatory hypervisor configuration (NCPU) missing",
+		__func__);
 	numcpu = strtoll(buf, NULL, 10);
 	if (numcpu < 1) {
-		panic("rump kernels are not lightweight enough for \"%d\" CPUs",
-		numcpu);
+		panic("%s: rump kernels are not lightweight enough for %d CPUs",
+		__func__, numcpu);
 	}
 
 	rump_thread_init();
@@ -393,6 +394,9 @@ rump_init(void)
 
 	mp_online = true;
 
+	if (cpuinit_callback)
+		(*cpuinit_callback)();
+
 	/* CPUs are up.  allow kernel threads to run */
 	rump_thread_allow(NULL);
 
@@ -415,7 +419,7 @@ rump_init(void)
 	if (rump_threads) {
 		if (kthread_create(PRI_PGDAEMON, KTHREAD_MPSAFE, NULL,
 		uvm_pageout, NULL, _lwp, "pdaemon") != 0)
-			panic("pagedaemon create failed");
+			panic("%s: pagedaemon create failed", __func__);
 	} else
 		uvm.pagedaemon_lwp = NULL; /* doesn't match curlwp */
 
@@ -456,7 +460,9 @@ rump_init(void)
 
 	if (rumpuser_getparam(RUMPUSER_PARAM_HOSTNAME,
 	hostname, MAXHOSTNAMELEN) != 0) {
-		panic("mandatory hypervisor configuration (HOSTNAME) missing");
+		panic(
+		"%s: mandatory hypervisor configuration (HOSTNAME) missing",
+		__func__);
 	}
 	hostnamelen = strlen(hostname);
 
@@ -474,7 +480,7 @@ rump_init(void)
 	initproc = proc_find_raw(1);
 	mutex_exit(_lock);
 	if (initproc == NULL)
-		panic("where in the world is initproc?");
+		panic("%s: where in the world is initproc?", __func__);
 	strlcpy(initproc->p_comm, "rumplocal", sizeof(initproc->p_comm));
 
 	rump_component_init(RUMP_COMPONENT_POSTINIT);
@@ -496,6 +502,13 @@ rump_init(void)
 
 	return 0;
 }
+
+int
+rump_init(void)
+{
+	return rump_init_callback(NULL);
+}
+
 /* historic compat */
 __strong_alias(rump__init,rump_init);
 



CVS commit: src/sys

2020-11-04 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Nov  4 20:54:20 UTC 2020

Modified Files:
src/sys/compat/netbsd32: netbsd32_core.c
src/sys/modules/compat_netbsd32_coredump: Makefile

Log Message:
Use opt_execfmt.h to get build options.

Only include elf32 hooks if we have elf32 defined and elf32 is not the
"native" emulation.  This allows for having compat_netbsd32 without
elf32 (although it's probably not too useful), and also enables arm's
old-ABI usage of compat_netbsd32.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/compat/netbsd32/netbsd32_core.c
cvs rdiff -u -r1.1 -r1.2 src/sys/modules/compat_netbsd32_coredump/Makefile

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

Modified files:

Index: src/sys/compat/netbsd32/netbsd32_core.c
diff -u src/sys/compat/netbsd32/netbsd32_core.c:1.16 src/sys/compat/netbsd32/netbsd32_core.c:1.17
--- src/sys/compat/netbsd32/netbsd32_core.c:1.16	Sun Nov  1 18:51:02 2020
+++ src/sys/compat/netbsd32/netbsd32_core.c	Wed Nov  4 20:54:20 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_core.c,v 1.16 2020/11/01 18:51:02 pgoyette Exp $	*/
+/*	$NetBSD: netbsd32_core.c,v 1.17 2020/11/04 20:54:20 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -45,13 +45,17 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_core.c,v 1.16 2020/11/01 18:51:02 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_core.c,v 1.17 2020/11/04 20:54:20 pgoyette Exp $");
 
 #include 
 #include 
 #include 
 #include 
 
+#ifdef _KERNEL_OPT
+#include "opt_execfmt.h"
+#endif
+
 #define DEPS "compat_netbsd32,compat_netbsd32_ptrace,coredump"
 
 MODULE(MODULE_CLASS_MISC, compat_netbsd32_coredump, DEPS);
@@ -68,11 +72,15 @@ compat_netbsd32_coredump_modcmd(modcmd_t
 	switch (cmd) {
 	case MODULE_CMD_INIT:
 		MODULE_HOOK_SET(coredump_netbsd32_hook, real_coredump_netbsd32);
+#if defined(EXEC_ELF32) && defined(__LP64)
 		MODULE_HOOK_SET(coredump_elf32_hook, real_coredump_elf32);
+#endif
 		return 0;
 	case MODULE_CMD_FINI:
 		MODULE_HOOK_UNSET(coredump_netbsd32_hook);
+#if defined(EXEC_ELF32) && defined(__LP64)
 		MODULE_HOOK_UNSET(coredump_elf32_hook);
+#endif
 		return 0;
 	default:
 		return ENOTTY;

Index: src/sys/modules/compat_netbsd32_coredump/Makefile
diff -u src/sys/modules/compat_netbsd32_coredump/Makefile:1.1 src/sys/modules/compat_netbsd32_coredump/Makefile:1.2
--- src/sys/modules/compat_netbsd32_coredump/Makefile:1.1	Sun Nov  1 18:51:03 2020
+++ src/sys/modules/compat_netbsd32_coredump/Makefile	Wed Nov  4 20:54:20 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.1 2020/11/01 18:51:03 pgoyette Exp $
+#	$NetBSD: Makefile,v 1.2 2020/11/04 20:54:20 pgoyette Exp $
 
 .include "../Makefile.inc"
 
@@ -10,7 +10,7 @@ SRCS=	netbsd32_core.c
 .PATH:	${S}/kern
 SRCS+=	core_elf32.c
 
-CPPFLAGS+=	-DCOMPAT_NETBSD32
+CPPFLAGS+=	-DCOMPAT_NETBSD32 -DEXEC_ELF32
 
 WARNS=	3
 



CVS commit: src/sys/arch/riscv

2020-11-04 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Nov  4 20:05:47 UTC 2020

Modified Files:
src/sys/arch/riscv/include: sysreg.h
src/sys/arch/riscv/riscv: genassym.cf locore.S riscv_machdep.c

Log Message:
Miscellaneous updates to reflect riscv-privileged-20190608.pdf

Some from zmcgrew@


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/riscv/include/sysreg.h
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/riscv/riscv/genassym.cf
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/riscv/riscv/locore.S
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/riscv/riscv/riscv_machdep.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/riscv/include/sysreg.h
diff -u src/sys/arch/riscv/include/sysreg.h:1.9 src/sys/arch/riscv/include/sysreg.h:1.10
--- src/sys/arch/riscv/include/sysreg.h:1.9	Wed Nov  4 06:56:56 2020
+++ src/sys/arch/riscv/include/sysreg.h	Wed Nov  4 20:05:47 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: sysreg.h,v 1.9 2020/11/04 06:56:56 skrll Exp $ */
+/* $NetBSD: sysreg.h,v 1.10 2020/11/04 20:05:47 skrll Exp $ */
 
 /*
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -167,12 +167,12 @@ riscvreg_fcsr_write_frm(uint32_t __new)
 #define SIE_IM		(SIE_SEI|SIE_UEIE|SIE_STIE|SIE_UTIE|SIE_SSIE|SIE_USIE)
 
 #ifdef _LP64
-#define	SR_USER		(SR_UIE | SR_U64 | SR_S64 | SR_IM)
-#define	SR_USER32	(SR_USER & ~SR_U64)
-#define	SR_KERNEL	(SR_S | SR_UIE | SR_U64 | SR_S64)
+#define	SR_USER		(SR_UIE)
+#define	SR_USER32	(SR_USER)
+#define	SR_KERNEL	(SR_SIE | SR_UIE)
 #else
-#define	SR_USER		(SR_UIE||SR_IM)
-#define	SR_KERNEL	(SR_S|SR_UIE)
+#define	SR_USER		(SR_UIE)
+#define	SR_KERNEL	(SR_SIE | SR_UIE)
 #endif
 
 static inline uint32_t

Index: src/sys/arch/riscv/riscv/genassym.cf
diff -u src/sys/arch/riscv/riscv/genassym.cf:1.9 src/sys/arch/riscv/riscv/genassym.cf:1.10
--- src/sys/arch/riscv/riscv/genassym.cf:1.9	Wed Nov  4 07:51:08 2020
+++ src/sys/arch/riscv/riscv/genassym.cf	Wed Nov  4 20:05:47 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.9 2020/11/04 07:51:08 skrll Exp $
+#	$NetBSD: genassym.cf,v 1.10 2020/11/04 20:05:47 skrll Exp $
 #-
 # Copyright (c) 2014 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -62,6 +62,14 @@ define	SR_SIE		SR_SIE
 
 define	CAUSE_SYSCALL	CAUSE_SYSCALL
 
+ifdef _LP64
+define	SATP_MODE_MASK	SATP_MODE
+define	SATP_MODE_SV39	__SHIFTIN(SATP_MODE_SV39, SATP_MODE)
+define	SATP_MODE_SV48	__SHIFTIN(SATP_MODE_SV48, SATP_MODE)
+else
+define	SATP_MODE_SV32	__SHIFTIN(SATP_MODE_SV32, SATP_MODE)
+endif
+
 define	IPL_HIGH	IPL_HIGH
 define	IPL_DDB		IPL_DDB
 define	IPL_SCHED	IPL_SCHED
@@ -108,7 +116,7 @@ define	TF_T6		offsetof(struct trapframe,
 define	TF_GP		offsetof(struct trapframe, tf_reg[_X_GP])
 define	TF_PC		offsetof(struct trapframe, tf_pc)
 define	TF_CAUSE	offsetof(struct trapframe, tf_cause)
-define	TF_TVA	L	offsetof(struct trapframe, tf_tval)
+define	TF_TVAL		offsetof(struct trapframe, tf_tval)
 define	TF_SR		offsetof(struct trapframe, tf_sr)
 
 define	L_CPU		offsetof(struct lwp, l_cpu)

Index: src/sys/arch/riscv/riscv/locore.S
diff -u src/sys/arch/riscv/riscv/locore.S:1.15 src/sys/arch/riscv/riscv/locore.S:1.16
--- src/sys/arch/riscv/riscv/locore.S:1.15	Wed Nov  4 07:09:46 2020
+++ src/sys/arch/riscv/riscv/locore.S	Wed Nov  4 20:05:47 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.S,v 1.15 2020/11/04 07:09:46 skrll Exp $ */
+/* $NetBSD: locore.S,v 1.16 2020/11/04 20:05:47 skrll Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -39,15 +39,6 @@ ENTRY_NP(start)
 	// We get loaded and starting running at or near 0, not where we
 	// should be. We need to construct an initial PDETAB
 
-#ifdef _LP64
-	li	t0, SR_U64|SR_S64
-	li	t1, SR_IM|SR_SIE
-	csrs	sstatus, t0
-#else
-	li	t1, SR_IM|SR_U64|SR_S64|SR_EI
-#endif
-	csrc	sstatus, t1
-
 	li	s11, VM_MAX_KERNEL_ADDRESS
 	li	s10, PAGE_SIZE
 	li	s9, USPACE

Index: src/sys/arch/riscv/riscv/riscv_machdep.c
diff -u src/sys/arch/riscv/riscv/riscv_machdep.c:1.12 src/sys/arch/riscv/riscv/riscv_machdep.c:1.13
--- src/sys/arch/riscv/riscv/riscv_machdep.c:1.12	Wed Nov  4 07:09:46 2020
+++ src/sys/arch/riscv/riscv/riscv_machdep.c	Wed Nov  4 20:05:47 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: riscv_machdep.c,v 1.12 2020/11/04 07:09:46 skrll Exp $	*/
+/*	$NetBSD: riscv_machdep.c,v 1.13 2020/11/04 20:05:47 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2014, 2019 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 
 #include "opt_modular.h"
 
-__RCSID("$NetBSD: riscv_machdep.c,v 1.12 2020/11/04 07:09:46 skrll Exp $");
+__RCSID("$NetBSD: riscv_machdep.c,v 1.13 2020/11/04 20:05:47 skrll Exp $");
 
 #include 
 #include 
@@ -124,7 +124,9 @@ md_child_return(struct lwp *l)
 
 	tf->tf_a0 = 0;
 	tf->tf_a1 = 1;
+#ifdef FPE
 	tf->tf_sr &= ~SR_EF;		/* Disable FP as we can't be them. */
+#endif
 }
 
 void



CVS commit: src/sys/arch/riscv/riscv

2020-11-04 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Nov  4 20:04:01 UTC 2020

Modified Files:
src/sys/arch/riscv/riscv: trap.c vm_machdep.c

Log Message:
Miscellaneous updates to reflect riscv-privileged-20190608.pdf

Some from zmcgrew@


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/riscv/riscv/trap.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/riscv/riscv/vm_machdep.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/riscv/riscv/trap.c
diff -u src/sys/arch/riscv/riscv/trap.c:1.12 src/sys/arch/riscv/riscv/trap.c:1.13
--- src/sys/arch/riscv/riscv/trap.c:1.12	Wed Nov  4 07:09:46 2020
+++ src/sys/arch/riscv/riscv/trap.c	Wed Nov  4 20:04:01 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.12 2020/11/04 07:09:46 skrll Exp $	*/
+/*	$NetBSD: trap.c,v 1.13 2020/11/04 20:04:01 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #define __PMAP_PRIVATE
 #define __UFETCHSTORE_PRIVATE
 
-__RCSID("$NetBSD: trap.c,v 1.12 2020/11/04 07:09:46 skrll Exp $");
+__RCSID("$NetBSD: trap.c,v 1.13 2020/11/04 20:04:01 skrll Exp $");
 
 #include 
 #include 
@@ -372,7 +372,7 @@ cpu_trap(struct trapframe *tf, register_
 {
 	const u_int fault_mask = 1U << cause;
 	const intptr_t addr = tval;
-	const bool usertrap_p = (status & SR_PS) == 0;
+	const bool usertrap_p = (status & SR_SPP) == 0;
 	bool ok = true;
 	ksiginfo_t ksi;
 

Index: src/sys/arch/riscv/riscv/vm_machdep.c
diff -u src/sys/arch/riscv/riscv/vm_machdep.c:1.3 src/sys/arch/riscv/riscv/vm_machdep.c:1.4
--- src/sys/arch/riscv/riscv/vm_machdep.c:1.3	Sat Mar 14 16:12:16 2020
+++ src/sys/arch/riscv/riscv/vm_machdep.c	Wed Nov  4 20:04:01 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_machdep.c,v 1.3 2020/03/14 16:12:16 skrll Exp $	*/
+/*	$NetBSD: vm_machdep.c,v 1.4 2020/11/04 20:04:01 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.3 2020/03/14 16:12:16 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.4 2020/11/04 20:04:01 skrll Exp $");
 
 #define _PMAP_PRIVATE
 
@@ -91,7 +91,9 @@ cpu_lwp_fork(struct lwp *l1, struct lwp 
 	vaddr_t ua2 = uvm_lwp_getuarea(l2);
 	tf = (struct trapframe *)(ua2 + USPACE) - 1;
 	*tf = *l1->l_md.md_utf;
+#ifdef FPE
 	tf->tf_sr &= ~SR_EF;	/* floating point must be disabled */
+#endif
 
 	/* If specified, set a different user stack for a child. */
 	if (stack != NULL) {
@@ -114,12 +116,8 @@ cpu_lwp_fork(struct lwp *l1, struct lwp 
 	tf->tf_s0 = (intptr_t)func;			/* S0 */
 	tf->tf_s1 = (intptr_t)arg;			/* S1 */
 	tf->tf_ra = (intptr_t)cpu_lwp_trampoline;	/* RA */
-	l2->l_md.md_ktf = tf;	/* SP */
-	KASSERT(tf->tf_sr & SR_S);
-#ifdef _LP64
-	KASSERT(tf->tf_sr & SR_S64);
-#endif
-	KASSERT(tf->tf_sr & SR_EI);
+	l2->l_md.md_ktf = tf;/* SP */
+	KASSERT(tf->tf_sr & SR_SIE);
 }
 
 /*



CVS commit: src/sys/rump/include/sys

2020-11-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov  4 19:27:53 UTC 2020

Modified Files:
src/sys/rump/include/sys: sleeptab.h

Log Message:
Add turnstile_print prototype for LOCKDEBUG


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/rump/include/sys/sleeptab.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/rump/include/sys/sleeptab.h
diff -u src/sys/rump/include/sys/sleeptab.h:1.1 src/sys/rump/include/sys/sleeptab.h:1.2
--- src/sys/rump/include/sys/sleeptab.h:1.1	Sun Nov  1 20:58:38 2020
+++ src/sys/rump/include/sys/sleeptab.h	Wed Nov  4 19:27:53 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: sleeptab.h,v 1.1 2020/11/01 20:58:38 christos Exp $	*/
+/*	$NetBSD: sleeptab.h,v 1.2 2020/11/04 19:27:53 martin Exp $	*/
 
 /*
  * Copyright (c) 2020
@@ -35,6 +35,10 @@ struct sleepq {
 	kcondvar_t sq_cv;
 };
 
-voidsleepq_destroy(sleepq_t *); 
+voidsleepq_destroy(sleepq_t *);
+#ifdef LOCKDEBUG
+void	turnstile_print(volatile void *, void (*)(const char *, ...)
+__printflike(1, 2));
+#endif
 
 #endif	/* _RUMP_SYS_SLEEPTAB_H_ */



CVS commit: src/sys/kern

2020-11-04 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Nov  4 19:27:41 UTC 2020

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

Log Message:
Merge the two separate sets of init/fini routines and unbreak the build.

XXX Still does not fix the problems noted with 32-bit arm - that will
need a lot more thought.


To generate a diff of this commit:
cvs rdiff -u -r1.90 -r1.91 src/sys/kern/sys_ptrace_common.c

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

Modified files:

Index: src/sys/kern/sys_ptrace_common.c
diff -u src/sys/kern/sys_ptrace_common.c:1.90 src/sys/kern/sys_ptrace_common.c:1.91
--- src/sys/kern/sys_ptrace_common.c:1.90	Wed Nov  4 18:12:18 2020
+++ src/sys/kern/sys_ptrace_common.c	Wed Nov  4 19:27:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_ptrace_common.c,v 1.90 2020/11/04 18:12:18 pgoyette Exp $	*/
+/*	$NetBSD: sys_ptrace_common.c,v 1.91 2020/11/04 19:27:41 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -107,7 +107,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.90 2020/11/04 18:12:18 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.91 2020/11/04 19:27:41 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ptrace.h"
@@ -292,40 +292,6 @@ ptrace_listener_cb(kauth_cred_t cred, ka
 	return result;
 }
 
-int
-ptrace_common_init(void)
-{
-
-#if 0
-	mutex_init(_mtx, MUTEX_DEFAULT, IPL_NONE);
-	cv_init(_cv, "ptracecb");
-	ptrace_cbref = 0;
-#endif
-	ptrace_listener = kauth_listen_scope(KAUTH_SCOPE_PROCESS,
-	ptrace_listener_cb, NULL);
-	return 0;
-}
-
-int
-ptrace_common_fini(void)
-{
-
-	kauth_unlisten_scope(ptrace_listener);
-
-#if 0
-	/* Make sure no-one is executing our kauth listener */
-
-	mutex_enter(_mtx);
-	while (ptrace_cbref != 0)
-		cv_wait(_cv, _mtx);
-	mutex_exit(_mtx);
-	mutex_destroy(_mtx);
-	cv_destroy(_cv);
-#endif
-
-	return 0;
-}
-
 static struct proc *
 ptrace_find(struct lwp *l, int req, pid_t pid)
 {
@@ -1578,6 +1544,13 @@ static int
 ptrace_common_init(void)
 {
 
+#if 0
+	mutex_init(_mtx, MUTEX_DEFAULT, IPL_NONE);
+	cv_init(_cv, "ptracecb");
+	ptrace_cbref = 0;
+#endif
+	ptrace_listener = kauth_listen_scope(KAUTH_SCOPE_PROCESS,
+	ptrace_listener_cb, NULL);
 	return 0;
 }
 
@@ -1585,6 +1558,19 @@ static int
 ptrace_common_fini(void)
 {
 
+	kauth_unlisten_scope(ptrace_listener);
+
+#if 0
+	/* Make sure no-one is executing our kauth listener */
+
+	mutex_enter(_mtx);
+	while (ptrace_cbref != 0)
+		cv_wait(_cv, _mtx);
+	mutex_exit(_mtx);
+	mutex_destroy(_mtx);
+	cv_destroy(_cv);
+#endif
+
 	return 0;
 }
 



CVS commit: src/sys/kern

2020-11-04 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Nov  4 19:16:34 UTC 2020

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

Log Message:
Don't use == for assignment.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/kern/sys_ptrace.c

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

Modified files:

Index: src/sys/kern/sys_ptrace.c
diff -u src/sys/kern/sys_ptrace.c:1.10 src/sys/kern/sys_ptrace.c:1.11
--- src/sys/kern/sys_ptrace.c:1.10	Wed Nov  4 19:03:17 2020
+++ src/sys/kern/sys_ptrace.c	Wed Nov  4 19:16:34 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_ptrace.c,v 1.10 2020/11/04 19:03:17 pgoyette Exp $	*/
+/*	$NetBSD: sys_ptrace.c,v 1.11 2020/11/04 19:16:34 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -69,7 +69,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sys_ptrace.c,v 1.10 2020/11/04 19:03:17 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_ptrace.c,v 1.11 2020/11/04 19:16:34 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ptrace.h"
@@ -207,7 +207,7 @@ ptrace_modcmd(modcmd_t cmd, void *arg)
  
 	switch (cmd) {
 	case MODULE_CMD_INIT: 
-		error == ptrace_init();
+		error = ptrace_init();
 		break;
 	case MODULE_CMD_FINI:
 		error = ptrace_fini();



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

2020-11-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Nov  4 19:11:39 UTC 2020

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

Log Message:
mark pamu2fcfg(1) as pam so MKPAM=no sets work


To generate a diff of this commit:
cvs rdiff -u -r1.1708 -r1.1709 src/distrib/sets/lists/man/mi

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

Modified files:

Index: src/distrib/sets/lists/man/mi
diff -u src/distrib/sets/lists/man/mi:1.1708 src/distrib/sets/lists/man/mi:1.1709
--- src/distrib/sets/lists/man/mi:1.1708	Mon Nov  2 06:40:11 2020
+++ src/distrib/sets/lists/man/mi	Wed Nov  4 19:11:39 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1708 2020/11/02 06:40:11 khorben Exp $
+# $NetBSD: mi,v 1.1709 2020/11/04 19:11:39 mrg Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -421,7 +421,7 @@
 ./usr/share/man/cat1/openssl_x509v3_config.0	man-obsolete		obsolete
 ./usr/share/man/cat1/page.0			man-util-catman		.cat
 ./usr/share/man/cat1/pagesize.0			man-util-catman		.cat
-./usr/share/man/cat1/pamu2fcfg.0		man-util-catman		.cat
+./usr/share/man/cat1/pamu2fcfg.0		man-util-catman		pam,.cat
 ./usr/share/man/cat1/passwd.0			man-util-catman		.cat
 ./usr/share/man/cat1/paste.0			man-util-catman		.cat
 ./usr/share/man/cat1/patch.0			man-util-catman		.cat
@@ -3709,7 +3709,7 @@
 ./usr/share/man/html1/openssl_x509v3_config.html	man-obsolete	obsolete
 ./usr/share/man/html1/page.html			man-util-htmlman	html
 ./usr/share/man/html1/pagesize.html		man-util-htmlman	html
-./usr/share/man/html1/pamu2fcfg.html		man-util-htmlman	html
+./usr/share/man/html1/pamu2fcfg.html		man-util-htmlman	pam,html
 ./usr/share/man/html1/passwd.html		man-util-htmlman	html
 ./usr/share/man/html1/paste.html		man-util-htmlman	html
 ./usr/share/man/html1/patch.html		man-util-htmlman	html
@@ -6639,7 +6639,7 @@
 ./usr/share/man/man1/openssl_x509v3_config.1	man-obsolete		obsolete
 ./usr/share/man/man1/page.1			man-util-man		.man
 ./usr/share/man/man1/pagesize.1			man-util-man		.man
-./usr/share/man/man1/pamu2fcfg.1		man-util-man		.man
+./usr/share/man/man1/pamu2fcfg.1		man-util-man		pam,.man
 ./usr/share/man/man1/passwd.1			man-util-man		.man
 ./usr/share/man/man1/paste.1			man-util-man		.man
 ./usr/share/man/man1/patch.1			man-util-man		.man



CVS commit: src/sys/kern

2020-11-04 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Nov  4 19:03:17 UTC 2020

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

Log Message:
For consistency with other code, put the module init/fini code into
separate routines called from module's modcmd() code, rather than
in-lining in the modcmd.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/kern/sys_ptrace.c

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

Modified files:

Index: src/sys/kern/sys_ptrace.c
diff -u src/sys/kern/sys_ptrace.c:1.9 src/sys/kern/sys_ptrace.c:1.10
--- src/sys/kern/sys_ptrace.c:1.9	Mon Oct 19 15:07:47 2020
+++ src/sys/kern/sys_ptrace.c	Wed Nov  4 19:03:17 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_ptrace.c,v 1.9 2020/10/19 15:07:47 kamil Exp $	*/
+/*	$NetBSD: sys_ptrace.c,v 1.10 2020/11/04 19:03:17 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -69,7 +69,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sys_ptrace.c,v 1.9 2020/10/19 15:07:47 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_ptrace.c,v 1.10 2020/11/04 19:03:17 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ptrace.h"
@@ -180,6 +180,25 @@ sys_ptrace(struct lwp *l, const struct s
 #define	DEPS	"ptrace_common"  
 
 MODULE(MODULE_CLASS_EXEC, ptrace, DEPS);
+
+static int
+ptrace_init(void)
+{ 
+	int error;
+
+	error = syscall_establish(_netbsd, ptrace_syscalls);
+	return error;
+}   
+ 
+static int 
+ptrace_fini(void)
+{
+	int error;
+
+	error = syscall_disestablish(_netbsd, ptrace_syscalls);
+	return error;
+}
+
  
 static int
 ptrace_modcmd(modcmd_t cmd, void *arg)
@@ -188,10 +207,10 @@ ptrace_modcmd(modcmd_t cmd, void *arg)
  
 	switch (cmd) {
 	case MODULE_CMD_INIT: 
-		error = syscall_establish(_netbsd, ptrace_syscalls);
+		error == ptrace_init();
 		break;
 	case MODULE_CMD_FINI:
-		error = syscall_disestablish(_netbsd, ptrace_syscalls);
+		error = ptrace_fini();
 		break;
 	default:
 		error = ENOTTY;



CVS commit: src/sys/sys

2020-11-04 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Nov  4 18:32:12 UTC 2020

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

Log Message:
Remove extraneous declaration of ptrace_common_{init,fini}()


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/sys/ptrace.h

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

Modified files:

Index: src/sys/sys/ptrace.h
diff -u src/sys/sys/ptrace.h:1.73 src/sys/sys/ptrace.h:1.74
--- src/sys/sys/ptrace.h:1.73	Wed Nov  4 18:12:19 2020
+++ src/sys/sys/ptrace.h	Wed Nov  4 18:32:12 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ptrace.h,v 1.73 2020/11/04 18:12:19 pgoyette Exp $	*/
+/*	$NetBSD: ptrace.h,v 1.74 2020/11/04 18:32:12 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 1984, 1993
@@ -241,8 +241,6 @@ struct ptrace_methods {
 	int (*ptm_dodbregs)(struct lwp *, struct lwp *, struct uio *);
 };
 
-int	ptrace_common_init(void);
-int	ptrace_common_fini(void);
 int	ptrace_update_lwp(struct proc *t, struct lwp **lt, lwpid_t lid);
 void	ptrace_hooks(void);
 



CVS commit: src/sys

2020-11-04 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Nov  4 18:12:19 UTC 2020

Modified Files:
src/sys/kern: sys_ptrace_common.c
src/sys/sys: ptrace.h

Log Message:
Finish the proper naming of the module init/fini routines.  Should
fix the "ptrace cannot be used by unpriv user" issue reported by
Rin Okuyama (thanks for the detailed report and analysis).


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/sys/kern/sys_ptrace_common.c
cvs rdiff -u -r1.72 -r1.73 src/sys/sys/ptrace.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/sys_ptrace_common.c
diff -u src/sys/kern/sys_ptrace_common.c:1.89 src/sys/kern/sys_ptrace_common.c:1.90
--- src/sys/kern/sys_ptrace_common.c:1.89	Sun Nov  1 18:51:02 2020
+++ src/sys/kern/sys_ptrace_common.c	Wed Nov  4 18:12:18 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_ptrace_common.c,v 1.89 2020/11/01 18:51:02 pgoyette Exp $	*/
+/*	$NetBSD: sys_ptrace_common.c,v 1.90 2020/11/04 18:12:18 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -107,7 +107,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.89 2020/11/01 18:51:02 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.90 2020/11/04 18:12:18 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ptrace.h"
@@ -293,7 +293,7 @@ ptrace_listener_cb(kauth_cred_t cred, ka
 }
 
 int
-ptrace_init(void)
+ptrace_common_init(void)
 {
 
 #if 0
@@ -307,7 +307,7 @@ ptrace_init(void)
 }
 
 int
-ptrace_fini(void)
+ptrace_common_fini(void)
 {
 
 	kauth_unlisten_scope(ptrace_listener);

Index: src/sys/sys/ptrace.h
diff -u src/sys/sys/ptrace.h:1.72 src/sys/sys/ptrace.h:1.73
--- src/sys/sys/ptrace.h:1.72	Tue Oct 20 20:28:55 2020
+++ src/sys/sys/ptrace.h	Wed Nov  4 18:12:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ptrace.h,v 1.72 2020/10/20 20:28:55 christos Exp $	*/
+/*	$NetBSD: ptrace.h,v 1.73 2020/11/04 18:12:19 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 1984, 1993
@@ -241,8 +241,8 @@ struct ptrace_methods {
 	int (*ptm_dodbregs)(struct lwp *, struct lwp *, struct uio *);
 };
 
-int	ptrace_init(void);
-int	ptrace_fini(void);
+int	ptrace_common_init(void);
+int	ptrace_common_fini(void);
 int	ptrace_update_lwp(struct proc *t, struct lwp **lt, lwpid_t lid);
 void	ptrace_hooks(void);
 



CVS commit: xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k

2020-11-04 Thread Izumi Tsutsui
Module Name:xsrc
Committed By:   tsutsui
Date:   Wed Nov  4 17:16:13 UTC 2020

Modified Files:
xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k: x68kFb.c x68kGraph.c
x68kKbd.c x68kReg.h x68kText.c

Log Message:
Use exact-width interger types properly for register accesses etc.

No binary changes.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kFb.c
cvs rdiff -u -r1.8 -r1.9 \
xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kGraph.c
cvs rdiff -u -r1.9 -r1.10 \
xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kKbd.c
cvs rdiff -u -r1.4 -r1.5 \
xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kReg.h \
xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kText.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/dist/hw/netbsd/x68k/x68kFb.c
diff -u xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kFb.c:1.6 xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kFb.c:1.7
--- xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kFb.c:1.6	Tue Nov  3 15:52:57 2020
+++ xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kFb.c	Wed Nov  4 17:16:13 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: x68kFb.c,v 1.6 2020/11/03 15:52:57 tsutsui Exp $ */
+/* $NetBSD: x68kFb.c,v 1.7 2020/11/04 17:16:13 tsutsui Exp $ */
 /*-
  * Copyright (c) 1996 Yasushi Yamasaki
  * All rights reserved.
@@ -132,7 +132,7 @@ x68kFbCommonClose(X68kScreenRec *pPriv)
 static void
 x68kRegSetup(X68kScreenRec *pPriv)
 {
-u_short pr20 = pPriv->reg->crtc.r20;
+uint16_t pr20 = pPriv->reg->crtc.r20;
 
 /* timing registers */
 if ( (pr20 & 0x0003) < (pPriv->x68kreg.crtc.r20 & 0x0003) ||
@@ -175,7 +175,7 @@ x68kSaveScreen(ScreenPtr pScreen, Bool o
 {
 X68kScreenRec *pPriv = x68kGetScreenPrivate(pScreen);
 static int status = FALSE;
-static u_short r2;
+static uint16_t r2;
 
 if (on == SCREEN_SAVER_ON || on == SCREEN_SAVER_CYCLE) {
 if (!status) {

Index: xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kGraph.c
diff -u xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kGraph.c:1.8 xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kGraph.c:1.9
--- xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kGraph.c:1.8	Tue Nov  3 16:59:38 2020
+++ xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kGraph.c	Wed Nov  4 17:16:13 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: x68kGraph.c,v 1.8 2020/11/03 16:59:38 tsutsui Exp $ */
+/* $NetBSD: x68kGraph.c,v 1.9 2020/11/04 17:16:13 tsutsui Exp $ */
 /*-
  * Copyright (c) 1996 Yasushi Yamasaki
  * All rights reserved.
@@ -125,7 +125,7 @@ static int x68kListInstalledColormaps(Sc
 static void x68kStoreColors(ColormapPtr pmap, int ndef, xColorItem *pdefs);
 
 static void x68kUpdateColormap(ScreenPtr pScreen, int dex, int count,
-   u_char *rmap, u_char *gmap, u_char *bmap);
+   uint8_t *rmap, uint8_t *gmap, uint8_t *bmap);
 
 /*-
  * function "x68kGraphOpen"  [ X68kFBProc function ]
@@ -147,7 +147,7 @@ x68kGraphOpen(X68kScreenRec *pPriv)
 if (pPriv->depth == 15 && pPriv->class == TrueColor) {
 /* for 32768 TrueColor mode */
 	int i;
-	u_short x = 0x0001;
+	uint16_t x = 0x0001;
 	for ( i = 0; i < 256; ) {
 	pPriv->reg->gpal[i++] = x;
 	pPriv->reg->gpal[i++] = x;
@@ -353,7 +353,7 @@ x68kInstallColormap(ColormapPtr cmap)
 register int i;
 register Entry *pent;
 register VisualPtr pVisual = cmap->pVisual;
-u_char   rmap[256], gmap[256], bmap[256];
+uint8_t   rmap[256], gmap[256], bmap[256];
 unsigned long rMask, gMask, bMask;
 int	oRed, oGreen, oBlue;
 
@@ -454,7 +454,7 @@ static void
 x68kStoreColors(ColormapPtr pmap, int ndef, xColorItem *pdefs)
 {
 X68kScreenRec *pPriv = x68kGetScreenPrivate(pmap->pScreen);
-u_char rmap[256], gmap[256], bmap[256];
+uint8_t rmap[256], gmap[256], bmap[256];
 xColorItem expanddefs[256];
 register int i;
 
@@ -481,20 +481,20 @@ x68kStoreColors(ColormapPtr pmap, int nd
  *  argument: (ScreenPtr)pScreen: screen
  *(int)dex  : colormap index
  *(int)count: count for updating
- *(u_char *)[rgb]map: each map
+ *(uint8_t *)[rgb]map: each map
  *  returns:  nothing
  *---*/
 static void
 x68kUpdateColormap(ScreenPtr pScreen, int dex, int count,
-   u_char *rmap, u_char *gmap, u_char *bmap)
+   uint8_t *rmap, uint8_t *gmap, uint8_t *bmap)
 {
 X68kScreenRec *pPriv = 

CVS commit: src/usr.sbin/sysinst

2020-11-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov  4 16:26:35 UTC 2020

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

Log Message:
Avoid warnings


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

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

Modified files:

Index: src/usr.sbin/sysinst/util.c
diff -u src/usr.sbin/sysinst/util.c:1.54 src/usr.sbin/sysinst/util.c:1.55
--- src/usr.sbin/sysinst/util.c:1.54	Wed Nov  4 14:29:40 2020
+++ src/usr.sbin/sysinst/util.c	Wed Nov  4 16:26:35 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: util.c,v 1.54 2020/11/04 14:29:40 martin Exp $	*/
+/*	$NetBSD: util.c,v 1.55 2020/11/04 16:26:35 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1192,7 +1192,7 @@ static bool
 entropy_get_file(bool use_netbsd_seed, char *path)
 {
 	static struct ftpinfo server = { .user = "ftp" };
-	char url[STRSIZE], tmpf[PATH_MAX], mountpt[PATH_MAX], *fn;
+	char url[STRSIZE], tmpf[PATH_MAX], mountpt[PATH_MAX];
 	const char *ftp_opt;
 	arg_rv arg;
 	int rv = 0;
@@ -1203,10 +1203,7 @@ entropy_get_file(bool use_netbsd_seed, c
 	path[0] = 0;
 	mountpt[0] = 0;
 
-	strcpy(tmpf, "/tmp/entr.XX");
-	fn = mktemp(tmpf);
-	if (fn == NULL)
-		return false;
+	sprintf(tmpf, "/tmp/entr.%06x", getpid());
 
 	msg_display(use_netbsd_seed ?
 	MSG_entropy_seed_hdr : MSG_entropy_data_hdr);
@@ -1242,8 +1239,8 @@ entropy_get_file(bool use_netbsd_seed, c
 		}
 		rv = run_program(RUN_DISPLAY | RUN_PROGRESS,
 		"/usr/bin/ftp %s -o %s %s",
-		ftp_opt, fn, url);
-		strcpy(path, fn);
+		ftp_opt, tmpf, url);
+		strcpy(path, tmpf);
 		return rv == 0;
 	case 3:
 #ifndef DEBUG
@@ -1267,11 +1264,11 @@ entropy_get_file(bool use_netbsd_seed, c
 			"mount -t nfs -r %s:/%s %s",
 			nfs_host, nfs_dir, mountpt) == 0) {
 run_program(RUN_SILENT,
-"cp %s %s", path, fn);
+"cp %s %s", path, tmpf);
 run_program(RUN_SILENT,
 "umount %s", mountpt);
 rmdir(mountpt);
-strcpy(path, fn);
+strcpy(path, tmpf);
 			}
 		}
 		break;
@@ -1292,11 +1289,11 @@ entropy_get_file(bool use_netbsd_seed, c
 			"mount -t %s -r /dev/%s %s",
 			localfs_fs, localfs_dev, mountpt) == 0) {
 run_program(RUN_SILENT,
-"cp %s %s", path, fn);
+"cp %s %s", path, tmpf);
 run_program(RUN_SILENT,
 "umount %s", mountpt);
 rmdir(mountpt);
-strcpy(path, fn);
+strcpy(path, tmpf);
 			}
 		}
 		break;
@@ -2555,11 +2552,11 @@ may_swap_if_not_sdmmc(const char *disk)
 	command_dict = prop_dictionary_create();
 	args_dict = prop_dictionary_create();
 
-	string = prop_string_create_cstring_nocopy("get-properties");
+	string = prop_string_create_nocopy("get-properties");
 	prop_dictionary_set(command_dict, "drvctl-command", string);
 	prop_object_release(string);
 
-	string = prop_string_create_cstring(disk);
+	string = prop_string_create_copy(disk);
 	prop_dictionary_set(args_dict, "device-name", string);
 	prop_object_release(string);
 
@@ -2575,14 +2572,14 @@ may_swap_if_not_sdmmc(const char *disk)
 		return true;
 
 	number = prop_dictionary_get(results_dict, "drvctl-error");
-	if (prop_number_integer_value(number) == 0) {
+	if (prop_number_signed_value(number) == 0) {
 		data_dict = prop_dictionary_get(results_dict,
 		"drvctl-result-data");
 		if (data_dict != NULL) {
 			string = prop_dictionary_get(data_dict,
 			"device-parent");
 			if (string != NULL)
-parent = prop_string_cstring_nocopy(string);
+parent = prop_string_value(string);
 		}
 	}
 



CVS commit: src/share/man/man4

2020-11-04 Thread Kimmo Suominen
Module Name:src
Committed By:   kim
Date:   Wed Nov  4 15:24:56 UTC 2020

Modified Files:
src/share/man/man4: ixl.4 ure.4 viornd.4 wpi.4

Log Message:
Allow line breaks inside author names in prose paragraphs


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/share/man/man4/ixl.4
cvs rdiff -u -r1.5 -r1.6 src/share/man/man4/ure.4
cvs rdiff -u -r1.2 -r1.3 src/share/man/man4/viornd.4
cvs rdiff -u -r1.16 -r1.17 src/share/man/man4/wpi.4

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

Modified files:

Index: src/share/man/man4/ixl.4
diff -u src/share/man/man4/ixl.4:1.3 src/share/man/man4/ixl.4:1.4
--- src/share/man/man4/ixl.4:1.3	Fri Dec 20 14:09:23 2019
+++ src/share/man/man4/ixl.4	Wed Nov  4 15:24:56 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ixl.4,v 1.3 2019/12/20 14:09:23 wiz Exp $
+.\"	$NetBSD: ixl.4,v 1.4 2020/11/04 15:24:56 kim Exp $
 .\"
 .\" Copyright (c) 2019 Internet Initiative Japan, Inc.
 .\" All rights reserved.
@@ -51,6 +51,7 @@ driver comes from
 It first appeared in
 .Nx 10.0 .
 .Sh AUTHORS
+.An -nosplit
 The
 .Nm
 driver was written by

Index: src/share/man/man4/ure.4
diff -u src/share/man/man4/ure.4:1.5 src/share/man/man4/ure.4:1.6
--- src/share/man/man4/ure.4:1.5	Fri Aug 30 09:22:17 2019
+++ src/share/man/man4/ure.4	Wed Nov  4 15:24:56 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: ure.4,v 1.5 2019/08/30 09:22:17 wiz Exp $
+.\" $NetBSD: ure.4,v 1.6 2020/11/04 15:24:56 kim Exp $
 .\" $OpenBSD: ure.4,v 1.5 2017/04/16 20:26:34 jmc Exp $
 .\"
 .\" Copyright (c) 2015 Kevin Lo 
@@ -83,6 +83,7 @@ device driver first appeared in
 and
 .Nx 9.0 .
 .Sh AUTHORS
+.An -nosplit
 The
 .Nm
 driver was written by

Index: src/share/man/man4/viornd.4
diff -u src/share/man/man4/viornd.4:1.2 src/share/man/man4/viornd.4:1.3
--- src/share/man/man4/viornd.4:1.2	Sun Oct 26 22:07:47 2014
+++ src/share/man/man4/viornd.4	Wed Nov  4 15:24:56 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: viornd.4,v 1.2 2014/10/26 22:07:47 wiz Exp $
+.\" $NetBSD: viornd.4,v 1.3 2020/11/04 15:24:56 kim Exp $
 .\"
 .\" Copyright (c) 2014 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -51,6 +51,7 @@ The
 driver appeared in
 .Ox 5.5 .
 .Sh AUTHORS
+.An -nosplit
 The
 .Nm
 driver was written by

Index: src/share/man/man4/wpi.4
diff -u src/share/man/man4/wpi.4:1.16 src/share/man/man4/wpi.4:1.17
--- src/share/man/man4/wpi.4:1.16	Tue Mar 18 18:20:39 2014
+++ src/share/man/man4/wpi.4	Wed Nov  4 15:24:56 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: wpi.4,v 1.16 2014/03/18 18:20:39 riastradh Exp $
+.\" $NetBSD: wpi.4,v 1.17 2020/11/04 15:24:56 kim Exp $
 .\"
 .\" Copyright (c) 2006
 .\"	Damien Bergamini . All rights reserved.
@@ -232,6 +232,7 @@ when the interface will be set to up
 .%U http://damien.bergamini.free.fr/ipw/
 .Re
 .Sh AUTHORS
+.An -nosplit
 The
 .Nm
 driver was originally written by



CVS commit: src/usr.sbin/sysinst

2020-11-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov  4 14:29:40 UTC 2020

Modified Files:
src/usr.sbin/sysinst: Makefile.inc defs.h install.c menus.mi msg.mi.de
msg.mi.en msg.mi.es msg.mi.fr msg.mi.pl msg.pm.de msg.pm.en
msg.pm.es msg.pm.fr msg.pm.pl upgrade.c util.c
src/usr.sbin/sysinst/arch/atari: Makefile
src/usr.sbin/sysinst/arch/ews4800mips: Makefile
Added Files:
src/usr.sbin/sysinst: menus.entropy msg.entropy.de msg.entropy.en
msg.entropy.es msg.entropy.fr msg.entropy.pl

Log Message:
Add (experimental) entropy input support:
Early during new installs or after upgrades we check if entropy is
available. If not (no hardware random number generator available)
we inform the user and ask them to fix it.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/usr.sbin/sysinst/Makefile.inc
cvs rdiff -u -r1.68 -r1.69 src/usr.sbin/sysinst/defs.h
cvs rdiff -u -r1.19 -r1.20 src/usr.sbin/sysinst/install.c
cvs rdiff -u -r0 -r1.1 src/usr.sbin/sysinst/menus.entropy \
src/usr.sbin/sysinst/msg.entropy.de src/usr.sbin/sysinst/msg.entropy.en \
src/usr.sbin/sysinst/msg.entropy.es src/usr.sbin/sysinst/msg.entropy.fr \
src/usr.sbin/sysinst/msg.entropy.pl
cvs rdiff -u -r1.23 -r1.24 src/usr.sbin/sysinst/menus.mi
cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/sysinst/msg.mi.de
cvs rdiff -u -r1.34 -r1.35 src/usr.sbin/sysinst/msg.mi.en \
src/usr.sbin/sysinst/msg.mi.pl
cvs rdiff -u -r1.28 -r1.29 src/usr.sbin/sysinst/msg.mi.es
cvs rdiff -u -r1.33 -r1.34 src/usr.sbin/sysinst/msg.mi.fr
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/sysinst/msg.pm.de \
src/usr.sbin/sysinst/msg.pm.en src/usr.sbin/sysinst/msg.pm.es \
src/usr.sbin/sysinst/msg.pm.fr src/usr.sbin/sysinst/msg.pm.pl
cvs rdiff -u -r1.16 -r1.17 src/usr.sbin/sysinst/upgrade.c
cvs rdiff -u -r1.53 -r1.54 src/usr.sbin/sysinst/util.c
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/sysinst/arch/atari/Makefile
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/sysinst/arch/ews4800mips/Makefile

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

Modified files:

Index: src/usr.sbin/sysinst/Makefile.inc
diff -u src/usr.sbin/sysinst/Makefile.inc:1.36 src/usr.sbin/sysinst/Makefile.inc:1.37
--- src/usr.sbin/sysinst/Makefile.inc:1.36	Fri Oct 30 18:47:38 2020
+++ src/usr.sbin/sysinst/Makefile.inc	Wed Nov  4 14:29:40 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.36 2020/10/30 18:47:38 martin Exp $
+#	$NetBSD: Makefile.inc,v 1.37 2020/11/04 14:29:40 martin Exp $
 #
 # Makefile for sysinst
 
@@ -47,6 +47,11 @@ SRCS+=	mbr.c
 CPPFLAGS+=	-DNO_CLONES
 .endif
 
+.if ${CHECK_ENTROPY:Uyes} != "no"
+MENUS_MI+=	menus.entropy
+CPPFLAGS+=	-DCHECK_ENTROPY=1
+.endif
+
 MSG_MD?=	msg.md.${SYSINSTLANG}
 MENUS_MD?=	menus.md.${SYSINSTLANG}
 
@@ -197,7 +202,11 @@ msgtouch: ${DISTRIBVERDEP}
 	touch ${.TARGET}
 
 .if !defined(NOPARTMAN)
-MSG_MD+=	msg.pm.${SYSINSTLANG}	
+MSG_MD+=	msg.pm.${SYSINSTLANG}
+.endif
+
+.if ${CHECK_ENTROPY:Uyes} != "no"
+MSG_MD+=	msg.entropy.${SYSINSTLANG}
 .endif
 
 msg.def: msg.mi.${SYSINSTLANG} ${MSG_MD} msgtouch

Index: src/usr.sbin/sysinst/defs.h
diff -u src/usr.sbin/sysinst/defs.h:1.68 src/usr.sbin/sysinst/defs.h:1.69
--- src/usr.sbin/sysinst/defs.h:1.68	Fri Oct 30 18:47:38 2020
+++ src/usr.sbin/sysinst/defs.h	Wed Nov  4 14:29:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: defs.h,v 1.68 2020/10/30 18:47:38 martin Exp $	*/
+/*	$NetBSD: defs.h,v 1.69 2020/11/04 14:29:40 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -41,6 +41,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 const char *getfslabelname(uint, uint);
@@ -604,6 +605,7 @@ extern struct ftpinfo ftp, pkg, pkgsrc;
 extern int (*fetch_fn)(const char *);
 extern char nfs_host[STRSIZE];
 extern char nfs_dir[STRSIZE];
+extern char entropy_file[PATH_MAX];
 
 extern char cdrom_dev[SSTRSIZE];		/* Typically "cd0a" */
 extern char fd_dev[SSTRSIZE];			/* Typically "/dev/fd0a" */
@@ -888,6 +890,7 @@ bool	install_desc_from_parts(struct inst
 	struct disk_partitions*);
 void	free_install_desc(struct install_partition_desc*);
 bool	may_swap_if_not_sdmmc(const char*);
+bool	do_check_entropy(void);
 
 /* from target.c */
 #if defined(DEBUG)  ||	defined(DEBUG_ROOT)

Index: src/usr.sbin/sysinst/install.c
diff -u src/usr.sbin/sysinst/install.c:1.19 src/usr.sbin/sysinst/install.c:1.20
--- src/usr.sbin/sysinst/install.c:1.19	Wed Oct 14 13:20:27 2020
+++ src/usr.sbin/sysinst/install.c	Wed Nov  4 14:29:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: install.c,v 1.19 2020/10/14 13:20:27 martin Exp $	*/
+/*	$NetBSD: install.c,v 1.20 2020/11/04 14:29:40 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -168,6 +168,13 @@ do_install(void)
 		return;
 #endif
 
+#ifdef CHECK_ENTROPY
+	if (!do_check_entropy()) {
+		hit_enter_to_continue(MSG_abort_installation, NULL);
+		return;
+	}
+#endif
+
 	memset(, 0, sizeof install);
 
 	/* Create and mount partitions 

CVS commit: src/external/bsd/pam-u2f

2020-11-04 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Wed Nov  4 13:46:46 UTC 2020

Modified Files:
src/external/bsd/pam-u2f/bin/pamu2fcfg: Makefile
src/external/bsd/pam-u2f/lib/security/pam-u2f: Makefile

Log Message:
PR/55747: Tobias Nygren: Install manpages for pam-u2f

I have added a Makefile rule, indicating how to generate the manual
pages again. It has no dependency on the original file, in order to
avoid issues when building: the generation depends in asciidoc and
libxslt, which are not in tools or in the base tree anyway. It should
therefore never trigger, but should be used by the maintainer when
updating pam-u2f.

With this, I believe this PR can be closed.

Tested with "build.sh release" on amd64.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/pam-u2f/bin/pamu2fcfg/Makefile
cvs rdiff -u -r1.4 -r1.5 \
src/external/bsd/pam-u2f/lib/security/pam-u2f/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/bsd/pam-u2f/bin/pamu2fcfg/Makefile
diff -u src/external/bsd/pam-u2f/bin/pamu2fcfg/Makefile:1.3 src/external/bsd/pam-u2f/bin/pamu2fcfg/Makefile:1.4
--- src/external/bsd/pam-u2f/bin/pamu2fcfg/Makefile:1.3	Mon Nov  2 06:40:11 2020
+++ src/external/bsd/pam-u2f/bin/pamu2fcfg/Makefile	Wed Nov  4 13:46:46 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.3 2020/11/02 06:40:11 khorben Exp $
+# $NetBSD: Makefile,v 1.4 2020/11/04 13:46:46 khorben Exp $
 
 .include 
 
@@ -22,4 +22,9 @@ COPTS.util.c += -Wno-error=stack-protect
 LDADD+=-lpam -lfido2 -lcbor -lusbhid -lcrypto -lm
 DPADD+=${LIBPAM} ${LIBFIDO2} ${LIBCBOR} ${LIBUSBHID} ${LIBCRYPTO} ${LIBM}
 
+pamu2fcfg.1:
+	asciidoc -b docbook45 -d manpage -o pamu2fcfg.1.xml ../../dist/man/pamu2fcfg.1.txt
+	xsltproc --nonet --xinclude -o pamu2fcfg.1 'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl' pamu2fcfg.1.xml
+	rm -f pamu2fcfg.1.xml
+
 .include 

Index: src/external/bsd/pam-u2f/lib/security/pam-u2f/Makefile
diff -u src/external/bsd/pam-u2f/lib/security/pam-u2f/Makefile:1.4 src/external/bsd/pam-u2f/lib/security/pam-u2f/Makefile:1.5
--- src/external/bsd/pam-u2f/lib/security/pam-u2f/Makefile:1.4	Mon Nov  2 06:40:11 2020
+++ src/external/bsd/pam-u2f/lib/security/pam-u2f/Makefile	Wed Nov  4 13:46:46 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.4 2020/11/02 06:40:11 khorben Exp $
+# $NetBSD: Makefile,v 1.5 2020/11/04 13:46:46 khorben Exp $
 
 .include 
 .PATH: ${NETBSDSRCDIR}/external/bsd/pam-u2f/dist
@@ -18,4 +18,9 @@ LIBDPLIBS+= \
 	crypto	${NETBSDSRCDIR}/crypto/external/bsd/${EXTERNAL_OPENSSL_SUBDIR}/lib/libcrypto \
 	m	${NETBSDSRCDIR}/lib/libm
 
+pam_u2f.8:
+	asciidoc -b docbook45 -d manpage -o pam_u2f.8.xml ../../../dist/man/pam_u2f.8.txt
+	xsltproc --nonet --xinclude -o pam_u2f.8 'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl' pam_u2f.8.xml
+	rm -f pam_u2f.8.xml
+
 .include "${NETBSDSRCDIR}/lib/libpam/modules/mod.mk"



CVS commit: src/usr.bin/make

2020-11-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Nov  4 13:40:20 UTC 2020

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

Log Message:
make(1): group GNode fields by topic, document ParseErrorLevel


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

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

Modified files:

Index: src/usr.bin/make/make.h
diff -u src/usr.bin/make/make.h:1.187 src/usr.bin/make/make.h:1.188
--- src/usr.bin/make/make.h:1.187	Wed Nov  4 13:31:58 2020
+++ src/usr.bin/make/make.h	Wed Nov  4 13:40:20 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.187 2020/11/04 13:31:58 rillig Exp $	*/
+/*	$NetBSD: make.h,v 1.188 2020/11/04 13:40:20 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -330,9 +330,6 @@ typedef struct GNode {
  * file.c has the node for file.o in this list. */
 GNodeList *implicitParents;
 
-/* Other nodes of the same name, for the '::' operator. */
-GNodeList *cohorts;
-
 /* The nodes that depend on this one, or in other words, the nodes for
  * which this is a source. */
 GNodeList *parents;
@@ -348,6 +345,8 @@ typedef struct GNode {
  * in the normal sense. */
 GNodeList *order_succ;
 
+/* Other nodes of the same name, for the '::' dependency operator. */
+GNodeList *cohorts;
 /* The "#n" suffix for this cohort, or "" for other nodes */
 char cohort_num[8];
 /* The number of unmade instances on the cohorts list */
@@ -373,20 +372,19 @@ typedef struct GNode {
  * but the Suff module) */
 struct Suff *suffix;
 
-/* filename where the GNode got defined */
+/* Filename where the GNode got defined */
 const char *fname;
-/* line number where the GNode got defined */
+/* Line number where the GNode got defined */
 int lineno;
 } GNode;
 
-/*
- * Error levels for parsing. PARSE_FATAL means the process cannot continue
- * once the top-level makefile has been parsed. PARSE_WARNING and PARSE_INFO
- * mean it can.
- */
+/* Error levels for diagnostics during parsing. */
 typedef enum ParseErrorLevel {
+/* Exit when the current top-level makefile has been parsed completely. */
 PARSE_FATAL = 1,
+/* Print "warning"; may be upgraded to fatal by the -w option. */
 PARSE_WARNING,
+/* Informational, mainly used during development of makefiles. */
 PARSE_INFO
 } ParseErrorLevel;
 



CVS commit: [netbsd-9] src/doc

2020-11-04 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Wed Nov  4 13:33:10 UTC 2020

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

Log Message:
Ticket #1120


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.6 -r1.1.2.7 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.6 src/doc/CHANGES-9.2:1.1.2.7
--- src/doc/CHANGES-9.2:1.1.2.6	Wed Nov  4 13:27:40 2020
+++ src/doc/CHANGES-9.2	Wed Nov  4 13:33:10 2020
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.2,v 1.1.2.6 2020/11/04 13:27:40 sborrill Exp $
+# $NetBSD: CHANGES-9.2,v 1.1.2.7 2020/11/04 13:33:10 sborrill Exp $
 
 A complete list of changes from the NetBSD 9.1 release to the NetBSD 9.2
 release:
@@ -1031,3 +1031,9 @@ usr.sbin/sysinst/mbr.c1.37
 	an existing partition table hints at it.
 	[martin, ticket #1119]
 
+usr.sbin/sysinst/arch/i386/md.c			1.33
+
+	Do not force bootselector MBR code for installs with only a
+	single named partition.
+	[martin, ticket #1120]
+



CVS commit: src/usr.bin/make

2020-11-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Nov  4 13:31:58 UTC 2020

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

Log Message:
make(1): align comments on a few commonly used variables


To generate a diff of this commit:
cvs rdiff -u -r1.186 -r1.187 src/usr.bin/make/make.h
cvs rdiff -u -r1.425 -r1.426 src/usr.bin/make/parse.c

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

Modified files:

Index: src/usr.bin/make/make.h
diff -u src/usr.bin/make/make.h:1.186 src/usr.bin/make/make.h:1.187
--- src/usr.bin/make/make.h:1.186	Wed Nov  4 13:29:42 2020
+++ src/usr.bin/make/make.h	Wed Nov  4 13:31:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.186 2020/11/04 13:29:42 rillig Exp $	*/
+/*	$NetBSD: make.h,v 1.187 2020/11/04 13:31:58 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -460,10 +460,11 @@ extern SearchPath *sysIncPath;
 /* The default for sysIncPath. */
 extern SearchPath *defSysIncPath;
 
-extern char	curdir[];	/* Startup directory */
-extern char	*progname;	/* The program name */
-extern char	*makeDependfile; /* .depend */
-extern char	**savedEnv;	/* if we replaced environ this will be non-NULL */
+extern char curdir[];		/* Startup directory */
+extern char *progname;		/* The program name */
+extern char *makeDependfile;	/* .depend */
+/* If we replaced environ, this will be non-NULL. */
+extern char **savedEnv;
 
 extern int	makelevel;
 

Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.425 src/usr.bin/make/parse.c:1.426
--- src/usr.bin/make/parse.c:1.425	Wed Nov  4 06:09:55 2020
+++ src/usr.bin/make/parse.c	Wed Nov  4 13:31:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.425 2020/11/04 06:09:55 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.426 2020/11/04 13:31:58 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.425 2020/11/04 06:09:55 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.426 2020/11/04 13:31:58 rillig Exp $");
 
 /* types and constants */
 
@@ -125,7 +125,7 @@ MAKE_RCSID("$NetBSD: parse.c,v 1.425 202
  * Structure for a file being read ("included file")
  */
 typedef struct IFile {
-char *fname;		/* name of file */
+char *fname;		/* name of file (relative? absolute?) */
 Boolean fromForLoop;	/* simulated .include by the .for loop */
 int lineno;			/* current line number in file */
 int first_lineno;		/* line number of start of text */



CVS commit: [netbsd-9] src/usr.sbin/sysinst/arch/i386

2020-11-04 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Wed Nov  4 13:31:23 UTC 2020

Modified Files:
src/usr.sbin/sysinst/arch/i386 [netbsd-9]: md.c

Log Message:
Pull up the following revisions(s) (requested by martin in ticket #1120):
usr.sbin/sysinst/arch/i386/md.c:revision 1.33

Do not force bootselector MBR code for installs with only a single named
partition.


To generate a diff of this commit:
cvs rdiff -u -r1.20.2.7 -r1.20.2.8 src/usr.sbin/sysinst/arch/i386/md.c

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

Modified files:

Index: src/usr.sbin/sysinst/arch/i386/md.c
diff -u src/usr.sbin/sysinst/arch/i386/md.c:1.20.2.7 src/usr.sbin/sysinst/arch/i386/md.c:1.20.2.8
--- src/usr.sbin/sysinst/arch/i386/md.c:1.20.2.7	Thu Oct 15 19:36:51 2020
+++ src/usr.sbin/sysinst/arch/i386/md.c	Wed Nov  4 13:31:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.20.2.7 2020/10/15 19:36:51 bouyer Exp $ */
+/*	$NetBSD: md.c,v 1.20.2.8 2020/11/04 13:31:23 sborrill Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -573,12 +573,14 @@ md_check_mbr(struct disk_partitions *par
 	}
 
 	/* Sort out the name of the mbr code we need */
-	if (names > 0 || fl & (NETBSD_NAMED | ACTIVE_NAMED)) {
+	if (names > 1 ||
+	(parts->num_part > 1 && (fl & (NETBSD_NAMED | ACTIVE_NAMED {
 		/* Need bootselect code */
 		fl |= MBR_BS_ACTIVE;
 		bootcode = fl & MBR_BS_EXTLBA ? _PATH_BOOTEXT : _PATH_BOOTSEL;
-	} else
+	} else {
 		bootcode = _PATH_MBR;
+	}
 
 	fl &=  MBR_BS_ACTIVE | MBR_BS_EXTLBA;
 



CVS commit: src/usr.bin/make

2020-11-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Nov  4 13:29:42 UTC 2020

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

Log Message:
make(1): move declaration of parseIncPath from main.c to make.h


To generate a diff of this commit:
cvs rdiff -u -r1.424 -r1.425 src/usr.bin/make/main.c
cvs rdiff -u -r1.185 -r1.186 src/usr.bin/make/make.h

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

Modified files:

Index: src/usr.bin/make/main.c
diff -u src/usr.bin/make/main.c:1.424 src/usr.bin/make/main.c:1.425
--- src/usr.bin/make/main.c:1.424	Wed Nov  4 13:22:15 2020
+++ src/usr.bin/make/main.c	Wed Nov  4 13:29:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.424 2020/11/04 13:22:15 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.425 2020/11/04 13:29:42 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -118,7 +118,7 @@
 #include "trace.h"
 
 /*	"@(#)main.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: main.c,v 1.424 2020/11/04 13:22:15 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.425 2020/11/04 13:29:42 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	"The Regents of the University of California.  "
@@ -158,8 +158,6 @@ int makelevel;
 Boolean forceJobs = FALSE;
 static int errors = 0;
 
-extern SearchPath *parseIncPath;
-
 /*
  * For compatibility with the POSIX version of MAKEFLAGS that includes
  * all the options with out -, convert flags to -f -l -a -g -s.

Index: src/usr.bin/make/make.h
diff -u src/usr.bin/make/make.h:1.185 src/usr.bin/make/make.h:1.186
--- src/usr.bin/make/make.h:1.185	Wed Nov  4 13:22:15 2020
+++ src/usr.bin/make/make.h	Wed Nov  4 13:29:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.185 2020/11/04 13:22:15 rillig Exp $	*/
+/*	$NetBSD: make.h,v 1.186 2020/11/04 13:29:42 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -452,8 +452,13 @@ extern time_t	now;		/* The time at the s
  */
 extern Boolean preserveUndefined;
 
-extern SearchPath *sysIncPath;	/* The system include path. */
-extern SearchPath *defSysIncPath; /* The default system include path. */
+/* Used for .include "...". */
+extern SearchPath *parseIncPath;
+/* Used for .include <...>, for the built-in sys.mk and makefiles from the
+ * command line arguments. */
+extern SearchPath *sysIncPath;
+/* The default for sysIncPath. */
+extern SearchPath *defSysIncPath;
 
 extern char	curdir[];	/* Startup directory */
 extern char	*progname;	/* The program name */



CVS commit: src/usr.bin/make

2020-11-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Nov  4 13:27:00 UTC 2020

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

Log Message:
make(1): remove mistyped extern variable

Robust programs don't have extern variable declarations in .c files, as
that risks incomatible definitions that are not detected by the compiler
and invoke undefined behavior.  Make make a little more robust.


To generate a diff of this commit:
cvs rdiff -u -r1.136 -r1.137 src/usr.bin/make/meta.c

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

Modified files:

Index: src/usr.bin/make/meta.c
diff -u src/usr.bin/make/meta.c:1.136 src/usr.bin/make/meta.c:1.137
--- src/usr.bin/make/meta.c:1.136	Sat Oct 31 12:04:24 2020
+++ src/usr.bin/make/meta.c	Wed Nov  4 13:27:00 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: meta.c,v 1.136 2020/10/31 12:04:24 rillig Exp $ */
+/*  $NetBSD: meta.c,v 1.137 2020/11/04 13:27:00 rillig Exp $ */
 
 /*
  * Implement 'meta' mode.
@@ -80,7 +80,6 @@ static Boolean metaCurdirOk = FALSE;	/* 
 static Boolean metaSilent = FALSE;	/* if we have a .meta be SILENT */
 
 extern Boolean forceJobs;
-extern Boolean comatMake;
 extern char**environ;
 
 #define	MAKE_META_PREFIX	".MAKE.META.PREFIX"



CVS commit: [netbsd-9] src/usr.sbin/sysinst

2020-11-04 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Wed Nov  4 13:27:08 UTC 2020

Modified Files:
src/usr.sbin/sysinst [netbsd-9]: mbr.c

Log Message:
Pull up the following revisions(s) (requested by martin in ticket #1119):
usr.sbin/sysinst/mbr.c: revision 1.37

Do not force alignment of the first partition by default (which is
treated special to skip the first track), unless an existing partition
table hints at it.


To generate a diff of this commit:
cvs rdiff -u -r1.19.2.7 -r1.19.2.8 src/usr.sbin/sysinst/mbr.c

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

Modified files:

Index: src/usr.sbin/sysinst/mbr.c
diff -u src/usr.sbin/sysinst/mbr.c:1.19.2.7 src/usr.sbin/sysinst/mbr.c:1.19.2.8
--- src/usr.sbin/sysinst/mbr.c:1.19.2.7	Thu Oct 15 19:36:51 2020
+++ src/usr.sbin/sysinst/mbr.c	Wed Nov  4 13:27:08 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: mbr.c,v 1.19.2.7 2020/10/15 19:36:51 bouyer Exp $ */
+/*	$NetBSD: mbr.c,v 1.19.2.8 2020/11/04 13:27:08 sborrill Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -889,16 +889,15 @@ mbr_init_default_alignments(struct mbr_d
 	if (parts->dp.disk_size < 0)
 		return;
 
+	parts->ptn_0_offset = parts->geo_sec;
+
 	/* Use 1MB offset/alignemnt for large (>128GB) disks */
 	if (parts->dp.disk_size > HUGE_DISK_SIZE) {
 		parts->ptn_alignment = 2048;
-		parts->ptn_0_offset = 2048;
 	} else if (parts->dp.disk_size > TINY_DISK_SIZE) {
 		parts->ptn_alignment = 64;
-		parts->ptn_0_offset = parts->geo_sec;
 	} else {
 		parts->ptn_alignment = 1;
-		parts->ptn_0_offset = parts->geo_sec;
 	}
 	parts->ext_ptn_alignment = track;
 }



CVS commit: [netbsd-9] src/doc

2020-11-04 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Wed Nov  4 13:27:40 UTC 2020

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

Log Message:
Ticket #1119


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.5 -r1.1.2.6 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.5 src/doc/CHANGES-9.2:1.1.2.6
--- src/doc/CHANGES-9.2:1.1.2.5	Wed Nov  4 11:49:55 2020
+++ src/doc/CHANGES-9.2	Wed Nov  4 13:27:40 2020
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.2,v 1.1.2.5 2020/11/04 11:49:55 martin Exp $
+# $NetBSD: CHANGES-9.2,v 1.1.2.6 2020/11/04 13:27:40 sborrill Exp $
 
 A complete list of changes from the NetBSD 9.1 release to the NetBSD 9.2
 release:
@@ -1024,3 +1024,10 @@ sys/dev/pci/if_wmvar.h1.47
 	(ICH*/PCH*, 82580 and I350).
 	[knakahara, ticket #1126]
 
+usr.sbin/sysinst/mbr.c1.37
+
+	Do not force alignment of the first partition by default
+	(which is treated special to skip the first track), unless
+	an existing partition table hints at it.
+	[martin, ticket #1119]
+



CVS commit: src/usr.bin/make

2020-11-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Nov  4 13:22:15 UTC 2020

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

Log Message:
make(1): rename MAKEFILE_PREFERENCE for consistency

The names of the other special variables are all prefixed with MAKE_.


To generate a diff of this commit:
cvs rdiff -u -r1.423 -r1.424 src/usr.bin/make/main.c
cvs rdiff -u -r1.184 -r1.185 src/usr.bin/make/make.h

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

Modified files:

Index: src/usr.bin/make/main.c
diff -u src/usr.bin/make/main.c:1.423 src/usr.bin/make/main.c:1.424
--- src/usr.bin/make/main.c:1.423	Wed Nov  4 04:49:32 2020
+++ src/usr.bin/make/main.c	Wed Nov  4 13:22:15 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.423 2020/11/04 04:49:32 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.424 2020/11/04 13:22:15 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -118,7 +118,7 @@
 #include "trace.h"
 
 /*	"@(#)main.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: main.c,v 1.423 2020/11/04 04:49:32 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.424 2020/11/04 13:22:15 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	"The Regents of the University of California.  "
@@ -1272,7 +1272,7 @@ ReadMakefiles(void)
 		}
 	} else {
 		char *p1;
-		(void)Var_Subst("${" MAKEFILE_PREFERENCE "}",
+		(void)Var_Subst("${" MAKE_MAKEFILE_PREFERENCE "}",
 VAR_CMDLINE, VARE_WANTRES, );
 		/* TODO: handle errors */
 		(void)str2Lst_Append(opts.makefiles, p1, NULL);
@@ -1395,7 +1395,7 @@ main(int argc, char **argv)
 #ifndef MAKEFILE_PREFERENCE_LIST
 # define MAKEFILE_PREFERENCE_LIST "makefile Makefile"
 #endif
-	Var_Set(MAKEFILE_PREFERENCE, MAKEFILE_PREFERENCE_LIST,
+	Var_Set(MAKE_MAKEFILE_PREFERENCE, MAKEFILE_PREFERENCE_LIST,
 		VAR_GLOBAL);
 	Var_Set(MAKE_DEPENDFILE, ".depend", VAR_GLOBAL);
 

Index: src/usr.bin/make/make.h
diff -u src/usr.bin/make/make.h:1.184 src/usr.bin/make/make.h:1.185
--- src/usr.bin/make/make.h:1.184	Wed Nov  4 13:04:56 2020
+++ src/usr.bin/make/make.h	Wed Nov  4 13:22:15 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.184 2020/11/04 13:04:56 rillig Exp $	*/
+/*	$NetBSD: make.h,v 1.185 2020/11/04 13:22:15 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -475,7 +475,7 @@ extern pid_t	myPid;
 #define	MAKE_EXPORTED	".MAKE.EXPORTED"   /* variables we export */
 #define	MAKE_MAKEFILES	".MAKE.MAKEFILES"  /* all makefiles already loaded */
 #define	MAKE_LEVEL	".MAKE.LEVEL"	   /* recursion level */
-#define MAKEFILE_PREFERENCE ".MAKE.MAKEFILE_PREFERENCE"
+#define MAKE_MAKEFILE_PREFERENCE ".MAKE.MAKEFILE_PREFERENCE"
 #define MAKE_DEPENDFILE	".MAKE.DEPENDFILE" /* .depend */
 #define MAKE_MODE	".MAKE.MODE"
 #ifndef MAKE_LEVEL_ENV



CVS commit: src/usr.bin/make

2020-11-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Nov  4 13:04:56 UTC 2020

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

Log Message:
make(1): remove unused names DTARGET, FPREFIX, etc.


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

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

Modified files:

Index: src/usr.bin/make/make.h
diff -u src/usr.bin/make/make.h:1.183 src/usr.bin/make/make.h:1.184
--- src/usr.bin/make/make.h:1.183	Wed Nov  4 04:49:32 2020
+++ src/usr.bin/make/make.h	Wed Nov  4 13:04:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.183 2020/11/04 04:49:32 rillig Exp $	*/
+/*	$NetBSD: make.h,v 1.184 2020/11/04 13:04:56 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -410,13 +410,6 @@ typedef enum CondEvalResult {
 #define ARCHIVE		"!"	/* Archive in "archive(member)" syntax */
 #define MEMBER		"%"	/* Member in "archive(member)" syntax */
 
-#define FTARGET		"@F"	/* file part of TARGET */
-#define DTARGET		"@D"	/* directory part of TARGET */
-#define FIMPSRC		"

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

2020-11-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov  4 11:51:57 UTC 2020

Modified Files:
src/sys/dev/pci [netbsd-8]: if_wm.c if_wmvar.h

Log Message:
Pull up following revision(s) (requested by knakahara in ticket #1620):

sys/dev/pci/if_wm.c: revision 1.694
sys/dev/pci/if_wm.c: revision 1.695 (via patch)
sys/dev/pci/if_wmvar.h: revision 1.47

Add WMPHY_I350. Not used yet.

Workaround for ihphy and atphy(ICH*/PCH*, 82580 and I350).
These phys stop DMA while link is down which causes device timeout.
Fix PR/kern 40981
Reviewed and tested by msaitoh@n.o, thanks.
XXX pullup-[89]


To generate a diff of this commit:
cvs rdiff -u -r1.508.4.40 -r1.508.4.41 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.33.6.6 -r1.33.6.7 src/sys/dev/pci/if_wmvar.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/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.508.4.40 src/sys/dev/pci/if_wm.c:1.508.4.41
--- src/sys/dev/pci/if_wm.c:1.508.4.40	Fri Oct 16 08:06:02 2020
+++ src/sys/dev/pci/if_wm.c	Wed Nov  4 11:51:57 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.508.4.40 2020/10/16 08:06:02 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.508.4.41 2020/11/04 11:51:57 martin Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.40 2020/10/16 08:06:02 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.41 2020/11/04 11:51:57 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -374,7 +374,8 @@ struct wm_txqueue {
 	 * to manage Tx H/W queue's busy flag.
 	 */
 	int txq_flags;			/* flags for H/W queue, see below */
-#define	WM_TXQ_NO_SPACE	0x1
+#define	WM_TXQ_NO_SPACE		0x1
+#define	WM_TXQ_LINKDOWN_DISCARD	0x2
 
 	bool txq_stopping;
 
@@ -1018,6 +1019,9 @@ static void	wm_toggle_lanphypc_pch_lpt(s
 static int	wm_platform_pm_pch_lpt(struct wm_softc *, bool);
 static void	wm_pll_workaround_i210(struct wm_softc *);
 static void	wm_legacy_irq_quirk_spt(struct wm_softc *);
+static bool	wm_phy_need_linkdown_discard(struct wm_softc *);
+static void	wm_set_linkdown_discard(struct wm_softc *);
+static void	wm_clear_linkdown_discard(struct wm_softc *);
 
 CFATTACH_DECL3_NEW(wm, sizeof(struct wm_softc),
 wm_match, wm_attach, wm_detach, NULL, NULL, NULL, DVF_DETACH_SHUTDOWN);
@@ -3041,6 +3045,9 @@ alloc_retry:
 
 	sc->sc_txrx_use_workqueue = false;
 
+	if (wm_phy_need_linkdown_discard(sc))
+		wm_set_linkdown_discard(sc);
+
 	wm_init_sysctls(sc);
 
 	if (pmf_device_register(self, wm_suspend, wm_resume))
@@ -3399,6 +3406,49 @@ out:
 	return rc;
 }
 
+static bool
+wm_phy_need_linkdown_discard(struct wm_softc *sc)
+{
+
+	switch(sc->sc_phytype) {
+	case WMPHY_82577: /* ihphy */
+	case WMPHY_82578: /* atphy */
+	case WMPHY_82579: /* ihphy */
+	case WMPHY_I217: /* ihphy */
+	case WMPHY_82580: /* ihphy */
+	case WMPHY_I350: /* ihphy */
+		return true;
+	default:
+		return false;
+	}
+}
+
+static void
+wm_set_linkdown_discard(struct wm_softc *sc)
+{
+
+	for (int i = 0; i < sc->sc_nqueues; i++) {
+		struct wm_txqueue *txq = >sc_queue[i].wmq_txq;
+
+		mutex_enter(txq->txq_lock);
+		txq->txq_flags |= WM_TXQ_LINKDOWN_DISCARD;
+		mutex_exit(txq->txq_lock);
+	}
+}
+
+static void
+wm_clear_linkdown_discard(struct wm_softc *sc)
+{
+
+	for (int i = 0; i < sc->sc_nqueues; i++) {
+		struct wm_txqueue *txq = >sc_queue[i].wmq_txq;
+
+		mutex_enter(txq->txq_lock);
+		txq->txq_flags &= ~WM_TXQ_LINKDOWN_DISCARD;
+		mutex_exit(txq->txq_lock);
+	}
+}
+
 /*
  * wm_ioctl:		[ifnet interface function]
  *
@@ -3442,6 +3492,12 @@ wm_ioctl(struct ifnet *ifp, u_long cmd, 
 #ifdef WM_MPSAFE
 		splx(s);
 #endif
+		if (error == 0 && wm_phy_need_linkdown_discard(sc)) {
+			if (IFM_SUBTYPE(ifr->ifr_media) == IFM_NONE)
+wm_set_linkdown_discard(sc);
+			else
+wm_clear_linkdown_discard(sc);
+		}
 		break;
 	case SIOCINITIFADDR:
 		WM_CORE_LOCK(sc);
@@ -3456,8 +3512,17 @@ wm_ioctl(struct ifnet *ifp, u_long cmd, 
 			break;
 		}
 		WM_CORE_UNLOCK(sc);
+		if (((ifp->if_flags & IFF_UP) == 0) && wm_phy_need_linkdown_discard(sc))
+			wm_clear_linkdown_discard(sc);
 		/*FALLTHROUGH*/
 	default:
+		if (cmd == SIOCSIFFLAGS && wm_phy_need_linkdown_discard(sc)) {
+			if (((ifp->if_flags & IFF_UP) == 0) && ((ifr->ifr_flags & IFF_UP) != 0)) {
+wm_clear_linkdown_discard(sc);
+			} else if (((ifp->if_flags & IFF_UP) != 0) && ((ifr->ifr_flags & IFF_UP) == 0)) {
+wm_set_linkdown_discard(sc);
+			}
+		}
 #ifdef WM_MPSAFE
 		s = splnet();
 #endif
@@ -7542,6 +7607,16 @@ wm_select_txqueue(struct ifnet *ifp, str
 	return ((cpuid + ncpu - sc->sc_affinity_offset) % ncpu) % sc->sc_nqueues;
 }
 
+static inline bool
+wm_linkdown_discard(struct wm_txqueue *txq)
+{
+
+	if ((txq->txq_flags & WM_TXQ_LINKDOWN_DISCARD) != 0)
+		return true;
+
+	return false;
+}
+
 /*
  * wm_start:		[ifnet interface function]
  *
@@ -7636,6 +7711,23 @@ 

CVS commit: [netbsd-8] src/doc

2020-11-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov  4 11:52:47 UTC 2020

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

Log Message:
Ticket #1620


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.47 -r1.1.2.48 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.47 src/doc/CHANGES-8.3:1.1.2.48
--- src/doc/CHANGES-8.3:1.1.2.47	Sun Nov  1 18:09:23 2020
+++ src/doc/CHANGES-8.3	Wed Nov  4 11:52:47 2020
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.3,v 1.1.2.47 2020/11/01 18:09:23 martin Exp $
+# $NetBSD: CHANGES-8.3,v 1.1.2.48 2020/11/04 11:52:47 martin Exp $
 
 A complete list of changes from the NetBSD 8.2 release to the NetBSD 8.3
 release:
@@ -1305,3 +1305,12 @@ doc/3RDPARTY	(manually modified)
 
 	Update tmux to 3.1c.
 	[christos, ticket #1619]
+
+sys/dev/pci/if_wm.c1.694,1.695 (patch)
+sys/dev/pci/if_wmvar.h1.47
+
+	PR 40981: avoid device timeouts with ihphy and atphy
+	(ICH*/PCH*, 82580 and I350).
+	[knakahara, ticket #1620]
+
+



CVS commit: [netbsd-9] src/doc

2020-11-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov  4 11:49:55 UTC 2020

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

Log Message:
Ticket #1126


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.4 -r1.1.2.5 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.4 src/doc/CHANGES-9.2:1.1.2.5
--- src/doc/CHANGES-9.2:1.1.2.4	Sun Nov  1 18:03:21 2020
+++ src/doc/CHANGES-9.2	Wed Nov  4 11:49:55 2020
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.2,v 1.1.2.4 2020/11/01 18:03:21 martin Exp $
+# $NetBSD: CHANGES-9.2,v 1.1.2.5 2020/11/04 11:49:55 martin Exp $
 
 A complete list of changes from the NetBSD 9.1 release to the NetBSD 9.2
 release:
@@ -1016,3 +1016,11 @@ doc/3RDPARTY	(manually adjusted)
 
 	Update tmux to 3.1c.
 	[christos, ticket #1125]
+
+sys/dev/pci/if_wm.c1.694,1.695 (patch)
+sys/dev/pci/if_wmvar.h1.47
+
+	PR 40981: avoid device timeouts with ihphy and atphy
+	(ICH*/PCH*, 82580 and I350).
+	[knakahara, ticket #1126]
+



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

2020-11-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov  4 11:48:26 UTC 2020

Modified Files:
src/sys/dev/pci [netbsd-9]: if_wm.c if_wmvar.h

Log Message:
Pull up following revision(s) (requested by knakahara in ticket #1126):

sys/dev/pci/if_wm.c: revision 1.694
sys/dev/pci/if_wm.c: revision 1.695 (via patch)
sys/dev/pci/if_wmvar.h: revision 1.47

Add WMPHY_I350. Not used yet.

Workaround for ihphy and atphy(ICH*/PCH*, 82580 and I350).
These phys stop DMA while link is down which causes device timeout.
Fix PR/kern 40981
Reviewed and tested by msaitoh@n.o, thanks.
XXX pullup-[89]


To generate a diff of this commit:
cvs rdiff -u -r1.645.2.8 -r1.645.2.9 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.44.4.2 -r1.44.4.3 src/sys/dev/pci/if_wmvar.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/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.645.2.8 src/sys/dev/pci/if_wm.c:1.645.2.9
--- src/sys/dev/pci/if_wm.c:1.645.2.8	Fri Oct 16 08:03:36 2020
+++ src/sys/dev/pci/if_wm.c	Wed Nov  4 11:48:26 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.645.2.8 2020/10/16 08:03:36 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.645.2.9 2020/11/04 11:48:26 martin Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.645.2.8 2020/10/16 08:03:36 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.645.2.9 2020/11/04 11:48:26 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -375,7 +375,8 @@ struct wm_txqueue {
 	 * to manage Tx H/W queue's busy flag.
 	 */
 	int txq_flags;			/* flags for H/W queue, see below */
-#define	WM_TXQ_NO_SPACE	0x1
+#define	WM_TXQ_NO_SPACE		0x1
+#define	WM_TXQ_LINKDOWN_DISCARD	0x2
 
 	bool txq_stopping;
 
@@ -1031,6 +1032,9 @@ static void	wm_toggle_lanphypc_pch_lpt(s
 static int	wm_platform_pm_pch_lpt(struct wm_softc *, bool);
 static int	wm_pll_workaround_i210(struct wm_softc *);
 static void	wm_legacy_irq_quirk_spt(struct wm_softc *);
+static bool	wm_phy_need_linkdown_discard(struct wm_softc *);
+static void	wm_set_linkdown_discard(struct wm_softc *);
+static void	wm_clear_linkdown_discard(struct wm_softc *);
 
 CFATTACH_DECL3_NEW(wm, sizeof(struct wm_softc),
 wm_match, wm_attach, wm_detach, NULL, NULL, NULL, DVF_DETACH_SHUTDOWN);
@@ -3077,6 +3081,9 @@ alloc_retry:
 
 	sc->sc_txrx_use_workqueue = false;
 
+	if (wm_phy_need_linkdown_discard(sc))
+		wm_set_linkdown_discard(sc);
+
 	wm_init_sysctls(sc);
 
 	if (pmf_device_register(self, wm_suspend, wm_resume))
@@ -3455,6 +3462,49 @@ out:
 	return rc;
 }
 
+static bool
+wm_phy_need_linkdown_discard(struct wm_softc *sc)
+{
+
+	switch(sc->sc_phytype) {
+	case WMPHY_82577: /* ihphy */
+	case WMPHY_82578: /* atphy */
+	case WMPHY_82579: /* ihphy */
+	case WMPHY_I217: /* ihphy */
+	case WMPHY_82580: /* ihphy */
+	case WMPHY_I350: /* ihphy */
+		return true;
+	default:
+		return false;
+	}
+}
+
+static void
+wm_set_linkdown_discard(struct wm_softc *sc)
+{
+
+	for (int i = 0; i < sc->sc_nqueues; i++) {
+		struct wm_txqueue *txq = >sc_queue[i].wmq_txq;
+
+		mutex_enter(txq->txq_lock);
+		txq->txq_flags |= WM_TXQ_LINKDOWN_DISCARD;
+		mutex_exit(txq->txq_lock);
+	}
+}
+
+static void
+wm_clear_linkdown_discard(struct wm_softc *sc)
+{
+
+	for (int i = 0; i < sc->sc_nqueues; i++) {
+		struct wm_txqueue *txq = >sc_queue[i].wmq_txq;
+
+		mutex_enter(txq->txq_lock);
+		txq->txq_flags &= ~WM_TXQ_LINKDOWN_DISCARD;
+		mutex_exit(txq->txq_lock);
+	}
+}
+
 /*
  * wm_ioctl:		[ifnet interface function]
  *
@@ -3498,6 +3548,12 @@ wm_ioctl(struct ifnet *ifp, u_long cmd, 
 #ifdef WM_MPSAFE
 		splx(s);
 #endif
+		if (error == 0 && wm_phy_need_linkdown_discard(sc)) {
+			if (IFM_SUBTYPE(ifr->ifr_media) == IFM_NONE)
+wm_set_linkdown_discard(sc);
+			else
+wm_clear_linkdown_discard(sc);
+		}
 		break;
 	case SIOCINITIFADDR:
 		WM_CORE_LOCK(sc);
@@ -3512,8 +3568,17 @@ wm_ioctl(struct ifnet *ifp, u_long cmd, 
 			break;
 		}
 		WM_CORE_UNLOCK(sc);
+		if (((ifp->if_flags & IFF_UP) == 0) && wm_phy_need_linkdown_discard(sc))
+			wm_clear_linkdown_discard(sc);
 		/*FALLTHROUGH*/
 	default:
+		if (cmd == SIOCSIFFLAGS && wm_phy_need_linkdown_discard(sc)) {
+			if (((ifp->if_flags & IFF_UP) == 0) && ((ifr->ifr_flags & IFF_UP) != 0)) {
+wm_clear_linkdown_discard(sc);
+			} else if (((ifp->if_flags & IFF_UP) != 0) && ((ifr->ifr_flags & IFF_UP) == 0)) {
+wm_set_linkdown_discard(sc);
+			}
+		}
 #ifdef WM_MPSAFE
 		s = splnet();
 #endif
@@ -7627,6 +7692,16 @@ wm_select_txqueue(struct ifnet *ifp, str
 	return ((cpuid + ncpu - sc->sc_affinity_offset) % ncpu) % sc->sc_nqueues;
 }
 
+static inline bool
+wm_linkdown_discard(struct wm_txqueue *txq)
+{
+
+	if ((txq->txq_flags & WM_TXQ_LINKDOWN_DISCARD) != 0)
+		return true;
+
+	return false;
+}
+
 /*
  * wm_start:		[ifnet interface function]
  *
@@ -7721,6 +7796,23 @@ 

CVS commit: src/sys/dev/mii

2020-11-04 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Nov  4 09:15:10 UTC 2020

Modified Files:
src/sys/dev/mii: igphy.c ihphy.c makphy.c

Log Message:
 Fix a bug that "ifconfig xx0 media none" set LINK_STATE_UNKNOWN instead of
LINK_STATE_DOWN.

XXX We should check for other PHY drivers, too.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/mii/igphy.c
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/mii/ihphy.c
cvs rdiff -u -r1.67 -r1.68 src/sys/dev/mii/makphy.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/mii/igphy.c
diff -u src/sys/dev/mii/igphy.c:1.36 src/sys/dev/mii/igphy.c:1.37
--- src/sys/dev/mii/igphy.c:1.36	Mon Aug  3 07:25:59 2020
+++ src/sys/dev/mii/igphy.c	Wed Nov  4 09:15:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: igphy.c,v 1.36 2020/08/03 07:25:59 msaitoh Exp $	*/
+/*	$NetBSD: igphy.c,v 1.37 2020/11/04 09:15:10 msaitoh Exp $	*/
 
 /*
  * The Intel copyright applies to the analog register setup, and the
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: igphy.c,v 1.36 2020/08/03 07:25:59 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: igphy.c,v 1.37 2020/11/04 09:15:10 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_mii.h"
@@ -437,7 +437,6 @@ igphy_status(struct mii_softc *sc)
 	PHY_READ(sc, MII_BMCR, );
 	if (bmcr & BMCR_ISO) {
 		mii->mii_media_active |= IFM_NONE;
-		mii->mii_media_status = 0;
 		return;
 	}
 

Index: src/sys/dev/mii/ihphy.c
diff -u src/sys/dev/mii/ihphy.c:1.18 src/sys/dev/mii/ihphy.c:1.19
--- src/sys/dev/mii/ihphy.c:1.18	Sat Mar 28 18:37:18 2020
+++ src/sys/dev/mii/ihphy.c	Wed Nov  4 09:15:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ihphy.c,v 1.18 2020/03/28 18:37:18 thorpej Exp $	*/
+/*	$NetBSD: ihphy.c,v 1.19 2020/11/04 09:15:10 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ihphy.c,v 1.18 2020/03/28 18:37:18 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ihphy.c,v 1.19 2020/11/04 09:15:10 msaitoh Exp $");
 
 #include 
 #include 
@@ -242,7 +242,6 @@ ihphy_status(struct mii_softc *sc)
 	PHY_READ(sc, MII_BMCR, );
 	if (bmcr & (BMCR_ISO | BMCR_PDOWN)) {
 		mii->mii_media_active |= IFM_NONE;
-		mii->mii_media_status = 0;
 		return;
 	}
 

Index: src/sys/dev/mii/makphy.c
diff -u src/sys/dev/mii/makphy.c:1.67 src/sys/dev/mii/makphy.c:1.68
--- src/sys/dev/mii/makphy.c:1.67	Tue Oct 20 08:53:34 2020
+++ src/sys/dev/mii/makphy.c	Wed Nov  4 09:15:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: makphy.c,v 1.67 2020/10/20 08:53:34 msaitoh Exp $	*/
+/*	$NetBSD: makphy.c,v 1.68 2020/11/04 09:15:10 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: makphy.c,v 1.67 2020/10/20 08:53:34 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: makphy.c,v 1.68 2020/11/04 09:15:10 msaitoh Exp $");
 
 #include 
 #include 
@@ -436,9 +436,8 @@ makphy_status(struct mii_softc *sc)
 	if (bmcr & BMCR_LOOP)
 		mii->mii_media_active |= IFM_LOOP;
 
-	if (bmcr & BMCR_ISO) {
+	if (bmcr & (BMCR_ISO | BMCR_PDOWN)) {
 		mii->mii_media_active |= IFM_NONE;
-		mii->mii_media_status = 0;
 		return;
 	}