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

2024-01-20 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Jan 21 03:42:08 UTC 2024

Modified Files:
src/common/lib/libc/atomic: atomic_init_testset.c

Log Message:
Catch up with revision 1.5 of atomic_init_cas.c.  Fixes building libc
on sun2, and probably others.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/common/lib/libc/atomic/atomic_init_testset.c

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



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

2024-01-20 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Jan 21 03:42:08 UTC 2024

Modified Files:
src/common/lib/libc/atomic: atomic_init_testset.c

Log Message:
Catch up with revision 1.5 of atomic_init_cas.c.  Fixes building libc
on sun2, and probably others.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/common/lib/libc/atomic/atomic_init_testset.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/atomic/atomic_init_testset.c
diff -u src/common/lib/libc/atomic/atomic_init_testset.c:1.18 src/common/lib/libc/atomic/atomic_init_testset.c:1.19
--- src/common/lib/libc/atomic/atomic_init_testset.c:1.18	Fri Jan 19 19:33:49 2024
+++ src/common/lib/libc/atomic/atomic_init_testset.c	Sun Jan 21 03:42:08 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_init_testset.c,v 1.18 2024/01/19 19:33:49 christos Exp $	*/
+/*	$NetBSD: atomic_init_testset.c,v 1.19 2024/01/21 03:42:08 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -36,8 +36,9 @@
  */
 
 #include 
-__RCSID("$NetBSD: atomic_init_testset.c,v 1.18 2024/01/19 19:33:49 christos Exp $");
+__RCSID("$NetBSD: atomic_init_testset.c,v 1.19 2024/01/21 03:42:08 thorpej Exp $");
 
+#include "extern.h"
 #include "atomic_op_namespace.h"
 
 #include 



CVS commit: src/sys/arch/evbppc

2024-01-20 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jan 21 01:41:54 UTC 2024

Modified Files:
src/sys/arch/evbppc/include: wii.h
src/sys/arch/evbppc/wii: machdep.c

Log Message:
wii: support RB_POWERDOWN


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbppc/include/wii.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbppc/wii/machdep.c

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



CVS commit: src/sys/arch/evbppc

2024-01-20 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jan 21 01:41:54 UTC 2024

Modified Files:
src/sys/arch/evbppc/include: wii.h
src/sys/arch/evbppc/wii: machdep.c

Log Message:
wii: support RB_POWERDOWN


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbppc/include/wii.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbppc/wii/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/evbppc/include/wii.h
diff -u src/sys/arch/evbppc/include/wii.h:1.1 src/sys/arch/evbppc/include/wii.h:1.2
--- src/sys/arch/evbppc/include/wii.h:1.1	Sat Jan 20 21:36:00 2024
+++ src/sys/arch/evbppc/include/wii.h	Sun Jan 21 01:41:54 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: wii.h,v 1.1 2024/01/20 21:36:00 jmcneill Exp $ */
+/* $NetBSD: wii.h,v 1.2 2024/01/21 01:41:54 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2024 Jared McNeill 
@@ -99,7 +99,7 @@
 #define HW_ARMIRQMASK			(HOLLYWOOD_PRIV_BASE + 0x03c)
 #define HW_AHBPROT			(HOLLYWOOD_PRIV_BASE + 0x064)
 #define HW_GPIOB_OUT			(HOLLYWOOD_BASE + 0x0c0)
-#define HW_GPIO_OUT			(HOLLYWOOD_PRIV_BASE + 0x0e0)
+#define HW_GPIO_OWNER			(HOLLYWOOD_PRIV_BASE + 0x0fc)
 #define HW_RESETS			(HOLLYWOOD_PRIV_BASE + 0x194)
 #define  RSTB_IOP			__BIT(23)
 #define  RSTBINB			__BIT(0)
@@ -108,6 +108,7 @@
 #define  HWREV_MASK			__BITS(3,0)
 
 /* GPIOs */
+#define GPIO_SHUTDOWN			1
 #define GPIO_SLOT_LED			5
 
 /* Blink the slot LED forever at the specified interval. */

Index: src/sys/arch/evbppc/wii/machdep.c
diff -u src/sys/arch/evbppc/wii/machdep.c:1.1 src/sys/arch/evbppc/wii/machdep.c:1.2
--- src/sys/arch/evbppc/wii/machdep.c:1.1	Sat Jan 20 21:36:00 2024
+++ src/sys/arch/evbppc/wii/machdep.c	Sun Jan 21 01:41:54 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.1 2024/01/20 21:36:00 jmcneill Exp $ */
+/* $NetBSD: machdep.c,v 1.2 2024/01/21 01:41:54 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2002, 2024 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
 #define _POWERPC_BUS_DMA_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.1 2024/01/20 21:36:00 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.2 2024/01/21 01:41:54 jmcneill Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_ddb.h"
@@ -379,17 +379,25 @@ cpu_reboot(int howto, char *what)
 	}
 	pmf_system_shutdown(boothowto);
 	doshutdownhooks();
+
+	disable_intr();
+
 	/* Force halt on panic to capture the cause on screen. */
 	if (panicstr != NULL) {
 		howto |= RB_HALT;
 	}
+	if ((howto & RB_POWERDOWN) == RB_POWERDOWN) {
+		printf("power off\n\n");
+		out32(HW_GPIOB_OUT, in32(HW_GPIOB_OUT) | __BIT(GPIO_SHUTDOWN));
+		delay(10);
+		printf("power off failed!\n\n");
+	}
 	if (howto & RB_HALT) {
 		printf("halted\n\n");
 		while (1);
 	}
 
 	printf("rebooting\n\n");
-	disable_intr();
 	out32(HW_RESETS, in32(HW_RESETS) & ~RSTBINB);
 	while (1);
 }
@@ -399,6 +407,9 @@ wii_setup(void)
 {
 	/* Turn on the drive slot LED. */
 	out32(HW_GPIOB_OUT, in32(HW_GPIOB_OUT) | __BIT(GPIO_SLOT_LED));
+
+	/* Enable PPC access to SHUTDOWN GPIO. */
+	out32(HW_GPIO_OWNER, in32(HW_GPIO_OWNER) | __BIT(GPIO_SHUTDOWN));
 }
 
 static void



CVS commit: src/lib/libc/compiler_rt

2024-01-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jan 21 00:43:35 UTC 2024

Modified Files:
src/lib/libc/compiler_rt: Makefile.inc

Log Message:
fix more alpha


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/lib/libc/compiler_rt/Makefile.inc

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



CVS commit: src/lib/libc/compiler_rt

2024-01-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jan 21 00:43:35 UTC 2024

Modified Files:
src/lib/libc/compiler_rt: Makefile.inc

Log Message:
fix more alpha


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/lib/libc/compiler_rt/Makefile.inc

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

Modified files:

Index: src/lib/libc/compiler_rt/Makefile.inc
diff -u src/lib/libc/compiler_rt/Makefile.inc:1.43 src/lib/libc/compiler_rt/Makefile.inc:1.44
--- src/lib/libc/compiler_rt/Makefile.inc:1.43	Fri Jan 19 13:45:01 2024
+++ src/lib/libc/compiler_rt/Makefile.inc	Sat Jan 20 19:43:34 2024
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.43 2024/01/19 18:45:01 christos Exp $
+# $NetBSD: Makefile.inc,v 1.44 2024/01/21 00:43:34 christos Exp $
 
 COMPILER_RT_DIR=	${NETBSDSRCDIR}/sys/external/bsd/compiler_rt
 COMPILER_RT_SRCDIR=	${COMPILER_RT_DIR}/dist
@@ -360,15 +360,20 @@ LINTFLAGS.fixunsxfti.c += -X 132,351
 LINTFLAGS.fixxfdi.c += -X 351
 LINTFLAGS.fixxfti.c += -X 117,132,351
 LINTFLAGS.floatdidf.c += -X 351
+LINTFLAGS.floatdidf.c += -X 117	# alpha
 LINTFLAGS.floatdisf.c += -X 351
+LINTFLAGS.floatdisf.c += -X 117	# alpha
 LINTFLAGS.floatdixf.c += -X 351
+LINTFLAGS.floatdixf.c += -X 117	# alpha
 LINTFLAGS.floattidf.c += -X 117,122,141,267,351
 LINTFLAGS.floattisf.c += -X 117,351
 LINTFLAGS.floattisf.c += -X 117,351
 LINTFLAGS.floattixf.c += -X 117,122,351
+LINTFLAGS.floattixf.c += -X 141	# alpha
 LINTFLAGS.floatuntidf.c += -X 122,141,267,351
 LINTFLAGS.floatuntisf.c += -X 351
 LINTFLAGS.floatuntixf.c += -X 122,351
+LINTFLAGS.floatuntixf.c += -X 141 # alpha
 LINTFLAGS.int_util.c += -X 231
 LINTFLAGS.lshrti3.c += -X 351
 LINTFLAGS.modsi3.c += -X 117,351



CVS commit: src/lib/libc/sys

2024-01-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jan 21 00:35:57 UTC 2024

Modified Files:
src/lib/libc/sys: Lint_ptrace.c

Log Message:
fix alpha, grr.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/sys/Lint_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/lib/libc/sys/Lint_ptrace.c
diff -u src/lib/libc/sys/Lint_ptrace.c:1.3 src/lib/libc/sys/Lint_ptrace.c:1.4
--- src/lib/libc/sys/Lint_ptrace.c:1.3	Sat Jan 20 09:52:49 2024
+++ src/lib/libc/sys/Lint_ptrace.c	Sat Jan 20 19:35:57 2024
@@ -1,10 +1,11 @@
-/* $NetBSD: Lint_ptrace.c,v 1.3 2024/01/20 14:52:49 christos Exp $ */
+/* $NetBSD: Lint_ptrace.c,v 1.4 2024/01/21 00:35:57 christos Exp $ */
 
 /*
  * This file placed in the public domain.
  * Chris Demetriou, November 5, 1997.
  */
 
+#include 	/* XXX: alpha  needs sigset_t! */
 #include 
 #include 
 



CVS commit: src/lib/libc/sys

2024-01-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jan 21 00:35:57 UTC 2024

Modified Files:
src/lib/libc/sys: Lint_ptrace.c

Log Message:
fix alpha, grr.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/sys/Lint_ptrace.c

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



CVS commit: src

2024-01-20 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jan 20 21:36:00 UTC 2024

Modified Files:
src/distrib/utils/embedded: mkimage
src/etc/etc.evbppc: Makefile.inc
src/usr.sbin/sysinst/arch/evbppc: md.c md.h
Added Files:
src/distrib/utils/embedded/conf: evbppc.conf wii.conf
src/distrib/utils/embedded/files: evbppc_wii_meta.xml
src/sys/arch/evbppc/conf: INSTALL_WII Makefile.wii.inc WII files.wii
std.wii
src/sys/arch/evbppc/include: wii.h
src/sys/arch/evbppc/wii: autoconf.c machdep.c mainbus.c pic_pi.c
wii_locore.S wii_mmuinit.S
src/sys/arch/evbppc/wii/dev: ehci_hollywood.c hollywood.c hollywood.h
mainbus.h ohci_hollywood.c resetbtn.c sdhc_hollywood.c vireg.h
wiifb.c

Log Message:
evbppc: Add initial support for the Nintendo Wii


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/distrib/utils/embedded/mkimage
cvs rdiff -u -r0 -r1.1 src/distrib/utils/embedded/conf/evbppc.conf \
src/distrib/utils/embedded/conf/wii.conf
cvs rdiff -u -r0 -r1.1 src/distrib/utils/embedded/files/evbppc_wii_meta.xml
cvs rdiff -u -r1.14 -r1.15 src/etc/etc.evbppc/Makefile.inc
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbppc/conf/INSTALL_WII \
src/sys/arch/evbppc/conf/Makefile.wii.inc src/sys/arch/evbppc/conf/WII \
src/sys/arch/evbppc/conf/files.wii src/sys/arch/evbppc/conf/std.wii
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbppc/include/wii.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbppc/wii/autoconf.c \
src/sys/arch/evbppc/wii/machdep.c src/sys/arch/evbppc/wii/mainbus.c \
src/sys/arch/evbppc/wii/pic_pi.c src/sys/arch/evbppc/wii/wii_locore.S \
src/sys/arch/evbppc/wii/wii_mmuinit.S
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbppc/wii/dev/ehci_hollywood.c \
src/sys/arch/evbppc/wii/dev/hollywood.c \
src/sys/arch/evbppc/wii/dev/hollywood.h \
src/sys/arch/evbppc/wii/dev/mainbus.h \
src/sys/arch/evbppc/wii/dev/ohci_hollywood.c \
src/sys/arch/evbppc/wii/dev/resetbtn.c \
src/sys/arch/evbppc/wii/dev/sdhc_hollywood.c \
src/sys/arch/evbppc/wii/dev/vireg.h src/sys/arch/evbppc/wii/dev/wiifb.c
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/sysinst/arch/evbppc/md.c
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/sysinst/arch/evbppc/md.h

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



CVS commit: src

2024-01-20 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jan 20 21:36:00 UTC 2024

Modified Files:
src/distrib/utils/embedded: mkimage
src/etc/etc.evbppc: Makefile.inc
src/usr.sbin/sysinst/arch/evbppc: md.c md.h
Added Files:
src/distrib/utils/embedded/conf: evbppc.conf wii.conf
src/distrib/utils/embedded/files: evbppc_wii_meta.xml
src/sys/arch/evbppc/conf: INSTALL_WII Makefile.wii.inc WII files.wii
std.wii
src/sys/arch/evbppc/include: wii.h
src/sys/arch/evbppc/wii: autoconf.c machdep.c mainbus.c pic_pi.c
wii_locore.S wii_mmuinit.S
src/sys/arch/evbppc/wii/dev: ehci_hollywood.c hollywood.c hollywood.h
mainbus.h ohci_hollywood.c resetbtn.c sdhc_hollywood.c vireg.h
wiifb.c

Log Message:
evbppc: Add initial support for the Nintendo Wii


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/distrib/utils/embedded/mkimage
cvs rdiff -u -r0 -r1.1 src/distrib/utils/embedded/conf/evbppc.conf \
src/distrib/utils/embedded/conf/wii.conf
cvs rdiff -u -r0 -r1.1 src/distrib/utils/embedded/files/evbppc_wii_meta.xml
cvs rdiff -u -r1.14 -r1.15 src/etc/etc.evbppc/Makefile.inc
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbppc/conf/INSTALL_WII \
src/sys/arch/evbppc/conf/Makefile.wii.inc src/sys/arch/evbppc/conf/WII \
src/sys/arch/evbppc/conf/files.wii src/sys/arch/evbppc/conf/std.wii
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbppc/include/wii.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbppc/wii/autoconf.c \
src/sys/arch/evbppc/wii/machdep.c src/sys/arch/evbppc/wii/mainbus.c \
src/sys/arch/evbppc/wii/pic_pi.c src/sys/arch/evbppc/wii/wii_locore.S \
src/sys/arch/evbppc/wii/wii_mmuinit.S
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbppc/wii/dev/ehci_hollywood.c \
src/sys/arch/evbppc/wii/dev/hollywood.c \
src/sys/arch/evbppc/wii/dev/hollywood.h \
src/sys/arch/evbppc/wii/dev/mainbus.h \
src/sys/arch/evbppc/wii/dev/ohci_hollywood.c \
src/sys/arch/evbppc/wii/dev/resetbtn.c \
src/sys/arch/evbppc/wii/dev/sdhc_hollywood.c \
src/sys/arch/evbppc/wii/dev/vireg.h src/sys/arch/evbppc/wii/dev/wiifb.c
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/sysinst/arch/evbppc/md.c
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/sysinst/arch/evbppc/md.h

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

Modified files:

Index: src/distrib/utils/embedded/mkimage
diff -u src/distrib/utils/embedded/mkimage:1.78 src/distrib/utils/embedded/mkimage:1.79
--- src/distrib/utils/embedded/mkimage:1.78	Sat Sep 25 08:54:30 2021
+++ src/distrib/utils/embedded/mkimage	Sat Jan 20 21:35:59 2024
@@ -1,5 +1,5 @@
 #!/bin/sh
-# $NetBSD: mkimage,v 1.78 2021/09/25 08:54:30 maya Exp $
+# $NetBSD: mkimage,v 1.79 2024/01/20 21:35:59 jmcneill Exp $
 #
 # Copyright (c) 2013, 2014 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -312,11 +312,11 @@ else
 
 		echo ${bar} Adding label ${bar}
 		make_label > ${tmp}/label
-		${DISKLABEL} -R -F ${image} ${tmp}/label
+		${DISKLABEL} -m -R -F ${image} ${tmp}/label
 	elif [ -n "${netbsdid}" ]; then
 		echo ${bar} Adding label ${bar}
 		make_label > ${tmp}/label
-		${DISKLABEL} -R -F ${image} ${tmp}/label
+		${DISKLABEL} -m -R -F ${image} ${tmp}/label
 
 		echo ${bar} Running fdisk ${bar}
 		${FDISK} -f -i ${image}

Index: src/etc/etc.evbppc/Makefile.inc
diff -u src/etc/etc.evbppc/Makefile.inc:1.14 src/etc/etc.evbppc/Makefile.inc:1.15
--- src/etc/etc.evbppc/Makefile.inc:1.14	Fri Apr  2 07:08:36 2021
+++ src/etc/etc.evbppc/Makefile.inc	Sat Jan 20 21:35:59 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.14 2021/04/02 07:08:36 rin Exp $
+#	$NetBSD: Makefile.inc,v 1.15 2024/01/20 21:35:59 jmcneill Exp $
 #
 #	etc.evbppc/Makefile.inc -- evbppc-specific etc Makefile targets
 #
@@ -26,6 +26,44 @@ KERNEL_SETS+=		TWRP1025
 BUILD_KERNELS+=		INSTALL_P2020DS INSTALL_P2020RDB
 BUILD_KERNELS+=		INSTALL_RB850GX2
 BUILD_KERNELS+=		INSTALL_TWRP1025
+# wii
+KERNEL_SETS+=		WII
+BUILD_KERNELS+=		INSTALL_WII
 #
 KERNEL_SUFFIXES=	img bin ub
 .endif
+
+# Support for mkimage
+MKIMAGE= 	${NETBSDSRCDIR}/distrib/utils/embedded/mkimage
+IMAGE.rel=  ${RELEASEDIR}/${RELEASEMACHINEDIR}
+IMAGE.dir=  ${IMAGE.rel}/binary/gzimg
+IMAGE.kern= ${IMAGE.rel}/binary/kernel
+IMAGEENDIAN=	be
+
+__mkimage: .USE
+	TOOL_MAKE=${MAKE} \
+	TOOL_MAKEFS=${TOOL_MAKEFS} \
+	TOOL_DISKLABEL=${TOOL_DISKLABEL} \
+	TOOL_FDISK=${TOOL_FDISK} \
+	TOOL_GPT=${TOOL_GPT} \
+	TOOL_GZIP=${TOOL_GZIP} \
+	TOOL_MKNOD=${TOOL_MKNOD} \
+	TOOL_PAX=${TOOL_PAX} \
+	TOOL_MKUBOOTIMAGE=${TOOL_MKUBOOTIMAGE} \
+	TOOL_MTREE=${TOOL_MTREE} \
+	HOST_SH=${HOST_SH} \
+	KERNOBJDIR=${KERNOBJDIR} \
+	MACHINE=${MACHINE} \
+	MKDTB=${MKDTB} \
+	${HOST_SH} -x ${MKIMAGE} -h ${.TARGET:S/smp_//} -D ${DESTDIR} \
+-S ${NETBSDSRCDIR} -B ${IMAGEENDIAN} ${MKI_OPTS.${.TARGET}} \
+${IMAGE.dir}/${.TARGET:S/smp_//}.img.gz
+
+.if ${MACHINE_ARCH} == "powerpc"
+smp_wii: __mkimage

CVS commit: src/sys/dev/usb

2024-01-20 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jan 20 21:09:28 UTC 2024

Modified Files:
src/sys/dev/usb: usb.h

Log Message:
usb: increase USB_PORT_RESET_RECOVERY from 10ms to 20ms

I changed this from 250ms to 10ms back in 2021 based on a similar FreeBSD
change, but it seems to be a bit too aggressive for some platforms.


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/sys/dev/usb/usb.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/usb/usb.h
diff -u src/sys/dev/usb/usb.h:1.123 src/sys/dev/usb/usb.h:1.124
--- src/sys/dev/usb/usb.h:1.123	Mon Jul 31 23:52:12 2023
+++ src/sys/dev/usb/usb.h	Sat Jan 20 21:09:28 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb.h,v 1.123 2023/07/31 23:52:12 christos Exp $	*/
+/*	$NetBSD: usb.h,v 1.124 2024/01/20 21:09:28 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -778,7 +778,7 @@ typedef struct {
 /* Allow for marginal (i.e. non-conforming) devices. */
 #define USB_PORT_RESET_DELAY	50  /* ms */
 #define USB_PORT_ROOT_RESET_DELAY 250  /* ms */
-#define USB_PORT_RESET_RECOVERY	10  /* ms */
+#define USB_PORT_RESET_RECOVERY	20  /* ms */
 #define USB_PORT_POWERUP_DELAY	300 /* ms */
 #define USB_SET_ADDRESS_SETTLE	10  /* ms */
 #define USB_RESUME_DELAY	(50*5)  /* ms */



CVS commit: src/sys/dev/usb

2024-01-20 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jan 20 21:09:28 UTC 2024

Modified Files:
src/sys/dev/usb: usb.h

Log Message:
usb: increase USB_PORT_RESET_RECOVERY from 10ms to 20ms

I changed this from 250ms to 10ms back in 2021 based on a similar FreeBSD
change, but it seems to be a bit too aggressive for some platforms.


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/sys/dev/usb/usb.h

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



CVS commit: src/sys/arch/powerpc/powerpc

2024-01-20 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jan 20 20:49:11 UTC 2024

Modified Files:
src/sys/arch/powerpc/powerpc: clock.c

Log Message:
powerpc: fix delay for large (> ~5sec) values

When calculating the target timebase, promote '1000' on the RHS to ULL
to force 64-bit calculation, otherwise 'n * 1000' will overflow.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/powerpc/powerpc/clock.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/powerpc/powerpc/clock.c
diff -u src/sys/arch/powerpc/powerpc/clock.c:1.17 src/sys/arch/powerpc/powerpc/clock.c:1.18
--- src/sys/arch/powerpc/powerpc/clock.c:1.17	Mon Jul  6 10:31:24 2020
+++ src/sys/arch/powerpc/powerpc/clock.c	Sat Jan 20 20:49:11 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: clock.c,v 1.17 2020/07/06 10:31:24 rin Exp $	*/
+/*	$NetBSD: clock.c,v 1.18 2024/01/20 20:49:11 jmcneill Exp $	*/
 /*  $OpenBSD: clock.c,v 1.3 1997/10/13 13:42:53 pefo Exp $	*/
 
 /*
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.17 2020/07/06 10:31:24 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.18 2024/01/20 20:49:11 jmcneill Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ppcarch.h"
@@ -232,7 +232,7 @@ delay(unsigned int n)
 #endif /* !_ARCH_PPC64 */
 	{
 		tb = mftb();
-		tb += (n * 1000 + ns_per_tick - 1) / ns_per_tick;
+		tb += (n * 1000ULL + ns_per_tick - 1) / ns_per_tick;
 #ifdef _ARCH_PPC64
 		__asm volatile ("1: mftb %0; cmpld %0,%1; blt 1b;"
 			  : "="(scratch) : "r"(tb)



CVS commit: src/sys/arch/powerpc/powerpc

2024-01-20 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jan 20 20:49:11 UTC 2024

Modified Files:
src/sys/arch/powerpc/powerpc: clock.c

Log Message:
powerpc: fix delay for large (> ~5sec) values

When calculating the target timebase, promote '1000' on the RHS to ULL
to force 64-bit calculation, otherwise 'n * 1000' will overflow.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/powerpc/powerpc/clock.c

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



CVS commit: src/etc/etc.riscv

2024-01-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jan 20 17:20:09 UTC 2024

Modified Files:
src/etc/etc.riscv: MAKEDEV.conf

Log Message:
Create some more nodes.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/etc/etc.riscv/MAKEDEV.conf

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

Modified files:

Index: src/etc/etc.riscv/MAKEDEV.conf
diff -u src/etc/etc.riscv/MAKEDEV.conf:1.1 src/etc/etc.riscv/MAKEDEV.conf:1.2
--- src/etc/etc.riscv/MAKEDEV.conf:1.1	Fri Sep 19 17:36:24 2014
+++ src/etc/etc.riscv/MAKEDEV.conf	Sat Jan 20 17:20:09 2024
@@ -1,10 +1,13 @@
-# $NetBSD: MAKEDEV.conf,v 1.1 2014/09/19 17:36:24 matt Exp $
+# $NetBSD: MAKEDEV.conf,v 1.2 2024/01/20 17:20:09 skrll Exp $
 
 all_md)
+	makedev wd0 wd1 wd2 wd3 sd0 sd1 sd2 sd3
 	makedev ld0 ld1 ld2 ld3 dk0 dk1 dk2 dk3 dk4 dk5 dk6 dk7
+	makedev tty0 tty1 tty2 tty3
 	makedev scsibus0 
 	makedev	sysmon
 	makedev kttcp
+	makedev bpf
 	;;
 
 ramdisk|floppy)



CVS commit: src/etc/etc.riscv

2024-01-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jan 20 17:20:09 UTC 2024

Modified Files:
src/etc/etc.riscv: MAKEDEV.conf

Log Message:
Create some more nodes.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/etc/etc.riscv/MAKEDEV.conf

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



CVS commit: src/tests/lib/libc/stdlib

2024-01-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan 20 16:52:41 UTC 2024

Modified Files:
src/tests/lib/libc/stdlib: t_strtoi.c

Log Message:
Add range tests with trailing characters.


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

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

Modified files:

Index: src/tests/lib/libc/stdlib/t_strtoi.c
diff -u src/tests/lib/libc/stdlib/t_strtoi.c:1.2 src/tests/lib/libc/stdlib/t_strtoi.c:1.3
--- src/tests/lib/libc/stdlib/t_strtoi.c:1.2	Fri Apr 28 15:01:01 2017
+++ src/tests/lib/libc/stdlib/t_strtoi.c	Sat Jan 20 11:52:41 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_strtoi.c,v 1.2 2017/04/28 19:01:01 kamil Exp $	*/
+/*	$NetBSD: t_strtoi.c,v 1.3 2024/01/20 16:52:41 christos Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_strtoi.c,v 1.2 2017/04/28 19:01:01 kamil Exp $");
+__RCSID("$NetBSD: t_strtoi.c,v 1.3 2024/01/20 16:52:41 christos Exp $");
 
 #include 
 #include 
@@ -235,6 +235,38 @@ ATF_TC_BODY(strtoi_range, tc)
 	}
 }
 
+ATF_TC(strtoi_range_trail);
+ATF_TC_HEAD(strtoi_range_trail, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test ERANGE from strtoi(3) "
+		"with trailing characters");
+}
+
+ATF_TC_BODY(strtoi_range_trail, tc)
+{
+	struct test t[] = {
+		{ "11x", 9, 10, "x", 0,	9, ERANGE },
+		{ " -3y", -2, 10, "y", -2, 1, ERANGE },
+	};
+
+	intmax_t rv;
+	char *end;
+	int e;
+	size_t i;
+
+	for (i = 0; i < __arraycount(t); i++) {
+
+		errno = 0;
+		rv = strtoi(t[i].str, , t[i].base, t[i].lo, t[i].hi, );
+
+		if (errno != 0)
+			atf_tc_fail("strtoi(3) changed errno to %d ('%s')",
+			e, strerror(e));
+
+		check([i], rv, end, e);
+	}
+}
+
 ATF_TC(strtoi_signed);
 ATF_TC_HEAD(strtoi_signed, tc)
 {
@@ -298,6 +330,7 @@ ATF_TP_ADD_TCS(tp)
 	ATF_TP_ADD_TC(tp, strtoi_base);
 	ATF_TP_ADD_TC(tp, strtoi_case);
 	ATF_TP_ADD_TC(tp, strtoi_range);
+	ATF_TP_ADD_TC(tp, strtoi_range_trail);
 	ATF_TP_ADD_TC(tp, strtoi_signed);
 
 	return atf_no_error();



CVS commit: src/tests/lib/libc/stdlib

2024-01-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan 20 16:52:41 UTC 2024

Modified Files:
src/tests/lib/libc/stdlib: t_strtoi.c

Log Message:
Add range tests with trailing characters.


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

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



CVS commit: src/lib/libc/stdlib

2024-01-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan 20 16:45:07 UTC 2024

Modified Files:
src/lib/libc/stdlib: Makefile.inc strtoi.3
Removed Files:
src/lib/libc/stdlib: strtou.3

Log Message:
generate strtou.3 from strtoi.3, grammar police


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/lib/libc/stdlib/Makefile.inc
cvs rdiff -u -r1.8 -r1.9 src/lib/libc/stdlib/strtoi.3
cvs rdiff -u -r1.8 -r0 src/lib/libc/stdlib/strtou.3

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



CVS commit: src/lib/libc/stdlib

2024-01-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan 20 16:45:07 UTC 2024

Modified Files:
src/lib/libc/stdlib: Makefile.inc strtoi.3
Removed Files:
src/lib/libc/stdlib: strtou.3

Log Message:
generate strtou.3 from strtoi.3, grammar police


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/lib/libc/stdlib/Makefile.inc
cvs rdiff -u -r1.8 -r1.9 src/lib/libc/stdlib/strtoi.3
cvs rdiff -u -r1.8 -r0 src/lib/libc/stdlib/strtou.3

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

Modified files:

Index: src/lib/libc/stdlib/Makefile.inc
diff -u src/lib/libc/stdlib/Makefile.inc:1.96 src/lib/libc/stdlib/Makefile.inc:1.97
--- src/lib/libc/stdlib/Makefile.inc:1.96	Fri Jan 19 13:41:30 2024
+++ src/lib/libc/stdlib/Makefile.inc	Sat Jan 20 11:45:07 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.96 2024/01/19 18:41:30 christos Exp $
+#	$NetBSD: Makefile.inc,v 1.97 2024/01/20 16:45:07 christos Exp $
 #	from: @(#)Makefile.inc	8.3 (Berkeley) 2/4/95
 
 # stdlib sources
@@ -62,6 +62,12 @@ MAN+=	a64l.3 abort.3 abs.3 alloca.3 atex
 	tsearch.3 \
 	unlockpt.3
 
+strtou.3: strtoi.3
+	${_MKTARGET_CREATE}
+	${TOOL_SED} -e s/strtoi/strtou/g -e s/STRTOI/STRTOU/g \
+	-e s/intmax_t/uintmax_t/g -e s/%jd/%ju/g ${.ALLSRC} > ${.TARGET}
+CLEANFILES += strtou.3
+
 MLINKS+=a64l.3 l64a.3
 MLINKS+=a64l.3 l64a_r.3
 MLINKS+=abs.3 labs.3 \

Index: src/lib/libc/stdlib/strtoi.3
diff -u src/lib/libc/stdlib/strtoi.3:1.8 src/lib/libc/stdlib/strtoi.3:1.9
--- src/lib/libc/stdlib/strtoi.3:1.8	Sat Jan 20 11:13:39 2024
+++ src/lib/libc/stdlib/strtoi.3	Sat Jan 20 11:45:07 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: strtoi.3,v 1.8 2024/01/20 16:13:39 christos Exp $
+.\"	$NetBSD: strtoi.3,v 1.9 2024/01/20 16:45:07 christos Exp $
 .\"
 .\" Copyright (c) 1990, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -202,7 +202,7 @@ or the range given was invalid, i.e.
 .Fa hi .
 .El
 .Pp
-The range check is important than the unconverted characters check,
+The range check is more important than the unconverted characters check,
 and it is performed first.
 If a program needs to know if there were unconverted characters when an
 out of range number has been provided, it needs to supply and test



CVS commit: src/sys/compat/ufs/lfs

2024-01-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan 20 16:28:44 UTC 2024

Added Files:
src/sys/compat/ufs/lfs: lfs_extern.h

Log Message:
add compat decls


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/compat/ufs/lfs/lfs_extern.h

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



CVS commit: src/sys/compat/ufs/lfs

2024-01-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan 20 16:28:44 UTC 2024

Added Files:
src/sys/compat/ufs/lfs: lfs_extern.h

Log Message:
add compat decls


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/compat/ufs/lfs/lfs_extern.h

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

Added files:

Index: src/sys/compat/ufs/lfs/lfs_extern.h
diff -u /dev/null src/sys/compat/ufs/lfs/lfs_extern.h:1.1
--- /dev/null	Sat Jan 20 11:28:44 2024
+++ src/sys/compat/ufs/lfs/lfs_extern.h	Sat Jan 20 11:28:43 2024
@@ -0,0 +1,13 @@
+/*	$NetBSD: lfs_extern.h,v 1.1 2024/01/20 16:28:43 christos Exp $	*/
+
+#ifndef _COMPAT_UFS_LFS_LFS_EXTERN_H_
+#define _COMPAT_UFS_LFS_LFS_EXTERN_H_
+
+__BEGIN_DECLS
+#ifndef _KERNEL
+int lfs_segwait(fsid_t *, struct timeval50 *);
+int __lfs_segwait50(fsid_t *, struct timeval *);
+#endif
+__END_DECLS
+
+#endif /* !_COMPAT_UFS_LFS_LFS_EXTERN_H_ */



CVS commit: src/lib/libc/net

2024-01-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan 20 16:18:56 UTC 2024

Modified Files:
src/lib/libc/net: getaddrinfo.c

Log Message:
Make the first argument of ip6_str2scopeid const, instead of __UNCONST.
Thanks kre@. While here s/u_int32_t/uint32_t/


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/lib/libc/net/getaddrinfo.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/libc/net/getaddrinfo.c
diff -u src/lib/libc/net/getaddrinfo.c:1.125 src/lib/libc/net/getaddrinfo.c:1.126
--- src/lib/libc/net/getaddrinfo.c:1.125	Sat Jan 20 09:52:48 2024
+++ src/lib/libc/net/getaddrinfo.c	Sat Jan 20 11:18:56 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: getaddrinfo.c,v 1.125 2024/01/20 14:52:48 christos Exp $	*/
+/*	$NetBSD: getaddrinfo.c,v 1.126 2024/01/20 16:18:56 christos Exp $	*/
 /*	$KAME: getaddrinfo.c,v 1.29 2000/08/31 17:26:57 itojun Exp $	*/
 
 /*
@@ -55,7 +55,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: getaddrinfo.c,v 1.125 2024/01/20 14:52:48 christos Exp $");
+__RCSID("$NetBSD: getaddrinfo.c,v 1.126 2024/01/20 16:18:56 christos Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #ifndef RUMP_ACTION
@@ -196,7 +196,7 @@ struct ai_order {
 		struct sockaddr aiou_sa;
 	} aio_src_un;
 #define aio_srcsa aio_src_un.aiou_sa
-	u_int32_t aio_srcflag;
+	uint32_t aio_srcflag;
 	int aio_srcscope;
 	int aio_dstscope;
 	struct policyqueue *aio_srcpolicy;
@@ -257,7 +257,7 @@ static void set_source(struct ai_order *
 struct servent_data *);
 static int comp_dst(const void *, const void *);
 #ifdef INET6
-static int ip6_str2scopeid(char *, struct sockaddr_in6 *, u_int32_t *);
+static int ip6_str2scopeid(const char *, struct sockaddr_in6 *, uint32_t *);
 #endif
 static int gai_addr2scopetype(struct sockaddr *);
 
@@ -921,7 +921,7 @@ set_source(struct ai_order *aio, struct 
 #ifdef INET6
 	if (ai.ai_family == AF_INET6) {
 		struct in6_ifreq ifr6;
-		u_int32_t flags6;
+		uint32_t flags6;
 
 		memset(, 0, sizeof(ifr6));
 		memcpy(_addr, ai.ai_addr, ai.ai_addrlen);
@@ -1434,13 +1434,13 @@ explore_numeric_scope(const struct addri
 
 	error = explore_numeric(pai, addr, servname, res, hostname, svd);
 	if (error == 0) {
-		u_int32_t scopeid;
+		uint32_t scopeid;
 
 		for (cur = *res; cur; cur = cur->ai_next) {
 			if (cur->ai_family != AF_INET6)
 continue;
 			sin6 = (struct sockaddr_in6 *)(void *)cur->ai_addr;
-			if (ip6_str2scopeid(__UNCONST(scope), sin6, )
+			if (ip6_str2scopeid(scope, sin6, )
 			== -1) {
 free(hostname2);
 return EAI_NODATA; /* XXX: is return OK? */
@@ -1644,7 +1644,7 @@ addrconfig(uint64_t *mask)
 #ifdef INET6
 /* convert a string to a scope identifier. XXX: IPv6 specific */
 static int
-ip6_str2scopeid(char *scope, struct sockaddr_in6 *sin6, u_int32_t *scopeid)
+ip6_str2scopeid(const char *scope, struct sockaddr_in6 *sin6, uint32_t *scopeid)
 {
 	u_long lscopeid;
 	struct in6_addr *a6;
@@ -1684,7 +1684,7 @@ ip6_str2scopeid(char *scope, struct sock
   trynumeric:
 	errno = 0;
 	lscopeid = strtoul(scope, , 10);
-	*scopeid = (u_int32_t)(lscopeid & 0xUL);
+	*scopeid = (uint32_t)(lscopeid & 0xUL);
 	if (errno == 0 && ep && *ep == '\0' && *scopeid == lscopeid)
 		return 0;
 	else



CVS commit: src/lib/libc/net

2024-01-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan 20 16:18:56 UTC 2024

Modified Files:
src/lib/libc/net: getaddrinfo.c

Log Message:
Make the first argument of ip6_str2scopeid const, instead of __UNCONST.
Thanks kre@. While here s/u_int32_t/uint32_t/


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/lib/libc/net/getaddrinfo.c

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



CVS commit: src

2024-01-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan 20 16:13:39 UTC 2024

Modified Files:
src/common/lib/libc/stdlib: _strtoi.h
src/lib/libc/stdlib: strtoi.3 strtonum.c strtou.3

Log Message:
PR/57828: Alejandro Colomar: Prioritize test for ERANGE before testing for
fully consuming the string. Adjust strtonum(3) to behave as before. Document
the order of the tests and sync the man pages (I should really autogenerate
one of the two man pages...)


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/common/lib/libc/stdlib/_strtoi.h
cvs rdiff -u -r1.7 -r1.8 src/lib/libc/stdlib/strtoi.3 \
src/lib/libc/stdlib/strtou.3
cvs rdiff -u -r1.6 -r1.7 src/lib/libc/stdlib/strtonum.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/stdlib/_strtoi.h
diff -u src/common/lib/libc/stdlib/_strtoi.h:1.2 src/common/lib/libc/stdlib/_strtoi.h:1.3
--- src/common/lib/libc/stdlib/_strtoi.h:1.2	Sun Jan 18 12:55:22 2015
+++ src/common/lib/libc/stdlib/_strtoi.h	Sat Jan 20 11:13:39 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: _strtoi.h,v 1.2 2015/01/18 17:55:22 christos Exp $	*/
+/*	$NetBSD: _strtoi.h,v 1.3 2024/01/20 16:13:39 christos Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -100,26 +100,26 @@ INT_FUNCNAME(_int_, _FUNCNAME, _l)(const
 	errno = serrno;
 #endif
 
-	if (*rstatus == 0) {
-		/* No digits were found */
-		if (nptr == *endptr)
-			*rstatus = ECANCELED;
-		/* There are further characters after number */
-		else if (**endptr != '\0')
-			*rstatus = ENOTSUP;
-	}
+	/* No digits were found */
+	if (*rstatus == 0 && nptr == *endptr)
+		*rstatus = ECANCELED;
 
 	if (im < lo) {
 		if (*rstatus == 0)
 			*rstatus = ERANGE;
 		return lo;
 	}
+
 	if (im > hi) {
 		if (*rstatus == 0)
 			*rstatus = ERANGE;
 		return hi;
 	}
 
+	/* There are further characters after number */
+	if (*rstatus == 0 && **endptr != '\0')
+		*rstatus = ENOTSUP;
+
 	return im;
 }
 

Index: src/lib/libc/stdlib/strtoi.3
diff -u src/lib/libc/stdlib/strtoi.3:1.7 src/lib/libc/stdlib/strtoi.3:1.8
--- src/lib/libc/stdlib/strtoi.3:1.7	Mon Jul  3 17:32:50 2017
+++ src/lib/libc/stdlib/strtoi.3	Sat Jan 20 11:13:39 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: strtoi.3,v 1.7 2017/07/03 21:32:50 wiz Exp $
+.\"	$NetBSD: strtoi.3,v 1.8 2024/01/20 16:13:39 christos Exp $
 .\"
 .\" Copyright (c) 1990, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -36,12 +36,12 @@
 .\" Created by Kamil Rytarowski, based on ID:
 .\" NetBSD: strtol.3,v 1.31 2015/03/11 09:57:35 wiz Exp
 .\"
-.Dd November 13, 2015
+.Dd January 20, 2024
 .Dt STRTOI 3
 .Os
 .Sh NAME
 .Nm strtoi
-.Nd convert string value to an intmax_t integer
+.Nd convert a string value to an intmax_t integer
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
@@ -58,8 +58,7 @@
 .Sh DESCRIPTION
 The
 .Fn strtoi
-function
-converts the string in
+function converts the string in
 .Fa nptr
 to an
 .Ft intmax_t
@@ -117,10 +116,11 @@ is taken as 10 (decimal) unless the next
 .Ql 0 ,
 in which case it is taken as 8 (octal).
 .Pp
-The remainder of the string is converted to a
+The remainder of the string is converted to an
 .Em intmax_t
 value in the obvious manner,
-stopping at the first character which is not a valid digit
+stopping at the end of the string
+or at the first character which is not a valid digit
 in the given base.
 (In bases above 10, the letter
 .Ql A
@@ -201,6 +201,12 @@ or the range given was invalid, i.e.
 >
 .Fa hi .
 .El
+.Pp
+The range check is important than the unconverted characters check,
+and it is performed first.
+If a program needs to know if there were unconverted characters when an
+out of range number has been provided, it needs to supply and test
+.Fa endptr.
 .Sh SEE ALSO
 .Xr atof 3 ,
 .Xr atoi 3 ,
Index: src/lib/libc/stdlib/strtou.3
diff -u src/lib/libc/stdlib/strtou.3:1.7 src/lib/libc/stdlib/strtou.3:1.8
--- src/lib/libc/stdlib/strtou.3:1.7	Mon Jul  3 17:32:50 2017
+++ src/lib/libc/stdlib/strtou.3	Sat Jan 20 11:13:39 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: strtou.3,v 1.7 2017/07/03 21:32:50 wiz Exp $
+.\"	$NetBSD: strtou.3,v 1.8 2024/01/20 16:13:39 christos Exp $
 .\"
 .\" Copyright (c) 1990, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -36,12 +36,12 @@
 .\" Created by Kamil Rytarowski, based on ID:
 .\" NetBSD: strtoul.3,v 1.29 2015/03/10 13:00:58 christos Exp
 .\"
-.Dd November 13, 2015
+.Dd January 20, 2024
 .Dt STRTOU 3
 .Os
 .Sh NAME
 .Nm strtou
-.Nd convert a string to an uintmax_t integer
+.Nd convert a string value to an uintmax_t integer
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
@@ -120,7 +120,7 @@ The remainder of the string is converted
 .Em uintmax_t
 value in the obvious manner,
 stopping at the end of the string
-or at the first character that does not produce a valid digit
+or at the first character which is not a valid digit
 in the given base.
 (In bases above 10, the letter
 .Ql A
@@ -195,12 

CVS commit: src

2024-01-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan 20 16:13:39 UTC 2024

Modified Files:
src/common/lib/libc/stdlib: _strtoi.h
src/lib/libc/stdlib: strtoi.3 strtonum.c strtou.3

Log Message:
PR/57828: Alejandro Colomar: Prioritize test for ERANGE before testing for
fully consuming the string. Adjust strtonum(3) to behave as before. Document
the order of the tests and sync the man pages (I should really autogenerate
one of the two man pages...)


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/common/lib/libc/stdlib/_strtoi.h
cvs rdiff -u -r1.7 -r1.8 src/lib/libc/stdlib/strtoi.3 \
src/lib/libc/stdlib/strtou.3
cvs rdiff -u -r1.6 -r1.7 src/lib/libc/stdlib/strtonum.c

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



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

2024-01-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan 20 14:55:11 UTC 2024

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

Log Message:
Add __UNCONST


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/common/lib/libc/string/strpbrk.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/strpbrk.c
diff -u src/common/lib/libc/string/strpbrk.c:1.2 src/common/lib/libc/string/strpbrk.c:1.3
--- src/common/lib/libc/string/strpbrk.c:1.2	Sat Feb  3 20:13:45 2018
+++ src/common/lib/libc/string/strpbrk.c	Sat Jan 20 09:55:11 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: strpbrk.c,v 1.2 2018/02/04 01:13:45 mrg Exp $	*/
+/*	$NetBSD: strpbrk.c,v 1.3 2024/01/20 14:55:11 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 Joerg Sonnenberger
@@ -26,7 +26,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: strpbrk.c,v 1.2 2018/02/04 01:13:45 mrg Exp $");
+__RCSID("$NetBSD: strpbrk.c,v 1.3 2024/01/20 14:55:11 christos Exp $");
 
 #if !defined(_KERNEL) && !defined(_STANDALONE)
 #include 
@@ -64,7 +64,7 @@ strpbrk(const char *s, const char *chars
 	if (charset[0] == '\0')
 		return NULL;
 	if (charset[1] == '\0')
-		return strchr(s, charset[0]);
+		return __UNCONST(strchr(s, charset[0]));
 
 	for (; *charset != '\0'; ++charset)
 		ADD_TO_SET(UC(*charset));



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

2024-01-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan 20 14:55:11 UTC 2024

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

Log Message:
Add __UNCONST


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/common/lib/libc/string/strpbrk.c

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



CVS commit: src/common/lib/libc

2024-01-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan 20 14:55:02 UTC 2024

Modified Files:
src/common/lib/libc/gen: ptree.c
src/common/lib/libc/hash/sha2: sha2.c

Log Message:
move local decls to headers


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/common/lib/libc/gen/ptree.c
cvs rdiff -u -r1.25 -r1.26 src/common/lib/libc/hash/sha2/sha2.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/gen/ptree.c
diff -u src/common/lib/libc/gen/ptree.c:1.12 src/common/lib/libc/gen/ptree.c:1.13
--- src/common/lib/libc/gen/ptree.c:1.12	Thu May 26 11:23:33 2022
+++ src/common/lib/libc/gen/ptree.c	Sat Jan 20 09:55:02 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: ptree.c,v 1.12 2022/05/26 15:23:33 rillig Exp $	*/
+/*	$NetBSD: ptree.c,v 1.13 2024/01/20 14:55:02 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
 #include 
 #include 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ptree.c,v 1.12 2022/05/26 15:23:33 rillig Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ptree.c,v 1.13 2024/01/20 14:55:02 christos Exp $");
 #else
 #include 
 #include 
@@ -53,7 +53,7 @@ __KERNEL_RCSID(0, "$NetBSD: ptree.c,v 1.
 #else
 #define	KASSERT(e)	do { } while (0)
 #endif
-__RCSID("$NetBSD: ptree.c,v 1.12 2022/05/26 15:23:33 rillig Exp $");
+__RCSID("$NetBSD: ptree.c,v 1.13 2024/01/20 14:55:02 christos Exp $");
 #endif /* _KERNEL || _STANDALONE */
 
 #ifdef _LIBC
@@ -111,7 +111,6 @@ __RCSID("$NetBSD: ptree.c,v 1.12 2022/05
 #define	ITEMTONODE(pt, ptn)	\
 	((pt_node_t *)((uintptr_t)(ptn) + (pt)->pt_node_offset))
 
-bool ptree_check(const pt_tree_t *);
 #if PTCHECK > 1
 #define	PTREE_CHECK(pt)		ptree_check(pt)
 #else

Index: src/common/lib/libc/hash/sha2/sha2.c
diff -u src/common/lib/libc/hash/sha2/sha2.c:1.25 src/common/lib/libc/hash/sha2/sha2.c:1.26
--- src/common/lib/libc/hash/sha2/sha2.c:1.25	Thu Oct 28 11:08:05 2021
+++ src/common/lib/libc/hash/sha2/sha2.c	Sat Jan 20 09:55:02 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: sha2.c,v 1.25 2021/10/28 15:08:05 christos Exp $ */
+/* $NetBSD: sha2.c,v 1.26 2024/01/20 14:55:02 christos Exp $ */
 /*	$KAME: sha2.c,v 1.9 2003/07/20 00:28:38 itojun Exp $	*/
 
 /*
@@ -43,7 +43,7 @@
 #include 
 
 #if defined(_KERNEL) || defined(_STANDALONE)
-__KERNEL_RCSID(0, "$NetBSD: sha2.c,v 1.25 2021/10/28 15:08:05 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sha2.c,v 1.26 2024/01/20 14:55:02 christos Exp $");
 
 #include 	/* XXX: to pull  for vax memset(9) */
 #include 
@@ -51,7 +51,7 @@ __KERNEL_RCSID(0, "$NetBSD: sha2.c,v 1.2
 #else
 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: sha2.c,v 1.25 2021/10/28 15:08:05 christos Exp $");
+__RCSID("$NetBSD: sha2.c,v 1.26 2024/01/20 14:55:02 christos Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -59,6 +59,10 @@ __RCSID("$NetBSD: sha2.c,v 1.25 2021/10/
 
 #endif
 
+#ifndef _LIBC_INTERNAL
+#define _LIBC_INTERNAL
+#endif
+
 #include 
 #include 
 
@@ -122,10 +126,6 @@ __RCSID("$NetBSD: sha2.c,v 1.25 2021/10/
  * only.
  */
 static void SHA512_Last(SHA512_CTX *);
-void SHA224_Transform(SHA224_CTX *, const uint32_t*);
-void SHA256_Transform(SHA256_CTX *, const uint32_t*);
-void SHA384_Transform(SHA384_CTX *, const uint64_t*);
-void SHA512_Transform(SHA512_CTX *, const uint64_t*);
 
 
 /*** SHA-XYZ INITIAL HASH VALUES AND CONSTANTS /



CVS commit: src/common/lib/libc

2024-01-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan 20 14:55:02 UTC 2024

Modified Files:
src/common/lib/libc/gen: ptree.c
src/common/lib/libc/hash/sha2: sha2.c

Log Message:
move local decls to headers


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/common/lib/libc/gen/ptree.c
cvs rdiff -u -r1.25 -r1.26 src/common/lib/libc/hash/sha2/sha2.c

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



CVS commit: src/lib/libc

2024-01-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan 20 14:52:49 UTC 2024

Modified Files:
src/lib/libc: Makefile.inc
src/lib/libc/citrus: citrus_stdenc.h
src/lib/libc/compat/gen: compat_errlist.c compat_frexp_ieee754.c
compat_modf_ieee754.c compat_siglist.c compat_signame.c
compat_syslog.c compat_timezone.c
src/lib/libc/compat/include: locale.h signal.h time.h unistd.h
src/lib/libc/compat/locale: compat_setlocale1.c
src/lib/libc/compat/net: __cmsg_alignbytes.c
src/lib/libc/compat/sys: Lint_Ovfork.c compat___sigaction14_sigtramp.c
compat_fhopen.c compat_fhstatvfs.c compat_fhstatvfs1.c
compat_getfh.c compat_getrusage.c compat_lfs_segwait.c
compat_mount.c compat_sched.c compat_sigtimedwait.c compat_wait4.c
src/lib/libc/db/db: db.c
src/lib/libc/gdtoa: dtoa.c gdtoa.c
src/lib/libc/gen: Lint_flt_rounds.c Makefile.inc _errno.c arc4random.c
errno.c execl.c execv.c execvp.c getdevmajor.c getlogin.c
getpwent.c humanize_number.c pthread_atfork.c pw_private.h
sysctlgetmibinfo.c vis.c wordexp.c
src/lib/libc/hash/md2: md2.c
src/lib/libc/inet: inet_cidr_pton.c
src/lib/libc/isc: Makefile.inc
src/lib/libc/locale: __mb_cur_max.c generic_lc_all.c newlocale.c
src/lib/libc/misc: initfini.c
src/lib/libc/nameser: ns_name.c
src/lib/libc/net: base64.c getaddrinfo.c getprotobyname.c
getprotobynumber.c getservbyname.c getservbyport.c protoent.h
rcmd.c sctp_sys_calls.c servent.h
src/lib/libc/posix1e: acl_branding.c acl_calc_mask.c acl_copy.c
acl_from_text.c acl_from_text_nfs4.c acl_support.h
acl_support_nfs4.c acl_to_text_nfs4.c
src/lib/libc/regex: Makefile.inc
src/lib/libc/ssp: ssp_redirect.c
src/lib/libc/stdio: Makefile.inc fread.c gettemp.c vfwprintf.c
src/lib/libc/sys: Lint___vfork14.c Lint_clone.c Lint_ptrace.c
makelintstub
src/lib/libc/time: asctime.c difftime.c localtime.c private.h
strftime.c
src/lib/libc/tls: tls.c
Added Files:
src/lib/libc/compat/include: errno.h extern.h sched.h
src/lib/libc/gen: errno_private.h getdevmajor_private.h

Log Message:
Catch up with all the lint warnings since exit on warning was disabled.
Disable 'missing header declaration' and 'nested extern' warnings for now.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/lib/libc/Makefile.inc
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/citrus/citrus_stdenc.h
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/compat/gen/compat_errlist.c \
src/lib/libc/compat/gen/compat_syslog.c
cvs rdiff -u -r1.5 -r1.6 src/lib/libc/compat/gen/compat_frexp_ieee754.c \
src/lib/libc/compat/gen/compat_modf_ieee754.c
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/compat/gen/compat_siglist.c \
src/lib/libc/compat/gen/compat_signame.c
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/compat/gen/compat_timezone.c
cvs rdiff -u -r0 -r1.1 src/lib/libc/compat/include/errno.h \
src/lib/libc/compat/include/extern.h src/lib/libc/compat/include/sched.h
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/compat/include/locale.h
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/compat/include/signal.h
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/compat/include/time.h
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/compat/include/unistd.h
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/compat/locale/compat_setlocale1.c
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/compat/net/__cmsg_alignbytes.c
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/compat/sys/Lint_Ovfork.c \
src/lib/libc/compat/sys/compat___sigaction14_sigtramp.c
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/compat/sys/compat_fhopen.c \
src/lib/libc/compat/sys/compat_fhstatvfs.c \
src/lib/libc/compat/sys/compat_fhstatvfs1.c \
src/lib/libc/compat/sys/compat_getrusage.c
cvs rdiff -u -r1.6 -r1.7 src/lib/libc/compat/sys/compat_getfh.c
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/compat/sys/compat_lfs_segwait.c \
src/lib/libc/compat/sys/compat_mount.c \
src/lib/libc/compat/sys/compat_sched.c \
src/lib/libc/compat/sys/compat_sigtimedwait.c
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/compat/sys/compat_wait4.c
cvs rdiff -u -r1.20 -r1.21 src/lib/libc/db/db/db.c
cvs rdiff -u -r1.11 -r1.12 src/lib/libc/gdtoa/dtoa.c
cvs rdiff -u -r1.10 -r1.11 src/lib/libc/gdtoa/gdtoa.c
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/gen/Lint_flt_rounds.c \
src/lib/libc/gen/pw_private.h src/lib/libc/gen/wordexp.c
cvs rdiff -u -r1.216 -r1.217 src/lib/libc/gen/Makefile.inc
cvs rdiff -u -r1.13 -r1.14 src/lib/libc/gen/_errno.c
cvs rdiff -u -r1.33 -r1.34 src/lib/libc/gen/arc4random.c
cvs rdiff -u -r1.5 -r1.6 src/lib/libc/gen/errno.c
cvs rdiff -u -r0 -r1.1 src/lib/libc/gen/errno_private.h \
src/lib/libc/gen/getdevmajor_private.h
cvs rdiff -u -r1.17 -r1.18 src/lib/libc/gen/execl.c \
src/lib/libc/gen/pthread_atfork.c
cvs rdiff -u -r1.10 -r1.11 

CVS commit: src/lib/libc

2024-01-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan 20 14:52:49 UTC 2024

Modified Files:
src/lib/libc: Makefile.inc
src/lib/libc/citrus: citrus_stdenc.h
src/lib/libc/compat/gen: compat_errlist.c compat_frexp_ieee754.c
compat_modf_ieee754.c compat_siglist.c compat_signame.c
compat_syslog.c compat_timezone.c
src/lib/libc/compat/include: locale.h signal.h time.h unistd.h
src/lib/libc/compat/locale: compat_setlocale1.c
src/lib/libc/compat/net: __cmsg_alignbytes.c
src/lib/libc/compat/sys: Lint_Ovfork.c compat___sigaction14_sigtramp.c
compat_fhopen.c compat_fhstatvfs.c compat_fhstatvfs1.c
compat_getfh.c compat_getrusage.c compat_lfs_segwait.c
compat_mount.c compat_sched.c compat_sigtimedwait.c compat_wait4.c
src/lib/libc/db/db: db.c
src/lib/libc/gdtoa: dtoa.c gdtoa.c
src/lib/libc/gen: Lint_flt_rounds.c Makefile.inc _errno.c arc4random.c
errno.c execl.c execv.c execvp.c getdevmajor.c getlogin.c
getpwent.c humanize_number.c pthread_atfork.c pw_private.h
sysctlgetmibinfo.c vis.c wordexp.c
src/lib/libc/hash/md2: md2.c
src/lib/libc/inet: inet_cidr_pton.c
src/lib/libc/isc: Makefile.inc
src/lib/libc/locale: __mb_cur_max.c generic_lc_all.c newlocale.c
src/lib/libc/misc: initfini.c
src/lib/libc/nameser: ns_name.c
src/lib/libc/net: base64.c getaddrinfo.c getprotobyname.c
getprotobynumber.c getservbyname.c getservbyport.c protoent.h
rcmd.c sctp_sys_calls.c servent.h
src/lib/libc/posix1e: acl_branding.c acl_calc_mask.c acl_copy.c
acl_from_text.c acl_from_text_nfs4.c acl_support.h
acl_support_nfs4.c acl_to_text_nfs4.c
src/lib/libc/regex: Makefile.inc
src/lib/libc/ssp: ssp_redirect.c
src/lib/libc/stdio: Makefile.inc fread.c gettemp.c vfwprintf.c
src/lib/libc/sys: Lint___vfork14.c Lint_clone.c Lint_ptrace.c
makelintstub
src/lib/libc/time: asctime.c difftime.c localtime.c private.h
strftime.c
src/lib/libc/tls: tls.c
Added Files:
src/lib/libc/compat/include: errno.h extern.h sched.h
src/lib/libc/gen: errno_private.h getdevmajor_private.h

Log Message:
Catch up with all the lint warnings since exit on warning was disabled.
Disable 'missing header declaration' and 'nested extern' warnings for now.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/lib/libc/Makefile.inc
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/citrus/citrus_stdenc.h
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/compat/gen/compat_errlist.c \
src/lib/libc/compat/gen/compat_syslog.c
cvs rdiff -u -r1.5 -r1.6 src/lib/libc/compat/gen/compat_frexp_ieee754.c \
src/lib/libc/compat/gen/compat_modf_ieee754.c
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/compat/gen/compat_siglist.c \
src/lib/libc/compat/gen/compat_signame.c
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/compat/gen/compat_timezone.c
cvs rdiff -u -r0 -r1.1 src/lib/libc/compat/include/errno.h \
src/lib/libc/compat/include/extern.h src/lib/libc/compat/include/sched.h
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/compat/include/locale.h
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/compat/include/signal.h
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/compat/include/time.h
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/compat/include/unistd.h
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/compat/locale/compat_setlocale1.c
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/compat/net/__cmsg_alignbytes.c
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/compat/sys/Lint_Ovfork.c \
src/lib/libc/compat/sys/compat___sigaction14_sigtramp.c
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/compat/sys/compat_fhopen.c \
src/lib/libc/compat/sys/compat_fhstatvfs.c \
src/lib/libc/compat/sys/compat_fhstatvfs1.c \
src/lib/libc/compat/sys/compat_getrusage.c
cvs rdiff -u -r1.6 -r1.7 src/lib/libc/compat/sys/compat_getfh.c
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/compat/sys/compat_lfs_segwait.c \
src/lib/libc/compat/sys/compat_mount.c \
src/lib/libc/compat/sys/compat_sched.c \
src/lib/libc/compat/sys/compat_sigtimedwait.c
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/compat/sys/compat_wait4.c
cvs rdiff -u -r1.20 -r1.21 src/lib/libc/db/db/db.c
cvs rdiff -u -r1.11 -r1.12 src/lib/libc/gdtoa/dtoa.c
cvs rdiff -u -r1.10 -r1.11 src/lib/libc/gdtoa/gdtoa.c
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/gen/Lint_flt_rounds.c \
src/lib/libc/gen/pw_private.h src/lib/libc/gen/wordexp.c
cvs rdiff -u -r1.216 -r1.217 src/lib/libc/gen/Makefile.inc
cvs rdiff -u -r1.13 -r1.14 src/lib/libc/gen/_errno.c
cvs rdiff -u -r1.33 -r1.34 src/lib/libc/gen/arc4random.c
cvs rdiff -u -r1.5 -r1.6 src/lib/libc/gen/errno.c
cvs rdiff -u -r0 -r1.1 src/lib/libc/gen/errno_private.h \
src/lib/libc/gen/getdevmajor_private.h
cvs rdiff -u -r1.17 -r1.18 src/lib/libc/gen/execl.c \
src/lib/libc/gen/pthread_atfork.c
cvs rdiff -u -r1.10 -r1.11 

CVS commit: src/sys/dev/stbi

2024-01-20 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Jan 20 13:33:03 UTC 2024

Modified Files:
src/sys/dev/stbi: stb_image.c

Log Message:
Don't put big structures on stack.
Should fix PR 57859.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/stbi/stb_image.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/stbi/stb_image.c
diff -u src/sys/dev/stbi/stb_image.c:1.11 src/sys/dev/stbi/stb_image.c:1.12
--- src/sys/dev/stbi/stb_image.c:1.11	Sat Aug 26 21:03:53 2023
+++ src/sys/dev/stbi/stb_image.c	Sat Jan 20 13:33:03 2024
@@ -430,7 +430,7 @@ extern int  stbi_gif_info_from_file 
 #endif
 #ifdef _KERNEL
 #include 
-__KERNEL_RCSID(0, "$NetBSD: stb_image.c,v 1.11 2023/08/26 21:03:53 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: stb_image.c,v 1.12 2024/01/20 13:33:03 mlelstv Exp $");
 #include 
 #include 
 #include 
@@ -2144,16 +2144,28 @@ int stbi_jpeg_info(char const *filename,
 
 int stbi_jpeg_test_memory(stbi_uc const *buffer, int len)
 {
-   jpeg j;
-   start_mem(, buffer,len);
-   return decode_jpeg_header(, SCAN_type);
+jpeg *j;
+int res;
+
+j = MALLOC(sizeof(*j));
+if (j == NULL) return 0;
+start_mem(>s, buffer,len);
+res = decode_jpeg_header(j, SCAN_type);
+FREE(j);
+return res;
 }
 
 int stbi_jpeg_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp)
 {
-jpeg j;
-start_mem(, buffer, len);
-return stbi_jpeg_info_raw(, x, y, comp);
+jpeg *j;
+int res;
+
+j = MALLOC(sizeof(*j));
+if (j == NULL) return 0;
+start_mem(>s, buffer, len);
+res = stbi_jpeg_info_raw(j, x, y, comp);
+FREE(j);
+return res;
 }
 
 #ifndef STBI_NO_STDIO
@@ -2523,18 +2535,25 @@ static int do_zlib(zbuf *a, char *obuf, 
 
 char *stbi_zlib_decode_malloc_guesssize(const char * buffer, int len, int initial_size, int *outlen)
 {
-   zbuf a;
-   char *p = MALLOC(initial_size);
-   if (p == NULL) return NULL;
-   a.zbuffer = (uint8 const *) buffer;
-   a.zbuffer_end = (uint8 const *) buffer + len;
-   if (do_zlib(, p, initial_size, 1, 1)) {
-  if (outlen) *outlen = (int) (a.zout - a.zout_start);
-  return a.zout_start;
+   zbuf *a;
+   char *p;
+   char *res = NULL;
+
+   a = MALLOC(sizeof(*a));
+   if (a == NULL) return NULL;
+   p = MALLOC(initial_size);
+   if (p == NULL) goto fail;
+   a->zbuffer = (uint8 const *) buffer;
+   a->zbuffer_end = (uint8 const *) buffer + len;
+   if (do_zlib(a, p, initial_size, 1, 1)) {
+  if (outlen) *outlen = (int) (a->zout - a->zout_start);
+  res = a->zout_start;
} else {
-  FREE(a.zout_start);
-  return NULL;
+  FREE(a->zout_start);
}
+fail:
+   FREE(a);
+   return res;
 }
 
 char *stbi_zlib_decode_malloc(char const *buffer, int len, int *outlen)
@@ -2544,56 +2563,81 @@ char *stbi_zlib_decode_malloc(char const
 
 char *stbi_zlib_decode_malloc_guesssize_headerflag(const char *buffer, int len, int initial_size, int *outlen, int parse_header)
 {
-   zbuf a;
-   char *p = MALLOC(initial_size);
-   if (p == NULL) return NULL;
-   a.zbuffer = (uint8 const *) buffer;
-   a.zbuffer_end = (uint8 const *) buffer + len;
-   if (do_zlib(, p, initial_size, 1, parse_header)) {
-  if (outlen) *outlen = (int) (a.zout - a.zout_start);
-  return a.zout_start;
+   zbuf *a;
+   char *p;
+   char *res = NULL;
+
+   a = MALLOC(sizeof(*a));
+   if (a == NULL) return NULL;
+   p = MALLOC(initial_size);
+   if (p == NULL) goto fail;
+   a->zbuffer = (uint8 const *) buffer;
+   a->zbuffer_end = (uint8 const *) buffer + len;
+   if (do_zlib(a, p, initial_size, 1, parse_header)) {
+  if (outlen) *outlen = (int) (a->zout - a->zout_start);
+  res = a->zout_start;
} else {
-  FREE(a.zout_start);
-  return NULL;
+  FREE(a->zout_start);
}
+fail:
+   FREE(a);
+   return res;
 }
 
 int stbi_zlib_decode_buffer(char *obuffer, int olen, char const *ibuffer, int ilen)
 {
-   zbuf a;
-   a.zbuffer = (uint8 const *) ibuffer;
-   a.zbuffer_end = (uint8 const *) ibuffer + ilen;
-   if (do_zlib(, obuffer, olen, 0, 1))
-  return (int) (a.zout - a.zout_start);
+   zbuf *a;
+   int res;
+
+   a = MALLOC(sizeof(*a));
+   if (a == NULL) return -1;
+   a->zbuffer = (uint8 const *) ibuffer;
+   a->zbuffer_end = (uint8 const *) ibuffer + ilen;
+   if (do_zlib(a, obuffer, olen, 0, 1))
+  res = (int) (a->zout - a->zout_start);
else
-  return -1;
+  res = -1;
+   FREE(a);
+   return res;
 }
 
 char *stbi_zlib_decode_noheader_malloc(char const *buffer, int len, int *outlen)
 {
-   zbuf a;
-   char *p = MALLOC(16384);
-   if (p == NULL) return NULL;
-   a.zbuffer = (uint8 const *) buffer;
-   a.zbuffer_end = (uint8 const *) buffer+len;
-   if (do_zlib(, p, 16384, 1, 0)) {
-  if (outlen) *outlen = (int) (a.zout - a.zout_start);
-  return a.zout_start;
-   } else {
-  FREE(a.zout_start);
-  return NULL;
-   }
+   

CVS commit: src/sys/dev/stbi

2024-01-20 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Jan 20 13:33:03 UTC 2024

Modified Files:
src/sys/dev/stbi: stb_image.c

Log Message:
Don't put big structures on stack.
Should fix PR 57859.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/stbi/stb_image.c

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



CVS commit: src/sys/sys

2024-01-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan 20 13:15:46 UTC 2024

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

Log Message:
Make __learn_tree always visible. It starts with __ anyway.


To generate a diff of this commit:
cvs rdiff -u -r1.238 -r1.239 src/sys/sys/sysctl.h

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



CVS commit: src/sys/sys

2024-01-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan 20 13:15:46 UTC 2024

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

Log Message:
Make __learn_tree always visible. It starts with __ anyway.


To generate a diff of this commit:
cvs rdiff -u -r1.238 -r1.239 src/sys/sys/sysctl.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/sysctl.h
diff -u src/sys/sys/sysctl.h:1.238 src/sys/sys/sysctl.h:1.239
--- src/sys/sys/sysctl.h:1.238	Fri Jan 19 13:39:59 2024
+++ src/sys/sys/sysctl.h	Sat Jan 20 08:15:46 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysctl.h,v 1.238 2024/01/19 18:39:59 christos Exp $	*/
+/*	$NetBSD: sysctl.h,v 1.239 2024/01/20 13:15:46 christos Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -1231,9 +1231,7 @@ int	proc_compare(const struct kinfo_proc
 const struct kinfo_proc2 *, const struct kinfo_lwp *);
 void	*asysctl(const int *, size_t, size_t *);
 void	*asysctlbyname(const char *, size_t *);
-#ifdef _LIBC_INTERNAL
 int	__learn_tree(int *, u_int, struct sysctlnode *);
-#endif
 __END_DECLS
 
 #endif	/* !_KERNEL */



CVS commit: src/usr.bin/xlint

2024-01-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Jan 20 12:02:10 UTC 2024

Modified Files:
src/usr.bin/xlint/common: externs.h mem.c
src/usr.bin/xlint/xlint: xlint.c

Log Message:
lint: clean up


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/usr.bin/xlint/common/externs.h
cvs rdiff -u -r1.24 -r1.25 src/usr.bin/xlint/common/mem.c
cvs rdiff -u -r1.121 -r1.122 src/usr.bin/xlint/xlint/xlint.c

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



CVS commit: src/usr.bin/xlint

2024-01-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Jan 20 12:02:10 UTC 2024

Modified Files:
src/usr.bin/xlint/common: externs.h mem.c
src/usr.bin/xlint/xlint: xlint.c

Log Message:
lint: clean up


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/usr.bin/xlint/common/externs.h
cvs rdiff -u -r1.24 -r1.25 src/usr.bin/xlint/common/mem.c
cvs rdiff -u -r1.121 -r1.122 src/usr.bin/xlint/xlint/xlint.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/xlint/common/externs.h
diff -u src/usr.bin/xlint/common/externs.h:1.33 src/usr.bin/xlint/common/externs.h:1.34
--- src/usr.bin/xlint/common/externs.h:1.33	Sat Jan 20 10:25:57 2024
+++ src/usr.bin/xlint/common/externs.h	Sat Jan 20 12:02:09 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: externs.h,v 1.33 2024/01/20 10:25:57 rillig Exp $	*/
+/*	$NetBSD: externs.h,v 1.34 2024/01/20 12:02:09 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -42,8 +42,8 @@ const char *tspec_name(tspec_t);
 /*
  * mem.c
  */
-void *xmalloc(size_t);
 #if IS_LINT1 || IS_LINT2
+void *xmalloc(size_t);
 void *xcalloc(size_t, size_t);
 #endif
 void *xrealloc(void *, size_t);

Index: src/usr.bin/xlint/common/mem.c
diff -u src/usr.bin/xlint/common/mem.c:1.24 src/usr.bin/xlint/common/mem.c:1.25
--- src/usr.bin/xlint/common/mem.c:1.24	Sat Jan 20 10:25:57 2024
+++ src/usr.bin/xlint/common/mem.c	Sat Jan 20 12:02:09 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: mem.c,v 1.24 2024/01/20 10:25:57 rillig Exp $	*/
+/*	$NetBSD: mem.c,v 1.25 2024/01/20 12:02:09 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: mem.c,v 1.24 2024/01/20 10:25:57 rillig Exp $");
+__RCSID("$NetBSD: mem.c,v 1.25 2024/01/20 12:02:09 rillig Exp $");
 #endif
 
 #include 
@@ -51,10 +51,11 @@ not_null(void *ptr)
 {
 
 	if (ptr == NULL)
-		errx(1, "virtual memory exhausted");
+		errx(1, "out of memory");
 	return ptr;
 }
 
+#if IS_LINT1 || IS_LINT2
 void *
 xmalloc(size_t s)
 {
@@ -62,7 +63,6 @@ xmalloc(size_t s)
 	return not_null(malloc(s));
 }
 
-#if IS_LINT1 || IS_LINT2
 void *
 xcalloc(size_t n, size_t s)
 {
@@ -85,7 +85,7 @@ xstrdup(const char *s)
 	return not_null(strdup(s));
 }
 
-#if defined(IS_XLINT)
+#if IS_XLINT
 char *
 xasprintf(const char *fmt, ...)
 {

Index: src/usr.bin/xlint/xlint/xlint.c
diff -u src/usr.bin/xlint/xlint/xlint.c:1.121 src/usr.bin/xlint/xlint/xlint.c:1.122
--- src/usr.bin/xlint/xlint/xlint.c:1.121	Sun Dec 10 14:59:47 2023
+++ src/usr.bin/xlint/xlint/xlint.c	Sat Jan 20 12:02:10 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: xlint.c,v 1.121 2023/12/10 14:59:47 rillig Exp $ */
+/* $NetBSD: xlint.c,v 1.122 2024/01/20 12:02:10 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: xlint.c,v 1.121 2023/12/10 14:59:47 rillig Exp $");
+__RCSID("$NetBSD: xlint.c,v 1.122 2024/01/20 12:02:10 rillig Exp $");
 #endif
 
 #include 
@@ -60,8 +60,6 @@ __RCSID("$NetBSD: xlint.c,v 1.121 2023/1
 #include "pathnames.h"
 #include "findcc.h"
 
-#define DEFAULT_PATH		_PATH_DEFPATH
-
 typedef struct {
 	char	**items;
 	size_t	len;
@@ -73,8 +71,8 @@ static struct {
 	list	flags;		/* flags always passed */
 	list	lcflags;	/* flags, controlled by sflag/tflag */
 	char	*outfile;	/* path name for preprocessed C source */
-	int	outfd;		/* file descriptor for outfile */
-} cpp = { .outfd = -1 };
+	int	output_fd;	/* file descriptor for outfile */
+} cpp;
 
 /* Parameters for lint1, which checks an isolated translation unit. */
 static struct {
@@ -85,9 +83,9 @@ static struct {
 /* Parameters for lint2, which performs cross-translation-unit checks. */
 static struct {
 	list	flags;
-	list	infiles;	/* input files (without libraries) */
-	list	inlibs;		/* input libraries */
-	char	*outlib;	/* output library that will be created */
+	list	input_files;	/* without libraries */
+	list	input_libraries;
+	char	*output_library;
 } lint2;
 
 static const char *tmpdir;
@@ -100,8 +98,8 @@ static char *output_filename;	/* filenam
 static bool seen_filename;
 
 /*
- * name of a file which is currently written by a child and should
- * be removed after abnormal termination of the child
+ * The file that is currently written by a child process and should be removed
+ * in case the child process fails.
  */
 static const char *currfn;
 
@@ -168,10 +166,9 @@ concat2(const char *s1, const char *s2)
 
 	size_t len1 = strlen(s1);
 	size_t len2 = strlen(s2);
-	char *s = xmalloc(len1 + len2 + 1);
+	char *s = xrealloc(NULL, len1 + len2 + 1);
 	memcpy(s, s1, len1);
 	memcpy(s + len1, s2, len2 + 1);
-
 	return s;
 }
 
@@ -191,8 +188,8 @@ __dead static void
 terminate(int signo)
 {
 
-	if (cpp.outfd != -1)
-		(void)close(cpp.outfd);
+	if (cpp.output_fd != -1)
+		(void)close(cpp.output_fd);
 	if (cpp.outfile != NULL) {
 		const char *keep_env = 

CVS commit: src

2024-01-20 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sat Jan 20 11:04:53 UTC 2024

Modified Files:
src/sys/lib/libkern: Makefile.libkern
src/sys/stand/efiboot: Makefile.efiboot
Added Files:
src/common/include/libc: extern.h

Log Message:
Compensate for src/common/lib/libc/atomic/atomic_init_cas.c losing
the extern declaration of __libc_atomic_init() and instead using a
new one added to src/lib/libc/include/extern.h

That file is outside src/common and src/sys so is unavailable to
kernel builds, so instead make a new include file in src/common
which the kernel can read which contains the needed extern decl
for __libc_atomic_init()

This seems to fix the evbarm builds (maybe others) - but it is
all MUCH TOO UGLY to keep.   Someone please make a better fix,
even if that just means reverting rev 1.5 of
src/common/lib/libc/atomic/atomic_init_cas.c
and all of the changes here (the addition to libc/include/extern.h
should be harmless to keep).


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/common/include/libc/extern.h
cvs rdiff -u -r1.54 -r1.55 src/sys/lib/libkern/Makefile.libkern
cvs rdiff -u -r1.29 -r1.30 src/sys/stand/efiboot/Makefile.efiboot

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

Modified files:

Index: src/sys/lib/libkern/Makefile.libkern
diff -u src/sys/lib/libkern/Makefile.libkern:1.54 src/sys/lib/libkern/Makefile.libkern:1.55
--- src/sys/lib/libkern/Makefile.libkern:1.54	Mon Jan  1 20:33:34 2024
+++ src/sys/lib/libkern/Makefile.libkern	Sat Jan 20 11:04:53 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.libkern,v 1.54 2024/01/01 20:33:34 rhialto Exp $
+#	$NetBSD: Makefile.libkern,v 1.55 2024/01/20 11:04:53 kre Exp $
 
 #
 # Variable definitions for libkern.
@@ -35,6 +35,7 @@ CPPFLAGS+=	-I$M ${KERNCPPFLAGS} ${KERNMI
 .include "${.PARSEDIR}/../../../common/lib/libppath/Makefile.inc"
 
 CPPFLAGS+=	-I${KERNDIR}/../../../common/include
+CPPFLAGS+=	-I${KERNDIR}/../../../common/include/libc
 CPPFLAGS+=	-I${KERNDIR}/../../../common/libc/hash/sha3
 
 .PATH.c: ${KERNDIR}

Index: src/sys/stand/efiboot/Makefile.efiboot
diff -u src/sys/stand/efiboot/Makefile.efiboot:1.29 src/sys/stand/efiboot/Makefile.efiboot:1.30
--- src/sys/stand/efiboot/Makefile.efiboot:1.29	Thu Jun 15 03:20:58 2023
+++ src/sys/stand/efiboot/Makefile.efiboot	Sat Jan 20 11:04:53 2024
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.efiboot,v 1.29 2023/06/15 03:20:58 rin Exp $
+# $NetBSD: Makefile.efiboot,v 1.30 2024/01/20 11:04:53 kre Exp $
 
 S=		${.CURDIR}/../../..
 
@@ -127,6 +127,7 @@ KERN_AS= library
 LIBKERN_ARCH?= ${MACHINE_ARCH}
 KERNMISCMAKEFLAGS+="LIBKERN_ARCH=${LIBKERN_ARCH}"
 .include "${S}/lib/libkern/Makefile.inc"
+CPPFLAGS+= -I${S}/../common/include/libc
 LIBKERN= ${KERNLIB}
 
 ### find out what to use for libz

Added files:

Index: src/common/include/libc/extern.h
diff -u /dev/null src/common/include/libc/extern.h:1.1
--- /dev/null	Sat Jan 20 11:04:53 2024
+++ src/common/include/libc/extern.h	Sat Jan 20 11:04:53 2024
@@ -0,0 +1,3 @@
+void  __section(".text.startup") __attribute__((__visibility__("hidden")))  
+__libc_atomic_init(void);
+



CVS commit: src

2024-01-20 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sat Jan 20 11:04:53 UTC 2024

Modified Files:
src/sys/lib/libkern: Makefile.libkern
src/sys/stand/efiboot: Makefile.efiboot
Added Files:
src/common/include/libc: extern.h

Log Message:
Compensate for src/common/lib/libc/atomic/atomic_init_cas.c losing
the extern declaration of __libc_atomic_init() and instead using a
new one added to src/lib/libc/include/extern.h

That file is outside src/common and src/sys so is unavailable to
kernel builds, so instead make a new include file in src/common
which the kernel can read which contains the needed extern decl
for __libc_atomic_init()

This seems to fix the evbarm builds (maybe others) - but it is
all MUCH TOO UGLY to keep.   Someone please make a better fix,
even if that just means reverting rev 1.5 of
src/common/lib/libc/atomic/atomic_init_cas.c
and all of the changes here (the addition to libc/include/extern.h
should be harmless to keep).


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/common/include/libc/extern.h
cvs rdiff -u -r1.54 -r1.55 src/sys/lib/libkern/Makefile.libkern
cvs rdiff -u -r1.29 -r1.30 src/sys/stand/efiboot/Makefile.efiboot

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



CVS commit: src/usr.bin/xlint/common

2024-01-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Jan 20 10:25:57 UTC 2024

Modified Files:
src/usr.bin/xlint/common: externs.h inittyp.c lint.h mem.c tyname.c

Log Message:
lint: unclutter conditional compilation


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/usr.bin/xlint/common/externs.h
cvs rdiff -u -r1.41 -r1.42 src/usr.bin/xlint/common/inittyp.c
cvs rdiff -u -r1.46 -r1.47 src/usr.bin/xlint/common/lint.h
cvs rdiff -u -r1.23 -r1.24 src/usr.bin/xlint/common/mem.c
cvs rdiff -u -r1.57 -r1.58 src/usr.bin/xlint/common/tyname.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/xlint/common/externs.h
diff -u src/usr.bin/xlint/common/externs.h:1.32 src/usr.bin/xlint/common/externs.h:1.33
--- src/usr.bin/xlint/common/externs.h:1.32	Sat Jan 20 10:21:35 2024
+++ src/usr.bin/xlint/common/externs.h	Sat Jan 20 10:25:57 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: externs.h,v 1.32 2024/01/20 10:21:35 rillig Exp $	*/
+/*	$NetBSD: externs.h,v 1.33 2024/01/20 10:25:57 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -34,7 +34,7 @@
 /*
  * tyname.c
  */
-#if defined(IS_LINT1) || defined(IS_LINT2)
+#if IS_LINT1 || IS_LINT2
 const char *type_name(const type_t *);
 const char *tspec_name(tspec_t);
 #endif
@@ -43,7 +43,7 @@ const char *tspec_name(tspec_t);
  * mem.c
  */
 void *xmalloc(size_t);
-#if defined(IS_LINT1) || defined(IS_LINT2)
+#if IS_LINT1 || IS_LINT2
 void *xcalloc(size_t, size_t);
 #endif
 void *xrealloc(void *, size_t);
@@ -53,7 +53,7 @@ char *xasprintf(const char *, ...) __pri
 /*
  * emit.c
  */
-#if defined(IS_LINT1) || defined(IS_LINT2)
+#if IS_LINT1 || IS_LINT2
 void outopen(const char *);
 void outclose(void);
 void outchar(char);

Index: src/usr.bin/xlint/common/inittyp.c
diff -u src/usr.bin/xlint/common/inittyp.c:1.41 src/usr.bin/xlint/common/inittyp.c:1.42
--- src/usr.bin/xlint/common/inittyp.c:1.41	Sun Dec  3 18:17:41 2023
+++ src/usr.bin/xlint/common/inittyp.c	Sat Jan 20 10:25:57 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: inittyp.c,v 1.41 2023/12/03 18:17:41 rillig Exp $	*/
+/*	$NetBSD: inittyp.c,v 1.42 2024/01/20 10:25:57 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,10 +37,10 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: inittyp.c,v 1.41 2023/12/03 18:17:41 rillig Exp $");
+__RCSID("$NetBSD: inittyp.c,v 1.42 2024/01/20 10:25:57 rillig Exp $");
 #endif
 
-#if defined(IS_LINT1)
+#if IS_LINT1
 #include "lint1.h"
 #else
 #include "lint2.h"
@@ -48,7 +48,7 @@ __RCSID("$NetBSD: inittyp.c,v 1.41 2023/
 
 #define INT_RANK	(/*CONSTCOND*/INTPTR_TSPEC == LONG ? 4 : 5)
 
-#ifdef IS_LINT1
+#if IS_LINT1
 #define typeinfo(name, signed_type, unsigned_type, size_in_bits, rv, c) \
 	{ /*CONSTCOND*/ \
 		size_in_bits, \

Index: src/usr.bin/xlint/common/lint.h
diff -u src/usr.bin/xlint/common/lint.h:1.46 src/usr.bin/xlint/common/lint.h:1.47
--- src/usr.bin/xlint/common/lint.h:1.46	Sun Dec  3 18:17:41 2023
+++ src/usr.bin/xlint/common/lint.h	Sat Jan 20 10:25:57 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: lint.h,v 1.46 2023/12/03 18:17:41 rillig Exp $	*/
+/*	$NetBSD: lint.h,v 1.47 2024/01/20 10:25:57 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -47,7 +47,7 @@
 
 #include "param.h"
 
-#if defined(IS_LINT1) || defined(IS_LINT2)
+#if IS_LINT1 || IS_LINT2
 /*
  * Type specifiers, used in type structures (type_t) and elsewhere.
  */
@@ -93,7 +93,7 @@ typedef enum {
  * size of types, name and classification
  */
 typedef struct {
-#ifdef IS_LINT1
+#if IS_LINT1
 	unsigned int tt_size_in_bits;
 	enum rank_kind {
 		RK_NONE,
@@ -107,7 +107,7 @@ typedef struct {
 	tspec_t	tt_signed_counterpart;
 	tspec_t	tt_unsigned_counterpart;
 	bool	tt_is_integer:1;	/* integer type */
-#ifdef IS_LINT1
+#if IS_LINT1
 	bool	tt_is_uinteger:1;	/* unsigned integer type */
 	bool	tt_is_floating:1;	/* floating point type */
 	bool	tt_is_arithmetic:1;	/* arithmetic type */
@@ -145,7 +145,7 @@ typedef enum {
 	DEF			/* defined */
 } def_t;
 
-#if defined(IS_LINT1)
+#if IS_LINT1
 typedef struct lint1_type type_t;
 #else
 typedef struct lint2_type type_t;

Index: src/usr.bin/xlint/common/mem.c
diff -u src/usr.bin/xlint/common/mem.c:1.23 src/usr.bin/xlint/common/mem.c:1.24
--- src/usr.bin/xlint/common/mem.c:1.23	Sat Jan 20 10:21:35 2024
+++ src/usr.bin/xlint/common/mem.c	Sat Jan 20 10:25:57 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: mem.c,v 1.23 2024/01/20 10:21:35 rillig Exp $	*/
+/*	$NetBSD: mem.c,v 1.24 2024/01/20 10:25:57 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: mem.c,v 1.23 2024/01/20 10:21:35 rillig Exp $");
+__RCSID("$NetBSD: mem.c,v 1.24 2024/01/20 10:25:57 rillig Exp $");
 #endif
 
 #include 
@@ -62,7 +62,7 @@ xmalloc(size_t s)
 	return not_null(malloc(s));
 }
 
-#if defined(IS_LINT1) || defined(IS_LINT2)
+#if IS_LINT1 || IS_LINT2
 void *
 xcalloc(size_t n, size_t s)
 {

Index: 

CVS commit: src/usr.bin/xlint/common

2024-01-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Jan 20 10:25:57 UTC 2024

Modified Files:
src/usr.bin/xlint/common: externs.h inittyp.c lint.h mem.c tyname.c

Log Message:
lint: unclutter conditional compilation


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/usr.bin/xlint/common/externs.h
cvs rdiff -u -r1.41 -r1.42 src/usr.bin/xlint/common/inittyp.c
cvs rdiff -u -r1.46 -r1.47 src/usr.bin/xlint/common/lint.h
cvs rdiff -u -r1.23 -r1.24 src/usr.bin/xlint/common/mem.c
cvs rdiff -u -r1.57 -r1.58 src/usr.bin/xlint/common/tyname.c

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



CVS commit: src/usr.bin/xlint/common

2024-01-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Jan 20 10:21:35 UTC 2024

Modified Files:
src/usr.bin/xlint/common: externs.h mem.c

Log Message:
lint: only define xcalloc if actually used


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/usr.bin/xlint/common/externs.h
cvs rdiff -u -r1.22 -r1.23 src/usr.bin/xlint/common/mem.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/xlint/common/externs.h
diff -u src/usr.bin/xlint/common/externs.h:1.31 src/usr.bin/xlint/common/externs.h:1.32
--- src/usr.bin/xlint/common/externs.h:1.31	Sun Dec  3 18:17:41 2023
+++ src/usr.bin/xlint/common/externs.h	Sat Jan 20 10:21:35 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: externs.h,v 1.31 2023/12/03 18:17:41 rillig Exp $	*/
+/*	$NetBSD: externs.h,v 1.32 2024/01/20 10:21:35 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -43,7 +43,9 @@ const char *tspec_name(tspec_t);
  * mem.c
  */
 void *xmalloc(size_t);
+#if defined(IS_LINT1) || defined(IS_LINT2)
 void *xcalloc(size_t, size_t);
+#endif
 void *xrealloc(void *, size_t);
 char *xstrdup(const char *);
 char *xasprintf(const char *, ...) __printflike(1, 2);

Index: src/usr.bin/xlint/common/mem.c
diff -u src/usr.bin/xlint/common/mem.c:1.22 src/usr.bin/xlint/common/mem.c:1.23
--- src/usr.bin/xlint/common/mem.c:1.22	Thu Jul 13 08:40:38 2023
+++ src/usr.bin/xlint/common/mem.c	Sat Jan 20 10:21:35 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: mem.c,v 1.22 2023/07/13 08:40:38 rillig Exp $	*/
+/*	$NetBSD: mem.c,v 1.23 2024/01/20 10:21:35 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: mem.c,v 1.22 2023/07/13 08:40:38 rillig Exp $");
+__RCSID("$NetBSD: mem.c,v 1.23 2024/01/20 10:21:35 rillig Exp $");
 #endif
 
 #include 
@@ -62,12 +62,14 @@ xmalloc(size_t s)
 	return not_null(malloc(s));
 }
 
+#if defined(IS_LINT1) || defined(IS_LINT2)
 void *
 xcalloc(size_t n, size_t s)
 {
 
 	return not_null(calloc(n, s));
 }
+#endif
 
 void *
 xrealloc(void *p, size_t s)



CVS commit: src/usr.bin/xlint/common

2024-01-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Jan 20 10:21:35 UTC 2024

Modified Files:
src/usr.bin/xlint/common: externs.h mem.c

Log Message:
lint: only define xcalloc if actually used


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/usr.bin/xlint/common/externs.h
cvs rdiff -u -r1.22 -r1.23 src/usr.bin/xlint/common/mem.c

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



CVS commit: src

2024-01-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Jan 20 10:02:31 UTC 2024

Modified Files:
src/tests/usr.bin/xlint/lint1: queries.c t_usage.sh
src/usr.bin/xlint/lint1: decl.c err.c

Log Message:
lint: add query for const automatic variables


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/tests/usr.bin/xlint/lint1/queries.c
cvs rdiff -u -r1.13 -r1.14 src/tests/usr.bin/xlint/lint1/t_usage.sh
cvs rdiff -u -r1.386 -r1.387 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.222 -r1.223 src/usr.bin/xlint/lint1/err.c

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

Modified files:

Index: src/tests/usr.bin/xlint/lint1/queries.c
diff -u src/tests/usr.bin/xlint/lint1/queries.c:1.21 src/tests/usr.bin/xlint/lint1/queries.c:1.22
--- src/tests/usr.bin/xlint/lint1/queries.c:1.21	Sun Jan  7 18:42:37 2024
+++ src/tests/usr.bin/xlint/lint1/queries.c	Sat Jan 20 10:02:31 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: queries.c,v 1.21 2024/01/07 18:42:37 rillig Exp $	*/
+/*	$NetBSD: queries.c,v 1.22 2024/01/20 10:02:31 rillig Exp $	*/
 # 3 "queries.c"
 
 /*
@@ -15,7 +15,7 @@
  *	such as casts between arithmetic types.
  */
 
-/* lint1-extra-flags: -q 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17 -X 351 */
+/* lint1-extra-flags: -q 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18 -X 351 */
 
 typedef unsigned char u8_t;
 typedef unsigned short u16_t;
@@ -452,9 +452,10 @@ Q15(void)
  * non-'static' declaration, it may look confusing.
  */
 static void Q16(void);
-/* expect+2: 'Q16' was declared 'static', now non-'static' [Q16] */
-/* expect+1: warning: static function 'Q16' unused [236] */
-void Q16(void)
+/* expect+3: 'Q16' was declared 'static', now non-'static' [Q16] */
+/* expect+2: warning: static function 'Q16' unused [236] */
+void
+Q16(void)
 {
 }
 
@@ -464,6 +465,24 @@ char Q17_char[] = { ' ', '\0', '	' };
 char Q17_string[] = " \0	";
 
 /*
+ * Variables with automatic storage duration often have so small scope that
+ * adding the 'const' qualifier hurts readability more than it helps.
+ */
+int
+/* expect+1: const automatic variable 'const_arg' [Q18] */
+Q18(const int const_arg, int arg)
+{
+	/* expect+1: const automatic variable 'Q18_scalar' [Q18] */
+	const char Q18_scalar = '1';
+	const char Q18_array[] = { '1', '2', '3' };
+	const char Q18_string[] = "123";
+	const char *Q18_string_pointer = "123";
+
+	return const_arg + arg
+	+ Q18_scalar + Q18_array[0] + Q18_string[0] + Q18_string_pointer[0];
+}
+
+/*
  * Since queries do not affect the exit status, force a warning to make this
  * test conform to the general expectation that a test that produces output
  * exits non-successfully.

Index: src/tests/usr.bin/xlint/lint1/t_usage.sh
diff -u src/tests/usr.bin/xlint/lint1/t_usage.sh:1.13 src/tests/usr.bin/xlint/lint1/t_usage.sh:1.14
--- src/tests/usr.bin/xlint/lint1/t_usage.sh:1.13	Sun Jan  7 18:42:37 2024
+++ src/tests/usr.bin/xlint/lint1/t_usage.sh	Sat Jan 20 10:02:31 2024
@@ -1,4 +1,4 @@
-# $NetBSD: t_usage.sh,v 1.13 2024/01/07 18:42:37 rillig Exp $
+# $NetBSD: t_usage.sh,v 1.14 2024/01/20 10:02:31 rillig Exp $
 #
 # Copyright (c) 2023 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -89,13 +89,13 @@ enable_queries_body()
 
 	# The largest known query.
 	atf_check \
-	"$lint1" -q 17 code.c /dev/null
+	"$lint1" -q 18 code.c /dev/null
 
 	# Larger than the largest known query.
 	atf_check \
 	-s 'exit:1' \
-	-e "inline:lint1: invalid query ID '18'\n" \
-	"$lint1" -q 18 code.c /dev/null
+	-e "inline:lint1: invalid query ID '19'\n" \
+	"$lint1" -q 19 code.c /dev/null
 
 	# Whitespace is not allowed before a query ID.
 	atf_check \

Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.386 src/usr.bin/xlint/lint1/decl.c:1.387
--- src/usr.bin/xlint/lint1/decl.c:1.386	Sat Jan  6 15:05:24 2024
+++ src/usr.bin/xlint/lint1/decl.c	Sat Jan 20 10:02:31 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.386 2024/01/06 15:05:24 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.387 2024/01/20 10:02:31 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: decl.c,v 1.386 2024/01/06 15:05:24 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.387 2024/01/20 10:02:31 rillig Exp $");
 #endif
 
 #include 
@@ -2351,6 +2351,12 @@ declare_parameter(sym_t *sym, bool has_i
 		/* parameter '%s' declared inline */
 		warning(269, sym->s_name);
 
+	if (any_query_enabled && sym->s_type->t_const
+	&& (sym->s_scl == AUTO || sym->s_scl == REG)) {
+		/* const automatic variable '%s' */
+		query_message(18, sym->s_name);
+	}
+
 	/*
 	 * Arguments must have complete types. length_in_bits prints the needed
 	 * error messages (null dimension is impossible because arrays are
@@ -2694,6 +2700,12 @@ declare_local(sym_t *dsym, bool has_init
 		}
 	}
 
+	if (any_query_enabled && dsym->s_type->t_const
+	&& 

CVS commit: src

2024-01-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Jan 20 10:02:31 UTC 2024

Modified Files:
src/tests/usr.bin/xlint/lint1: queries.c t_usage.sh
src/usr.bin/xlint/lint1: decl.c err.c

Log Message:
lint: add query for const automatic variables


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/tests/usr.bin/xlint/lint1/queries.c
cvs rdiff -u -r1.13 -r1.14 src/tests/usr.bin/xlint/lint1/t_usage.sh
cvs rdiff -u -r1.386 -r1.387 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.222 -r1.223 src/usr.bin/xlint/lint1/err.c

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



CVS commit: src/sys/arch/powerpc/include/oea

2024-01-20 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jan 20 09:47:35 UTC 2024

Modified Files:
src/sys/arch/powerpc/include/oea: hid.h

Log Message:
fix comments: HID0 ICFI/DCFI are "flash invalidate", not "flush invalidate"


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/powerpc/include/oea/hid.h

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

Modified files:

Index: src/sys/arch/powerpc/include/oea/hid.h
diff -u src/sys/arch/powerpc/include/oea/hid.h:1.13 src/sys/arch/powerpc/include/oea/hid.h:1.14
--- src/sys/arch/powerpc/include/oea/hid.h:1.13	Mon Jul  6 10:31:23 2020
+++ src/sys/arch/powerpc/include/oea/hid.h	Sat Jan 20 09:47:35 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: hid.h,v 1.13 2020/07/06 10:31:23 rin Exp $	*/
+/*	$NetBSD: hid.h,v 1.14 2024/01/20 09:47:35 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2000 Tsubai Masanari.  All rights reserved.
@@ -81,8 +81,8 @@
 #define HID0_DCE	0x4000  /* Enable d-cache */
 #define HID0_ILOCK	0x2000  /* i-cache lock */
 #define HID0_DLOCK	0x1000  /* d-cache lock */
-#define HID0_ICFI	0x0800  /* i-cache flush invalidate */
-#define HID0_DCFI	0x0400  /* d-cache flush invalidate */
+#define HID0_ICFI	0x0800  /* i-cache flash invalidate */
+#define HID0_DCFI	0x0400  /* d-cache flash invalidate */
 #define HID0_SPD	0x0200  /* Disable speculative cache access */
 #define HID0_IFEM	0x0100  /* Enable M-bit for I-fetch */
 #define HID0_XBSEN	0x0100  /* Extended BAT block size enable (7455+) */



CVS commit: src/sys/arch/powerpc/include/oea

2024-01-20 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jan 20 09:47:35 UTC 2024

Modified Files:
src/sys/arch/powerpc/include/oea: hid.h

Log Message:
fix comments: HID0 ICFI/DCFI are "flash invalidate", not "flush invalidate"


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/powerpc/include/oea/hid.h

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



CVS commit: src/sys/compat/sys

2024-01-20 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sat Jan 20 08:40:37 UTC 2024

Modified Files:
src/sys/compat/sys: resource.h

Log Message:
Now that rusage_to_rusage50() has switched from being an external
function, to a static inline, we need  for it to work.
Not all callers provide that (and nor should they need to), so include
it here.

Should unbreak the builds.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/compat/sys/resource.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/compat/sys/resource.h
diff -u src/sys/compat/sys/resource.h:1.6 src/sys/compat/sys/resource.h:1.7
--- src/sys/compat/sys/resource.h:1.6	Fri Jan 19 18:39:15 2024
+++ src/sys/compat/sys/resource.h	Sat Jan 20 08:40:37 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: resource.h,v 1.6 2024/01/19 18:39:15 christos Exp $	*/
+/*	$NetBSD: resource.h,v 1.7 2024/01/20 08:40:37 kre Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -35,6 +35,7 @@
 #define	_COMPAT_SYS_RESOURCE_H_
 
 #include 
+#include 
 #include 
 #include 
 



CVS commit: src/sys/compat/sys

2024-01-20 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sat Jan 20 08:40:37 UTC 2024

Modified Files:
src/sys/compat/sys: resource.h

Log Message:
Now that rusage_to_rusage50() has switched from being an external
function, to a static inline, we need  for it to work.
Not all callers provide that (and nor should they need to), so include
it here.

Should unbreak the builds.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/compat/sys/resource.h

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



CVS commit: src

2024-01-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jan 20 08:09:13 UTC 2024

Modified Files:
src/external/broadcom/bwfm: Makefile
src/share/mk: bsd.own.mk
Added Files:
src/distrib/sets/lists/base: md.riscv

Log Message:
risc-v: Add bwfm(4) firmware files to release image

Create the correct link for beagle,beaglev-starlight-jh7100-r0.txt NVRAM
config file.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/distrib/sets/lists/base/md.riscv
cvs rdiff -u -r1.9 -r1.10 src/external/broadcom/bwfm/Makefile
cvs rdiff -u -r1.1362 -r1.1363 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.



CVS commit: src

2024-01-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jan 20 08:09:13 UTC 2024

Modified Files:
src/external/broadcom/bwfm: Makefile
src/share/mk: bsd.own.mk
Added Files:
src/distrib/sets/lists/base: md.riscv

Log Message:
risc-v: Add bwfm(4) firmware files to release image

Create the correct link for beagle,beaglev-starlight-jh7100-r0.txt NVRAM
config file.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/distrib/sets/lists/base/md.riscv
cvs rdiff -u -r1.9 -r1.10 src/external/broadcom/bwfm/Makefile
cvs rdiff -u -r1.1362 -r1.1363 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/broadcom/bwfm/Makefile
diff -u src/external/broadcom/bwfm/Makefile:1.9 src/external/broadcom/bwfm/Makefile:1.10
--- src/external/broadcom/bwfm/Makefile:1.9	Tue Feb  9 11:57:20 2021
+++ src/external/broadcom/bwfm/Makefile	Sat Jan 20 08:09:13 2024
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.9 2021/02/09 11:57:20 yamt Exp $
+# $NetBSD: Makefile,v 1.10 2024/01/20 08:09:13 skrll Exp $
 
 NOMAN=	# define
 
@@ -6,7 +6,8 @@ NOMAN=	# define
 
 # Only install the SDIO firmware binaries on platforms where it will
 # be useful.
-.if ${MACHINE} == "evbarm"
+.if (${MACHINE} == "evbarm" || \
+ ${MACHINE} == "riscv")
 BWFM_WANT_SDIO_FIRMWARE=	yes
 .endif
 
@@ -83,5 +84,13 @@ LINKS+=	${FILESDIR}/brcmfmac43455-sdio.r
 ${FILESDIR}/brcmfmac43455-sdio.raspberrypi,3-model-a-plus.txt
 .endif
 
+# Platform-specific configuration files
+.if ${MACHINE} == "riscv"
+# Boards that share the common AP6212 nvram config are listed here.
+FILES+=	dist/brcmfmac43430-sdio.AP6212.txt
+LINKS+=	${FILESDIR}/brcmfmac43430-sdio.AP6212.txt \
+	${FILESDIR}/brcmfmac43430-sdio.beagle,beaglev-starlight-jh7100-r0.txt
+.endif
+
 .include 
 .include 

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.1362 src/share/mk/bsd.own.mk:1.1363
--- src/share/mk/bsd.own.mk:1.1362	Wed Jan  3 02:59:00 2024
+++ src/share/mk/bsd.own.mk	Sat Jan 20 08:09:13 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.1362 2024/01/03 02:59:00 thorpej Exp $
+#	$NetBSD: bsd.own.mk,v 1.1363 2024/01/20 08:09:13 skrll Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -1289,6 +1289,7 @@ MKFIRMWARE.hppa=		yes
 MKFIRMWARE.i386=		yes
 MKFIRMWARE.mac68k=		yes
 MKFIRMWARE.macppc=		yes
+MKFIRMWARE.riscv=		yes
 MKFIRMWARE.sandpoint=		yes
 MKFIRMWARE.sparc64=		yes
 

Added files:

Index: src/distrib/sets/lists/base/md.riscv
diff -u /dev/null src/distrib/sets/lists/base/md.riscv:1.1
--- /dev/null	Sat Jan 20 08:09:13 2024
+++ src/distrib/sets/lists/base/md.riscv	Sat Jan 20 08:09:13 2024
@@ -0,0 +1,22 @@
+# $NetBSD: md.riscv,v 1.1 2024/01/20 08:09:13 skrll Exp $
+./libdata/firmware/if_bwfm/brcmfmac43143-sdio.bin		base-firmware-root	firmware
+./libdata/firmware/if_bwfm/brcmfmac43241b0-sdio.bin		base-firmware-root	firmware
+./libdata/firmware/if_bwfm/brcmfmac43241b4-sdio.bin		base-firmware-root	firmware
+./libdata/firmware/if_bwfm/brcmfmac43241b5-sdio.bin		base-firmware-root	firmware
+./libdata/firmware/if_bwfm/brcmfmac4329-sdio.bin		base-firmware-root	firmware
+./libdata/firmware/if_bwfm/brcmfmac4330-sdio.bin		base-firmware-root	firmware
+./libdata/firmware/if_bwfm/brcmfmac4334-sdio.bin		base-firmware-root	firmware
+./libdata/firmware/if_bwfm/brcmfmac43340-sdio.bin		base-firmware-root	firmware
+./libdata/firmware/if_bwfm/brcmfmac4335-sdio.bin		base-firmware-root	firmware
+./libdata/firmware/if_bwfm/brcmfmac43362-sdio.bin		base-firmware-root	firmware
+./libdata/firmware/if_bwfm/brcmfmac4339-sdio.bin		base-firmware-root	firmware
+./libdata/firmware/if_bwfm/brcmfmac43430-sdio.bin		base-firmware-root	firmware
+./libdata/firmware/if_bwfm/brcmfmac43430a0-sdio.bin		base-firmware-root	firmware
+./libdata/firmware/if_bwfm/brcmfmac43455-sdio.bin		base-firmware-root	firmware
+./libdata/firmware/if_bwfm/brcmfmac43456-sdio.bin		base-firmware-root	firmware
+./libdata/firmware/if_bwfm/brcmfmac43456-sdio.clm_blob		base-firmware-root	firmware
+./libdata/firmware/if_bwfm/brcmfmac4354-sdio.bin		base-firmware-root	firmware
+./libdata/firmware/if_bwfm/brcmfmac4356-sdio.bin		base-firmware-root	firmware
+./libdata/firmware/if_bwfm/brcmfmac4373-sdio.bin		base-firmware-root	firmware
+./libdata/firmware/if_bwfm/brcmfmac43430-sdio.AP6212.txt	base-firmware-root	firmware
+./libdata/firmware/if_bwfm/brcmfmac43430-sdio.beagle,beaglev-starlight-jh7100-r0.txt	base-firmware-root	firmware



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

2024-01-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jan 20 08:05:37 UTC 2024

Modified Files:
src/sys/arch/riscv/conf: GENERIC64

Log Message:
Add bwfm* at sdmmc? for the Broadcom BCM43xxx WiFi Interface


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/riscv/conf/GENERIC64

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/conf/GENERIC64
diff -u src/sys/arch/riscv/conf/GENERIC64:1.5 src/sys/arch/riscv/conf/GENERIC64:1.6
--- src/sys/arch/riscv/conf/GENERIC64:1.5	Sat Jan 20 08:04:35 2024
+++ src/sys/arch/riscv/conf/GENERIC64	Sat Jan 20 08:05:37 2024
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC64,v 1.5 2024/01/20 08:04:35 skrll Exp $
+# $NetBSD: GENERIC64,v 1.6 2024/01/20 08:05:37 skrll Exp $
 #
 # GENERIC machine description file
 #
@@ -55,6 +55,7 @@ jh7100clkc* 	at fdt?	pass 2		# StarFive 
 # SDMMC
 dwcmmc* 	at fdt?			# DesignWare SD/MMC
 sdmmc*		at sdmmcbus?
+bwfm*		at sdmmc?		# Broadcom BCM43xxx WiFi Interface
 
 # USB
 jh71x0usb* 	at fdt?			# StarFive JH71x0 usb



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

2024-01-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jan 20 08:05:37 UTC 2024

Modified Files:
src/sys/arch/riscv/conf: GENERIC64

Log Message:
Add bwfm* at sdmmc? for the Broadcom BCM43xxx WiFi Interface


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/riscv/conf/GENERIC64

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



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

2024-01-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jan 20 08:04:35 UTC 2024

Modified Files:
src/sys/arch/riscv/conf: GENERIC64

Log Message:
Add DesignWare SD/MMC attachment.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/riscv/conf/GENERIC64

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/conf/GENERIC64
diff -u src/sys/arch/riscv/conf/GENERIC64:1.4 src/sys/arch/riscv/conf/GENERIC64:1.5
--- src/sys/arch/riscv/conf/GENERIC64:1.4	Thu Jan 18 07:48:56 2024
+++ src/sys/arch/riscv/conf/GENERIC64	Sat Jan 20 08:04:35 2024
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC64,v 1.4 2024/01/18 07:48:56 skrll Exp $
+# $NetBSD: GENERIC64,v 1.5 2024/01/20 08:04:35 skrll Exp $
 #
 # GENERIC machine description file
 #
@@ -52,6 +52,10 @@ ccache* 	at fdt?			# SiFive FU[57]40 L2 
 # Clock controller
 jh7100clkc* 	at fdt?	pass 2		# StarFive JH7100 clock controller
 
+# SDMMC
+dwcmmc* 	at fdt?			# DesignWare SD/MMC
+sdmmc*		at sdmmcbus?
+
 # USB
 jh71x0usb* 	at fdt?			# StarFive JH71x0 usb
 



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

2024-01-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jan 20 08:04:35 UTC 2024

Modified Files:
src/sys/arch/riscv/conf: GENERIC64

Log Message:
Add DesignWare SD/MMC attachment.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/riscv/conf/GENERIC64

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