CVS commit: src/sys/dev/pci

2024-04-01 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Mon Apr  1 22:56:56 UTC 2024

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

Log Message:
s/Doucments/Documents/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.390 -r1.391 src/sys/dev/pci/if_bge.c

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



CVS commit: src/sys/dev/pci

2024-04-01 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Mon Apr  1 22:56:56 UTC 2024

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

Log Message:
s/Doucments/Documents/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.390 -r1.391 src/sys/dev/pci/if_bge.c

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

Modified files:

Index: src/sys/dev/pci/if_bge.c
diff -u src/sys/dev/pci/if_bge.c:1.390 src/sys/dev/pci/if_bge.c:1.391
--- src/sys/dev/pci/if_bge.c:1.390	Fri Feb  9 22:08:35 2024
+++ src/sys/dev/pci/if_bge.c	Mon Apr  1 22:56:55 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bge.c,v 1.390 2024/02/09 22:08:35 andvar Exp $	*/
+/*	$NetBSD: if_bge.c,v 1.391 2024/04/01 22:56:55 andvar Exp $	*/
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.390 2024/02/09 22:08:35 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.391 2024/04/01 22:56:55 andvar Exp $");
 
 #include 
 #include 
@@ -5746,7 +5746,7 @@ bge_init_locked(struct ifnet *ifp)
 
 	/* 5718 step 12, 57XX step 37 */
 	/*
-	 * XXX Doucments of 5718 series and 577xx say the recommended value
+	 * XXX Documents of 5718 series and 577xx say the recommended value
 	 * is 1, but tg3 set 1 only on 57765 series.
 	 */
 	if (BGE_IS_57765_PLUS(sc))



CVS commit: src/share/mk

2024-04-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Apr  1 22:23:15 UTC 2024

Modified Files:
src/share/mk: bsd.own.mk

Log Message:
Use the TOOL_GZIP we built as part of tools if available.


To generate a diff of this commit:
cvs rdiff -u -r1.1363 -r1.1364 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/share/mk

2024-04-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Apr  1 22:23:15 UTC 2024

Modified Files:
src/share/mk: bsd.own.mk

Log Message:
Use the TOOL_GZIP we built as part of tools if available.


To generate a diff of this commit:
cvs rdiff -u -r1.1363 -r1.1364 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/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.1363 src/share/mk/bsd.own.mk:1.1364
--- src/share/mk/bsd.own.mk:1.1363	Sat Jan 20 03:09:13 2024
+++ src/share/mk/bsd.own.mk	Mon Apr  1 18:23:14 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.1363 2024/01/20 08:09:13 skrll Exp $
+#	$NetBSD: bsd.own.mk,v 1.1364 2024/04/01 22:23:14 christos Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -1612,7 +1612,11 @@ USE_XZ_SETS?= no
 TOOL_GZIP=		${TOOL_PIGZ}
 GZIP_N_FLAG?=		-nT
 .else
+.if ${USETOOLS} == "yes"
+TOOL_GZIP=		${TOOLDIR}/bin/${_TOOL_PREFIX}gzip
+.else
 TOOL_GZIP=		gzip
+.endif
 GZIP_N_FLAG?=		-n
 .endif
 TOOL_GZIP_N=		${TOOL_GZIP} ${GZIP_N_FLAG}



CVS commit: src/usr.bin/gzip

2024-04-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Apr  1 22:20:58 UTC 2024

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

Log Message:
Handle not having SIGINFO (Jan-Benedict Glaw)


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/usr.bin/gzip/gzip.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/gzip/gzip.c
diff -u src/usr.bin/gzip/gzip.c:1.123 src/usr.bin/gzip/gzip.c:1.124
--- src/usr.bin/gzip/gzip.c:1.123	Sun Mar 31 22:20:52 2024
+++ src/usr.bin/gzip/gzip.c	Mon Apr  1 18:20:58 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: gzip.c,v 1.123 2024/04/01 02:20:52 christos Exp $	*/
+/*	$NetBSD: gzip.c,v 1.124 2024/04/01 22:20:58 christos Exp $	*/
 
 /*
  * Copyright (c) 1997-2024 Matthew R. Green
@@ -34,7 +34,7 @@
 #ifndef lint
 __COPYRIGHT("@(#) Copyright (c) 1997-2024 Matthew R. Green. "
 	"All rights reserved.");
-__RCSID("$NetBSD: gzip.c,v 1.123 2024/04/01 02:20:52 christos Exp $");
+__RCSID("$NetBSD: gzip.c,v 1.124 2024/04/01 22:20:58 christos Exp $");
 #endif /* not lint */
 
 /*
@@ -192,7 +192,9 @@ static	int	qflag;			/* quiet mode */
 static	int	rflag;			/* recursive mode */
 static	int	tflag;			/* test */
 static	int	vflag;			/* verbose mode */
+#ifdef SIGINFO
 static	sig_atomic_t print_info = 0;
+#endif
 #else
 #define		qflag	0
 #define		tflag	0
@@ -244,7 +246,11 @@ static	void	infile_set(const char *newin
 static	off_t	infile_total;		/* total expected to read/write */
 static	off_t	infile_current;		/* current read/write */
 
+#ifdef SIGINFO
 static	void	check_siginfo(void);
+#else
+#define check_siginfo() /* nothing */
+#endif
 static	off_t	cat_fd(unsigned char *, size_t, off_t *, int fd);
 static	void	prepend_gzip(char *, int *, char ***);
 static	void	handle_dir(char *);
@@ -1217,18 +1223,22 @@ unlink_input(const char *file, const str
 	unlink(file);
 }
 
+#ifdef SIGINFO
 static void
 got_siginfo(int signo)
 {
 
 	print_info = 1;
 }
+#endif
 
 static void
 setup_signals(void)
 {
 
+#ifdef SIGINFO
 	signal(SIGINFO, got_siginfo);
+#endif
 }
 
 static	void
@@ -1713,7 +1723,7 @@ file_uncompress(char *file, char *outfil
 	return -1;
 }
 
-#ifndef SMALL
+#ifndef check_siginfo
 static void
 check_siginfo(void)
 {



CVS commit: src/usr.bin/gzip

2024-04-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Apr  1 22:20:58 UTC 2024

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

Log Message:
Handle not having SIGINFO (Jan-Benedict Glaw)


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/usr.bin/gzip/gzip.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/make

2024-04-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Apr  1 12:26:02 UTC 2024

Modified Files:
src/usr.bin/make: parse.c
src/usr.bin/make/unit-tests: directive-for-null.exp
directive-for-null.mk opt-file.exp opt-file.mk

Log Message:
make: exit immediately after reading a null byte from a makefile

The chance of other garbage bytes in such a file is just too high.


To generate a diff of this commit:
cvs rdiff -u -r1.717 -r1.718 src/usr.bin/make/parse.c
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/directive-for-null.exp
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/directive-for-null.mk
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/opt-file.exp
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/make/unit-tests/opt-file.mk

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

Modified files:

Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.717 src/usr.bin/make/parse.c:1.718
--- src/usr.bin/make/parse.c:1.717	Wed Feb  7 06:43:02 2024
+++ src/usr.bin/make/parse.c	Mon Apr  1 12:26:02 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.717 2024/02/07 06:43:02 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.718 2024/04/01 12:26:02 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -105,7 +105,7 @@
 #include "pathnames.h"
 
 /*	"@(#)parse.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: parse.c,v 1.717 2024/02/07 06:43:02 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.718 2024/04/01 12:26:02 rillig Exp $");
 
 /* Detects a multiple-inclusion guard in a makefile. */
 typedef enum {
@@ -2368,7 +2368,7 @@ ParseRawLine(IncludedFile *curFile, char
 		ch = *p;
 		if (ch == '\0' || (ch == '\\' && p[1] == '\0')) {
 			Parse_Error(PARSE_FATAL, "Zero byte read from file");
-			return PRLR_ERROR;
+			exit(2);
 		}
 
 		/* Treat next character after '\' as literal. */

Index: src/usr.bin/make/unit-tests/directive-for-null.exp
diff -u src/usr.bin/make/unit-tests/directive-for-null.exp:1.2 src/usr.bin/make/unit-tests/directive-for-null.exp:1.3
--- src/usr.bin/make/unit-tests/directive-for-null.exp:1.2	Thu Dec  9 20:13:10 2021
+++ src/usr.bin/make/unit-tests/directive-for-null.exp	Mon Apr  1 12:26:02 2024
@@ -1,9 +1,5 @@
 make: "(stdin)" line 2: Zero byte read from file
-make: "(stdin)" line 2: Unexpected end of file in .for loop
-make: "(stdin)" line 3: Zero byte read from file
-make: Fatal errors encountered -- cannot continue
-make: stopped in unit-tests
-*** Error code 1 (continuing)
+*** Error code 2 (continuing)
 
 Stop.
 make: stopped in unit-tests

Index: src/usr.bin/make/unit-tests/directive-for-null.mk
diff -u src/usr.bin/make/unit-tests/directive-for-null.mk:1.3 src/usr.bin/make/unit-tests/directive-for-null.mk:1.4
--- src/usr.bin/make/unit-tests/directive-for-null.mk:1.3	Sun Jun 12 15:03:27 2022
+++ src/usr.bin/make/unit-tests/directive-for-null.mk	Mon Apr  1 12:26:02 2024
@@ -1,18 +1,8 @@
-# $NetBSD: directive-for-null.mk,v 1.3 2022/06/12 15:03:27 rillig Exp $
+# $NetBSD: directive-for-null.mk,v 1.4 2024/04/01 12:26:02 rillig Exp $
 #
 # Test for parsing a .for loop that accidentally contains a null byte.
 #
-# As of 2020-12-19, there are 3 error messages:
-#
-#	make: "(stdin)" line 2: Zero byte read from file
-#	make: "(stdin)" line 2: Unexpected end of file in for loop.
-#	make: "(stdin)" line 3: Zero byte read from file
-#
-# The one about "end of file" might be misleading but is due to the
-# implementation.  On both errors and EOF, ParseRawLine returns NULL.
-#
-# The one about the "zero byte" in line 3 is surprising since the only
-# line that contains a null byte is line 2.
+# expect: make: "(stdin)" line 2: Zero byte read from file
 
 all: .PHONY
 	@printf '%s\n' \

Index: src/usr.bin/make/unit-tests/opt-file.exp
diff -u src/usr.bin/make/unit-tests/opt-file.exp:1.7 src/usr.bin/make/unit-tests/opt-file.exp:1.8
--- src/usr.bin/make/unit-tests/opt-file.exp:1.7	Tue Dec 22 08:51:30 2020
+++ src/usr.bin/make/unit-tests/opt-file.exp	Mon Apr  1 12:26:02 2024
@@ -2,9 +2,7 @@ value
 value
 line-with-trailing-whitespace
 make: "(stdin)" line 1: Zero byte read from file
-make: Fatal errors encountered -- cannot continue
-make: stopped in unit-tests
-*** Error code 1 (continuing)
+*** Error code 2 (continuing)
 `all' not remade because of errors.
 
 Stop.

Index: src/usr.bin/make/unit-tests/opt-file.mk
diff -u src/usr.bin/make/unit-tests/opt-file.mk:1.15 src/usr.bin/make/unit-tests/opt-file.mk:1.16
--- src/usr.bin/make/unit-tests/opt-file.mk:1.15	Sat Mar 26 13:32:31 2022
+++ src/usr.bin/make/unit-tests/opt-file.mk	Mon Apr  1 12:26:02 2024
@@ -1,4 +1,4 @@
-# $NetBSD: opt-file.mk,v 1.15 2022/03/26 13:32:31 rillig Exp $
+# $NetBSD: opt-file.mk,v 1.16 2024/04/01 12:26:02 rillig Exp $
 #
 # Tests for the -f command line option, which adds a makefile to the list of
 # files that are parsed.
@@ -79,7 +79,7 @@ line-with-trailing-whitespace: .PHONY
 #	exit status 0
 #
 #	2008 to 2010:
-#	make: 

CVS commit: src/usr.bin/make

2024-04-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Apr  1 12:26:02 UTC 2024

Modified Files:
src/usr.bin/make: parse.c
src/usr.bin/make/unit-tests: directive-for-null.exp
directive-for-null.mk opt-file.exp opt-file.mk

Log Message:
make: exit immediately after reading a null byte from a makefile

The chance of other garbage bytes in such a file is just too high.


To generate a diff of this commit:
cvs rdiff -u -r1.717 -r1.718 src/usr.bin/make/parse.c
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/directive-for-null.exp
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/directive-for-null.mk
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/opt-file.exp
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/make/unit-tests/opt-file.mk

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



CVS commit: src

2024-04-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Apr  1 18:33:24 UTC 2024

Modified Files:
src/external/bsd/elftoolchain/dist/libelf: _libelf_config.h libelf.h
src/external/bsd/elftoolchain/lib/libdwarf: Makefile
src/external/cddl/osnet/dist/lib/libdtrace/common: drti.c dt_module.c
src/external/cddl/osnet/sys: elf.h
src/external/cddl/osnet/sys/sys: elf.h
src/tests/lib/libc/sys: t_ptrace_wait.c
src/tools/ctfconvert: Makefile
src/tools/ctfmerge: Makefile
src/tools/elftoolchain/libdwarf: Makefile
src/tools/elftoolchain/libelf: Makefile
src/tools/libctf: Makefile
src/usr.bin/kdump: Makefile.ioctl-c
src/usr.sbin/tprof: ksyms.c

Log Message:
elftoolchain: Be consistent about which ELF header files we use.

1. For tools that use elftoolchain: always use elftoolchain's
   elfdefinitions.h.  Don't even think about looking at the host's
   sys/exec_elf.h, which makes no sense and should never happen.

   (ELF tools that don't use elftoolchain, like m68k-elf2coff,
   continue to use nbincludes/sys/exec_elf.h.  But no more nbincludes
   hacks in elftoolchain.)

2. For kernel components (solaris, zfs, dtrace): always use
   sys/exec_elf.h, even in Solaris components via sys/elf.h.
   elfdefinitions.h is not wired up in the kernel build at all.

3. For most userland components that involve libelf: use
   elfdefinitions.h via libelf header files (libelf.h, gelf.h).

   libdtrace in particular requires _all_ R_* reloc type definitions,
   but sys/exec_elf.h brings in only the _current machine's_ R_*
   reloc type definitions.  (While here: Use uintptr_t instead of
   Elf_Addr for pointer-to-integer cast, since Elf_Addr is MD and
   provided only by sys/exec_elf.h, not by elfdefinitions.h.)

   And most userland components using libelf don't rely on any
   properties of the current machine from sys/exec_elf.h, so they can
   use libelf's elfdefinition.h.

   Exceptions:

   - dtrace drti.c relies on link.h -> link_elf.h -> sys/exec_elf.h,
 but it also relies on sys/dtrace.h -> sys/elf.h ->
 elfdefinitions.h like other userland components using sys/elf.h.

   - kdump-ioctl.c uses sys/exec_elf.h directly and sys/dtrace.h ->
 sys/elf.h -> elfdefinitions like other userland components using
 sys/elf.h.

   - t_ptrace_wait.c (via t_ptrace_core_wait.h) uses libelf to parse
 core files, but relies on sys/exec_elf.h for struct
 netbsd_elfcore_procinfo.

   None of these exceptions needs all R_* reloc type definitions, so
   as a workaround, we can just suppress libelf's elfdefinitions.h by
   defining _SYS_ELFDEFINITIONS_H_ and use sys/exec_elf.h in these
   exceptions.

And undo the whole BUILTIN_ELF_HEADERS mistake.  This was:

- half bogus workarounds for missing build_install dependencies in
  tools/Makefile, which are no longer missing now, and
- half futile attempt to use src/sys/sys/exec_elf.h via nbincludes in
  tools involving libelf instead of libelf's elfdefinitions.h, which
  collides.

Longer-term, we may wish to unify sys/exec_elf.h and libelf's
elfdefinitions.h, so we don't have to play these games.

But at least now the games are limited to three .c files (one of
which is generated by Makefile.ioctl-c), rather than haphazardly
applied tree-wide by monstrous kludges in widely used .h files with
broken hackarounds to get the tools build lurching to completion.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
src/external/bsd/elftoolchain/dist/libelf/_libelf_config.h \
src/external/bsd/elftoolchain/dist/libelf/libelf.h
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/elftoolchain/lib/libdwarf/Makefile
cvs rdiff -u -r1.8 -r1.9 \
src/external/cddl/osnet/dist/lib/libdtrace/common/drti.c
cvs rdiff -u -r1.18 -r1.19 \
src/external/cddl/osnet/dist/lib/libdtrace/common/dt_module.c
cvs rdiff -u -r1.1 -r1.2 src/external/cddl/osnet/sys/elf.h
cvs rdiff -u -r1.6 -r1.7 src/external/cddl/osnet/sys/sys/elf.h
cvs rdiff -u -r1.191 -r1.192 src/tests/lib/libc/sys/t_ptrace_wait.c
cvs rdiff -u -r1.10 -r1.11 src/tools/ctfconvert/Makefile
cvs rdiff -u -r1.11 -r1.12 src/tools/ctfmerge/Makefile
cvs rdiff -u -r1.6 -r1.7 src/tools/elftoolchain/libdwarf/Makefile
cvs rdiff -u -r1.2 -r1.3 src/tools/elftoolchain/libelf/Makefile
cvs rdiff -u -r1.9 -r1.10 src/tools/libctf/Makefile
cvs rdiff -u -r1.39 -r1.40 src/usr.bin/kdump/Makefile.ioctl-c
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/tprof/ksyms.c

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



CVS commit: src

2024-04-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Apr  1 18:33:24 UTC 2024

Modified Files:
src/external/bsd/elftoolchain/dist/libelf: _libelf_config.h libelf.h
src/external/bsd/elftoolchain/lib/libdwarf: Makefile
src/external/cddl/osnet/dist/lib/libdtrace/common: drti.c dt_module.c
src/external/cddl/osnet/sys: elf.h
src/external/cddl/osnet/sys/sys: elf.h
src/tests/lib/libc/sys: t_ptrace_wait.c
src/tools/ctfconvert: Makefile
src/tools/ctfmerge: Makefile
src/tools/elftoolchain/libdwarf: Makefile
src/tools/elftoolchain/libelf: Makefile
src/tools/libctf: Makefile
src/usr.bin/kdump: Makefile.ioctl-c
src/usr.sbin/tprof: ksyms.c

Log Message:
elftoolchain: Be consistent about which ELF header files we use.

1. For tools that use elftoolchain: always use elftoolchain's
   elfdefinitions.h.  Don't even think about looking at the host's
   sys/exec_elf.h, which makes no sense and should never happen.

   (ELF tools that don't use elftoolchain, like m68k-elf2coff,
   continue to use nbincludes/sys/exec_elf.h.  But no more nbincludes
   hacks in elftoolchain.)

2. For kernel components (solaris, zfs, dtrace): always use
   sys/exec_elf.h, even in Solaris components via sys/elf.h.
   elfdefinitions.h is not wired up in the kernel build at all.

3. For most userland components that involve libelf: use
   elfdefinitions.h via libelf header files (libelf.h, gelf.h).

   libdtrace in particular requires _all_ R_* reloc type definitions,
   but sys/exec_elf.h brings in only the _current machine's_ R_*
   reloc type definitions.  (While here: Use uintptr_t instead of
   Elf_Addr for pointer-to-integer cast, since Elf_Addr is MD and
   provided only by sys/exec_elf.h, not by elfdefinitions.h.)

   And most userland components using libelf don't rely on any
   properties of the current machine from sys/exec_elf.h, so they can
   use libelf's elfdefinition.h.

   Exceptions:

   - dtrace drti.c relies on link.h -> link_elf.h -> sys/exec_elf.h,
 but it also relies on sys/dtrace.h -> sys/elf.h ->
 elfdefinitions.h like other userland components using sys/elf.h.

   - kdump-ioctl.c uses sys/exec_elf.h directly and sys/dtrace.h ->
 sys/elf.h -> elfdefinitions like other userland components using
 sys/elf.h.

   - t_ptrace_wait.c (via t_ptrace_core_wait.h) uses libelf to parse
 core files, but relies on sys/exec_elf.h for struct
 netbsd_elfcore_procinfo.

   None of these exceptions needs all R_* reloc type definitions, so
   as a workaround, we can just suppress libelf's elfdefinitions.h by
   defining _SYS_ELFDEFINITIONS_H_ and use sys/exec_elf.h in these
   exceptions.

And undo the whole BUILTIN_ELF_HEADERS mistake.  This was:

- half bogus workarounds for missing build_install dependencies in
  tools/Makefile, which are no longer missing now, and
- half futile attempt to use src/sys/sys/exec_elf.h via nbincludes in
  tools involving libelf instead of libelf's elfdefinitions.h, which
  collides.

Longer-term, we may wish to unify sys/exec_elf.h and libelf's
elfdefinitions.h, so we don't have to play these games.

But at least now the games are limited to three .c files (one of
which is generated by Makefile.ioctl-c), rather than haphazardly
applied tree-wide by monstrous kludges in widely used .h files with
broken hackarounds to get the tools build lurching to completion.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
src/external/bsd/elftoolchain/dist/libelf/_libelf_config.h \
src/external/bsd/elftoolchain/dist/libelf/libelf.h
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/elftoolchain/lib/libdwarf/Makefile
cvs rdiff -u -r1.8 -r1.9 \
src/external/cddl/osnet/dist/lib/libdtrace/common/drti.c
cvs rdiff -u -r1.18 -r1.19 \
src/external/cddl/osnet/dist/lib/libdtrace/common/dt_module.c
cvs rdiff -u -r1.1 -r1.2 src/external/cddl/osnet/sys/elf.h
cvs rdiff -u -r1.6 -r1.7 src/external/cddl/osnet/sys/sys/elf.h
cvs rdiff -u -r1.191 -r1.192 src/tests/lib/libc/sys/t_ptrace_wait.c
cvs rdiff -u -r1.10 -r1.11 src/tools/ctfconvert/Makefile
cvs rdiff -u -r1.11 -r1.12 src/tools/ctfmerge/Makefile
cvs rdiff -u -r1.6 -r1.7 src/tools/elftoolchain/libdwarf/Makefile
cvs rdiff -u -r1.2 -r1.3 src/tools/elftoolchain/libelf/Makefile
cvs rdiff -u -r1.9 -r1.10 src/tools/libctf/Makefile
cvs rdiff -u -r1.39 -r1.40 src/usr.bin/kdump/Makefile.ioctl-c
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/tprof/ksyms.c

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

Modified files:

Index: src/external/bsd/elftoolchain/dist/libelf/_libelf_config.h
diff -u src/external/bsd/elftoolchain/dist/libelf/_libelf_config.h:1.6 src/external/bsd/elftoolchain/dist/libelf/_libelf_config.h:1.7
--- src/external/bsd/elftoolchain/dist/libelf/_libelf_config.h:1.6	Sun Mar  3 17:37:33 2024
+++ src/external/bsd/elftoolchain/dist/libelf/_libelf_config.h	Mon Apr  1 

CVS commit: src/common/lib/libutil

2024-04-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Apr  1 08:53:42 UTC 2024

Modified Files:
src/common/lib/libutil: snprintb.c

Log Message:
snprintb: remove redundant memset in kernel mode

The provided buffer is already null-terminated by finish_buffer, even in
error cases, there is no need to repeat the same work.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/common/lib/libutil/snprintb.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/libutil/snprintb.c
diff -u src/common/lib/libutil/snprintb.c:1.44 src/common/lib/libutil/snprintb.c:1.45
--- src/common/lib/libutil/snprintb.c:1.44	Mon Mar 25 20:39:26 2024
+++ src/common/lib/libutil/snprintb.c	Mon Apr  1 08:53:42 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: snprintb.c,v 1.44 2024/03/25 20:39:26 rillig Exp $	*/
+/*	$NetBSD: snprintb.c,v 1.45 2024/04/01 08:53:42 rillig Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2024 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #  include 
 #  if defined(LIBC_SCCS)
-__RCSID("$NetBSD: snprintb.c,v 1.44 2024/03/25 20:39:26 rillig Exp $");
+__RCSID("$NetBSD: snprintb.c,v 1.45 2024/04/01 08:53:42 rillig Exp $");
 #  endif
 
 #  include 
@@ -46,7 +46,7 @@ __RCSID("$NetBSD: snprintb.c,v 1.44 2024
 #  include 
 # else /* ! _KERNEL */
 #  include 
-__KERNEL_RCSID(0, "$NetBSD: snprintb.c,v 1.44 2024/03/25 20:39:26 rillig Exp $");
+__KERNEL_RCSID(0, "$NetBSD: snprintb.c,v 1.45 2024/04/01 08:53:42 rillig Exp $");
 #  include 
 #  include 
 #  include 
@@ -251,15 +251,6 @@ int
 snprintb_m(char *buf, size_t bufsize, const char *bitfmt, uint64_t val,
 	   size_t line_max)
 {
-#ifdef _KERNEL
-	/*
-	 * For safety; no other *s*printf() do this, but in the kernel
-	 * we don't usually check the return value.
-	 */
-	if (bufsize > 0)
-		(void)memset(buf, 0, bufsize);
-#endif /* _KERNEL */
-
 	int old = *bitfmt != '\177';
 	if (!old)
 		bitfmt++;



CVS commit: src/common/lib/libutil

2024-04-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Apr  1 08:53:42 UTC 2024

Modified Files:
src/common/lib/libutil: snprintb.c

Log Message:
snprintb: remove redundant memset in kernel mode

The provided buffer is already null-terminated by finish_buffer, even in
error cases, there is no need to repeat the same work.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/common/lib/libutil/snprintb.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/hppa/dev

2024-04-01 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Apr  1 09:48:58 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c

Log Message:
make gftfb_restore_palette() grab the default colour map from rasops instead
of just writing the driver's map into the hardware ( which may have been
modified by the likes of wsfb )
With this we get a readable console even when exiting X in a less than
graceful manner.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/hppa/dev/gftfb.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/hppa/dev

2024-04-01 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Apr  1 09:48:58 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c

Log Message:
make gftfb_restore_palette() grab the default colour map from rasops instead
of just writing the driver's map into the hardware ( which may have been
modified by the likes of wsfb )
With this we get a readable console even when exiting X in a less than
graceful manner.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/hppa/dev/gftfb.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/hppa/dev/gftfb.c
diff -u src/sys/arch/hppa/dev/gftfb.c:1.12 src/sys/arch/hppa/dev/gftfb.c:1.13
--- src/sys/arch/hppa/dev/gftfb.c:1.12	Thu Mar 28 12:50:31 2024
+++ src/sys/arch/hppa/dev/gftfb.c	Mon Apr  1 09:48:58 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: gftfb.c,v 1.12 2024/03/28 12:50:31 macallan Exp $	*/
+/*	$NetBSD: gftfb.c,v 1.13 2024/04/01 09:48:58 macallan Exp $	*/
 
 /*	$OpenBSD: sti_pci.c,v 1.7 2009/02/06 22:51:04 miod Exp $	*/
 
@@ -212,8 +212,7 @@ gftfb_attach(device_t parent, device_t s
 	struct rasops_info *ri;
 	struct wsemuldisplaydev_attach_args aa;
 	unsigned long defattr = 0;
-	int ret, is_console = 0, i, j;
-	uint8_t cmap[768];
+	int ret, is_console = 0;
 
 	sc->sc_dev = self;
 
@@ -329,15 +328,7 @@ gftfb_attach(device_t parent, device_t s
 defattr);
 	}
 
-	j = 0;
-	rasops_get_cmap(ri, cmap, sizeof(cmap));
-	for (i = 0; i < 256; i++) {
-		sc->sc_cmap_red[i] = cmap[j];
-		sc->sc_cmap_green[i] = cmap[j + 1];
-		sc->sc_cmap_blue[i] = cmap[j + 2];
-		gftfb_putpalreg(sc, i, cmap[j], cmap[j + 1], cmap[j + 2]);
-		j += 3;
-	}
+	gftfb_restore_palette(sc);
 
 	/* no suspend/resume support yet */
 	if (!pmf_device_register(sc->sc_dev, NULL, NULL))
@@ -1008,11 +999,17 @@ gftfb_getcmap(struct gftfb_softc *sc, st
 static void
 gftfb_restore_palette(struct gftfb_softc *sc)
 {
-	int i;
+	uint8_t cmap[768];
+	int i, j;
 
+	j = 0;
+	rasops_get_cmap(>sc_console_screen.scr_ri, cmap, sizeof(cmap));
 	for (i = 0; i < 256; i++) {
-		gftfb_putpalreg(sc, i, sc->sc_cmap_red[i],
-		sc->sc_cmap_green[i], sc->sc_cmap_blue[i]);
+		sc->sc_cmap_red[i] = cmap[j];
+		sc->sc_cmap_green[i] = cmap[j + 1];
+		sc->sc_cmap_blue[i] = cmap[j + 2];
+		gftfb_putpalreg(sc, i, cmap[j], cmap[j + 1], cmap[j + 2]);
+		j += 3;
 	}
 }
 



CVS commit: src/usr.bin/make

2024-04-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Apr  1 12:33:28 UTC 2024

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

Log Message:
make: remove unreachable code in handling .for loops


To generate a diff of this commit:
cvs rdiff -u -r1.178 -r1.179 src/usr.bin/make/for.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/make

2024-04-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Apr  1 12:33:28 UTC 2024

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

Log Message:
make: remove unreachable code in handling .for loops


To generate a diff of this commit:
cvs rdiff -u -r1.178 -r1.179 src/usr.bin/make/for.c

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

Modified files:

Index: src/usr.bin/make/for.c
diff -u src/usr.bin/make/for.c:1.178 src/usr.bin/make/for.c:1.179
--- src/usr.bin/make/for.c:1.178	Sun Jan 21 15:02:17 2024
+++ src/usr.bin/make/for.c	Mon Apr  1 12:33:27 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: for.c,v 1.178 2024/01/21 15:02:17 rillig Exp $	*/
+/*	$NetBSD: for.c,v 1.179 2024/04/01 12:33:27 rillig Exp $	*/
 
 /*
  * Copyright (c) 1992, The Regents of the University of California.
@@ -58,7 +58,7 @@
 #include "make.h"
 
 /*	"@(#)for.c	8.1 (Berkeley) 6/6/93"	*/
-MAKE_RCSID("$NetBSD: for.c,v 1.178 2024/01/21 15:02:17 rillig Exp $");
+MAKE_RCSID("$NetBSD: for.c,v 1.179 2024/04/01 12:33:27 rillig Exp $");
 
 
 typedef struct ForLoop {
@@ -196,11 +196,7 @@ ForLoop_ParseItems(ForLoop *f, const cha
 	cpp_skip_whitespace();
 
 	items = Var_Subst(p, SCOPE_GLOBAL, VARE_WANTRES);
-	if (items == var_Error) {
-		/* TODO: Make this part of the code reachable. */
-		Parse_Error(PARSE_FATAL, "Error in .for loop items");
-		return false;
-	}
+	/* TODO: handle errors */
 
 	f->items = Substring_Words(items, false);
 	free(items);
@@ -490,12 +486,11 @@ ForLoop_SubstBody(ForLoop *f, unsigned i
 			p += 2;
 			ForLoop_SubstVarLong(f, firstItem, body,
 			, endc, );
-		} else if (p[1] != '\0') {
+		} else {
 			ForLoop_SubstVarShort(f, firstItem, body,
 			p + 1, );
 			p += 2;
-		} else
-			break;
+		}
 	}
 
 	Buf_AddRange(body, mark, end);



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

2024-04-01 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Mon Apr  1 15:52:08 UTC 2024

Modified Files:
src/sys/arch/arm/ti: ti_gpio.c

Log Message:
ti_gpio: add gpio(4) interrupt support

tested with gpiopps(4) on Beagle Bone Black


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/ti/ti_gpio.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/arm/ti

2024-04-01 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Mon Apr  1 15:52:08 UTC 2024

Modified Files:
src/sys/arch/arm/ti: ti_gpio.c

Log Message:
ti_gpio: add gpio(4) interrupt support

tested with gpiopps(4) on Beagle Bone Black


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/ti/ti_gpio.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/ti/ti_gpio.c
diff -u src/sys/arch/arm/ti/ti_gpio.c:1.14 src/sys/arch/arm/ti/ti_gpio.c:1.15
--- src/sys/arch/arm/ti/ti_gpio.c:1.14	Sat Aug  7 16:18:46 2021
+++ src/sys/arch/arm/ti/ti_gpio.c	Mon Apr  1 15:52:08 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: ti_gpio.c,v 1.14 2021/08/07 16:18:46 thorpej Exp $ */
+/* $NetBSD: ti_gpio.c,v 1.15 2024/04/01 15:52:08 jakllsch Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ti_gpio.c,v 1.14 2021/08/07 16:18:46 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ti_gpio.c,v 1.15 2024/04/01 15:52:08 jakllsch Exp $");
 
 #include 
 #include 
@@ -262,10 +262,8 @@ static struct fdtbus_gpio_controller_fun
 };
 
 static void
-ti_gpio_intr_disestablish(device_t dev, void *ih)
+ti_gpio_intr_disable(struct ti_gpio_softc * const sc, struct ti_gpio_intr * const intr)
 {
-	struct ti_gpio_softc * const sc = device_private(dev);
-	struct ti_gpio_intr *intr = ih;
 	const u_int pin = intr->intr_pin;
 	const uint32_t pin_mask = __BIT(pin);
 	uint32_t val;
@@ -280,6 +278,7 @@ ti_gpio_intr_disestablish(device_t dev, 
 
 	intr->intr_func = NULL;
 	intr->intr_arg = NULL;
+	intr->intr_mpsafe = false;
 }
 
 static void *
@@ -359,6 +358,15 @@ ti_gpio_intr_establish(device_t dev, u_i
 	return >sc_intr[pin];
 }
 
+static void
+ti_gpio_intr_disestablish(device_t dev, void *ih)
+{
+	struct ti_gpio_softc * const sc = device_private(dev);
+	struct ti_gpio_intr * const intr = ih;
+	
+	ti_gpio_intr_disable(sc, intr);
+}
+
 static bool
 ti_gpio_intrstr(device_t dev, u_int *specifier, char *buf, size_t buflen)
 {
@@ -423,6 +431,106 @@ ti_gpio_pin_ctl(void *priv, int pin, int
 	mutex_exit(>sc_lock);
 }
 
+static void *
+ti_gpio_gp_intr_establish(void *vsc, int pin, int ipl, int irqmode,
+int (*func)(void *), void *arg)
+{
+	struct ti_gpio_softc * const sc = vsc;
+	uint32_t val;
+
+	if (ipl != IPL_VM || pin < 0 || pin >= __arraycount(sc->sc_pins))
+		return NULL;
+
+	if (sc->sc_intr[pin].intr_func != NULL)
+		return NULL;
+
+	/*
+	 * Enabling both high and low level triggers will cause the GPIO
+	 * controller to always assert the interrupt.
+	 */
+	if ((irqmode & (GPIO_INTR_LOW_LEVEL|GPIO_INTR_HIGH_LEVEL)) ==
+	(GPIO_INTR_LOW_LEVEL|GPIO_INTR_HIGH_LEVEL))
+		return NULL;
+
+	/* Set pin as input */
+	mutex_enter(>sc_lock);
+	if (ti_gpio_ctl(sc, pin, GPIO_PIN_INPUT) != 0) {
+		mutex_exit(>sc_lock);
+		return NULL;
+	}
+
+	sc->sc_intr[pin].intr_pin = pin;
+	sc->sc_intr[pin].intr_func = func;
+	sc->sc_intr[pin].intr_arg = arg;
+	sc->sc_intr[pin].intr_mpsafe = (irqmode & GPIO_INTR_MPSAFE) != 0;
+
+	const uint32_t pin_mask = __BIT(pin);
+
+	/* Configure triggers */
+	val = RD4(sc, GPIO_LEVELDETECT0);
+	if ((irqmode & GPIO_INTR_LOW_LEVEL) != 0)
+		val |= pin_mask;
+	else
+		val &= ~pin_mask;
+	WR4(sc, GPIO_LEVELDETECT0, val);
+
+	val = RD4(sc, GPIO_LEVELDETECT1);
+	if ((irqmode & GPIO_INTR_HIGH_LEVEL) != 0)
+		val |= pin_mask;
+	else
+		val &= ~pin_mask;
+	WR4(sc, GPIO_LEVELDETECT1, val);
+
+	val = RD4(sc, GPIO_RISINGDETECT);
+	if ((irqmode & GPIO_INTR_POS_EDGE) != 0 ||
+	(irqmode & GPIO_INTR_DOUBLE_EDGE) != 0)
+		val |= pin_mask;
+	else
+		val &= ~pin_mask;
+	WR4(sc, GPIO_RISINGDETECT, val);
+
+	val = RD4(sc, GPIO_FALLINGDETECT);
+	if ((irqmode & GPIO_INTR_NEG_EDGE) != 0 ||
+	(irqmode & GPIO_INTR_DOUBLE_EDGE) != 0)
+		val |= pin_mask;
+	else
+		val &= ~pin_mask;
+	WR4(sc, GPIO_FALLINGDETECT, val);
+
+	/* Enable interrupts */
+	if (sc->sc_type == TI_GPIO_OMAP3) {
+		val = RD4(sc, GPIO_IRQENABLE1);
+		WR4(sc, GPIO_IRQENABLE1, val | pin_mask);
+	} else {
+		WR4(sc, GPIO_IRQENABLE1_SET, pin_mask);
+	}
+
+	mutex_exit(>sc_lock);
+	
+	return >sc_intr[pin];
+}
+
+static void
+ti_gpio_gp_intr_disestablish(void *vsc, void *ih)
+{
+	struct ti_gpio_softc * const sc = vsc;
+	struct ti_gpio_intr * const intr = ih;
+
+	ti_gpio_intr_disable(sc, intr);
+}
+
+static bool
+ti_gpio_gp_intrstr(void *vsc, int pin, int irqmode, char *buf, size_t buflen)
+{
+	struct ti_gpio_softc * const sc = vsc;
+
+	if (pin < 0 || pin >= TI_GPIO_NPINS)
+		return false;
+
+	snprintf(buf, buflen, "%s pin %d", sc->sc_modname, pin);
+	return true;
+}
+
 static void
 ti_gpio_attach_ports(struct ti_gpio_softc *sc)
 {
@@ -434,10 +542,17 @@ ti_gpio_attach_ports(struct ti_gpio_soft
 	gp->gp_pin_read = ti_gpio_pin_read;
 	gp->gp_pin_write = ti_gpio_pin_write;
 	gp->gp_pin_ctl = ti_gpio_pin_ctl;
+	gp->gp_intr_establish = ti_gpio_gp_intr_establish;
+	gp->gp_intr_disestablish = ti_gpio_gp_intr_disestablish;
+	

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

2024-04-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Apr  1 16:24:01 UTC 2024

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

Log Message:
Return the correct error from {fetch,store}_user_data and fix

futex_wake_op_op: [0.273033s] Failed: 
/usr/src/tests/lib/libc/sys/t_futex_ops.c:942: Expected errno 14, got 1, in 
__futex(_word, FUTEX_WAKE_OP | flags, 0, NULL, NULL, 0, op) == -1


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/riscv/riscv/trap.c

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

Modified files:

Index: src/sys/arch/riscv/riscv/trap.c
diff -u src/sys/arch/riscv/riscv/trap.c:1.24 src/sys/arch/riscv/riscv/trap.c:1.25
--- src/sys/arch/riscv/riscv/trap.c:1.24	Thu Sep  7 12:48:49 2023
+++ src/sys/arch/riscv/riscv/trap.c	Mon Apr  1 16:24:01 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.24 2023/09/07 12:48:49 skrll Exp $	*/
+/*	$NetBSD: trap.c,v 1.25 2024/04/01 16:24:01 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #define	__PMAP_PRIVATE
 #define	__UFETCHSTORE_PRIVATE
 
-__RCSID("$NetBSD: trap.c,v 1.24 2023/09/07 12:48:49 skrll Exp $");
+__RCSID("$NetBSD: trap.c,v 1.25 2024/04/01 16:24:01 skrll Exp $");
 
 #include 
 
@@ -672,7 +672,7 @@ fetch_user_data(const void *uaddr, void 
 	if (__predict_false(uva > VM_MAXUSER_ADDRESS - size))
 		return EFAULT;
 
-	if ((error = cpu_set_onfault(, 1)) != 0)
+	if ((error = cpu_set_onfault(, EFAULT)) != 0)
 		return error;
 
 	csr_sstatus_set(SR_SUM);
@@ -737,7 +737,7 @@ store_user_data(void *uaddr, const void 
 	if (__predict_false(uva > VM_MAXUSER_ADDRESS - size))
 		return EFAULT;
 
-	if ((error = cpu_set_onfault(, 1)) != 0)
+	if ((error = cpu_set_onfault(, EFAULT)) != 0)
 		return error;
 
 	csr_sstatus_set(SR_SUM);



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

2024-04-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Apr  1 16:24:01 UTC 2024

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

Log Message:
Return the correct error from {fetch,store}_user_data and fix

futex_wake_op_op: [0.273033s] Failed: 
/usr/src/tests/lib/libc/sys/t_futex_ops.c:942: Expected errno 14, got 1, in 
__futex(_word, FUTEX_WAKE_OP | flags, 0, NULL, NULL, 0, op) == -1


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/riscv/riscv/trap.c

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



CVS commit: src/tests/lib/libutil

2024-04-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Apr  1 09:15:51 UTC 2024

Modified Files:
src/tests/lib/libutil: t_snprintb.c

Log Message:
tests/snprintb_m: test null-terminated output in error case

While here, clean up the buffer handling for the visualized array
content in case of a failed test.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/tests/lib/libutil/t_snprintb.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/libutil/t_snprintb.c
diff -u src/tests/lib/libutil/t_snprintb.c:1.31 src/tests/lib/libutil/t_snprintb.c:1.32
--- src/tests/lib/libutil/t_snprintb.c:1.31	Mon Mar 25 20:39:27 2024
+++ src/tests/lib/libutil/t_snprintb.c	Mon Apr  1 09:15:51 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: t_snprintb.c,v 1.31 2024/03/25 20:39:27 rillig Exp $ */
+/* $NetBSD: t_snprintb.c,v 1.32 2024/04/01 09:15:51 rillig Exp $ */
 
 /*
  * Copyright (c) 2002, 2004, 2008, 2010, 2024 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #include 
 __COPYRIGHT("@(#) Copyright (c) 2008, 2010, 2024\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_snprintb.c,v 1.31 2024/03/25 20:39:27 rillig Exp $");
+__RCSID("$NetBSD: t_snprintb.c,v 1.32 2024/04/01 09:15:51 rillig Exp $");
 
 #include 
 #include 
@@ -42,19 +42,16 @@ __RCSID("$NetBSD: t_snprintb.c,v 1.31 20
 #include 
 
 static const char *
-vis_arr(const char *arr, size_t arrsize)
+vis_arr(char *buf, size_t bufsize, const char *arr, size_t arrsize)
 {
-	static char buf[3][1024];
-	static size_t i;
-
-	i = (i + 1) % (sizeof(buf) / sizeof(buf[0]));
-	int rv = strnvisx(buf[i] + 1, sizeof(buf[i]) - 2, arr, arrsize,
+	ATF_REQUIRE(bufsize >= 2);
+	int rv = strnvisx(buf + 1, bufsize - 2, arr, arrsize,
 	VIS_WHITE | VIS_OCTAL);
 	ATF_REQUIRE_MSG(rv >= 0, "buffer too small for size %zu", arrsize);
-	buf[i][0] = '"';
-	buf[i][1 + rv] = '"';
-	buf[i][1 + rv + 1] = '\0';
-	return buf[i];
+	buf[0] = '"';
+	buf[1 + rv] = '"';
+	buf[1 + rv + 1] = '\0';
+	return buf;
 }
 
 static void
@@ -63,7 +60,7 @@ check_snprintb_m(const char *file, size_
 size_t line_max,
 int want_rv, const char *want_buf, size_t want_bufsize)
 {
-	char buf[1024];
+	char buf[1024], vis_bitfmt[1024], vis_want_buf[1024], vis_buf[1024];
 
 	ATF_REQUIRE(bufsize <= sizeof(buf));
 	ATF_REQUIRE(want_bufsize <= sizeof(buf));
@@ -103,11 +100,12 @@ check_snprintb_m(const char *file, size_
 	"\twant: %d bytes %s\n"
 	"\thave: %d bytes %s\n",
 	file, line,
-	vis_arr(bitfmt, bitfmtlen),
+	vis_arr(vis_bitfmt, sizeof(vis_bitfmt), bitfmt, bitfmtlen),
 	(uintmax_t)val,
 	line_max,
-	want_rv, vis_arr(want_buf, want_bufsize),
-	rv, vis_arr(buf, have_bufsize));
+	want_rv, vis_arr(vis_want_buf, sizeof(vis_want_buf),
+		want_buf, want_bufsize),
+	rv, vis_arr(vis_buf, sizeof(vis_buf), buf, have_bufsize));
 }
 
 #define	h_snprintb_m_len(bufsize, bitfmt, val, line_max,		\
@@ -1501,6 +1499,15 @@ ATF_TC_BODY(snprintb_m, tc)
 	"0x800f0701\0"
 	"0x800f0701\0");
 
+	// new style, missing number base
+	h_snprintb_m_len(
+	1024,
+	"\177",
+	0xff,
+	128,
+	-1,
+	"#\0");
+
 	// new style, buffer too small for complete number in line 2
 	h_snprintb_m_len(
 	15,



CVS commit: src/tests/lib/libutil

2024-04-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Apr  1 09:15:51 UTC 2024

Modified Files:
src/tests/lib/libutil: t_snprintb.c

Log Message:
tests/snprintb_m: test null-terminated output in error case

While here, clean up the buffer handling for the visualized array
content in case of a failed test.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/tests/lib/libutil/t_snprintb.c

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