CVS commit: src/common/lib/libc/string

2021-04-16 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sat Apr 17 05:57:11 UTC 2021

Modified Files:
src/common/lib/libc/string: memset2.c

Log Message:
Disable the larger/faster code path.  While the optimised code path was
indeed quicker, it nonetheless failed to actually fill all the requested
memory with the specified value much of the time if a non-aligned start
address was used.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/common/lib/libc/string/memset2.c

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

Modified files:

Index: src/common/lib/libc/string/memset2.c
diff -u src/common/lib/libc/string/memset2.c:1.5 src/common/lib/libc/string/memset2.c:1.6
--- src/common/lib/libc/string/memset2.c:1.5	Fri Mar  2 16:22:27 2012
+++ src/common/lib/libc/string/memset2.c	Sat Apr 17 05:57:11 2021
@@ -29,7 +29,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: memset2.c,v 1.5 2012/03/02 16:22:27 apb Exp $");
+__RCSID("$NetBSD: memset2.c,v 1.6 2021/04/17 05:57:11 simonb Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include 
@@ -47,6 +47,8 @@ __RCSID("$NetBSD: memset2.c,v 1.5 2012/0
 #include 
 #include 
 
+#define __OPTIMIZE_SIZE__	/* other code path is very broken */
+
 #ifdef TEST
 #include 
 #define _DIAGASSERT(a)		assert(a)



CVS commit: src/doc

2021-04-16 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Apr 17 04:11:52 UTC 2021

Modified Files:
src/doc: 3RDPARTY CHANGES

Log Message:
note GCC 10 and the ports that switched.


To generate a diff of this commit:
cvs rdiff -u -r1.1794 -r1.1795 src/doc/3RDPARTY
cvs rdiff -u -r1.2795 -r1.2796 src/doc/CHANGES

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1794 src/doc/3RDPARTY:1.1795
--- src/doc/3RDPARTY:1.1794	Sun Apr 11 01:37:02 2021
+++ src/doc/3RDPARTY	Sat Apr 17 04:11:52 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1794 2021/04/11 01:37:02 mrg Exp $
+#	$NetBSD: 3RDPARTY,v 1.1795 2021/04/17 04:11:52 mrg Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -449,7 +449,7 @@ Notes:
 There is a flex2netbsd script to help newer imports.
 
 Package:	gcc
-Version:	9.3.0
+Version:	9.3.0/10.3.0
 Current Vers:	9.3.0/10.3.0
 Maintainer:	FSF
 Archive Site:	ftp://ftp.gnu.org/gnu/gcc/

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2795 src/doc/CHANGES:1.2796
--- src/doc/CHANGES:1.2795	Sat Apr 10 20:12:47 2021
+++ src/doc/CHANGES	Sat Apr 17 04:11:52 2021
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2795 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2796 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -352,3 +352,11 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	file(1): Upgraded to 5.40. [christos 20210409]
 	pkg_install: Updated to 20210410. This simplifes version checking for
 		NetBSD. [nia 20210410]
+	gcc(1): Import GCC 10.3.  [mrg 20200410]
+	alpha: Switch to GCC 10.  [mrg 20200416]
+	amd64: Switch to GCC 10.  [mrg 20200416]
+	ia64: Switch to GCC 10.  [mrg 20200416]
+	riscv: Switch to GCC 10.  [mrg 20200416]
+	sparc: Switch to GCC 10.  [mrg 20200416]
+	sparc64: Switch to GCC 10.  [mrg 20200416]
+	vax: Switch to GCC 10.  [mrg 20200416]



CVS commit: src

2021-04-16 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Apr 17 04:08:32 UTC 2021

Modified Files:
src: UPDATING

Log Message:
add a note about potential GCC 9->10 build failures


To generate a diff of this commit:
cvs rdiff -u -r1.317 -r1.318 src/UPDATING

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

Modified files:

Index: src/UPDATING
diff -u src/UPDATING:1.317 src/UPDATING:1.318
--- src/UPDATING:1.317	Sat Jan  9 20:51:08 2021
+++ src/UPDATING	Sat Apr 17 04:08:32 2021
@@ -1,4 +1,4 @@
-$NetBSD: UPDATING,v 1.317 2021/01/09 20:51:08 rillig Exp $
+$NetBSD: UPDATING,v 1.318 2021/04/17 04:08:32 mrg Exp $
 
 This file (UPDATING) is intended to be a brief reference to recent
 changes that might cause problems in the build process, and a guide for
@@ -19,6 +19,11 @@ See also: BUILDING, build.sh, Makefile.
 Recent changes:
 ^^^
 
+20210417:
+	GCC 10 was enabled for several platforms.  If builds fail in either
+	tools/gcc or external/gpl/gcc, first try cleaning those objects and
+	removing the $DESTDIR/usr/include/g++ subdirectory.
+
 20201230:
 	lint1/ops.c is no longer autogenerated.  If this makes the build
 	fail, clean $OBJDIR/tools/*lint* and $OBJDIR/usr.bin/*xlint*.



CVS commit: src

2021-04-16 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Apr 17 04:07:16 UTC 2021

Modified Files:
src/external/gpl3/gcc: README.gcc10
src/share/mk: bsd.own.mk

Log Message:
switch alpha, ia64, sparc*, riscv*, amd64 and vax to GCC 10 default.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/external/gpl3/gcc/README.gcc10
cvs rdiff -u -r1.1239 -r1.1240 src/share/mk/bsd.own.mk

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

Modified files:

Index: src/external/gpl3/gcc/README.gcc10
diff -u src/external/gpl3/gcc/README.gcc10:1.10 src/external/gpl3/gcc/README.gcc10:1.11
--- src/external/gpl3/gcc/README.gcc10:1.10	Sat Apr 17 01:59:41 2021
+++ src/external/gpl3/gcc/README.gcc10	Sat Apr 17 04:07:16 2021
@@ -1,4 +1,4 @@
-$NetBSD: README.gcc10,v 1.10 2021/04/17 01:59:41 mrg Exp $
+$NetBSD: README.gcc10,v 1.11 2021/04/17 04:07:16 mrg Exp $
 
 
 new stuff:
@@ -34,7 +34,7 @@ architecture	tools	kernels	libgcc	native
 	-	---	--	--			---	
 aarch64		y	n[3]	n[3]	y		n		?	?	?
 aarch64be	y	n[3]	n[3]	y		n		?	?	?
-alpha		y	y	y	y		y		y	y	n
+alpha		y	y	y	y		y		y	y	y
 earmv4		y	y	y	y		y		y	?	n
 earmv4eb	y	b	y	y		y		?	?	?
 earmv5		y	b	y	y		y		?	?	?
@@ -51,7 +51,7 @@ earmv7hf	y	y	y	y		y		y	y	n
 earmv7hfeb	y	b	y	y		y		?	?	?
 hppa		y	y	y	y		y		y	?	?
 i386		y	y	y	y		y		y	n[8]	?
-ia64		y	y	y	y		y		?	N/A	n
+ia64		y	y	y	y		y		?	N/A	y
 m68000		y	b	y	y		n[1]		?	?	?
 m68k		y	y	y	y		y[9]		y	n	n
 mipseb		y	y	y	y		y		y	?	?
@@ -62,12 +62,12 @@ powerpc		y	b	y	y		y		y	?	n
 powerpc64	y	b	y	y		y		N/A	N/A	n
 sh3eb		y	b	y	y		y		?	?	?
 sh3el		y	y	y	y		y		y	y[7]	?
-sparc		y	y	y	y		y		y	y	n
-sparc64		y	y	y	y		y		y	y	n
-vax		y	y	y	y		y		y	n[6]	n
-x86_64		y	y	y	y		y		y	y	n
-riscv32		y	N/A	y	y		y		N/A	N/A	n
-riscv64		y	N/A	y	y		y		N/A	N/A	n
+sparc		y	y	y	y		y		y	y	y
+sparc64		y	y	y	y		y		y	y	y
+vax		y	y	y	y		y		y	n[6]	y
+x86_64		y	y	y	y		y		y	y	y
+riscv32		y	N/A	y	y		y		N/A	N/A	y
+riscv64		y	N/A	y	y		y		N/A	N/A	y
 --
 coldfire	?	N/A	?	?		?		N/A	N/A
 	-	---	--	--			---

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.1239 src/share/mk/bsd.own.mk:1.1240
--- src/share/mk/bsd.own.mk:1.1239	Mon Apr 12 04:18:38 2021
+++ src/share/mk/bsd.own.mk	Sat Apr 17 04:07:16 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.1239 2021/04/12 04:18:38 mrg Exp $
+#	$NetBSD: bsd.own.mk,v 1.1240 2021/04/17 04:07:16 mrg Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -63,7 +63,18 @@ TOOLCHAIN_MISSING?=	no
 #
 # What GCC is used?
 #
+.if ${MACHINE} == "alpha" || \
+${MACHINE} == "amd64" || \
+${MACHINE} == "ia64" || \
+${MACHINE} == "sparc" || \
+${MACHINE} == "sparc64" || \
+${MACHINE} == "vax" || \
+${MACHINE_ARCH} == "riscv32" || \
+${MACHINE_ARCH} == "riscv64"
+HAVE_GCC?=	10
+.else
 HAVE_GCC?=	9
+.endif
 
 #
 # Platforms that can't run a modern GCC natively



CVS commit: src/sys/compat/netbsd32

2021-04-16 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sat Apr 17 03:57:42 UTC 2021

Modified Files:
src/sys/compat/netbsd32: files.netbsd32

Log Message:
Compile in compat32 syscall names all the time, as we do for native
syscall names.  Needed for dtrace.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/compat/netbsd32/files.netbsd32

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/files.netbsd32
diff -u src/sys/compat/netbsd32/files.netbsd32:1.52 src/sys/compat/netbsd32/files.netbsd32:1.53
--- src/sys/compat/netbsd32/files.netbsd32:1.52	Sat May 16 18:31:48 2020
+++ src/sys/compat/netbsd32/files.netbsd32	Sat Apr 17 03:57:42 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: files.netbsd32,v 1.52 2020/05/16 18:31:48 christos Exp $
+#	$NetBSD: files.netbsd32,v 1.53 2021/04/17 03:57:42 simonb Exp $
 #
 # config file description for machine-independent netbsd32 compat code.
 # included by ports that need it.
@@ -41,7 +41,7 @@ file	compat/netbsd32/netbsd32_time.c		co
 file	compat/netbsd32/netbsd32_wait.c		compat_netbsd32
 file	compat/netbsd32/netbsd32_vm.c		compat_netbsd32
 file	compat/netbsd32/netbsd32_sysent.c	compat_netbsd32
-file	compat/netbsd32/netbsd32_syscalls.c	compat_netbsd32 & syscall_debug
+file	compat/netbsd32/netbsd32_syscalls.c	compat_netbsd32
 
 file	compat/netbsd32/netbsd32_compat_09.c	compat_netbsd32 & (compat_09 | compat_sunos)
 file	compat/netbsd32/netbsd32_compat_10_sysv.c compat_netbsd32 & compat_10 &



CVS commit: src/external/gpl3/gcc

2021-04-16 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Apr 17 01:59:41 UTC 2021

Modified Files:
src/external/gpl3/gcc: README.gcc10

Log Message:
various updates, thanks to those who provided feedback.

- powerpc ports work
- m68k ports work, x68k has a new caveat
- hppa works
- mips64eb vs UVMHIST has been fix
- i386 reboot problem fixed (cardbus issue, not GCC related)


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/external/gpl3/gcc/README.gcc10

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

Modified files:

Index: src/external/gpl3/gcc/README.gcc10
diff -u src/external/gpl3/gcc/README.gcc10:1.9 src/external/gpl3/gcc/README.gcc10:1.10
--- src/external/gpl3/gcc/README.gcc10:1.9	Thu Apr 15 05:12:57 2021
+++ src/external/gpl3/gcc/README.gcc10	Sat Apr 17 01:59:41 2021
@@ -1,4 +1,4 @@
-$NetBSD: README.gcc10,v 1.9 2021/04/15 05:12:57 mrg Exp $
+$NetBSD: README.gcc10,v 1.10 2021/04/17 01:59:41 mrg Exp $
 
 
 new stuff:
@@ -49,17 +49,17 @@ earmv7		y	b	y	y		y		?	?	?
 earmv7eb	y	b	y	y		y		?	?	?
 earmv7hf	y	y	y	y		y		y	y	n
 earmv7hfeb	y	b	y	y		y		?	?	?
-hppa		y	b	y	y		y		?	?	?
+hppa		y	y	y	y		y		y	?	?
 i386		y	y	y	y		y		y	n[8]	?
 ia64		y	y	y	y		y		?	N/A	n
 m68000		y	b	y	y		n[1]		?	?	?
-m68k		y	y	y	y		y[9]		y	?	?
+m68k		y	y	y	y		y[9]		y	n	n
 mipseb		y	y	y	y		y		y	?	?
 mipsel		y	y	y	y		y		y	?	?
-mips64eb	y	y	y	y		y		n[4]	?	?
+mips64eb	y	y	y	y		y		y	?	?
 mips64el	y	b	y	y		y		y	?	?
-powerpc		y	b	y	y		y		n[2]	?	?
-powerpc64	y	b	y	y		y		N/A	N/A	?
+powerpc		y	b	y	y		y		y	?	n
+powerpc64	y	b	y	y		y		N/A	N/A	n
 sh3eb		y	b	y	y		y		?	?	?
 sh3el		y	y	y	y		y		y	y[7]	?
 sparc		y	y	y	y		y		y	y	n
@@ -74,36 +74,22 @@ coldfire	?	N/A	?	?		?		N/A	N/A
 architecture	tools	kernels	libgcc	native-gcc	make release	runs	atf
 
 [1] - ramdisk.fs is too large, needs fixing.
-[2] - powerpc ports have regressions; fixes incoming from rin@
 [3] - missing __aarch64_swp1_acq in kernels.  missing lse.S in libgcc.
-[4] - edgerouter lite3 crashes early in boot:
-  [   1.000] u-boot bootmem desc @ 0x24108 version 3.0
-  [   1.000] phys segment: 0xfc000 @ 0x102000
-  [   1.000] adding 0xfc000 @ 0x102000 to freelist 3
-  [   1.000] phys segment: 0x7276000 @ 0xe8a000
-  [   1.000] adding 0x7276000 @ 0xe8a000 to freelist 3
-  [   1.000] phys segment: 0x7efa000 @ 0x8102000
-  [   1.000] adding 0x7efa000 @ 0x8102000 to freelist 3
-  [   1.000] phys segment: 0xff0 @ 0x41000
-  [   1.000] adding 0xff0 @ 0x41000 to freelist 0
-  [   1.000] pid 0(system): trap: cpu0, TLB miss (load or instr. fetch) in kernel mode
-  [   1.000] status=0xa3, cause=0x8, epc=0x802564d4, vaddr=0
-  [   1.000] tf=0x98165bb0 ksp=0x98165cf0 ra=0x80256470 ppl=0
-  [   1.000] kernel: TLB miss (load or instr. fetch) trap
-  Stopped in pid 0.0 (system) at  802564d4:   sw  zero,16(s0)
-  0x98165cf0: 0x802563+0xd8 (0x8000,0,0,0xc800) ra 0x803edd18 sz 0
-  0x98165cf0: 0x803edc+0x84 (0x8000,0,0,0xc800) ra 0 sz 0
-- OCTEON kernel seems OK, something in my private configuration?
 [6] - vax vs c++ exceptions issue, same as it ever was
 [7] - fails just as poorly in gxemul/landisk as GCC 9
-[8] - i386 seems to have a signal delivery issue.  GCC 9 or 10 kernels are
-  unable to reboot properly, and GCC 10 atf runs hang in signal delivery.
-  bisection so far has reduced bug introduction between 2020-05-08 and
-  2020-05-15.  possibly pthread or condvar changes in this period.
+[8] - i386 seems to have a signal delivery issue.  pthread tests hang and then
+  complain with eg:
+	  threads_and_exec: q[ 627.6700846] sorry, pid 3154 was killed: orphaned traced process
+  this problem occurs with GCC 9 as well.
 [9] - x68k/stand fails with:
   link  loadbsd/loadbsd.x
   loadbsd1: program header #1 is not loadable
-  may be due to it pulling in libc sources that get TLS marked?
+  problem is understood (thanks tsutsui@): previously loadbsd was linked
+  against normal userland libc components for m68k, which allows it to
+  detect running on m68000 CPU and sanely fail, instead of an barf error.
+  new gcc built libc includes TLS support, that isn't compatible with this
+  and the conversion process fails.  can be fixed by using libkern instead,
+  and accepting the poor error on m68000.
 
 
 
@@ -114,7 +100,7 @@ CPU		platform list
 ---		 
 		acorn32		cats	epoc32	evbarm-eb	evbarm-el	hpcarm		iyonix		netwinder	shark 		zaurus
 earmv4:		y		y	y	y		y		y		 		y		y		 
-earm:		 		 	 	r		y		 		y		 		 		y
+earm:		 		 	 	y		y		 		y		 		 		y
 earmhf:		 		 	 	y		y		 		 		 		 		 
 earmv6:		 		 	 	y		y
 earmv6hf:	 		 	 	y		y



CVS commit: src/sys

2021-04-16 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Apr 17 01:53:58 UTC 2021

Modified Files:
src/sys/arch/aarch64/aarch64: pmap.c
src/sys/dev/usb: usbhist.h
src/sys/sys: biohist.h kernhist.h
src/sys/uvm: uvm_map.c uvm_pdaemon.c uvm_stat.h
src/sys/uvm/pmap: pmap.c

Log Message:
remove KERNHIST_INIT_STATIC().  it stradles the line between usable
early in boot and broken early in boot by requiring a partly static
structure with another structure that must be present by the time
any uses are performed.  theoretically platform code could allocate
a chunk while seting up memory and assign it here, giving a dynamic
sizing for the entry list, but the reality is that all users have
a statically allocated entry list as well.

the existing KERNHIST_LINK_STATIC() is used in conjunction with
KERNHIST_INITIALIZER() instead.

this stops a NULL pointer deref when the _LOG() macro is called
before the storage is linked in, which happens with GCC 10 on OCTEON
with UVMHIST enabled, crashing in very early kernel init.


To generate a diff of this commit:
cvs rdiff -u -r1.103 -r1.104 src/sys/arch/aarch64/aarch64/pmap.c
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/usb/usbhist.h
cvs rdiff -u -r1.2 -r1.3 src/sys/sys/biohist.h
cvs rdiff -u -r1.25 -r1.26 src/sys/sys/kernhist.h
cvs rdiff -u -r1.386 -r1.387 src/sys/uvm/uvm_map.c
cvs rdiff -u -r1.131 -r1.132 src/sys/uvm/uvm_pdaemon.c
cvs rdiff -u -r1.54 -r1.55 src/sys/uvm/uvm_stat.h
cvs rdiff -u -r1.61 -r1.62 src/sys/uvm/pmap/pmap.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/aarch64/aarch64/pmap.c
diff -u src/sys/arch/aarch64/aarch64/pmap.c:1.103 src/sys/arch/aarch64/aarch64/pmap.c:1.104
--- src/sys/arch/aarch64/aarch64/pmap.c:1.103	Tue Mar  9 16:40:59 2021
+++ src/sys/arch/aarch64/aarch64/pmap.c	Sat Apr 17 01:53:58 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.103 2021/03/09 16:40:59 ryo Exp $	*/
+/*	$NetBSD: pmap.c,v 1.104 2021/04/17 01:53:58 mrg Exp $	*/
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.103 2021/03/09 16:40:59 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.104 2021/04/17 01:53:58 mrg Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_ddb.h"
@@ -68,7 +68,6 @@ __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.1
 #define VPRINTF(...)	__nothing
 #endif
 
-UVMHIST_DEFINE(pmaphist);
 #ifdef UVMHIST
 
 #ifndef UVMHIST_PMAPHIST_SIZE
@@ -76,13 +75,14 @@ UVMHIST_DEFINE(pmaphist);
 #endif
 
 struct kern_history_ent pmaphistbuf[UVMHIST_PMAPHIST_SIZE];
+UVMHIST_DEFINE(pmaphist) = UVMHIST_INITIALIZER(pmaphist, pmaphistbuf);;
 
 static void
 pmap_hist_init(void)
 {
 	static bool inited = false;
 	if (inited == false) {
-		UVMHIST_INIT_STATIC(pmaphist, pmaphistbuf);
+		UVMHIST_LINK_STATIC(pmaphist);
 		inited = true;
 	}
 }

Index: src/sys/dev/usb/usbhist.h
diff -u src/sys/dev/usb/usbhist.h:1.6 src/sys/dev/usb/usbhist.h:1.7
--- src/sys/dev/usb/usbhist.h:1.6	Thu Aug 22 00:24:07 2019
+++ src/sys/dev/usb/usbhist.h	Sat Apr 17 01:53:58 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbhist.h,v 1.6 2019/08/22 00:24:07 mrg Exp $	*/
+/*	$NetBSD: usbhist.h,v 1.7 2021/04/17 01:53:58 mrg Exp $	*/
 
 /*
  * Copyright (c) 2012 Matthew R. Green
@@ -51,7 +51,6 @@ extern int usbdebug;
 #define USBHIST_DECL(NAME)		KERNHIST_DECL(NAME)
 #define USBHIST_DEFINE(NAME)		KERNHIST_DEFINE(NAME)
 #define USBHIST_INIT(NAME,N)		KERNHIST_INIT(NAME,N)
-#define USBHIST_INIT_STATIC(NAME,BUF)	KERNHIST_INIT_STATIC(NAME,BUF)
 #define USBHIST_LINK_STATIC(NAME)	KERNHIST_LINK_STATIC(NAME)
 #define USBHIST_LOGN(NAME,N,FMT,A,B,C,D)	do {		\
 	if ((NAME) >= (N)) {	\
@@ -88,7 +87,6 @@ USBHIST_DECL(usbhist);
 #define USBHIST_DECL(NAME)
 #define USBHIST_DEFINE(NAME)
 #define USBHIST_INIT(NAME,N)
-#define USBHIST_INIT_STATIC(NAME,BUF)
 #define USBHIST_LINK_STATIC(NAME)
 #define USBHIST_LOGN(N,NAME,FMT,A,B,C,D)	do { } while(0)
 #define USBHIST_LOGM(N,NAME,FMT,A,B,C,D)	do { } while(0)

Index: src/sys/sys/biohist.h
diff -u src/sys/sys/biohist.h:1.2 src/sys/sys/biohist.h:1.3
--- src/sys/sys/biohist.h:1.2	Tue Dec 27 04:12:34 2016
+++ src/sys/sys/biohist.h	Sat Apr 17 01:53:58 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: biohist.h,v 1.2 2016/12/27 04:12:34 pgoyette Exp $ */
+/*	$NetBSD: biohist.h,v 1.3 2021/04/17 01:53:58 mrg Exp $ */
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -50,7 +50,6 @@
 #define BIOHIST_DECL(NAME)		KERNHIST_DECL(NAME)
 #define BIOHIST_DEFINE(NAME)		KERNHIST_DEFINE(NAME)
 #define BIOHIST_INIT(NAME,N)		KERNHIST_INIT(NAME,N)
-#define BIOHIST_INIT_STATIC(NAME,BUF)	KERNHIST_INIT_STATIC(NAME,BUF)
 #define BIOHIST_INITIALIZER(NAME,BUF)	KERNHIST_INITIALIZER(NAME,BUF)
 #define BIOHIST_LINK_STATIC(NAME)	KERNHIST_LINK_STATIC(NAME)
 #define BIOHIST_LOG(NAME,FMT,A,B,C,D)	KERNHIST_LOG(NAME,FMT,A,B,C,D)
@@ -68,7 +67,6 @@
 #define BIOHIST_DECL(NAME)
 #define BIOHIST_DEFINE(NAME)
 #define BIOHIST_INIT(NAME,N)
-#define 

CVS commit: src/sys/dev/cardbus

2021-04-16 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Apr 17 01:19:48 UTC 2021

Modified Files:
src/sys/dev/cardbus: cardslot.c cardslotvar.h

Log Message:
convert cardslot event thread from wakeup/tsleep to mutex/condvar.
this avoids a strange hang at reboot i am seeing on an old pentium4-m
laptop, that was introduced with kern_mutex.c 1.91/92, though i can
not really explain why that matters (in the waiting thread, a pointer
that should be NULL remains non NULL.)  thanks to jmcneill@ for some
helpful review commentary here.

don't panic() if either "cardbus" or "pcmcia" didn't attach and a
card is inserted.  this can happen for various reasons, including
some regression in netbsd (-current, and -9, at least) that suggests
using PCI_BUS_FIXUP (though it still fails to attach the card i have.)

both found with GCC 10 testing, though both also occur with GCC 7 in
the netbsd-9 tree as well.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/dev/cardbus/cardslot.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/cardbus/cardslotvar.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/cardbus/cardslot.c
diff -u src/sys/dev/cardbus/cardslot.c:1.57 src/sys/dev/cardbus/cardslot.c:1.58
--- src/sys/dev/cardbus/cardslot.c:1.57	Sun Oct  4 06:15:54 2020
+++ src/sys/dev/cardbus/cardslot.c	Sat Apr 17 01:19:48 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: cardslot.c,v 1.57 2020/10/04 06:15:54 nat Exp $	*/
+/*	$NetBSD: cardslot.c,v 1.58 2021/04/17 01:19:48 mrg Exp $	*/
 
 /*
  * Copyright (c) 1999 and 2000
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cardslot.c,v 1.57 2020/10/04 06:15:54 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cardslot.c,v 1.58 2021/04/17 01:19:48 mrg Exp $");
 
 #include "opt_cardslot.h"
 
@@ -129,6 +129,8 @@ cardslotattach(device_t parent, device_t
 	sc->sc_16_softc = NULL;
 	SIMPLEQ_INIT(>sc_events);
 	sc->sc_th_enable = 0;
+	mutex_init(>sc_event_lock, MUTEX_DEFAULT, IPL_TTY);
+	cv_init(>sc_event_cv, "evexit");
 
 	aprint_naive("\n");
 	aprint_normal("\n");
@@ -192,14 +194,24 @@ cardslotdetach(device_t self, int flags)
 	if ((rc = config_detach_children(self, flags)) != 0)
 		return rc;
 
-	sc->sc_th_enable = 0;
-	wakeup(>sc_events);
-	while (sc->sc_event_thread != NULL)
-		(void)tsleep(sc, PWAIT, "cardslotthd", 0);
+	mutex_enter(>sc_event_lock);
+
+	if (sc->sc_event_thread != NULL) {
+		sc->sc_th_enable = 0;
+		cv_signal(>sc_event_cv);
+		while (sc->sc_event_thread != NULL) {
+			cv_wait(>sc_event_cv, >sc_event_lock);
+		}
+	}
 
 	if (!SIMPLEQ_EMPTY(>sc_events))
 		aprint_error_dev(self, "events outstanding");
 
+	mutex_exit(>sc_event_lock);
+
+	mutex_destroy(>sc_event_lock);
+	cv_destroy(>sc_event_cv);
+
 	pmf_device_deregister(self);
 	return 0;
 }
@@ -272,13 +284,11 @@ cardslot_event_throw(struct cardslot_sof
 
 	ce->ce_type = ev;
 
-	{
-		int s = spltty();
-		SIMPLEQ_INSERT_TAIL(>sc_events, ce, ce_q);
-		splx(s);
-	}
+	mutex_enter(>sc_event_lock);
+	SIMPLEQ_INSERT_TAIL(>sc_events, ce, ce_q);
+	mutex_exit(>sc_event_lock);
 
-	wakeup(>sc_events);
+	cv_signal(>sc_event_cv);
 
 	return;
 }
@@ -296,29 +306,28 @@ cardslot_event_thread(void *arg)
 {
 	struct cardslot_softc *sc = arg;
 	struct cardslot_event *ce;
-	int s, first = 1;
+	int first = 1;
 	static int antonym_ev[4] = {
 		CARDSLOT_EVENT_REMOVAL_16, CARDSLOT_EVENT_INSERTION_16,
 		CARDSLOT_EVENT_REMOVAL_CB, CARDSLOT_EVENT_INSERTION_CB
 	};
 
+	mutex_enter(>sc_event_lock);
 	while (sc->sc_th_enable) {
-		s = spltty();
 		if ((ce = SIMPLEQ_FIRST(>sc_events)) == NULL) {
-			splx(s);
 			if (first) {
 first = 0;
+mutex_exit(>sc_event_lock);
 config_pending_decr(sc->sc_dev);
+mutex_enter(>sc_event_lock);
 			}
-			(void) tsleep(>sc_events, PWAIT, "cardslotev", 0);
+			cv_wait(>sc_event_cv, >sc_event_lock);
 			continue;
 		}
 		SIMPLEQ_REMOVE_HEAD(>sc_events, ce_q);
-		splx(s);
 
 		if (IS_CARDSLOT_INSERT_REMOVE_EV(ce->ce_type)) {
 			/* Chattering suppression */
-			s = spltty();
 			while (1) {
 struct cardslot_event *ce1, *ce2;
 
@@ -340,8 +349,8 @@ cardslot_event_thread(void *arg)
 	free(ce2, M_TEMP);
 }
 			}
-			splx(s);
 		}
+		mutex_exit(>sc_event_lock);
 
 		switch (ce->ce_type) {
 		case CARDSLOT_EVENT_INSERTION_CB:
@@ -371,8 +380,10 @@ cardslot_event_thread(void *arg)
 	CARDSLOT_STATUS_NOTWORK);
 }
 			} else {
-panic("no cardbus on %s",
+printf("%s: no cardbus on %s\n", __func__,
   device_xname(sc->sc_dev));
+CARDSLOT_SET_WORK(sc->sc_status,
+CARDSLOT_STATUS_NOTWORK);
 			}
 
 			break;
@@ -400,8 +411,10 @@ cardslot_event_thread(void *arg)
 	CARDSLOT_STATUS_WORKING);
 }
 			} else {
-panic("no 16-bit pcmcia on %s",
+printf("%s: no 16-bit pcmcia on %s\n", __func__,
   device_xname(sc->sc_dev));
+CARDSLOT_SET_WORK(sc->sc_status,
+CARDSLOT_STATUS_NOTWORK);
 			}
 
 			break;
@@ -451,12 +464,14 @@ 

CVS commit: src/sys/kern

2021-04-16 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Apr 17 00:05:31 UTC 2021

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

Log Message:
avoid an error in the recent sys/evcnt.h change to drop the 0
array size from evcnt_sysctl:ev_strings that clang does not like.

the previous "struct xevcnt_sysctl" was well defined as the
evcnt_sysctl with array length of 0 could be placed as the
anywhere in other structures, but with [] it must remain last
and xevcnt_sysctl then places a char array afterwards.

avoid this entirely by removing struct xevcnt_sysctl, combining
the string array + struct evcnt_sysctl size manually for the
allocation, and moving all "ev_string" accesses to be via the
new [] array.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/kern/subr_evcnt.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/subr_evcnt.c
diff -u src/sys/kern/subr_evcnt.c:1.16 src/sys/kern/subr_evcnt.c:1.17
--- src/sys/kern/subr_evcnt.c:1.16	Thu Apr 15 00:37:31 2021
+++ src/sys/kern/subr_evcnt.c	Sat Apr 17 00:05:31 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_evcnt.c,v 1.16 2021/04/15 00:37:31 rin Exp $ */
+/* $NetBSD: subr_evcnt.c,v 1.17 2021/04/17 00:05:31 mrg Exp $ */
 
 /*
  * Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -77,7 +77,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_evcnt.c,v 1.16 2021/04/15 00:37:31 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_evcnt.c,v 1.17 2021/04/17 00:05:31 mrg Exp $");
 
 #include 
 #include 
@@ -214,13 +214,10 @@ evcnt_detach(struct evcnt *ev)
 	mutex_exit(_lock);
 }
 
-struct xevcnt_sysctl {
-	struct evcnt_sysctl evs;
-	char ev_strings[2*EVCNT_STRING_MAX];
-};
+typedef char ev_strings[2*EVCNT_STRING_MAX];
 
 static size_t
-sysctl_fillevcnt(const struct evcnt *ev, struct xevcnt_sysctl *xevs,
+sysctl_fillevcnt(const struct evcnt *ev, struct evcnt_sysctl *evs,
 	size_t *copylenp)
 {
 	const bool allowaddr = get_expose_address(curproc);
@@ -228,17 +225,17 @@ sysctl_fillevcnt(const struct evcnt *ev,
 	+ ev->ev_grouplen + 1 + ev->ev_namelen + 1;
 	const size_t len = roundup2(copylen, sizeof(uint64_t));
 
-	if (xevs != NULL) {
-		xevs->evs.ev_count = ev->ev_count;
-		COND_SET_VALUE(xevs->evs.ev_addr, PTRTOUINT64(ev), allowaddr);
-		COND_SET_VALUE(xevs->evs.ev_parent, PTRTOUINT64(ev->ev_parent),
+	if (evs != NULL) {
+		evs->ev_count = ev->ev_count;
+		COND_SET_VALUE(evs->ev_addr, PTRTOUINT64(ev), allowaddr);
+		COND_SET_VALUE(evs->ev_parent, PTRTOUINT64(ev->ev_parent),
 		allowaddr);
-		xevs->evs.ev_type = ev->ev_type;
-		xevs->evs.ev_grouplen = ev->ev_grouplen;
-		xevs->evs.ev_namelen = ev->ev_namelen;
-		xevs->evs.ev_len = len / sizeof(uint64_t);
-		strcpy(xevs->evs.ev_strings, ev->ev_group);
-		strcpy(xevs->evs.ev_strings + ev->ev_grouplen + 1, ev->ev_name);
+		evs->ev_type = ev->ev_type;
+		evs->ev_grouplen = ev->ev_grouplen;
+		evs->ev_namelen = ev->ev_namelen;
+		evs->ev_len = len / sizeof(uint64_t);
+		strcpy(evs->ev_strings, ev->ev_group);
+		strcpy(evs->ev_strings + ev->ev_grouplen + 1, ev->ev_name);
 	}
 
 	*copylenp = copylen;
@@ -248,7 +245,8 @@ sysctl_fillevcnt(const struct evcnt *ev,
 static int
 sysctl_doevcnt(SYSCTLFN_ARGS)
 {   
-	struct xevcnt_sysctl *xevs0 = NULL, *xevs;
+	struct evcnt_sysctl *evs0 = NULL, *evs;
+	const size_t xevcnt_size = sizeof(*evs0) + sizeof(ev_strings);
 	const struct evcnt *ev;
 	int error;
 	int retries;
@@ -278,14 +276,14 @@ sysctl_doevcnt(SYSCTLFN_ARGS)
 
 	sysctl_unlock();
 
-	if (oldp != NULL && xevs0 == NULL)
-		xevs0 = kmem_zalloc(sizeof(*xevs0), KM_SLEEP);
+	if (oldp != NULL)
+		evs0 = kmem_zalloc(xevcnt_size, KM_SLEEP);
 
 	retries = 100;
  retry:
 	dp = oldp;
 	len = (oldp != NULL) ? *oldlenp : 0;
-	xevs = xevs0;
+	evs = evs0;
 	error = 0;
 	needed = 0;
 
@@ -300,22 +298,22 @@ sysctl_doevcnt(SYSCTLFN_ARGS)
 			continue;
 
 		/*
-		 * Prepare to copy.  If xevs is NULL, fillevcnt will just
+		 * Prepare to copy.  If evs is NULL, fillevcnt will just
 		 * how big the item is.
 		 */
 		size_t copylen;
-		const size_t elem_size = sysctl_fillevcnt(ev, xevs, );
+		const size_t elem_size = sysctl_fillevcnt(ev, evs, );
 		needed += elem_size;
 
 		if (len < elem_size) {
-			xevs = NULL;
+			evs = NULL;
 			continue;
 		}
 
-		KASSERT(xevs != NULL);
-		KASSERT(xevs->evs.ev_grouplen != 0);
-		KASSERT(xevs->evs.ev_namelen != 0);
-		KASSERT(xevs->evs.ev_strings[0] != 0);
+		KASSERT(evs != NULL);
+		KASSERT(evs->ev_grouplen != 0);
+		KASSERT(evs->ev_namelen != 0);
+		KASSERT(evs->ev_strings[0] != 0);
 
 		const uint32_t last_generation = evcnt_generation;
 		mutex_exit(_lock);
@@ -325,7 +323,7 @@ sysctl_doevcnt(SYSCTLFN_ARGS)
 		 * number.  If we did the latter we'd have to zero them
 		 * first or we'd leak random kernel memory.
 		 */
-		error = copyout(xevs, dp, copylen);
+		error = copyout(evs, dp, copylen);
 
 		mutex_enter(_lock);
 		if (error)
@@ -354,8 +352,8 @@ 

CVS commit: src/usr.bin/shlock

2021-04-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr 17 00:02:19 UTC 2021

Modified Files:
src/usr.bin/shlock: shlock.c

Log Message:
appease gcc-9


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/shlock/shlock.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/shlock/shlock.c
diff -u src/usr.bin/shlock/shlock.c:1.14 src/usr.bin/shlock/shlock.c:1.15
--- src/usr.bin/shlock/shlock.c:1.14	Fri Apr 16 18:41:12 2021
+++ src/usr.bin/shlock/shlock.c	Fri Apr 16 20:02:19 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: shlock.c,v 1.14 2021/04/16 22:41:12 christos Exp $	*/
+/*	$NetBSD: shlock.c,v 1.15 2021/04/17 00:02:19 christos Exp $	*/
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: shlock.c,v 1.14 2021/04/16 22:41:12 christos Exp $");
+__RCSID("$NetBSD: shlock.c,v 1.15 2021/04/17 00:02:19 christos Exp $");
 #endif
 
 #include 
@@ -254,7 +254,7 @@ cklock(const char *file, struct stat *st
 static int
 mklock(const char *file, pid_t pid, int uucpstyle)
 {
-	char	*tmp, tmp2[BUFSIZ];
+	char	*tmp, tmp2[BUFSIZ + 2];
 	int	retcode = FALSE;
 	struct stat stlock, sttmp, stlock2;
 



CVS commit: src/usr.bin/shlock

2021-04-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr 16 22:41:12 UTC 2021

Modified Files:
src/usr.bin/shlock: shlock.c

Log Message:
PR/56112: Justin Parrott: Don't unlink a lock file without locking it, because
you can have races when multiple processes try to unlink it. Check the link
count to see if we have won the race.

While here:
- use snprintf
- use warn
- use size_t/ssize_t
- use loops instead of goto
- KNF


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/shlock/shlock.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/shlock/shlock.c
diff -u src/usr.bin/shlock/shlock.c:1.13 src/usr.bin/shlock/shlock.c:1.14
--- src/usr.bin/shlock/shlock.c:1.13	Fri Apr 10 05:34:43 2015
+++ src/usr.bin/shlock/shlock.c	Fri Apr 16 18:41:12 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: shlock.c,v 1.13 2015/04/10 09:34:43 tron Exp $	*/
+/*	$NetBSD: shlock.c,v 1.14 2021/04/16 22:41:12 christos Exp $	*/
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -64,11 +64,13 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: shlock.c,v 1.13 2015/04/10 09:34:43 tron Exp $");
+__RCSID("$NetBSD: shlock.c,v 1.14 2021/04/16 22:41:12 christos Exp $");
 #endif
 
 #include 
+#include 
 #include 
+#include 
 #include 			/* Needed on hpux */
 #include 
 #include 
@@ -91,8 +93,10 @@ __RCSID("$NetBSD: shlock.c,v 1.13 2015/0
 static int	Debug = FALSE;
 static char	*Pname;
 static const char USAGE[] = "%s: USAGE: %s [-du] [-p PID] -f file\n";
-static const char E_unlk[] = "%s: unlink(%s): %s\n";
-static const char E_open[] = "%s: open(%s): %s\n";
+static const char E_unlk[] = "unlink(%s)";
+static const char E_link[] = "link(%s, %s)";
+static const char E_open[] = "open(%s)";
+static const char E_stat[] = "stat(%s)";
 
 #define	dprintf	if (Debug) printf
 
@@ -103,10 +107,10 @@ static const char E_open[] = "%s: open(%
 */
 
 /* the following is in case you need to make the prototypes go away. */
-static char	*xtmpfile(char *, pid_t, int);
+static char	*xtmpfile(const char *, pid_t, int);
 static int	p_exists(pid_t);
-static int	cklock(char *, int);
-static int	mklock(char *, pid_t, int);
+static int	cklock(const char *, struct stat *, int);
+static int	mklock(const char *, pid_t, int);
 __dead static void	bad_usage(void);
 
 /*
@@ -116,14 +120,14 @@ __dead static void	bad_usage(void);
 ** which might not be in the same filesystem.
 */
 static char *
-xtmpfile(char *file, pid_t pid, int uucpstyle)
+xtmpfile(const char *file, pid_t pid, int uucpstyle)
 {
 	int	fd;
-	int	len;
+	size_t	len;
 	char	*cp, buf[BUFSIZ];
 	static char	tempname[BUFSIZ];
 
-	sprintf(buf, "shlock%ld", (long)getpid());
+	snprintf(buf, sizeof(buf), "shlock%jd", (intmax_t)getpid());
 	if ((cp = strrchr(strcpy(tempname, file), '/')) != NULL) {
 		*++cp = '\0';
 		(void) strcat(tempname, buf);
@@ -131,27 +135,21 @@ xtmpfile(char *file, pid_t pid, int uucp
 		(void) strcpy(tempname, buf);
 	dprintf("%s: temporary filename: %s\n", Pname, tempname);
 
-	sprintf(buf, "%ld\n", (long)pid);
+	snprintf(buf, sizeof(buf), "%jd\n", (intmax_t)pid);
 	len = strlen(buf);
-openloop:
-	if ((fd = open(tempname, O_RDWR|O_CREAT|O_EXCL, 0644)) < 0) {
+	while ((fd = open(tempname, O_RDWR|O_CREAT|O_TRUNC|O_SYNC|O_EXCL, 0644))
+	== -1)
+	{
 		switch(errno) {
 		case EEXIST:
-			dprintf("%s: file %s exists already.\n",
-Pname, tempname);
-			if (unlink(tempname) < 0) {
-fprintf(stderr, E_unlk,
-	Pname, tempname, strerror(errno));
-return (NULL);
+			if (unlink(tempname) == -1) {
+warn(E_unlk, tempname);
+return NULL;
 			}
-			/*
-			** Further profanity
-			*/
-			goto openloop;
+			break;
 		default:
-			fprintf(stderr, E_open,
-Pname, tempname, strerror(errno));
-			return (NULL);
+			warn(E_open, tempname);
+			return NULL;
 		}
 	}
 
@@ -162,19 +160,17 @@ openloop:
 	*/
 	if (uucpstyle ?
 		(write(fd, , sizeof(pid)) != sizeof(pid)) :
-		(write(fd, buf, len) < 0))
+		(write(fd, buf, len) != (ssize_t)len))
 	{
-		fprintf(stderr, "%s: write(%s,%ld): %s\n",
-			Pname, tempname, (long)pid, strerror(errno));
+		warn("write(%s,%jd)", tempname, (intmax_t)pid);
 		(void) close(fd);
-		if (unlink(tempname) < 0) {
-			fprintf(stderr, E_unlk,
-Pname, tempname, strerror(errno));
+		if (unlink(tempname) == -1) {
+			warn(E_unlk, tempname);
 		}
-		return (NULL);
+		return NULL;
 	}
 	(void) close(fd);
-	return(tempname);
+	return tempname;
 }
 
 /*
@@ -184,26 +180,26 @@ openloop:
 static int
 p_exists(pid_t pid)
 {
-	dprintf("%s: process %ld is ", Pname, (long)pid);
+	dprintf("%s: process %jd is ", Pname, (intmax_t)pid);
 	if (pid <= 0) {
 		dprintf("invalid\n");
-		return(FALSE);
+		return FALSE;
 	}
-	if (kill(pid, 0) < 0) {
+	if (kill(pid, 0) == -1) {
 		switch(errno) {
 		case ESRCH:
-			dprintf("dead\n");
-			return(FALSE);	/* pid does not exist */
+			dprintf("dead %jd\n", (intmax_t)pid);
+			return FALSE;	/* pid does not 

CVS commit: src/usr.bin/printf

2021-04-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr 16 18:31:28 UTC 2021

Modified Files:
src/usr.bin/printf: printf.c

Log Message:
make value an int to avoid all the casts and conversion warnings.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/usr.bin/printf/printf.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/printf/printf.c
diff -u src/usr.bin/printf/printf.c:1.51 src/usr.bin/printf/printf.c:1.52
--- src/usr.bin/printf/printf.c:1.51	Fri Apr 16 11:10:18 2021
+++ src/usr.bin/printf/printf.c	Fri Apr 16 14:31:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: printf.c,v 1.51 2021/04/16 15:10:18 christos Exp $	*/
+/*	$NetBSD: printf.c,v 1.52 2021/04/16 18:31:28 christos Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -41,7 +41,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 19
 #if 0
 static char sccsid[] = "@(#)printf.c	8.2 (Berkeley) 3/22/95";
 #else
-__RCSID("$NetBSD: printf.c,v 1.51 2021/04/16 15:10:18 christos Exp $");
+__RCSID("$NetBSD: printf.c,v 1.52 2021/04/16 18:31:28 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -119,9 +119,9 @@ static char  **gargv;
 }
 
 #define isodigit(c)	((c) >= '0' && (c) <= '7')
-#define octtobin(c)	(char)((c) - '0')
-#define check(c, a)	(c) >= (a) && (c) <= (a) + 5 ? (char)((c) - (a) + 10)
-#define hextobin(c)	(check(c, 'a') : check(c, 'A') : (char)((c) - '0'))
+#define octtobin(c)	((c) - '0')
+#define check(c, a)	(c) >= (a) && (c) <= (a) + 5 ? (c) - (a) + 10
+#define hextobin(c)	(check(c, 'a') : check(c, 'A') : (c) - '0')
 #ifdef main
 int main(int, char *[]);
 #endif
@@ -486,7 +486,7 @@ conv_escape_str(char *str, void (*do_put
 static char *
 conv_escape(char *str, char *conv_ch, int quiet)
 {
-	char value = 0;
+	int value = 0;
 	char ch, *begin;
 	int c;
 
@@ -520,8 +520,7 @@ conv_escape(char *str, char *conv_ch, in
 		begin = str;
 		for (c = 2; c-- && isxdigit((unsigned char)*str); str++) {
 			value <<= 4;
-			const char d = hextobin(*str);
-			value += d;
+			value += hextobin(*str);
 		}
 		if (str == begin) {
 			if (!quiet)
@@ -552,7 +551,7 @@ conv_escape(char *str, char *conv_ch, in
 		break;
 	}
 
-	*conv_ch = value;
+	*conv_ch = (char)value;
 	return str;
 }
 



CVS commit: [netbsd-9] src/doc

2021-04-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Apr 16 17:04:59 UTC 2021

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

Log Message:
Ticket #1246


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.65 -r1.1.2.66 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.65 src/doc/CHANGES-9.2:1.1.2.66
--- src/doc/CHANGES-9.2:1.1.2.65	Thu Apr  8 15:22:30 2021
+++ src/doc/CHANGES-9.2	Fri Apr 16 17:04:59 2021
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.2,v 1.1.2.65 2021/04/08 15:22:30 martin Exp $
+# $NetBSD: CHANGES-9.2,v 1.1.2.66 2021/04/16 17:04:59 martin Exp $
 
 A complete list of changes from the NetBSD 9.1 release to the NetBSD 9.2
 release:
@@ -2934,3 +2934,8 @@ crypto/external/bsd/openssl/lib/libcrypt
 	requires a sparcv9 cpu.
 	[christos, ticket #1245]
 
+crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/modes.inc 1.6
+
+	Restore sparcv9 optimization for 32bit builds on sparc64.
+	[mrg, ticket #1246]
+



CVS commit: [netbsd-9] src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc

2021-04-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Apr 16 17:03:59 UTC 2021

Added Files:
src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc [netbsd-9]:
modes.inc

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

crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/modes.inc: 
revision 1.6

Restore r1.3 of modes.inc: we are using this directory for the
-m32 compat builds on sparc64, where the sparcv9 instructions
and the GHASH asm code are usefull.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.3.16.3 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/modes.inc

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

Added files:

Index: src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/modes.inc
diff -u /dev/null src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/modes.inc:1.3.16.3
--- /dev/null	Fri Apr 16 17:03:59 2021
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/modes.inc	Fri Apr 16 17:03:59 2021
@@ -0,0 +1,7 @@
+.if ${MACHINE} == "sparc64"
+.PATH.S: ${.PARSEDIR}
+MODES_SRCS = ghash-sparcv9.S
+MODESCPPFLAGS = -DGHASH_ASM
+AFLAGS.ghash-sparcv9.S+= -Wa,-Av9
+.endif
+.include "../../modes.inc"



CVS commit: src/usr.bin/make

2021-04-16 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr 16 16:49:28 UTC 2021

Modified Files:
src/usr.bin/make: job.c
src/usr.bin/make/unit-tests: sh-jobs.mk

Log Message:
make: use distinct wording for writing to the shell commands file

The word 'write' now means to write to the file that holds the shell
commands to be run later.

The word 'print' is now used exclusively for handling the output of the
child commands and printing them to make's stdout.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.428 -r1.429 src/usr.bin/make/job.c
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/sh-jobs.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/job.c
diff -u src/usr.bin/make/job.c:1.428 src/usr.bin/make/job.c:1.429
--- src/usr.bin/make/job.c:1.428	Fri Apr 16 16:10:01 2021
+++ src/usr.bin/make/job.c	Fri Apr 16 16:49:27 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.428 2021/04/16 16:10:01 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.429 2021/04/16 16:49:27 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -142,7 +142,7 @@
 #include "trace.h"
 
 /*	"@(#)job.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: job.c,v 1.428 2021/04/16 16:10:01 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.429 2021/04/16 16:49:27 rillig Exp $");
 
 /*
  * A shell defines how the commands are run.  All commands for a target are
@@ -223,8 +223,8 @@ typedef struct CommandFlags {
 	bool always;
 
 	/*
-	 * true if we turned error checking off before printing the command
-	 * and need to turn it back on
+	 * true if we turned error checking off before writing the command to
+	 * the commands file and need to turn it back on
 	 */
 	bool ignerr;
 } CommandFlags;
@@ -760,7 +760,7 @@ EscapeShellDblQuot(const char *cmd)
 }
 
 static void
-ShellWriter_PrintFmt(ShellWriter *wr, const char *fmt, const char *arg)
+ShellWriter_WriteFmt(ShellWriter *wr, const char *fmt, const char *arg)
 {
 	DEBUG1(JOB, fmt, arg);
 
@@ -770,36 +770,36 @@ ShellWriter_PrintFmt(ShellWriter *wr, co
 }
 
 static void
-ShellWriter_Println(ShellWriter *wr, const char *line)
+ShellWriter_WriteLine(ShellWriter *wr, const char *line)
 {
-	ShellWriter_PrintFmt(wr, "%s\n", line);
+	ShellWriter_WriteFmt(wr, "%s\n", line);
 }
 
 static void
 ShellWriter_EchoOff(ShellWriter *wr)
 {
 	if (shell->hasEchoCtl)
-		ShellWriter_Println(wr, shell->echoOff);
+		ShellWriter_WriteLine(wr, shell->echoOff);
 }
 
 static void
 ShellWriter_EchoCmd(ShellWriter *wr, const char *escCmd)
 {
-	ShellWriter_PrintFmt(wr, shell->echoTmpl, escCmd);
+	ShellWriter_WriteFmt(wr, shell->echoTmpl, escCmd);
 }
 
 static void
 ShellWriter_EchoOn(ShellWriter *wr)
 {
 	if (shell->hasEchoCtl)
-		ShellWriter_Println(wr, shell->echoOn);
+		ShellWriter_WriteLine(wr, shell->echoOn);
 }
 
 static void
 ShellWriter_TraceOn(ShellWriter *wr)
 {
 	if (!wr->xtraced) {
-		ShellWriter_Println(wr, "set -x");
+		ShellWriter_WriteLine(wr, "set -x");
 		wr->xtraced = true;
 	}
 }
@@ -809,7 +809,7 @@ ShellWriter_ErrOff(ShellWriter *wr, bool
 {
 	if (echo)
 		ShellWriter_EchoOff(wr);
-	ShellWriter_Println(wr, shell->errOff);
+	ShellWriter_WriteLine(wr, shell->errOff);
 	if (echo)
 		ShellWriter_EchoOn(wr);
 }
@@ -819,7 +819,7 @@ ShellWriter_ErrOn(ShellWriter *wr, bool 
 {
 	if (echo)
 		ShellWriter_EchoOff(wr);
-	ShellWriter_Println(wr, shell->errOn);
+	ShellWriter_WriteLine(wr, shell->errOn);
 	if (echo)
 		ShellWriter_EchoOn(wr);
 }
@@ -830,7 +830,7 @@ ShellWriter_ErrOn(ShellWriter *wr, bool 
  * (configurable per shell).
  */
 static void
-JobPrintSpecialsEchoCtl(Job *job, ShellWriter *wr, CommandFlags *inout_cmdFlags,
+JobWriteSpecialsEchoCtl(Job *job, ShellWriter *wr, CommandFlags *inout_cmdFlags,
 			const char *escCmd, const char **inout_cmdTemplate)
 {
 	/* XXX: Why is the job modified at this point? */
@@ -860,7 +860,7 @@ JobPrintSpecialsEchoCtl(Job *job, ShellW
 }
 
 static void
-JobPrintSpecials(Job *job, ShellWriter *wr, const char *escCmd, bool run,
+JobWriteSpecials(Job *job, ShellWriter *wr, const char *escCmd, bool run,
 		 CommandFlags *inout_cmdFlags, const char **inout_cmdTemplate)
 {
 	if (!run) {
@@ -872,34 +872,38 @@ JobPrintSpecials(Job *job, ShellWriter *
 	} else if (shell->hasErrCtl)
 		ShellWriter_ErrOff(wr, job->echo && inout_cmdFlags->echo);
 	else if (shell->runIgnTmpl != NULL && shell->runIgnTmpl[0] != '\0') {
-		JobPrintSpecialsEchoCtl(job, wr, inout_cmdFlags, escCmd,
+		JobWriteSpecialsEchoCtl(job, wr, inout_cmdFlags, escCmd,
 		inout_cmdTemplate);
 	} else
 		inout_cmdFlags->ignerr = false;
 }
 
 /*
- * Put out another command for the given job.
+ * Write a shell command to the job's commands file, to be run later.
  *
  * If the command starts with '@' and neither the -s nor the -n flag was
- * given to make, we stick a shell-specific echoOff command in the script.
+ * given to 

CVS commit: src/usr.bin/make

2021-04-16 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr 16 16:10:01 UTC 2021

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

Log Message:
make: align name of jobs_table_dump to the other functions


To generate a diff of this commit:
cvs rdiff -u -r1.427 -r1.428 src/usr.bin/make/job.c

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

Modified files:

Index: src/usr.bin/make/job.c
diff -u src/usr.bin/make/job.c:1.427 src/usr.bin/make/job.c:1.428
--- src/usr.bin/make/job.c:1.427	Thu Apr 15 19:06:42 2021
+++ src/usr.bin/make/job.c	Fri Apr 16 16:10:01 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.427 2021/04/15 19:06:42 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.428 2021/04/16 16:10:01 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -142,7 +142,7 @@
 #include "trace.h"
 
 /*	"@(#)job.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: job.c,v 1.427 2021/04/15 19:06:42 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.428 2021/04/16 16:10:01 rillig Exp $");
 
 /*
  * A shell defines how the commands are run.  All commands for a target are
@@ -478,7 +478,7 @@ Job_FlagsToString(const Job *job, char *
 }
 
 static void
-job_table_dump(const char *where)
+DumpJobs(const char *where)
 {
 	Job *job;
 	char flags[4];
@@ -710,7 +710,7 @@ JobFindPid(int pid, JobStatus status, bo
 			return job;
 	}
 	if (DEBUG(JOB) && isJobs)
-		job_table_dump("no pid");
+		DumpJobs("no pid");
 	return NULL;
 }
 
@@ -1514,7 +1514,7 @@ JobExec(Job *job, char **argv)
 	if (DEBUG(JOB)) {
 		debug_printf("JobExec(%s): pid %d added to jobs table\n",
 		job->node->name, job->pid);
-		job_table_dump("job started");
+		DumpJobs("job started");
 	}
 	JobSigUnlock();
 }



CVS commit: src/share/misc

2021-04-16 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Apr 16 15:53:56 UTC 2021

Modified Files:
src/share/misc: acronyms acronyms.comp

Log Message:
Add a couple definitions for RPG


To generate a diff of this commit:
cvs rdiff -u -r1.308 -r1.309 src/share/misc/acronyms
cvs rdiff -u -r1.322 -r1.323 src/share/misc/acronyms.comp

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

Modified files:

Index: src/share/misc/acronyms
diff -u src/share/misc/acronyms:1.308 src/share/misc/acronyms:1.309
--- src/share/misc/acronyms:1.308	Mon Oct  5 14:54:50 2020
+++ src/share/misc/acronyms	Fri Apr 16 15:53:55 2021
@@ -1,4 +1,4 @@
-$NetBSD: acronyms,v 1.308 2020/10/05 14:54:50 nia Exp $
+$NetBSD: acronyms,v 1.309 2021/04/16 15:53:55 pgoyette Exp $
 10Q	thank you
 10X	thanks
 1337	elite ("leet")
@@ -502,6 +502,7 @@ ROM	rough order of magnitude
 ROI	return on investment
 ROTFL	rolling on the floor laughing
 RP	responsible person
+RPG	rocket-propelled grenade
 RR	railroad
 RSI	repetitive strain injury
 RSN	real soon now

Index: src/share/misc/acronyms.comp
diff -u src/share/misc/acronyms.comp:1.322 src/share/misc/acronyms.comp:1.323
--- src/share/misc/acronyms.comp:1.322	Sun Mar 28 17:52:09 2021
+++ src/share/misc/acronyms.comp	Fri Apr 16 15:53:55 2021
@@ -1,4 +1,4 @@
-$NetBSD: acronyms.comp,v 1.322 2021/03/28 17:52:09 nia Exp $
+$NetBSD: acronyms.comp,v 1.323 2021/04/16 15:53:55 pgoyette Exp $
 3WHS	three-way handshake
 8VSB	8-state vestigial side band modulation
 AA	anti-aliasing
@@ -1367,6 +1367,7 @@ RMW	read, modify, write
 RNG	random number generator
 ROM	read only memory
 RPC	remote procedure call
+RPG	Report Program Generator
 RPKI	resource PKI
 RPL	requested privilege level
 RPM	revolutions per minute



CVS commit: src/usr.bin/printf

2021-04-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr 16 15:10:18 UTC 2021

Modified Files:
src/usr.bin/printf: printf.c

Log Message:
Change octal and hex parsing to not use strtoul so that they don't handle
'-'. From Martijn van Duren.
Also add a warning if the conversion fails (like the gnu printf does)


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/usr.bin/printf/printf.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/printf/printf.c
diff -u src/usr.bin/printf/printf.c:1.50 src/usr.bin/printf/printf.c:1.51
--- src/usr.bin/printf/printf.c:1.50	Mon Jul 22 13:34:31 2019
+++ src/usr.bin/printf/printf.c	Fri Apr 16 11:10:18 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: printf.c,v 1.50 2019/07/22 17:34:31 kre Exp $	*/
+/*	$NetBSD: printf.c,v 1.51 2021/04/16 15:10:18 christos Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -41,7 +41,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 19
 #if 0
 static char sccsid[] = "@(#)printf.c	8.2 (Berkeley) 3/22/95";
 #else
-__RCSID("$NetBSD: printf.c,v 1.50 2019/07/22 17:34:31 kre Exp $");
+__RCSID("$NetBSD: printf.c,v 1.51 2021/04/16 15:10:18 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -118,6 +118,10 @@ static char  **gargv;
 		error = asprintf(cpp, f, func); \
 }
 
+#define isodigit(c)	((c) >= '0' && (c) <= '7')
+#define octtobin(c)	(char)((c) - '0')
+#define check(c, a)	(c) >= (a) && (c) <= (a) + 5 ? (char)((c) - (a) + 10)
+#define hextobin(c)	(check(c, 'a') : check(c, 'A') : (char)((c) - '0'))
 #ifdef main
 int main(int, char *[]);
 #endif
@@ -482,9 +486,9 @@ conv_escape_str(char *str, void (*do_put
 static char *
 conv_escape(char *str, char *conv_ch, int quiet)
 {
-	char value;
-	char ch;
-	char num_buf[4], *num_end;
+	char value = 0;
+	char ch, *begin;
+	int c;
 
 	ch = *str++;
 
@@ -499,13 +503,11 @@ conv_escape(char *str, char *conv_ch, in
 
 	case '0': case '1': case '2': case '3':
 	case '4': case '5': case '6': case '7':
-		num_buf[0] = ch;
-		ch = str[0];
-		num_buf[1] = ch;
-		num_buf[2] = (char)(ch != '\0' ? str[1] : '\0');
-		num_buf[3] = '\0';
-		value = (char)strtoul(num_buf, _end, 8);
-		str += num_end  - (num_buf + 1);
+		str--;
+		for (c = 3; c-- && isodigit(*str); str++) {
+			value <<= 3;
+			value += octtobin(*str);
+		}
 		break;
 
 	case 'x':
@@ -515,12 +517,18 @@ conv_escape(char *str, char *conv_ch, in
 		 * way to detect the end of the constant.
 		 * Supporting 2 byte constants is a compromise.
 		 */
-		ch = str[0];
-		num_buf[0] = ch;
-		num_buf[1] = (char)(ch != '\0' ? str[1] : '\0');
-		num_buf[2] = '\0';
-		value = (char)strtoul(num_buf, _end, 16);
-		str += num_end - num_buf;
+		begin = str;
+		for (c = 2; c-- && isxdigit((unsigned char)*str); str++) {
+			value <<= 4;
+			const char d = hextobin(*str);
+			value += d;
+		}
+		if (str == begin) {
+			if (!quiet)
+warnx("\\x%s: missing hexadecimal number "
+"in escape", begin);
+			rval = 1;
+		}
 		break;
 
 	case '\\':	value = '\\';	break;	/* backslash */



CVS commit: src/external/bsd/top/dist/machine

2021-04-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr 16 13:02:47 UTC 2021

Modified Files:
src/external/bsd/top/dist/machine: m_netbsd.c

Log Message:
go back to right-aligning the titles for CPU and WCPU.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/external/bsd/top/dist/machine/m_netbsd.c

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

Modified files:

Index: src/external/bsd/top/dist/machine/m_netbsd.c
diff -u src/external/bsd/top/dist/machine/m_netbsd.c:1.24 src/external/bsd/top/dist/machine/m_netbsd.c:1.25
--- src/external/bsd/top/dist/machine/m_netbsd.c:1.24	Sat Apr  3 15:25:38 2021
+++ src/external/bsd/top/dist/machine/m_netbsd.c	Fri Apr 16 09:02:47 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: m_netbsd.c,v 1.24 2021/04/03 19:25:38 christos Exp $	*/
+/*	$NetBSD: m_netbsd.c,v 1.25 2021/04/16 13:02:47 christos Exp $	*/
 
 /*
  * top - a top users display for Unix
@@ -37,12 +37,12 @@
  *		Andrew Doran 
  *
  *
- * $Id: m_netbsd.c,v 1.24 2021/04/03 19:25:38 christos Exp $
+ * $Id: m_netbsd.c,v 1.25 2021/04/16 13:02:47 christos Exp $
  */
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: m_netbsd.c,v 1.24 2021/04/03 19:25:38 christos Exp $");
+__RCSID("$NetBSD: m_netbsd.c,v 1.25 2021/04/16 13:02:47 christos Exp $");
 #endif
 
 #include 
@@ -103,14 +103,14 @@ struct handle {
  */
 
 static char Proc_header[] =
-  "  PID XPRI NICE   SIZE   RES STATE   TIME  WCPU   CPU   COMMAND";
+  "  PID XPRI NICE   SIZE   RES STATE   TIME   WCPUCPU COMMAND";
 /* 0123456   -- field to fill in starts at header+6 */
 #define PROC_UNAME_START 6
 #define Proc_format \
 	"%5d %-8.8s %3d %4d%7s %5s %-9.9s%7s %5.*f%% %5.*f%% %s"
 
 static char Thread_header[] =
-  "  PID   LID XPRI STATE   TIME  WCPU   CPU   NAME  COMMAND";
+  "  PID   LID XPRI STATE   TIME   WCPUCPU NAME  COMMAND";
 /* 0123456   -- field to fill in starts at header+6 */
 #define THREAD_UNAME_START 12
 #define Thread_format \



CVS commit: src/sys/dev/scsipi

2021-04-16 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Fri Apr 16 12:58:54 UTC 2021

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

Log Message:
Limit buffer size for device capabilities requests as a work-around for PR
kern/56109.


To generate a diff of this commit:
cvs rdiff -u -r1.350 -r1.351 src/sys/dev/scsipi/cd.c

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

Modified files:

Index: src/sys/dev/scsipi/cd.c
diff -u src/sys/dev/scsipi/cd.c:1.350 src/sys/dev/scsipi/cd.c:1.351
--- src/sys/dev/scsipi/cd.c:1.350	Wed Feb 10 16:30:01 2021
+++ src/sys/dev/scsipi/cd.c	Fri Apr 16 12:58:54 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: cd.c,v 1.350 2021/02/10 16:30:01 christos Exp $	*/
+/*	$NetBSD: cd.c,v 1.351 2021/04/16 12:58:54 reinoud Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001, 2003, 2004, 2005, 2008 The NetBSD Foundation,
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.350 2021/02/10 16:30:01 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.351 2021/04/16 12:58:54 reinoud Exp $");
 
 #include 
 #include 
@@ -2695,15 +2695,13 @@ mmc_getdiscinfo(struct scsipi_periph *pe
 	struct scsipi_get_conf_feature   *gcf;
 	struct scsipi_read_discinfo   di_cmd;
 	struct scsipi_read_discinfo_data  di __aligned(2);
-	const uint32_t buffer_size = 1024;
-	uint32_t feat_tbl_len, pos;
+	const uint32_t buffer_size = 0x200; /* XXX RPZ USB3 SCSI size issue */
+	uint32_t pos;
 	u_long   last_lba = 0;
 	uint8_t  *buffer, *fpos;
 	int feature, last_feature, features_len, feature_cur, feature_len;
 	int lsb, msb, error, flags;
 
-	feat_tbl_len = buffer_size;
-
 	buffer = malloc(buffer_size, M_TEMP, M_WAITOK);
 
 	/* initialise structure */
@@ -2748,12 +2746,12 @@ mmc_getdiscinfo(struct scsipi_periph *pe
 		memset(_cmd, 0, sizeof(gc_cmd));
 		gc_cmd.opcode = GET_CONFIGURATION;
 		_lto2b(last_feature, gc_cmd.start_at_feature);
-		_lto2b(feat_tbl_len, gc_cmd.data_len);
-		memset(gc, 0, feat_tbl_len);
+		_lto2b(buffer_size, gc_cmd.data_len);
+		memset(gc, 0, buffer_size);
 
 		error = scsipi_command(periph,
 			(void *)_cmd, sizeof(gc_cmd),
-			(void *) gc, feat_tbl_len,
+			(void *) gc, buffer_size,
 			CDRETRIES, 3, NULL, flags);
 		if (error) {
 			/* ieeek... break out of loop... i dunno what to do */
@@ -2761,7 +2759,7 @@ mmc_getdiscinfo(struct scsipi_periph *pe
 		}
 
 		features_len = _4btol(gc->data_len);
-		if (features_len < 4 || features_len > feat_tbl_len)
+		if (features_len < 4 || features_len > buffer_size)
 			break;
 
 		pos  = 0;



CVS commit: src/sys/dev/pci

2021-04-16 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Fri Apr 16 08:09:40 UTC 2021

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

Log Message:
fix typo


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/pci/if_aq.c

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

Modified files:

Index: src/sys/dev/pci/if_aq.c
diff -u src/sys/dev/pci/if_aq.c:1.24 src/sys/dev/pci/if_aq.c:1.25
--- src/sys/dev/pci/if_aq.c:1.24	Fri Apr 16 08:07:02 2021
+++ src/sys/dev/pci/if_aq.c	Fri Apr 16 08:09:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_aq.c,v 1.24 2021/04/16 08:07:02 ryo Exp $	*/
+/*	$NetBSD: if_aq.c,v 1.25 2021/04/16 08:09:40 ryo Exp $	*/
 
 /**
  * aQuantia Corporation Network Driver
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.24 2021/04/16 08:07:02 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.25 2021/04/16 08:09:40 ryo Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_aq.h"
@@ -1449,11 +1449,11 @@ aq_attach(device_t parent, device_t self
 	ifp->if_capabilities |= IFCAP_TSOv4 | IFCAP_TSOv6;
 #endif
 
-	/* TX hardware checksum offloadding */
+	/* TX hardware checksum offloading */
 	ifp->if_capabilities |= IFCAP_CSUM_IPv4_Tx;
 	ifp->if_capabilities |= IFCAP_CSUM_TCPv4_Tx | IFCAP_CSUM_TCPv6_Tx;
 	ifp->if_capabilities |= IFCAP_CSUM_UDPv4_Tx | IFCAP_CSUM_UDPv6_Tx;
-	/* RX hardware checksum offloadding */
+	/* RX hardware checksum offloading */
 	ifp->if_capabilities |= IFCAP_CSUM_IPv4_Rx;
 	ifp->if_capabilities |= IFCAP_CSUM_TCPv4_Rx | IFCAP_CSUM_TCPv6_Rx;
 	ifp->if_capabilities |= IFCAP_CSUM_UDPv4_Rx | IFCAP_CSUM_UDPv6_Rx;



CVS commit: src/sys/dev/pci

2021-04-16 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Fri Apr 16 08:07:02 UTC 2021

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

Log Message:
when the packet size was just n*MCLBYTES, there was an inconsistency in the 
length of mbuf.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/pci/if_aq.c

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

Modified files:

Index: src/sys/dev/pci/if_aq.c
diff -u src/sys/dev/pci/if_aq.c:1.23 src/sys/dev/pci/if_aq.c:1.24
--- src/sys/dev/pci/if_aq.c:1.23	Thu Apr 15 09:05:24 2021
+++ src/sys/dev/pci/if_aq.c	Fri Apr 16 08:07:02 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_aq.c,v 1.23 2021/04/15 09:05:24 ryo Exp $	*/
+/*	$NetBSD: if_aq.c,v 1.24 2021/04/16 08:07:02 ryo Exp $	*/
 
 /**
  * aQuantia Corporation Network Driver
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.23 2021/04/15 09:05:24 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.24 2021/04/16 08:07:02 ryo Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_aq.h"
@@ -4340,7 +4340,10 @@ aq_rx_intr(void *arg)
 			m->m_len = MCLBYTES;
 		} else {
 			/* last buffer */
-			m->m_len = rxd_pktlen % MCLBYTES;
+			int mlen = rxd_pktlen % MCLBYTES;
+			if (mlen == 0)
+mlen = MCLBYTES;
+			m->m_len = mlen;
 			m0->m_pkthdr.len = rxd_pktlen;
 			/* VLAN offloading */
 			if ((sc->sc_ethercom.ec_capenable &



CVS commit: src

2021-04-16 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Apr 16 07:45:42 UTC 2021

Modified Files:
src/distrib/sets/lists/comp: mi
src/share/man/man9: Makefile
src/usr.sbin/makemandb: nostem.txt

Log Message:
- Remove obsolete cltom(9) and mtocl(9).
- Add missing manual page's link of m_adj.


To generate a diff of this commit:
cvs rdiff -u -r1.2379 -r1.2380 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.456 -r1.457 src/share/man/man9/Makefile
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/makemandb/nostem.txt

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/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2379 src/distrib/sets/lists/comp/mi:1.2380
--- src/distrib/sets/lists/comp/mi:1.2379	Mon Apr 12 02:09:00 2021
+++ src/distrib/sets/lists/comp/mi	Fri Apr 16 07:45:41 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2379 2021/04/12 02:09:00 mrg Exp $
+#	$NetBSD: mi,v 1.2380 2021/04/16 07:45:41 msaitoh Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -11288,7 +11288,7 @@
 ./usr/share/man/cat9/clock_ymdhms_to_secs.0	comp-sys-catman		.cat
 ./usr/share/man/cat9/closef.0			comp-sys-catman		.cat
 ./usr/share/man/cat9/clrbit.0			comp-sys-catman		.cat
-./usr/share/man/cat9/cltom.0			comp-sys-catman		.cat
+./usr/share/man/cat9/cltom.0			comp-obsolete		obsolete
 ./usr/share/man/cat9/cn_check_magic.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/cn_destroy_magic.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/cn_get_magic.0		comp-sys-catman		.cat
@@ -11761,6 +11761,7 @@
 ./usr/share/man/cat9/ltsleep.0			comp-sys-catman		.cat
 ./usr/share/man/cat9/lwp_trampoline.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/m_adj.0			comp-sys-catman		.cat
+./usr/share/man/cat9/m_align.0			comp-sys-catman		.cat
 ./usr/share/man/cat9/m_apply.0			comp-sys-catman		.cat
 ./usr/share/man/cat9/m_cat.0			comp-sys-catman		.cat
 ./usr/share/man/cat9/m_copyback.0		comp-sys-catman		.cat
@@ -11844,7 +11845,7 @@
 ./usr/share/man/cat9/module_unregister_callbacks.0 comp-sys-catman		.cat
 ./usr/share/man/cat9/mono_time.0		comp-obsolete		obsolete
 ./usr/share/man/cat9/mstohz.0			comp-sys-catman		.cat
-./usr/share/man/cat9/mtocl.0			comp-sys-catman		.cat
+./usr/share/man/cat9/mtocl.0			comp-obsolete		obsolete
 ./usr/share/man/cat9/mtod.0			comp-sys-catman		.cat
 ./usr/share/man/cat9/mtsleep.0			comp-sys-catman		.cat
 ./usr/share/man/cat9/mutex.0			comp-sys-catman		.cat
@@ -19486,7 +19487,7 @@
 ./usr/share/man/html9/clock_ymdhms_to_secs.html comp-sys-htmlman	html
 ./usr/share/man/html9/closef.html		comp-sys-htmlman	html
 ./usr/share/man/html9/clrbit.html		comp-sys-htmlman	html
-./usr/share/man/html9/cltom.html		comp-sys-htmlman	html
+./usr/share/man/html9/cltom.html		comp-obsolete	obsolete
 ./usr/share/man/html9/cn_check_magic.html	comp-sys-htmlman	html
 ./usr/share/man/html9/cn_destroy_magic.html	comp-sys-htmlman	html
 ./usr/share/man/html9/cn_get_magic.html		comp-sys-htmlman	html
@@ -19938,6 +19939,7 @@
 ./usr/share/man/html9/ltsleep.html		comp-sys-htmlman	html
 ./usr/share/man/html9/lwp_trampoline.html	comp-sys-htmlman	html
 ./usr/share/man/html9/m_adj.html		comp-sys-htmlman	html
+./usr/share/man/html9/m_align.html		comp-sys-htmlman	html
 ./usr/share/man/html9/m_apply.html		comp-sys-htmlman	html
 ./usr/share/man/html9/m_cat.html		comp-sys-htmlman	html
 ./usr/share/man/html9/m_copyback.html		comp-sys-htmlman	html
@@ -20020,7 +20022,7 @@
 ./usr/share/man/html9/module_unload.html	comp-sys-htmlman	html
 ./usr/share/man/html9/module_unregister_callbacks.html comp-sys-htmlman	html
 ./usr/share/man/html9/mstohz.html		comp-sys-htmlman	html
-./usr/share/man/html9/mtocl.html		comp-sys-htmlman	html
+./usr/share/man/html9/mtocl.html		comp-obsolete		obsolete
 ./usr/share/man/html9/mtod.html			comp-sys-htmlman	html
 ./usr/share/man/html9/mtsleep.html		comp-sys-htmlman	html
 ./usr/share/man/html9/mutex.html		comp-sys-htmlman	html
@@ -27796,7 +27798,7 @@
 ./usr/share/man/man9/clock_ymdhms_to_secs.9	comp-sys-man		.man
 ./usr/share/man/man9/closef.9			comp-sys-man		.man
 ./usr/share/man/man9/clrbit.9			comp-sys-man		.man
-./usr/share/man/man9/cltom.9			comp-sys-man		.man
+./usr/share/man/man9/cltom.9			comp-obsolete		obsolete
 ./usr/share/man/man9/cn_check_magic.9		comp-sys-man		.man
 ./usr/share/man/man9/cn_destroy_magic.9		comp-sys-man		.man
 ./usr/share/man/man9/cn_get_magic.9		comp-sys-man		.man
@@ -28269,6 +28271,7 @@
 ./usr/share/man/man9/ltsleep.9			comp-sys-man		.man
 ./usr/share/man/man9/lwp_trampoline.9		comp-sys-man		.man
 ./usr/share/man/man9/m_adj.9			comp-sys-man		.man
+./usr/share/man/man9/m_align.9			comp-sys-man		.man
 ./usr/share/man/man9/m_apply.9			comp-sys-man		.man
 ./usr/share/man/man9/m_cat.9			comp-sys-man		.man
 ./usr/share/man/man9/m_copyback.9		comp-sys-man		.man
@@ -28352,7 +28355,7 @@
 ./usr/share/man/man9/module_unregister_callbacks.9 

CVS commit: src/sys/dev/i2c

2021-04-16 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Apr 16 07:02:09 UTC 2021

Modified Files:
src/sys/dev/i2c: i2cvar.h

Log Message:
spello in comment


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/i2c/i2cvar.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/i2c/i2cvar.h
diff -u src/sys/dev/i2c/i2cvar.h:1.23 src/sys/dev/i2c/i2cvar.h:1.24
--- src/sys/dev/i2c/i2cvar.h:1.23	Mon Jan 25 12:15:32 2021
+++ src/sys/dev/i2c/i2cvar.h	Fri Apr 16 07:02:09 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: i2cvar.h,v 1.23 2021/01/25 12:15:32 jmcneill Exp $	*/
+/*	$NetBSD: i2cvar.h,v 1.24 2021/04/16 07:02:09 skrll Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -151,7 +151,7 @@ struct i2c_attach_args {
 	int		ia_ncompat;	/* number of pointers in the
 	   ia_compat array */
 	const char **	ia_compat;	/* chip names */
-	prop_dictionary_t ia_prop;	/* dictionnary for this device */
+	prop_dictionary_t ia_prop;	/* dictionary for this device */
 	/*
 	 * The following is of limited usefulness and should only be used
 	 * in rare cases where we really know what we are doing. Example: