CVS commit: src/lib/libc/stdio

2024-05-03 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat May  4 05:50:49 UTC 2024

Modified Files:
src/lib/libc/stdio: mktemp.3

Log Message:
mktemp.3: mkdtemp is no longer nonstandard

Reported by Aleksey Cheusov on tech-userlevel.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/lib/libc/stdio/mktemp.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/stdio

2024-05-03 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat May  4 05:50:49 UTC 2024

Modified Files:
src/lib/libc/stdio: mktemp.3

Log Message:
mktemp.3: mkdtemp is no longer nonstandard

Reported by Aleksey Cheusov on tech-userlevel.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/lib/libc/stdio/mktemp.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/stdio/mktemp.3
diff -u src/lib/libc/stdio/mktemp.3:1.32 src/lib/libc/stdio/mktemp.3:1.33
--- src/lib/libc/stdio/mktemp.3:1.32	Thu Oct 28 09:51:39 2021
+++ src/lib/libc/stdio/mktemp.3	Sat May  4 05:50:49 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mktemp.3,v 1.32 2021/10/28 09:51:39 kim Exp $
+.\"	$NetBSD: mktemp.3,v 1.33 2024/05/04 05:50:49 rillig Exp $
 .\"
 .\" Copyright (c) 1989, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" @(#)mktemp.3	8.1 (Berkeley) 6/4/93
 .\"
-.Dd July 25, 2021
+.Dd May 4, 2024
 .Dt MKTEMP 3
 .Os
 .Sh NAME
@@ -304,13 +304,12 @@ It was however removed from the specific
 revision.
 The
 .Fn mkstemp
-and
+function conforms to
+.St -p1003.1-2004 .
+The
 .Fn mkdtemp
-functions conform to
-.St -p1003.1-2004
-and
-.St -p1003.1-2008 ,
-respectively.
+function conforms to
+.St -p1003.1-2008 .
 .Sh HISTORY
 A
 .Fn mktemp
@@ -372,10 +371,6 @@ For this reason,
 .Xr ld 1
 will output a warning message whenever it links code that uses
 .Fn mktemp .
-.Pp
-The
-.Fn mkdtemp
-function is nonstandard and should not be used if portability is required.
 .Sh SECURITY CONSIDERATIONS
 The use of
 .Fn mktemp



CVS commit: src/sys/fs/msdosfs

2024-05-03 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat May  4 05:49:39 UTC 2024

Modified Files:
src/sys/fs/msdosfs: msdosfs_rename.c

Log Message:
>From genfs_rename.c:

 * XXX Want a better equality test.  `tcnp->cn_cred == cred'
 * hoses p2k because puffs transmits the creds separately and
 * allocates distinct but equivalent structures for them.

Fixes rename crash in rump_msdos.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/fs/msdosfs/msdosfs_rename.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/fs/msdosfs/msdosfs_rename.c
diff -u src/sys/fs/msdosfs/msdosfs_rename.c:1.3 src/sys/fs/msdosfs/msdosfs_rename.c:1.4
--- src/sys/fs/msdosfs/msdosfs_rename.c:1.3	Sat Oct 23 16:58:17 2021
+++ src/sys/fs/msdosfs/msdosfs_rename.c	Sat May  4 05:49:39 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: msdosfs_rename.c,v 1.3 2021/10/23 16:58:17 thorpej Exp $	*/
+/*	$NetBSD: msdosfs_rename.c,v 1.4 2024/05/04 05:49:39 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: msdosfs_rename.c,v 1.3 2021/10/23 16:58:17 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: msdosfs_rename.c,v 1.4 2024/05/04 05:49:39 mlelstv Exp $");
 
 #include 
 #include 
@@ -127,7 +127,7 @@ msdosfs_rename(void *v)
 	KASSERT(tdvp->v_type == VDIR);
 
 	cred = fcnp->cn_cred;
-	KASSERT(tcnp->cn_cred == cred);
+	KASSERT(kauth_cred_uidmatch(cred, tcnp->cn_cred));
 
 	/*
 	 * Sanitize our world from the VFS insanity.  Unlock the target



CVS commit: src/sys/fs/msdosfs

2024-05-03 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat May  4 05:49:39 UTC 2024

Modified Files:
src/sys/fs/msdosfs: msdosfs_rename.c

Log Message:
>From genfs_rename.c:

 * XXX Want a better equality test.  `tcnp->cn_cred == cred'
 * hoses p2k because puffs transmits the creds separately and
 * allocates distinct but equivalent structures for them.

Fixes rename crash in rump_msdos.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/fs/msdosfs/msdosfs_rename.c

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



CVS commit: src

2024-05-03 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Sat May  4 02:21:49 UTC 2024

Modified Files:
src/distrib/sets/lists/dtb: ad.earmv7 ad.earmv7hf ad.earmv7hfeb
src/sys/external/gpl2/dts/dist/arch/arm/boot/dts: Makefile
Added Files:
src/sys/arch/arm/dts: zynq-red-pitaya-122-16.dts

Log Message:
Add a device tree for the Red Pitaya SDRlab 122-16.

To boot NetBSD on the 122-16, copy the .dtb built from
zynq-red-pitays-122-16.dts, the first-stage bootloader (called
boot.bin) and U-Boot that came with the 122-16 and a kernel image,
netbsd.ub, built for earmv7hf to an MS-DOS partition on an
MBR-partitioned SD card.  At the U-Boot prompt, "Zynq> ", type these
commands:

i2c dev 0
eeprom read 0 0x50 0 0x1804 0x400
env import -b 0 0x400 hw_rev serial ethaddr
setenv bootargs "root=ld0a"
fatload mmc 0 0x01f0 device~1.dtb
fatload mmc 0 0x0200 netbsd.ub
fdt addr 0x01f0
fdt set /axi/ethernet@e000b000 local-mac-address $ethaddr
bootm 0x0200 - 0x01f0

Note that the ethernet PHY will not attach unless you have applied
the patches from Lloyd Parkes in kern/58083.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/distrib/sets/lists/dtb/ad.earmv7 \
src/distrib/sets/lists/dtb/ad.earmv7hf \
src/distrib/sets/lists/dtb/ad.earmv7hfeb
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/dts/zynq-red-pitaya-122-16.dts
cvs rdiff -u -r1.1.1.10 -r1.2 \
src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/Makefile

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

Modified files:

Index: src/distrib/sets/lists/dtb/ad.earmv7
diff -u src/distrib/sets/lists/dtb/ad.earmv7:1.10 src/distrib/sets/lists/dtb/ad.earmv7:1.11
--- src/distrib/sets/lists/dtb/ad.earmv7:1.10	Wed Nov  1 12:51:13 2023
+++ src/distrib/sets/lists/dtb/ad.earmv7	Sat May  4 02:21:48 2024
@@ -1,4 +1,4 @@
-# $NetBSD: ad.earmv7,v 1.10 2023/11/01 12:51:13 simonb Exp $
+# $NetBSD: ad.earmv7,v 1.11 2024/05/04 02:21:48 dyoung Exp $
 #
 # DO NOT EDIT THIS FILE MANUALLY
 # Generated by "make update-sets" in sys/dtb
@@ -580,6 +580,7 @@
 ./boot/dtb/zynq-ebaz4205.dtb dtb-base-boot  dtb
 ./boot/dtb/zynq-microzed.dtb dtb-base-boot  dtb
 ./boot/dtb/zynq-parallella.dtb   dtb-base-boot  dtb
+./boot/dtb/zynq-red-pitaya-122-16.dtbdtb-base-boot  dtb
 ./boot/dtb/zynq-zc702.dtbdtb-base-boot  dtb
 ./boot/dtb/zynq-zc706.dtbdtb-base-boot  dtb
 ./boot/dtb/zynq-zc770-xm010.dtb  dtb-base-boot  dtb
Index: src/distrib/sets/lists/dtb/ad.earmv7hf
diff -u src/distrib/sets/lists/dtb/ad.earmv7hf:1.10 src/distrib/sets/lists/dtb/ad.earmv7hf:1.11
--- src/distrib/sets/lists/dtb/ad.earmv7hf:1.10	Thu May  4 13:41:46 2023
+++ src/distrib/sets/lists/dtb/ad.earmv7hf	Sat May  4 02:21:48 2024
@@ -1,4 +1,4 @@
-# $NetBSD: ad.earmv7hf,v 1.10 2023/05/04 13:41:46 bouyer Exp $
+# $NetBSD: ad.earmv7hf,v 1.11 2024/05/04 02:21:48 dyoung Exp $
 #
 # DO NOT EDIT THIS FILE MANUALLY
 # Generated by "make update-sets" in sys/dtb
@@ -580,6 +580,7 @@
 ./boot/dtb/zynq-ebaz4205.dtb dtb-base-boot  dtb
 ./boot/dtb/zynq-microzed.dtb dtb-base-boot  dtb
 ./boot/dtb/zynq-parallella.dtb   dtb-base-boot  dtb
+./boot/dtb/zynq-red-pitaya-122-16.dtbdtb-base-boot  dtb
 ./boot/dtb/zynq-zc702.dtbdtb-base-boot  dtb
 ./boot/dtb/zynq-zc706.dtbdtb-base-boot  dtb
 ./boot/dtb/zynq-zc770-xm010.dtb  dtb-base-boot  dtb
Index: src/distrib/sets/lists/dtb/ad.earmv7hfeb
diff -u src/distrib/sets/lists/dtb/ad.earmv7hfeb:1.10 src/distrib/sets/lists/dtb/ad.earmv7hfeb:1.11
--- src/distrib/sets/lists/dtb/ad.earmv7hfeb:1.10	Sat May  6 08:43:20 2023
+++ src/distrib/sets/lists/dtb/ad.earmv7hfeb	Sat May  4 02:21:48 2024
@@ -1,4 +1,4 @@
-# $NetBSD: ad.earmv7hfeb,v 1.10 2023/05/06 08:43:20 skrll Exp $
+# $NetBSD: ad.earmv7hfeb,v 1.11 2024/05/04 02:21:48 dyoung Exp $
 #
 # DO NOT EDIT THIS FILE MANUALLY
 # Generated by "make update-sets" in sys/dtb
@@ -580,6 +580,7 @@
 ./boot/dtb/zynq-ebaz4205.dtb dtb-base-boot  dtb
 ./boot/dtb/zynq-microzed.dtb dtb-base-boot  dtb
 ./boot/dtb/zynq-parallella.dtb   dtb-base-boot  dtb
+./boot/dtb/zynq-red-pitaya-122-16.dtbdtb-base-boot  dtb
 ./boot/dtb/zynq-zc702.dtbdtb-base-boot  dtb
 ./boot/dtb/zynq-zc706.dtbdtb-base-boot  dtb
 ./boot/dtb/zynq-zc770-xm010.dtb  dtb-base-boot  dtb

Index: src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/Makefile
diff -u src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/Makefile:1.1.1.10 src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/Makefile:1.2
--- src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/Makefile:1.1.1.10	

CVS commit: src

2024-05-03 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Sat May  4 02:21:49 UTC 2024

Modified Files:
src/distrib/sets/lists/dtb: ad.earmv7 ad.earmv7hf ad.earmv7hfeb
src/sys/external/gpl2/dts/dist/arch/arm/boot/dts: Makefile
Added Files:
src/sys/arch/arm/dts: zynq-red-pitaya-122-16.dts

Log Message:
Add a device tree for the Red Pitaya SDRlab 122-16.

To boot NetBSD on the 122-16, copy the .dtb built from
zynq-red-pitays-122-16.dts, the first-stage bootloader (called
boot.bin) and U-Boot that came with the 122-16 and a kernel image,
netbsd.ub, built for earmv7hf to an MS-DOS partition on an
MBR-partitioned SD card.  At the U-Boot prompt, "Zynq> ", type these
commands:

i2c dev 0
eeprom read 0 0x50 0 0x1804 0x400
env import -b 0 0x400 hw_rev serial ethaddr
setenv bootargs "root=ld0a"
fatload mmc 0 0x01f0 device~1.dtb
fatload mmc 0 0x0200 netbsd.ub
fdt addr 0x01f0
fdt set /axi/ethernet@e000b000 local-mac-address $ethaddr
bootm 0x0200 - 0x01f0

Note that the ethernet PHY will not attach unless you have applied
the patches from Lloyd Parkes in kern/58083.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/distrib/sets/lists/dtb/ad.earmv7 \
src/distrib/sets/lists/dtb/ad.earmv7hf \
src/distrib/sets/lists/dtb/ad.earmv7hfeb
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/dts/zynq-red-pitaya-122-16.dts
cvs rdiff -u -r1.1.1.10 -r1.2 \
src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/Makefile

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



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

2024-05-03 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Sat May  4 02:04:55 UTC 2024

Modified Files:
src/sys/arch/arm/xilinx: zynq_uart.c

Log Message:
Initialize `struct consdev` members cn_dev and cn_pri like other
UART drivers do.  If cn_dev is 0 instead of NODEV, then the kernel
may redirect console writes to major 0, minor 0, which is /dev/mem.
On my Zynq board the kernel overwrote the page free list with a
console message in this way.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/xilinx/zynq_uart.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/arm/xilinx/zynq_uart.c
diff -u src/sys/arch/arm/xilinx/zynq_uart.c:1.5 src/sys/arch/arm/xilinx/zynq_uart.c:1.6
--- src/sys/arch/arm/xilinx/zynq_uart.c:1.5	Thu Oct 27 07:57:46 2022
+++ src/sys/arch/arm/xilinx/zynq_uart.c	Sat May  4 02:04:54 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: zynq_uart.c,v 1.5 2022/10/27 07:57:46 skrll Exp $	*/
+/*	$NetBSD: zynq_uart.c,v 1.6 2024/05/04 02:04:54 dyoung Exp $	*/
 
 /*
  * Copyright (c) 2012  Genetec Corporation.  All rights reserved.
@@ -96,7 +96,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: zynq_uart.c,v 1.5 2022/10/27 07:57:46 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: zynq_uart.c,v 1.6 2024/05/04 02:04:54 dyoung Exp $");
 
 #include "opt_soc.h"
 #include "opt_console.h"
@@ -1974,7 +1974,9 @@ zynquart_init(struct zynquart_regs *regs
 struct consdev zynquartcons = {
 	.cn_getc = zynquartcngetc,
 	.cn_putc = zynquartcnputc,
-	.cn_pollc = nullcnpollc
+	.cn_pollc = nullcnpollc,
+	.cn_dev = NODEV,
+	.cn_pri = CN_NORMAL,
 };
 
 



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

2024-05-03 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Sat May  4 02:04:55 UTC 2024

Modified Files:
src/sys/arch/arm/xilinx: zynq_uart.c

Log Message:
Initialize `struct consdev` members cn_dev and cn_pri like other
UART drivers do.  If cn_dev is 0 instead of NODEV, then the kernel
may redirect console writes to major 0, minor 0, which is /dev/mem.
On my Zynq board the kernel overwrote the page free list with a
console message in this way.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/xilinx/zynq_uart.c

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



CVS commit: src/distrib/riscv/ramdisk

2024-05-03 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Sat May  4 00:41:06 UTC 2024

Modified Files:
src/distrib/riscv/ramdisk: Makefile

Log Message:
Add dhcpcd to riscv ramdisk, etc.

Be consistent with configs for pretty much every other (modern) arch
and provide dhcpcd, lest someone end up using this image and then be
surprised (as happened relatively recently with evbmips images). This
means of course we also need bpf.

While here, add a few wedge devices, too. This aligns us with the
device definitions evbmips uses (that appears to be where the riscv
Makefile was copied from back in 2015).


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/distrib/riscv/ramdisk/Makefile

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

Modified files:

Index: src/distrib/riscv/ramdisk/Makefile
diff -u src/distrib/riscv/ramdisk/Makefile:1.3 src/distrib/riscv/ramdisk/Makefile:1.4
--- src/distrib/riscv/ramdisk/Makefile:1.3	Wed Jun 14 23:03:19 2023
+++ src/distrib/riscv/ramdisk/Makefile	Sat May  4 00:41:06 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.3 2023/06/14 23:03:19 gutteridge Exp $
+#	$NetBSD: Makefile,v 1.4 2024/05/04 00:41:06 gutteridge Exp $
 
 .include 
 .include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
@@ -22,7 +22,8 @@ IMAGEDEPENDS=	${CRUNCHBIN} \
 		${NETBSDSRCDIR}/etc/netconfig ${DISTRIBDIR}/common/protocols \
 		${DISTRIBDIR}/common/services
 
-MAKEDEVTARGETS= std md0 wd0 wd1 wd2 wd3 cd0 cd1 sd0 sd1 sd2 sd3 st0 ipty
+MAKEDEVTARGETS= std md0 wd0 wd1 wd2 wd3 cd0 cd1 sd0 sd1 sd2 sd3 st0 ipty \
+		bpf dk0 dk1 dk2 dk3
 
 # Use stubs to eliminate some large stuff from libc
 HACKSRC=	${DISTRIBDIR}/utils/libhack
@@ -30,6 +31,7 @@ HACKSRC=	${DISTRIBDIR}/utils/libhack
 ${CRUNCHBIN}:	libhack.o
 
 .include "${DISTRIBDIR}/common/Makefile.crunch"
+.include "${DISTRIBDIR}/common/Makefile.dhcpcd"
 .include "${DISTRIBDIR}/common/Makefile.makedev"
 .include "${DISTRIBDIR}/common/Makefile.image"
 



CVS commit: src/distrib/riscv/ramdisk

2024-05-03 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Sat May  4 00:41:06 UTC 2024

Modified Files:
src/distrib/riscv/ramdisk: Makefile

Log Message:
Add dhcpcd to riscv ramdisk, etc.

Be consistent with configs for pretty much every other (modern) arch
and provide dhcpcd, lest someone end up using this image and then be
surprised (as happened relatively recently with evbmips images). This
means of course we also need bpf.

While here, add a few wedge devices, too. This aligns us with the
device definitions evbmips uses (that appears to be where the riscv
Makefile was copied from back in 2015).


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/distrib/riscv/ramdisk/Makefile

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



CVS commit: src/tests/lib/libm

2024-05-03 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri May  3 21:40:52 UTC 2024

Modified Files:
src/tests/lib/libm: t_fe_round.c

Log Message:
tests/lib/libm/t_fe_round.c: Expand nearbyint/rint tests.

PR lib/58054


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/tests/lib/libm/t_fe_round.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/libm/t_fe_round.c
diff -u src/tests/lib/libm/t_fe_round.c:1.15 src/tests/lib/libm/t_fe_round.c:1.16
--- src/tests/lib/libm/t_fe_round.c:1.15	Thu May  2 16:52:08 2024
+++ src/tests/lib/libm/t_fe_round.c	Fri May  3 21:40:51 2024
@@ -41,108 +41,246 @@ static const struct {
 	double input;
 	long int expected;
 } values[] = {
-	{ FE_DOWNWARD,		3.7,		3},
-	{ FE_DOWNWARD,		-3.7,		-4},
-	{ FE_DOWNWARD,		+0,		0},
-	{ FE_DOWNWARD,		-INT-0.01,	-INT-1},
-	{ FE_DOWNWARD,		+INT-0.01,	INT-1},
-	{ FE_DOWNWARD,		-INT+0.01,	-INT},
-	{ FE_DOWNWARD,		+INT+0.01,	INT},
+	{ FE_DOWNWARD,		3.75,		3},
+	{ FE_DOWNWARD,		-3.75,		-4},
+	{ FE_DOWNWARD,		+0.,		0},
+	{ FE_DOWNWARD,		-INT-0.0625,	-INT-1},
+	{ FE_DOWNWARD,		+INT-0.0625,	INT-1},
+	{ FE_DOWNWARD,		-INT+0.0625,	-INT},
+	{ FE_DOWNWARD,		+INT+0.0625,	INT},
 #if 0 /* cpu bugs? */
-	{ FE_DOWNWARD,		-0,		-1},
+	{ FE_DOWNWARD,		-0.,		-1},
 
-	{ FE_UPWARD,		+0,		1},
+	{ FE_UPWARD,		+0.,		1},
 #endif
-	{ FE_UPWARD,		-0,		0},
-	{ FE_UPWARD,		-123.7,		-123},
-	{ FE_UPWARD,		123.999,	124},
-	{ FE_UPWARD,		-INT-0.01,	-INT},
-	{ FE_UPWARD,		+INT-0.01,	INT},
-	{ FE_UPWARD,		-INT+0.01,	-INT+1},
-	{ FE_UPWARD,		+INT+0.01,	INT+1},
-
-	{ FE_TOWARDZERO,	1.99,		1},
-	{ FE_TOWARDZERO,	-1.99,		-1},
-	{ FE_TOWARDZERO,	0.2,		0},
-	{ FE_TOWARDZERO,	INT+0.01,	INT},
-	{ FE_TOWARDZERO,	INT-0.01,	INT - 1},
-	{ FE_TOWARDZERO,	-INT+0.01,	-INT + 1},
-	{ FE_TOWARDZERO,	+0,		0},
-	{ FE_TOWARDZERO,	-0,		0},
-
-	{ FE_TONEAREST,		-INT-0.01,	-INT},
-	{ FE_TONEAREST,		+INT-0.01,	INT},
-	{ FE_TONEAREST,		-INT+0.01,	-INT},
-	{ FE_TONEAREST,		+INT+0.01,	INT},
-	{ FE_TONEAREST,		-INT-0.501,	-INT-1},
-	{ FE_TONEAREST,		+INT-0.501,	INT-1},
-	{ FE_TONEAREST,		-INT+0.501,	-INT+1},
-	{ FE_TONEAREST,		+INT+0.501,	INT+1},
-	{ FE_TONEAREST,		+0,		0},
-	{ FE_TONEAREST,		-0,		0},
+	{ FE_UPWARD,		-0.,		0},
+	{ FE_UPWARD,		-123.75,	-123},
+	{ FE_UPWARD,		123.75,		124},
+	{ FE_UPWARD,		-INT-0.0625,	-INT},
+	{ FE_UPWARD,		+INT-0.0625,	INT},
+	{ FE_UPWARD,		-INT+0.0625,	-INT+1},
+	{ FE_UPWARD,		+INT+0.0625,	INT+1},
+
+	{ FE_TOWARDZERO,	1.9375,		1},
+	{ FE_TOWARDZERO,	-1.9375,	-1},
+	{ FE_TOWARDZERO,	0.25,		0},
+	{ FE_TOWARDZERO,	INT+0.0625,	INT},
+	{ FE_TOWARDZERO,	INT-0.0625,	INT - 1},
+	{ FE_TOWARDZERO,	-INT+0.0625,	-INT + 1},
+	{ FE_TOWARDZERO,	+0.,		0},
+	{ FE_TOWARDZERO,	-0.,		0},
+
+	{ FE_TONEAREST,		-INT-0.0625,	-INT},
+	{ FE_TONEAREST,		+INT-0.0625,	INT},
+	{ FE_TONEAREST,		-INT+0.0625,	-INT},
+	{ FE_TONEAREST,		+INT+0.0625,	INT},
+	{ FE_TONEAREST,		-INT-0.53125,	-INT-1},
+	{ FE_TONEAREST,		+INT-0.53125,	INT-1},
+	{ FE_TONEAREST,		-INT+0.53125,	-INT+1},
+	{ FE_TONEAREST,		+INT+0.53125,	INT+1},
+	{ FE_TONEAREST,		+0.,		0},
+	{ FE_TONEAREST,		-0.,		0},
 };
 
-ATF_TC(fe_round);
-ATF_TC_HEAD(fe_round, tc)
+ATF_TC(fe_lrint);
+ATF_TC_HEAD(fe_lrint, tc)
 {
-	atf_tc_set_md_var(tc, "descr","Checking IEEE 754 rounding modes using lrint");
+	atf_tc_set_md_var(tc, "descr",
+	"Checking IEEE 754 rounding modes using lrint(3)");
 }
 
-ATF_TC_BODY(fe_round, tc)
+ATF_TC_BODY(fe_lrint, tc)
 {
+	enum {
+		LLRINT,
+		LLRINTF,
+		LRINT,
+		LRINTF,
+		N_FN,
+	} fn;
+	static const char *const fnname[] = {
+		[LLRINT] = "llrint",
+		[LLRINTF] = "llrintf",
+		[LRINT] = "lrint",
+		[LRINTF] = "lrintf",
+	};
 	long int received;
+	unsigned i;
 
-	for (unsigned int i = 0; i < __arraycount(values); i++) {
-		fesetround(values[i].round_mode);
-
-		received = lrint(values[i].input);
-		ATF_CHECK_MSG(
-		(labs(received - values[i].expected) < EPSILON),
-		"lrint rounding wrong, difference too large\n"
-		"input: %f (index %d): got %ld, expected %ld\n",
-		values[i].input, i, received, values[i].expected);
-
-		/* Do we get the same rounding mode out? */
-		ATF_CHECK_MSG(
-		(fegetround() == values[i].round_mode),
-		"Didn't get the same rounding mode out!\n"
-		"(index %d) fed in %d rounding mode, got %d out\n",
-		i, values[i].round_mode, fegetround());
+	for (i = 0; i < __arraycount(values); i++) {
+		for (fn = 0; fn < N_FN; fn++) {
+			/*
+			 * Set the requested rounding mode.
+			 */
+			fesetround(values[i].round_mode);
+
+			/*
+			 * Call the lrint(3)-family function.
+			 */
+			switch (fn) {
+			case LLRINT:
+received = llrint(values[i].input);
+break;
+			case LLRINTF:
+received = llrintf(values[i].input);
+break;
+			case LRINT:
+received = lrint(values[i].input);
+break;
+			case LRINTF:
+received = lrintf(values[i].input);
+break;
+			default:
+atf_tc_fail("impossible");
+			}
+
+			/*
+			 * 

CVS commit: src/tests/lib/libm

2024-05-03 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri May  3 21:40:52 UTC 2024

Modified Files:
src/tests/lib/libm: t_fe_round.c

Log Message:
tests/lib/libm/t_fe_round.c: Expand nearbyint/rint tests.

PR lib/58054


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/tests/lib/libm/t_fe_round.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

2024-05-03 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Fri May  3 21:38:15 UTC 2024

Modified Files:
src/sys/arch/cobalt/stand/boot: zs.c
src/sys/arch/sgimips/stand/common: iris_zs.c

Log Message:
s/inerttupts/interrupts/ in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/cobalt/stand/boot/zs.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/sgimips/stand/common/iris_zs.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

2024-05-03 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Fri May  3 21:38:15 UTC 2024

Modified Files:
src/sys/arch/cobalt/stand/boot: zs.c
src/sys/arch/sgimips/stand/common: iris_zs.c

Log Message:
s/inerttupts/interrupts/ in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/cobalt/stand/boot/zs.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/sgimips/stand/common/iris_zs.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/cobalt/stand/boot/zs.c
diff -u src/sys/arch/cobalt/stand/boot/zs.c:1.3 src/sys/arch/cobalt/stand/boot/zs.c:1.4
--- src/sys/arch/cobalt/stand/boot/zs.c:1.3	Wed May 14 13:29:28 2008
+++ src/sys/arch/cobalt/stand/boot/zs.c	Fri May  3 21:38:15 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: zs.c,v 1.3 2008/05/14 13:29:28 tsutsui Exp $	*/
+/*	$NetBSD: zs.c,v 1.4 2024/05/03 21:38:15 andvar Exp $	*/
 
 /*-
  * Copyright (c) 2008 Izumi Tsutsui. All rights reserved.
@@ -87,7 +87,7 @@ zs_reset(void *dev)
 	zs_write_reg(dev,  9, ZSWR9_HARD_RESET);
 	delay(1000);
 
-	/* disable all inerttupts */
+	/* disable all interrupts */
 	zs_write_reg(dev,  1, 0);
 
 	/* set TX/RX misc parameters and modes */

Index: src/sys/arch/sgimips/stand/common/iris_zs.c
diff -u src/sys/arch/sgimips/stand/common/iris_zs.c:1.1 src/sys/arch/sgimips/stand/common/iris_zs.c:1.2
--- src/sys/arch/sgimips/stand/common/iris_zs.c:1.1	Sat Jan 12 16:44:47 2019
+++ src/sys/arch/sgimips/stand/common/iris_zs.c	Fri May  3 21:38:15 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: iris_zs.c,v 1.1 2019/01/12 16:44:47 tsutsui Exp $	*/
+/*	$NetBSD: iris_zs.c,v 1.2 2024/05/03 21:38:15 andvar Exp $	*/
 
 /*
  * Copyright (c) 2018 Naruaki Etomi
@@ -113,7 +113,7 @@ zs_reset(void *dev)
 	zs_write_reg(dev,  9, ZSWR9_HARD_RESET);
 	DELAY(1000);
 
-	/* disable all inerttupts */
+	/* disable all interrupts */
 	zs_write_reg(dev,  1, 0);
 
 	/* set TX/RX misc parameters and modes */



CVS commit: src/etc/defaults

2024-05-03 Thread Takeshi Nakayama
Module Name:src
Committed By:   nakayama
Date:   Fri May  3 20:48:59 UTC 2024

Modified Files:
src/etc/defaults: npf.boot.conf

Log Message:
Allow DHCPv6 so that dhcpcd(8) does not complain at boot when using
ia_pd option.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/etc/defaults/npf.boot.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/defaults/npf.boot.conf
diff -u src/etc/defaults/npf.boot.conf:1.3 src/etc/defaults/npf.boot.conf:1.4
--- src/etc/defaults/npf.boot.conf:1.3	Sun Aug  9 23:43:58 2020
+++ src/etc/defaults/npf.boot.conf	Fri May  3 20:48:58 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: npf.boot.conf,v 1.3 2020/08/09 23:43:58 gutteridge Exp $
+#	$NetBSD: npf.boot.conf,v 1.4 2024/05/03 20:48:58 nakayama Exp $
 #
 # /etc/defaults/npf.boot.conf --
 #	initial configuration for npf(7)
@@ -28,6 +28,8 @@ pass stateful out proto icmp icmp-type e
 # Allow DHCP
 pass out family inet4 proto udp from any port bootpc to any port bootps
 pass in family inet4 proto udp from any port bootps to any port bootpc
+pass out family inet6 proto udp from any port "dhcpv6-client" to any port "dhcpv6-server"
+pass in family inet6 proto udp from any port "dhcpv6-server" to any port "dhcpv6-client"
 
 # Allow IPv6 router/neighbor solicitation and advertisement.
 pass out  family inet6 proto ipv6-icmp icmp-type rtsol all



CVS commit: src/etc/defaults

2024-05-03 Thread Takeshi Nakayama
Module Name:src
Committed By:   nakayama
Date:   Fri May  3 20:48:59 UTC 2024

Modified Files:
src/etc/defaults: npf.boot.conf

Log Message:
Allow DHCPv6 so that dhcpcd(8) does not complain at boot when using
ia_pd option.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/etc/defaults/npf.boot.conf

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



CVS commit: src/tests/usr.bin/xlint/lint1

2024-05-03 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri May  3 19:16:13 UTC 2024

Modified Files:
src/tests/usr.bin/xlint/lint1: expr_sizeof.c

Log Message:
tests/lint: fix supposedly platform-independent type definitions

No idea where I got the previous type definitions from.  The typedef
names looked just too convincing to actually check the underlying types.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/tests/usr.bin/xlint/lint1/expr_sizeof.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/expr_sizeof.c
diff -u src/tests/usr.bin/xlint/lint1/expr_sizeof.c:1.17 src/tests/usr.bin/xlint/lint1/expr_sizeof.c:1.18
--- src/tests/usr.bin/xlint/lint1/expr_sizeof.c:1.17	Fri May  3 15:32:37 2024
+++ src/tests/usr.bin/xlint/lint1/expr_sizeof.c	Fri May  3 19:16:13 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: expr_sizeof.c,v 1.17 2024/05/03 15:32:37 rillig Exp $	*/
+/*	$NetBSD: expr_sizeof.c,v 1.18 2024/05/03 19:16:13 rillig Exp $	*/
 # 3 "expr_sizeof.c"
 
 /*
@@ -7,8 +7,6 @@
  */
 
 /* lint1-extra-flags: -X 351 */
-// TODO: Remove the lp64 restriction when sequence_of_structs has been fixed.
-/* lint1-only-if: lp64 */
 
 /*
  * A sizeof expression can either take a type name or an expression.
@@ -221,9 +219,9 @@ void
 sequence_of_structs(void)
 {
 	typedef unsigned char uint8_t;
-	typedef short unsigned int uint16_t;
+	typedef unsigned short uint16_t;
 	typedef unsigned int uint32_t;
-	typedef long unsigned int uint64_t;
+	typedef unsigned long long uint64_t;
 
 	union fp_addr {
 		uint64_t fa_64;



CVS commit: src/tests/usr.bin/xlint/lint1

2024-05-03 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri May  3 19:16:13 UTC 2024

Modified Files:
src/tests/usr.bin/xlint/lint1: expr_sizeof.c

Log Message:
tests/lint: fix supposedly platform-independent type definitions

No idea where I got the previous type definitions from.  The typedef
names looked just too convincing to actually check the underlying types.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/tests/usr.bin/xlint/lint1/expr_sizeof.c

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



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2024-05-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri May  3 15:50:42 UTC 2024

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: ctfmerge.c

Log Message:
add an environment variable to override the number ot threads.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 \
src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c

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

Modified files:

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c:1.18 src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c:1.19
--- src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c:1.18	Tue May 23 14:54:58 2023
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c	Fri May  3 11:50:42 2024
@@ -712,6 +712,7 @@ static void
 wq_init(workqueue_t *wq, int nfiles)
 {
 	int throttle, nslots, i;
+	const char *e;
 
 	if (getenv("CTFMERGE_MAX_SLOTS"))
 		nslots = atoi(getenv("CTFMERGE_MAX_SLOTS"));
@@ -728,17 +729,21 @@ wq_init(workqueue_t *wq, int nfiles)
 
 	wq->wq_wip = xcalloc(sizeof (wip_t) * nslots);
 	wq->wq_nwipslots = nslots;
+	e = getenv("CTFMERGE_NUM_THREADS");
+	if (e) {
+		wq->wq_nthreads = atoi(e);
+	} else {
 #ifdef _SC_NPROCESSORS_ONLN
-	wq->wq_nthreads = MIN(sysconf(_SC_NPROCESSORS_ONLN) * 3 / 2, nslots);
+		wq->wq_nthreads = MIN(sysconf(_SC_NPROCESSORS_ONLN) * 3 / 2,
+		nslots);
 #else
-	wq->wq_nthreads = 2;
+		wq->wq_nthreads = 2;
 #endif
+	}
 	wq->wq_thread = xmalloc(sizeof (pthread_t) * wq->wq_nthreads);
 
-	if (getenv("CTFMERGE_INPUT_THROTTLE"))
-		throttle = atoi(getenv("CTFMERGE_INPUT_THROTTLE"));
-	else
-		throttle = MERGE_INPUT_THROTTLE_LEN;
+	e = getenv("CTFMERGE_INPUT_THROTTLE");
+	throttle = e ? atoi(e) : MERGE_INPUT_THROTTLE_LEN;
 	wq->wq_ithrottle = throttle * wq->wq_nthreads;
 
 	debug(1, "Using %d slots, %d threads\n", wq->wq_nwipslots,



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2024-05-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri May  3 15:50:42 UTC 2024

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: ctfmerge.c

Log Message:
add an environment variable to override the number ot threads.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 \
src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.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/hp300/stand/mkboot

2024-05-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri May  3 15:39:50 UTC 2024

Modified Files:
src/sys/arch/hp300/stand/mkboot: mkboot.c

Log Message:
Fix build as a tool (Jan-Benedict Glaw)


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/hp300/stand/mkboot/mkboot.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/hp300/stand/mkboot/mkboot.c
diff -u src/sys/arch/hp300/stand/mkboot/mkboot.c:1.15 src/sys/arch/hp300/stand/mkboot/mkboot.c:1.16
--- src/sys/arch/hp300/stand/mkboot/mkboot.c:1.15	Sat Feb 24 10:34:47 2024
+++ src/sys/arch/hp300/stand/mkboot/mkboot.c	Fri May  3 11:39:50 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: mkboot.c,v 1.15 2024/02/24 15:34:47 christos Exp $	*/
+/*	$NetBSD: mkboot.c,v 1.16 2024/05/03 15:39:50 christos Exp $	*/
 
 /*
  * Copyright (c) 1990, 1993
@@ -46,7 +46,7 @@ The Regents of the University of Califor
 #ifdef notdef
 static char sccsid[] = "@(#)mkboot.c	7.2 (Berkeley) 12/16/90";
 #endif
-__RCSID("$NetBSD: mkboot.c,v 1.15 2024/02/24 15:34:47 christos Exp $");
+__RCSID("$NetBSD: mkboot.c,v 1.16 2024/05/03 15:39:50 christos Exp $");
 #endif /* not lint */
 
 #include 
@@ -90,6 +90,10 @@ char	*lifname(char *);
 int	 putfile(char *, int);
 void	 usage(void);
 
+#ifndef __CTASSERT
+#define	__CTASSERT(X)
+#endif
+
 #define CLEAR(a, b, c)	\
 __CTASSERT(sizeof(b) - 1 == c); \
 memcpy((a), (b), (c))



CVS commit: src/sys/arch/hp300/stand/mkboot

2024-05-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri May  3 15:39:50 UTC 2024

Modified Files:
src/sys/arch/hp300/stand/mkboot: mkboot.c

Log Message:
Fix build as a tool (Jan-Benedict Glaw)


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/hp300/stand/mkboot/mkboot.c

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



CVS commit: src/tests/usr.bin/xlint/lint1

2024-05-03 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri May  3 15:32:37 UTC 2024

Modified Files:
src/tests/usr.bin/xlint/lint1: expr_sizeof.c

Log Message:
tests/lint: skip test for sizeof struct on 32-bit platforms

Even though the test only uses fixed-size types, lint's computed size of
the resulting struct differs between i386 (80) and x86_64 (112).  Both
are wrong, probably due to the unrelated struct declaration above, as
already mentioned in the comments.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/tests/usr.bin/xlint/lint1/expr_sizeof.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/expr_sizeof.c
diff -u src/tests/usr.bin/xlint/lint1/expr_sizeof.c:1.16 src/tests/usr.bin/xlint/lint1/expr_sizeof.c:1.17
--- src/tests/usr.bin/xlint/lint1/expr_sizeof.c:1.16	Thu May  2 20:03:33 2024
+++ src/tests/usr.bin/xlint/lint1/expr_sizeof.c	Fri May  3 15:32:37 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: expr_sizeof.c,v 1.16 2024/05/02 20:03:33 rillig Exp $	*/
+/*	$NetBSD: expr_sizeof.c,v 1.17 2024/05/03 15:32:37 rillig Exp $	*/
 # 3 "expr_sizeof.c"
 
 /*
@@ -7,6 +7,8 @@
  */
 
 /* lint1-extra-flags: -X 351 */
+// TODO: Remove the lp64 restriction when sequence_of_structs has been fixed.
+/* lint1-only-if: lp64 */
 
 /*
  * A sizeof expression can either take a type name or an expression.
@@ -222,7 +224,6 @@ sequence_of_structs(void)
 	typedef short unsigned int uint16_t;
 	typedef unsigned int uint32_t;
 	typedef long unsigned int uint64_t;
-	typedef unsigned long size_t;
 
 	union fp_addr {
 		uint64_t fa_64;
@@ -255,10 +256,10 @@ sequence_of_structs(void)
 	};
 
 	/* expect+1: error: negative array dimension (-20) [20] */
-	typedef int o1[-(int)((size_t)(unsigned long)(&(((struct save87 *)0)->s87_dp)))];
+	typedef int o1[-(int)((unsigned long)(&(((struct save87 *)0)->s87_dp)))];
 	// FIXME: must be 28.
 	/* expect+1: error: negative array dimension (-32) [20] */
-	typedef int o2[-(int)((size_t)(unsigned long)(&(((struct save87 *)0)->s87_ac)))];
+	typedef int o2[-(int)((unsigned long)(&(((struct save87 *)0)->s87_ac)))];
 	// FIXME: must be 108.
 	/* expect+1: error: negative array dimension (-112) [20] */
 	typedef int reveal[-(int)sizeof(struct save87)];



CVS commit: src/tests/usr.bin/xlint/lint1

2024-05-03 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri May  3 15:32:37 UTC 2024

Modified Files:
src/tests/usr.bin/xlint/lint1: expr_sizeof.c

Log Message:
tests/lint: skip test for sizeof struct on 32-bit platforms

Even though the test only uses fixed-size types, lint's computed size of
the resulting struct differs between i386 (80) and x86_64 (112).  Both
are wrong, probably due to the unrelated struct declaration above, as
already mentioned in the comments.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/tests/usr.bin/xlint/lint1/expr_sizeof.c

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



Re: Clang vs. lint's strict bool mode (was: Re: CVS commit: src/usr.bin/base64)

2024-05-03 Thread Christos Zoulas



> On May 3, 2024, at 11:11 AM, Roland Illig  wrote:
> 
> Am 02.05.2024 um 22:44 schrieb Christos Zoulas:
>> On 2024-05-02 3:04 pm, Christos Zoulas wrote:
>>> This is with clang.
>>> 
>> And I don't get it. Gcc produces:
>> 
>>   if (ignore &&
>> # 139 "base64.c" 3 4
>>((int)((_ctype_tab_ + 1)[(
>> # 139 "base64.c"
>>c
>> # 139 "base64.c" 3 4
>>)] & 0x0040))
>> # 139 "base64.c"
>>  )
>>continue;
> 
> Since the '&&' in the condition comes from a system header, lint is not
> as strict as it could be, to allow user code to pass strict bool mode
> even when the system headers don't comply.
> 
>> Clang produces:
>>   if (ignore && ((int)((_ctype_tab_ + 1)[(c)] & 0x0040)))
>>continue;
> 
> Clang doesn't distinguish the system parts from the non-system parts,
> and that's the crucial difference. I never tested the combination of
> Clang with lint. I will do so now.

Got it, thank you!

christos

Clang vs. lint's strict bool mode (was: Re: CVS commit: src/usr.bin/base64)

2024-05-03 Thread Roland Illig
Am 02.05.2024 um 22:44 schrieb Christos Zoulas:
> On 2024-05-02 3:04 pm, Christos Zoulas wrote:
>> This is with clang.
>>
> And I don't get it. Gcc produces:
>
>if (ignore &&
> # 139 "base64.c" 3 4
> ((int)((_ctype_tab_ + 1)[(
> # 139 "base64.c"
> c
> # 139 "base64.c" 3 4
> )] & 0x0040))
> # 139 "base64.c"
>   )
> continue;

Since the '&&' in the condition comes from a system header, lint is not
as strict as it could be, to allow user code to pass strict bool mode
even when the system headers don't comply.

> Clang produces:
>if (ignore && ((int)((_ctype_tab_ + 1)[(c)] & 0x0040)))
> continue;

Clang doesn't distinguish the system parts from the non-system parts,
and that's the crucial difference. I never tested the combination of
Clang with lint. I will do so now.

Roland



CVS commit: src/doc/roadmaps

2024-05-03 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Fri May  3 09:00:59 UTC 2024

Modified Files:
src/doc/roadmaps: ports

Log Message:
update ports roadmap


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/doc/roadmaps/ports

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

Modified files:

Index: src/doc/roadmaps/ports
diff -u src/doc/roadmaps/ports:1.10 src/doc/roadmaps/ports:1.11
--- src/doc/roadmaps/ports:1.10	Fri May  3 07:00:14 2024
+++ src/doc/roadmaps/ports	Fri May  3 09:00:59 2024
@@ -1,4 +1,4 @@
-$NetBSD: ports,v 1.10 2024/05/03 07:00:14 skrll Exp $
+$NetBSD: ports,v 1.11 2024/05/03 09:00:59 nia Exp $
 
 NetBSD Ports Roadmap
 
@@ -14,8 +14,10 @@ priorities for the project:
 The following elements, projects, and goals are not strategic
 priorities but are still important undertakings worth doing:
 
- 1. or1k port
- 2. cheri port
+ 1. c-sky port
+ 2. latticemico32 port
+ 3. or1k port
+ 4. cheri port
 
 The following elements, projects, and goals are perhaps less pressing;
 this doesn't mean one shouldn't work on them but the expected payoff
@@ -29,16 +31,33 @@ Explanations
 
  0. DRMKMS update
 
-The DRM drivers get old with time. The current drivers are from Linux 4.4,
+The DRM drivers get old with time. The current drivers are from Linux 5.6,
 having a newer version would be nice.
 
-- As of July 2018, maya is working on this.
+ 1. c-sky port
 
- 1. or1k port
+C-Sky is a low-end 32-bit architecture common in devices in China.
+It is "inspired by" the M-CORE architecture from Motorola, with
+the addition of a MMU.
+
+As of 2024, low cost development boards exist and support exists in
+upstream GCC.  However, there is no NetBSD code.
+
+As of 2024, nobody is working on this.
+
+ 2. LatticeMico32 port
+
+Code exists in the inactive EdgeBSD fork, targeting the Milkymist SoC.
+
+As of 2024, nobody is working on importing it.
+
+ 3. or1k port
 
 We have a bit of or1k code, but it's not complete.
+As of 2024, we have a risc-v port, and due to the industry prioritizing
+risc-v it's unclear if or1k has a future.
 
- 2. cheri port
+ 4. cheri port
 
 http://cheri-cpu.org
 There are a number of reasons to tackle this; it will serve as a code



CVS commit: src/doc/roadmaps

2024-05-03 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Fri May  3 09:00:59 UTC 2024

Modified Files:
src/doc/roadmaps: ports

Log Message:
update ports roadmap


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/doc/roadmaps/ports

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/riscv

2024-05-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri May  3 07:24:31 UTC 2024

Modified Files:
src/sys/arch/riscv/riscv: cpu_subr.c

Log Message:
Small simplification. NFCI.


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

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

Modified files:

Index: src/sys/arch/riscv/riscv/cpu_subr.c
diff -u src/sys/arch/riscv/riscv/cpu_subr.c:1.4 src/sys/arch/riscv/riscv/cpu_subr.c:1.5
--- src/sys/arch/riscv/riscv/cpu_subr.c:1.4	Sun Sep  3 08:48:20 2023
+++ src/sys/arch/riscv/riscv/cpu_subr.c	Fri May  3 07:24:31 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.4 2023/09/03 08:48:20 skrll Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.5 2024/05/03 07:24:31 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #include "opt_riscv_debug.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.4 2023/09/03 08:48:20 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.5 2024/05/03 07:24:31 skrll Exp $");
 
 #include 
 #include 
@@ -212,7 +212,7 @@ cpu_ipi_wait(const char *s, const kcpuse
 	kcpuset_t *kcp = ci->ci_watchcpus;
 
 	/* some finite amount of time */
-	for (u_long limit = curcpu()->ci_cpu_freq /* / 10 */; !done && limit--; ) {
+	for (u_long limit = ci->ci_cpu_freq /* / 10 */; !done && limit--; ) {
 		kcpuset_copy(kcp, watchset);
 		kcpuset_intersect(kcp, wanted);
 		done = kcpuset_match(kcp, wanted);



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

2024-05-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri May  3 07:24:31 UTC 2024

Modified Files:
src/sys/arch/riscv/riscv: cpu_subr.c

Log Message:
Small simplification. NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/riscv/riscv/cpu_subr.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/riscv/include

2024-05-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri May  3 07:11:14 UTC 2024

Modified Files:
src/sys/arch/riscv/include: ptrace.h

Log Message:
Use the _X_FOO register macros instead of magic numbers.


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

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

Modified files:

Index: src/sys/arch/riscv/include/ptrace.h
diff -u src/sys/arch/riscv/include/ptrace.h:1.5 src/sys/arch/riscv/include/ptrace.h:1.6
--- src/sys/arch/riscv/include/ptrace.h:1.5	Thu Sep 14 03:25:31 2023
+++ src/sys/arch/riscv/include/ptrace.h	Fri May  3 07:11:14 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: ptrace.h,v 1.5 2023/09/14 03:25:31 rin Exp $ */
+/* $NetBSD: ptrace.h,v 1.6 2024/05/03 07:11:14 skrll Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -49,10 +49,10 @@
 
 #include 
 #define PTRACE_REG_PC(r)	(r)->r_pc
-#define PTRACE_REG_FP(r)	(r)->r_reg[7]
+#define PTRACE_REG_FP(r)	(r)->r_reg[_X_S0]
 #define PTRACE_REG_SET_PC(r, v)	(r)->r_pc = (v)
-#define PTRACE_REG_SP(r)	(r)->r_reg[1]
-#define PTRACE_REG_INTRV(r)	(r)->r_reg[9]
+#define PTRACE_REG_SP(r)	(r)->r_reg[_X_SP]
+#define PTRACE_REG_INTRV(r)	(r)->r_reg[_X_A0]
 
 #define PTRACE_ILLEGAL_ASM	__asm __volatile("c.unimp" ::: "memory")
 



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

2024-05-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri May  3 07:11:14 UTC 2024

Modified Files:
src/sys/arch/riscv/include: ptrace.h

Log Message:
Use the _X_FOO register macros instead of magic numbers.


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

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



CVS commit: src/sys/uvm

2024-05-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri May  3 07:09:20 UTC 2024

Modified Files:
src/sys/uvm: uvm_io.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/uvm/uvm_io.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/uvm/uvm_io.c
diff -u src/sys/uvm/uvm_io.c:1.29 src/sys/uvm/uvm_io.c:1.30
--- src/sys/uvm/uvm_io.c:1.29	Mon Sep 21 18:41:59 2020
+++ src/sys/uvm/uvm_io.c	Fri May  3 07:09:20 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_io.c,v 1.29 2020/09/21 18:41:59 chs Exp $	*/
+/*	$NetBSD: uvm_io.c,v 1.30 2024/05/03 07:09:20 skrll Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_io.c,v 1.29 2020/09/21 18:41:59 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_io.c,v 1.30 2024/05/03 07:09:20 skrll Exp $");
 
 #include 
 #include 
@@ -67,17 +67,17 @@ uvm_io(struct vm_map *map, struct uio *u
 	 */
 
 	if (uio->uio_resid == 0)
-		return(0);
+		return 0;
 	togo = uio->uio_resid;
 
 	baseva = (vaddr_t) uio->uio_offset;
 	endva = baseva + (togo - 1);
 
 	if (endva < baseva)   /* wrap around? */
-		return(EIO);
+		return EIO;
 
 	if (baseva >= VM_MAXUSER_ADDRESS)
-		return(0);
+		return 0;
 	if (endva >= VM_MAXUSER_ADDRESS)
 		/* EOF truncate */
 		togo = togo - (endva - VM_MAXUSER_ADDRESS + 1);
@@ -141,5 +141,5 @@ uvm_io(struct vm_map *map, struct uio *u
 		if (error)
 			break;
 	}
-	return (error);
+	return error;
 }



CVS commit: src/sys/uvm

2024-05-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri May  3 07:09:20 UTC 2024

Modified Files:
src/sys/uvm: uvm_io.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/uvm/uvm_io.c

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



CVS commit: src/sys/uvm/pmap

2024-05-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri May  3 07:06:18 UTC 2024

Modified Files:
src/sys/uvm/pmap: pmap.c

Log Message:
More debug.


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/sys/uvm/pmap/pmap.c

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

Modified files:

Index: src/sys/uvm/pmap/pmap.c
diff -u src/sys/uvm/pmap/pmap.c:1.78 src/sys/uvm/pmap/pmap.c:1.79
--- src/sys/uvm/pmap/pmap.c:1.78	Thu Apr 18 12:16:23 2024
+++ src/sys/uvm/pmap/pmap.c	Fri May  3 07:06:18 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.78 2024/04/18 12:16:23 skrll Exp $	*/
+/*	$NetBSD: pmap.c,v 1.79 2024/05/03 07:06:18 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.78 2024/04/18 12:16:23 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.79 2024/05/03 07:06:18 skrll Exp $");
 
 /*
  *	Manages physical address maps.
@@ -1829,7 +1829,9 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm
 vaddr_t src_addr)
 {
 	UVMHIST_FUNC(__func__);
-	UVMHIST_CALLED(pmaphist);
+	UVMHIST_CALLARGS(pmaphist, "(dpm=#%jx spm=%#jx dva=%#jx sva=%#jx",
+	dst_pmap, src_pmap, dst_addr, src_addr);
+	UVMHIST_LOG(pmaphist, "... len=%#jx)", len, 0, 0, 0);
 	PMAP_COUNT(copy);
 }
 



CVS commit: src/sys/uvm/pmap

2024-05-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri May  3 07:06:18 UTC 2024

Modified Files:
src/sys/uvm/pmap: pmap.c

Log Message:
More debug.


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/sys/uvm/pmap/pmap.c

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



CVS commit: src/doc/roadmaps

2024-05-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri May  3 07:00:14 UTC 2024

Modified Files:
src/doc/roadmaps: ports

Log Message:
Remove references to RISC-V.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/doc/roadmaps/ports

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



CVS commit: src/doc/roadmaps

2024-05-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri May  3 07:00:14 UTC 2024

Modified Files:
src/doc/roadmaps: ports

Log Message:
Remove references to RISC-V.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/doc/roadmaps/ports

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

Modified files:

Index: src/doc/roadmaps/ports
diff -u src/doc/roadmaps/ports:1.9 src/doc/roadmaps/ports:1.10
--- src/doc/roadmaps/ports:1.9	Sun Oct 31 08:11:13 2021
+++ src/doc/roadmaps/ports	Fri May  3 07:00:14 2024
@@ -1,4 +1,4 @@
-$NetBSD: ports,v 1.9 2021/10/31 08:11:13 nia Exp $
+$NetBSD: ports,v 1.10 2024/05/03 07:00:14 skrll Exp $
 
 NetBSD Ports Roadmap
 
@@ -14,7 +14,7 @@ priorities for the project:
 The following elements, projects, and goals are not strategic
 priorities but are still important undertakings worth doing:
 
- 1. riscv and/or or1k ports
+ 1. or1k port
  2. cheri port
 
 The following elements, projects, and goals are perhaps less pressing;
@@ -34,15 +34,9 @@ having a newer version would be nice.
 
 - As of July 2018, maya is working on this.
 
- 1. riscv and/or or1k ports
-
-We have some riscv code and a bit of or1k code, but neither is done.
-
- - As of July 2018, zmcgrew is working on riscv in a separate repository
-   https://github.com/zmcgrew/src/tree/riscv
-   Nobody is working on or1k.
- - Contact matt@ for further information.
+ 1. or1k port
 
+We have a bit of or1k code, but it's not complete.
 
  2. cheri port