CVS commit: src/include/arpa

2022-04-20 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Thu Apr 21 04:03:54 UTC 2022

Modified Files:
src/include/arpa: nameser_compat.h

Log Message:
nameser_compat.h: simplify logic to determine byte order

There's really no need for all the complex #ifdefs present and, on top
of that, it didn't even work correctly for all NetBSD architectures.
Simply use endian.h and drop the rest. (Since there is no upstream for
this code anymore, there's no concern about complicating future merges,
either. This change is also consistent with what FreeBSD and OpenBSD
did years ago.)

Addresses PR toolchain/53880 (reported by maya@, originally encountered
by me on macppc when building a package that pulls in nameser_compat.h
before nameser.h by necessity -- necessity, that is, on another OS).


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/include/arpa/nameser_compat.h

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



CVS commit: src/include/arpa

2022-04-20 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Thu Apr 21 04:03:54 UTC 2022

Modified Files:
src/include/arpa: nameser_compat.h

Log Message:
nameser_compat.h: simplify logic to determine byte order

There's really no need for all the complex #ifdefs present and, on top
of that, it didn't even work correctly for all NetBSD architectures.
Simply use endian.h and drop the rest. (Since there is no upstream for
this code anymore, there's no concern about complicating future merges,
either. This change is also consistent with what FreeBSD and OpenBSD
did years ago.)

Addresses PR toolchain/53880 (reported by maya@, originally encountered
by me on macppc when building a package that pulls in nameser_compat.h
before nameser.h by necessity -- necessity, that is, on another OS).


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/include/arpa/nameser_compat.h

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

Modified files:

Index: src/include/arpa/nameser_compat.h
diff -u src/include/arpa/nameser_compat.h:1.8 src/include/arpa/nameser_compat.h:1.9
--- src/include/arpa/nameser_compat.h:1.8	Wed Nov 18 12:49:52 2020
+++ src/include/arpa/nameser_compat.h	Thu Apr 21 04:03:54 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: nameser_compat.h,v 1.8 2020/11/18 12:49:52 is Exp $	*/
+/*	$NetBSD: nameser_compat.h,v 1.9 2022/04/21 04:03:54 gutteridge Exp $	*/
 
 /* Copyright (c) 1983, 1989
  *The Regents of the University of California.  All rights reserved.
@@ -36,53 +36,19 @@
 #ifndef _ARPA_NAMESER_COMPAT_
 #define	_ARPA_NAMESER_COMPAT_
 
-#define	__BIND		19950621	/*%< (DEAD) interface version stamp. */
+#include 
 
-#ifndef BYTE_ORDER
-#if (BSD >= 199103)
-# include 
-#else
-#ifdef __linux
-# include 
-#else
-#define	LITTLE_ENDIAN	1234	/*%< least-significant byte first (vax, pc) */
-#define	BIG_ENDIAN	4321	/*%< most-significant byte first (IBM, net) */
-#define	PDP_ENDIAN	3412	/*%< LSB first in word, MSW first in long (pdp) */
-
-#if defined(vax) || defined(ns32000) || defined(sun386) || defined(i386) || \
-defined(MIPSEL) || defined(_MIPSEL) || defined(BIT_ZERO_ON_RIGHT) || \
-defined(__i386__) || defined(__i386) || defined(__amd64__) || \
-defined(__x86_64__) || defined(MIPSEL) || defined(_MIPSEL) || \
-defined(BIT_ZERO_ON_RIGHT) || defined(__alpha__) || defined(__alpha) || \
-(defined(__Lynx__) && defined(__x86__))
-#define BYTE_ORDER	LITTLE_ENDIAN
-#endif
+#define	__BIND		19950621	/*%< (DEAD) interface version stamp. */
 
-#if defined(sel) || defined(pyr) || defined(mc68000) || defined(sparc) || \
-defined(is68k) || defined(tahoe) || defined(ibm032) || defined(ibm370) || \
-defined(MIPSEB) || defined(_MIPSEB) || defined(_IBMR2) || defined(DGUX) ||\
-defined(apollo) || defined(__convex__) || defined(_CRAY) || \
-defined(__hppa) || defined(__hp9000) || \
-defined(__hp9000s300) || defined(__hp9000s700) || \
-defined(__hp3000s900) || defined(__hpux) || defined(MPE) || \
-defined (BIT_ZERO_ON_LEFT) || defined(m68k) || defined(__sparc) ||  \
-(defined(__Lynx__) && \
- (defined(__68k__) || defined(__sparc__) || defined(__powerpc__)))
-#define BYTE_ORDER	BIG_ENDIAN
-#endif
-#endif /* __linux */
-#endif /* BSD */
-#endif /* BYTE_ORDER */
-
-#if !defined(BYTE_ORDER) || \
-(BYTE_ORDER != BIG_ENDIAN && BYTE_ORDER != LITTLE_ENDIAN && \
-BYTE_ORDER != PDP_ENDIAN)
+#if !defined(_BYTE_ORDER) || \
+(_BYTE_ORDER != _BIG_ENDIAN && _BYTE_ORDER != _LITTLE_ENDIAN && \
+_BYTE_ORDER != _PDP_ENDIAN)
 	/* you must determine what the correct bit order is for
 	 * your compiler - the next line is an intentional error
 	 * which will force your compiles to bomb until you fix
 	 * the above macros.
 	 */
-#error "Undefined or invalid BYTE_ORDER"
+#error "Undefined or invalid _BYTE_ORDER"
 #endif
 
 /*%
@@ -94,7 +60,7 @@
 
 typedef struct {
 	unsigned	id :16;		/*%< query identification number */
-#if BYTE_ORDER == BIG_ENDIAN
+#if _BYTE_ORDER == _BIG_ENDIAN
 			/* fields in third byte */
 	unsigned	qr: 1;		/*%< response flag */
 	unsigned	opcode: 4;	/*%< purpose of message */
@@ -108,7 +74,7 @@ typedef struct {
 	unsigned	cd: 1;		/*%< checking disabled by resolver */
 	unsigned	rcode :4;	/*%< response code */
 #endif
-#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN
+#if _BYTE_ORDER == _LITTLE_ENDIAN || _BYTE_ORDER == _PDP_ENDIAN
 			/* fields in third byte */
 	unsigned	rd :1;		/*%< recursion desired */
 	unsigned	tc :1;		/*%< truncated message */



CVS commit: src/sys/dev/audio

2022-04-20 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Apr 21 01:15:25 UTC 2022

Modified Files:
src/sys/dev/audio: audio.c

Log Message:
#if 0 now unused audio_track_is_record() to appease clang


To generate a diff of this commit:
cvs rdiff -u -r1.127 -r1.128 src/sys/dev/audio/audio.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/audio/audio.c
diff -u src/sys/dev/audio/audio.c:1.127 src/sys/dev/audio/audio.c:1.128
--- src/sys/dev/audio/audio.c:1.127	Wed Apr 20 07:11:13 2022
+++ src/sys/dev/audio/audio.c	Thu Apr 21 01:15:24 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.127 2022/04/20 07:11:13 isaki Exp $	*/
+/*	$NetBSD: audio.c,v 1.128 2022/04/21 01:15:24 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -181,7 +181,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.127 2022/04/20 07:11:13 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.128 2022/04/21 01:15:24 macallan Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -733,6 +733,7 @@ audio_track_is_playback(const audio_trac
 	return ((track->mode & AUMODE_PLAY) != 0);
 }
 
+#if 0
 /* Return true if this track is a recording track. */
 static __inline bool
 audio_track_is_record(const audio_track_t *track)
@@ -740,6 +741,7 @@ audio_track_is_record(const audio_track_
 
 	return ((track->mode & AUMODE_RECORD) != 0);
 }
+#endif
 
 #if 0 /* XXX Not used yet */
 /*



CVS commit: src/sys/dev/audio

2022-04-20 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Apr 21 01:15:25 UTC 2022

Modified Files:
src/sys/dev/audio: audio.c

Log Message:
#if 0 now unused audio_track_is_record() to appease clang


To generate a diff of this commit:
cvs rdiff -u -r1.127 -r1.128 src/sys/dev/audio/audio.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/sparc/sparc

2022-04-20 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Apr 20 23:32:17 UTC 2022

Modified Files:
src/sys/arch/sparc/sparc: clkctrl.c

Log Message:
the register is only one byte, act like it


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/sparc/sparc/clkctrl.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/sparc/sparc/clkctrl.c
diff -u src/sys/arch/sparc/sparc/clkctrl.c:1.6 src/sys/arch/sparc/sparc/clkctrl.c:1.7
--- src/sys/arch/sparc/sparc/clkctrl.c:1.6	Mon Dec 30 22:13:47 2019
+++ src/sys/arch/sparc/sparc/clkctrl.c	Wed Apr 20 23:32:17 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: clkctrl.c,v 1.6 2019/12/30 22:13:47 ad Exp $	*/
+/*	$NetBSD: clkctrl.c,v 1.7 2022/04/20 23:32:17 macallan Exp $	*/
 
 /*
  * Copyright (c) 2005 Michael Lorenz
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: clkctrl.c,v 1.6 2019/12/30 22:13:47 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clkctrl.c,v 1.7 2022/04/20 23:32:17 macallan Exp $");
 
 #include 
 #include 
@@ -72,7 +72,7 @@ clkctrl_attach(device_t parent, device_t
 	}
 	if (sbus_bus_map(sa->sa_bustag,
 			 sa->sa_slot, sa->sa_offset,
-			 sizeof(long),
+			 1,
 			 BUS_SPACE_MAP_LINEAR, ) != 0) {
 		aprint_error("unable to map register\n");
 		return;



CVS commit: src/sys/arch/sparc/sparc

2022-04-20 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Apr 20 23:32:17 UTC 2022

Modified Files:
src/sys/arch/sparc/sparc: clkctrl.c

Log Message:
the register is only one byte, act like it


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/sparc/sparc/clkctrl.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

2022-04-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Apr 20 22:50:56 UTC 2022

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

Log Message:
tests/lint: fix test for message 132 to be platform-independent

On i386, the test failed because the warning in line 101 was not
generated.  This was because size_t on i386 is unsigned int (see
arch/i386/targparam.h, SIZEOF_TSPEC). The result of the multiplication
had type unsigned int, and message 132 does not trigger for a conversion
from unsigned int to signed int because both types have the same size
(see check_integer_conversion, portable_size_in_bits).

Change the involved type from size_t (which the original code used) to
unsigned long long (which is uint64_t on all platforms supported by
lint), so that the warning is generated on all platforms in the same
way.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/msg_132.c
cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_132.exp

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/msg_132.c
diff -u src/tests/usr.bin/xlint/lint1/msg_132.c:1.7 src/tests/usr.bin/xlint/lint1/msg_132.c:1.8
--- src/tests/usr.bin/xlint/lint1/msg_132.c:1.7	Tue Apr 19 22:40:13 2022
+++ src/tests/usr.bin/xlint/lint1/msg_132.c	Wed Apr 20 22:50:56 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_132.c,v 1.7 2022/04/19 22:40:13 rillig Exp $	*/
+/*	$NetBSD: msg_132.c,v 1.8 2022/04/20 22:50:56 rillig Exp $	*/
 # 3 "msg_132.c"
 
 // Test for message: conversion from '%s' to '%s' may lose accuracy [132]
@@ -97,6 +97,6 @@ non_constant_expression(void)
 	 * that the conversion will always succeed.
 	 */
 	const int not_a_constant = 8;
-	/* expect+1: warning: conversion from 'unsigned long' to 'int' may lose accuracy [132] */
-	return sizeof(double) + not_a_constant * sizeof(char *);
+	/* expect+1: warning: conversion from 'unsigned long long' to 'int' may lose accuracy [132] */
+	return not_a_constant * 8ULL;
 }

Index: src/tests/usr.bin/xlint/lint1/msg_132.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_132.exp:1.6 src/tests/usr.bin/xlint/lint1/msg_132.exp:1.7
--- src/tests/usr.bin/xlint/lint1/msg_132.exp:1.6	Tue Apr 19 22:40:13 2022
+++ src/tests/usr.bin/xlint/lint1/msg_132.exp	Wed Apr 20 22:50:56 2022
@@ -12,4 +12,4 @@ msg_132.c(55): warning: conversion from 
 msg_132.c(59): warning: conversion from 'long long' to 'int' may lose accuracy [132]
 msg_132.c(85): error: operands of '+' have incompatible types (pointer != double) [107]
 msg_132.c(85): warning: function 'cover_build_plus_minus' expects to return value [214]
-msg_132.c(101): warning: conversion from 'unsigned long' to 'int' may lose accuracy [132]
+msg_132.c(101): warning: conversion from 'unsigned long long' to 'int' may lose accuracy [132]



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

2022-04-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Apr 20 22:50:56 UTC 2022

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

Log Message:
tests/lint: fix test for message 132 to be platform-independent

On i386, the test failed because the warning in line 101 was not
generated.  This was because size_t on i386 is unsigned int (see
arch/i386/targparam.h, SIZEOF_TSPEC). The result of the multiplication
had type unsigned int, and message 132 does not trigger for a conversion
from unsigned int to signed int because both types have the same size
(see check_integer_conversion, portable_size_in_bits).

Change the involved type from size_t (which the original code used) to
unsigned long long (which is uint64_t on all platforms supported by
lint), so that the warning is generated on all platforms in the same
way.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/msg_132.c
cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_132.exp

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

2022-04-20 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Wed Apr 20 22:08:10 UTC 2022

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

Log Message:
vio9p: avoid null pointer dereference on attach.

Pass "vqs" argument to virtio_child_attach_start().  The virtio API is
not quite clear to me here - there's also a separate setter
virtio_child_attach_set_vqs that performs some additional actions.

Queue setup for Virtio 1.0 accesses virtio_softc::sc_vqs and we didn't
set it.  QEMU exposes only the old virtio interface, so it doesn't
trigger the problem.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/pci/vio9p.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/vio9p.c
diff -u src/sys/dev/pci/vio9p.c:1.8 src/sys/dev/pci/vio9p.c:1.9
--- src/sys/dev/pci/vio9p.c:1.8	Wed Apr 13 15:24:42 2022
+++ src/sys/dev/pci/vio9p.c	Wed Apr 20 22:08:10 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: vio9p.c,v 1.8 2022/04/13 15:24:42 uwe Exp $	*/
+/*	$NetBSD: vio9p.c,v 1.9 2022/04/20 22:08:10 uwe Exp $	*/
 
 /*
  * Copyright (c) 2019 Internet Initiative Japan, Inc.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vio9p.c,v 1.8 2022/04/13 15:24:42 uwe Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vio9p.c,v 1.9 2022/04/20 22:08:10 uwe Exp $");
 
 #include 
 #include 
@@ -500,7 +500,7 @@ vio9p_attach(device_t parent, device_t s
 	sc->sc_dev = self;
 	sc->sc_virtio = vsc;
 
-	virtio_child_attach_start(vsc, self, IPL_VM, NULL,
+	virtio_child_attach_start(vsc, self, IPL_VM, sc->sc_vq,
 	NULL, virtio_vq_intr,
 	VIRTIO_F_INTR_MPSAFE | VIRTIO_F_INTR_SOFTINT,
 	VIO9P_F_MOUNT_TAG,



CVS commit: src/sys/dev/pci

2022-04-20 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Wed Apr 20 22:08:10 UTC 2022

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

Log Message:
vio9p: avoid null pointer dereference on attach.

Pass "vqs" argument to virtio_child_attach_start().  The virtio API is
not quite clear to me here - there's also a separate setter
virtio_child_attach_set_vqs that performs some additional actions.

Queue setup for Virtio 1.0 accesses virtio_softc::sc_vqs and we didn't
set it.  QEMU exposes only the old virtio interface, so it doesn't
trigger the problem.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/pci/vio9p.c

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



CVS commit: src/sys/ddb

2022-04-20 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Wed Apr 20 19:06:35 UTC 2022

Modified Files:
src/sys/ddb: db_command.c

Log Message:
ddb: guard invocation of db_cmd_on_enter properly.

db_command_loop - do not ignore the return value from setjmp used to
guard db_cmd_on_enter.  We do not want to re-execute the enter command
if it fails.  Note that "fails" includes e.g. aborting long output
from the enter command with "q" at the --db more-- prompt, which is
quite likely as the default enter command is "bt".

While here, don't even bother with the whole song and dance if the
enter command is not set.


To generate a diff of this commit:
cvs rdiff -u -r1.179 -r1.180 src/sys/ddb/db_command.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/ddb/db_command.c
diff -u src/sys/ddb/db_command.c:1.179 src/sys/ddb/db_command.c:1.180
--- src/sys/ddb/db_command.c:1.179	Sun Oct 10 18:08:12 2021
+++ src/sys/ddb/db_command.c	Wed Apr 20 19:06:35 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_command.c,v 1.179 2021/10/10 18:08:12 thorpej Exp $	*/
+/*	$NetBSD: db_command.c,v 1.180 2022/04/20 19:06:35 uwe Exp $	*/
 
 /*
  * Copyright (c) 1996, 1997, 1998, 1999, 2002, 2009, 2019
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_command.c,v 1.179 2021/10/10 18:08:12 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_command.c,v 1.180 2022/04/20 19:06:35 uwe Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_aio.h"
@@ -597,15 +597,16 @@ db_command_loop(void)
 	/* save context for return from ddb */
 	savejmp = db_recover;
 	db_recover = _jmpbuf;
-	(void) setjmp(_jmpbuf);
 
 	/*
 	 * Execute default ddb start commands only if this is the
 	 * first entry into DDB, in case the start commands fault
 	 * and we recurse into here.
 	 */
-	if (!savejmp)
-		db_execute_commandlist(db_cmd_on_enter);
+	if (savejmp == NULL && db_cmd_on_enter[0] != '\0') {
+		if (setjmp(_jmpbuf) == 0)
+			db_execute_commandlist(db_cmd_on_enter);
+	}
 
 	(void) setjmp(_jmpbuf);
 	while (!db_cmd_loop_done) {



CVS commit: src/sys/ddb

2022-04-20 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Wed Apr 20 19:06:35 UTC 2022

Modified Files:
src/sys/ddb: db_command.c

Log Message:
ddb: guard invocation of db_cmd_on_enter properly.

db_command_loop - do not ignore the return value from setjmp used to
guard db_cmd_on_enter.  We do not want to re-execute the enter command
if it fails.  Note that "fails" includes e.g. aborting long output
from the enter command with "q" at the --db more-- prompt, which is
quite likely as the default enter command is "bt".

While here, don't even bother with the whole song and dance if the
enter command is not set.


To generate a diff of this commit:
cvs rdiff -u -r1.179 -r1.180 src/sys/ddb/db_command.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/libcurses

2022-04-20 Thread Brett Lymn
Module Name:src
Committed By:   blymn
Date:   Wed Apr 20 07:43:05 UTC 2022

Modified Files:
src/tests/lib/libcurses: t_curses.sh
src/tests/lib/libcurses/check_files: Makefile
src/tests/lib/libcurses/tests: Makefile
Added Files:
src/tests/lib/libcurses/check_files: bkgrndset1.chk bkgrndset2.chk
src/tests/lib/libcurses/tests: bkgrndset

Log Message:
Add a test for the bkgrndset function


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/tests/lib/libcurses/t_curses.sh
cvs rdiff -u -r1.9 -r1.10 src/tests/lib/libcurses/check_files/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/lib/libcurses/check_files/bkgrndset1.chk \
src/tests/lib/libcurses/check_files/bkgrndset2.chk
cvs rdiff -u -r1.5 -r1.6 src/tests/lib/libcurses/tests/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/lib/libcurses/tests/bkgrndset

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/libcurses/t_curses.sh
diff -u src/tests/lib/libcurses/t_curses.sh:1.28 src/tests/lib/libcurses/t_curses.sh:1.29
--- src/tests/lib/libcurses/t_curses.sh:1.28	Mon Apr  4 19:33:46 2022
+++ src/tests/lib/libcurses/t_curses.sh	Wed Apr 20 07:43:05 2022
@@ -2011,6 +2011,16 @@ bkgdset_body()
 	h_run bkgdset
 }
 
+atf_test_case bkgrndset
+bkgrndset_head()
+{
+	atf_set "descr" "Validate curses sets the background character using a complex char on stdscr"
+}
+bkgrndset_body()
+{
+	h_run bkgrndset
+}
+
 atf_test_case getbkgd
 getbkgd_head()
 {

Index: src/tests/lib/libcurses/check_files/Makefile
diff -u src/tests/lib/libcurses/check_files/Makefile:1.9 src/tests/lib/libcurses/check_files/Makefile:1.10
--- src/tests/lib/libcurses/check_files/Makefile:1.9	Tue Nov 16 21:02:06 2021
+++ src/tests/lib/libcurses/check_files/Makefile	Wed Apr 20 07:43:05 2022
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.9 2021/11/16 21:02:06 blymn Exp $
+# $NetBSD: Makefile,v 1.10 2022/04/20 07:43:05 blymn Exp $
 
 NOMAN=		# defined
 
@@ -34,6 +34,8 @@ FILES+=		background4.chk
 FILES+=		background5.chk
 FILES+=		bell.chk
 FILES+=		bkgdset1.chk
+FILES+=		bkgrndset1.chk
+FILES+=		bkgrndset2.chk
 FILES+=		blank.chk
 FILES+=		border_set1.chk
 FILES+=		border_set2.chk

Index: src/tests/lib/libcurses/tests/Makefile
diff -u src/tests/lib/libcurses/tests/Makefile:1.5 src/tests/lib/libcurses/tests/Makefile:1.6
--- src/tests/lib/libcurses/tests/Makefile:1.5	Sat Feb 13 06:29:45 2021
+++ src/tests/lib/libcurses/tests/Makefile	Wed Apr 20 07:43:05 2022
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.5 2021/02/13 06:29:45 rillig Exp $
+# $NetBSD: Makefile,v 1.6 2022/04/20 07:43:05 blymn Exp $
 
 NOMAN=		# defined
 
@@ -24,6 +24,7 @@ FILES+=		attributes
 FILES+=		background
 FILES+=		beep
 FILES+=		bkgdset
+FILES+=		bkgrndset
 FILES+=		border_set
 FILES+=		box
 FILES+=		box_set

Added files:

Index: src/tests/lib/libcurses/check_files/bkgrndset1.chk
diff -u /dev/null src/tests/lib/libcurses/check_files/bkgrndset1.chk:1.1
--- /dev/null	Wed Apr 20 07:43:05 2022
+++ src/tests/lib/libcurses/check_files/bkgrndset1.chk	Wed Apr 20 07:43:05 2022
@@ -0,0 +1 @@
+thissmsoArmsoissmsoArmsoasmsoArmsotestsmsoAAcup2;1Xcup3;1Xcup4;1Xcup5;1Xcup6;1Xcup7;1Xcup8;1Xcup9;1Xcup10;1Xcup11;1Xcup12;1XA
 

CVS commit: src/tests/lib/libcurses

2022-04-20 Thread Brett Lymn
Module Name:src
Committed By:   blymn
Date:   Wed Apr 20 07:43:05 UTC 2022

Modified Files:
src/tests/lib/libcurses: t_curses.sh
src/tests/lib/libcurses/check_files: Makefile
src/tests/lib/libcurses/tests: Makefile
Added Files:
src/tests/lib/libcurses/check_files: bkgrndset1.chk bkgrndset2.chk
src/tests/lib/libcurses/tests: bkgrndset

Log Message:
Add a test for the bkgrndset function


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/tests/lib/libcurses/t_curses.sh
cvs rdiff -u -r1.9 -r1.10 src/tests/lib/libcurses/check_files/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/lib/libcurses/check_files/bkgrndset1.chk \
src/tests/lib/libcurses/check_files/bkgrndset2.chk
cvs rdiff -u -r1.5 -r1.6 src/tests/lib/libcurses/tests/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/lib/libcurses/tests/bkgrndset

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



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

2022-04-20 Thread Brett Lymn
Module Name:src
Committed By:   blymn
Date:   Wed Apr 20 07:41:04 UTC 2022

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

Log Message:
Add test and check file for bkgrndset


To generate a diff of this commit:
cvs rdiff -u -r1.1193 -r1.1194 src/distrib/sets/lists/tests/mi

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



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

2022-04-20 Thread Brett Lymn
Module Name:src
Committed By:   blymn
Date:   Wed Apr 20 07:41:04 UTC 2022

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

Log Message:
Add test and check file for bkgrndset


To generate a diff of this commit:
cvs rdiff -u -r1.1193 -r1.1194 src/distrib/sets/lists/tests/mi

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.1193 src/distrib/sets/lists/tests/mi:1.1194
--- src/distrib/sets/lists/tests/mi:1.1193	Mon Apr 18 15:06:27 2022
+++ src/distrib/sets/lists/tests/mi	Wed Apr 20 07:41:04 2022
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1193 2022/04/18 15:06:27 rillig Exp $
+# $NetBSD: mi,v 1.1194 2022/04/20 07:41:04 blymn Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -3305,6 +3305,8 @@
 ./usr/tests/lib/libcurses/check_files/background5.chk		tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libcurses/check_files/bell.chk			tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libcurses/check_files/bkgdset1.chk		tests-lib-tests		compattestfile,atf
+./usr/tests/lib/libcurses/check_files/bkgrndset1.chk		tests-lib-tests		compattestfile,atf
+./usr/tests/lib/libcurses/check_files/bkgrndset2.chk		tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libcurses/check_files/blank.chk			tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libcurses/check_files/border_set1.chk		tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libcurses/check_files/border_set2.chk		tests-lib-tests		compattestfile,atf
@@ -3574,6 +3576,7 @@
 ./usr/tests/lib/libcurses/tests/background		tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libcurses/tests/beep			tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libcurses/tests/bkgdset			tests-lib-tests		compattestfile,atf
+./usr/tests/lib/libcurses/tests/bkgrndset		tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libcurses/tests/border_set		tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libcurses/tests/box			tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libcurses/tests/box_set			tests-lib-tests		compattestfile,atf



CVS commit: src/sys/dev/audio

2022-04-20 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Wed Apr 20 07:11:14 UTC 2022

Modified Files:
src/sys/dev/audio: audio.c audiodef.h

Log Message:
audio(4): Rework AUDIO_GETOOFFS.
- Count .samples/.deltablks in blocks.  It makes .deltablks integer wrap
  around safe.
- Remove suspicious one block offset from .offset.  I added the offset
  because it was observed so on NetBSD7.  But according to manpage, it
  should not be.  And it looks fine without the offset.
- Related to that, remove a comment in AUDIO_WSEEK.
  Limit the user-visible buffer to usrbuf only.


To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/sys/dev/audio/audio.c
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/audio/audiodef.h

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

Modified files:

Index: src/sys/dev/audio/audio.c
diff -u src/sys/dev/audio/audio.c:1.126 src/sys/dev/audio/audio.c:1.127
--- src/sys/dev/audio/audio.c:1.126	Wed Apr 20 06:05:22 2022
+++ src/sys/dev/audio/audio.c	Wed Apr 20 07:11:13 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.126 2022/04/20 06:05:22 isaki Exp $	*/
+/*	$NetBSD: audio.c,v 1.127 2022/04/20 07:11:13 isaki Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -181,7 +181,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.126 2022/04/20 06:05:22 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.127 2022/04/20 07:11:13 isaki Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -2985,7 +2985,7 @@ audio_ioctl(dev_t dev, struct audio_soft
 	audio_encoding_t *ae;
 	audio_format_query_t *query;
 	u_int stamp;
-	u_int offs;
+	u_int offset;
 	int val;
 	int index;
 	int error;
@@ -3104,28 +3104,23 @@ audio_ioctl(dev_t dev, struct audio_soft
 		}
 		mutex_enter(sc->sc_lock);
 		mutex_enter(sc->sc_intr_lock);
-		/* figure out where next DMA will start */
-		stamp = track->usrbuf_stamp;
-		offs = track->usrbuf.head;
+		/* figure out where next transfer will start */
+		stamp = track->stamp;
+		offset = track->usrbuf.head;
 		mutex_exit(sc->sc_intr_lock);
 		mutex_exit(sc->sc_lock);
 
-		ao->samples = stamp;
-		ao->deltablks = (stamp / track->usrbuf_blksize) -
-		(track->usrbuf_stamp_last / track->usrbuf_blksize);
-		track->usrbuf_stamp_last = stamp;
-		offs = rounddown(offs, track->usrbuf_blksize)
-		+ track->usrbuf_blksize;
-		if (offs >= track->usrbuf.capacity)
-			offs -= track->usrbuf.capacity;
-		ao->offset = offs;
-
+		/* samples will overflow soon but is as per spec. */
+		ao->samples = stamp * track->usrbuf_blksize;
+		ao->deltablks = stamp - track->last_stamp;
+		ao->offset = offset;
 		TRACET(2, track, "%s samples=%u deltablks=%u offset=%u",
 		pre, ao->samples, ao->deltablks, ao->offset);
+
+		track->last_stamp = stamp;
 		break;
 
 	case AUDIO_WSEEK:
-		/* XXX return value does not include outbuf one. */
 		track = file->ptrack;
 		if (track) {
 			val = track->usrbuf.used;
@@ -4964,8 +4959,6 @@ audio_track_play(audio_track_t *track)
 	count = uimin(usrbuf->used, track->usrbuf_blksize) / framesize;
 	bytes = count * framesize;
 
-	track->usrbuf_stamp += bytes;
-
 	if (usrbuf->head + bytes < usrbuf->capacity) {
 		memcpy((uint8_t *)input->mem + auring_tail(input) * framesize,
 		(uint8_t *)usrbuf->mem + usrbuf->head,
@@ -5060,6 +5053,8 @@ audio_track_play(audio_track_t *track)
 		track->outputcounter += track->outbuf.used - track_count_0;
 	}
 
+	track->stamp++;
+
 #if defined(AUDIO_DEBUG)
 	if (audiodebug >= 3) {
 		struct audio_track_debugbuf m;
@@ -6311,6 +6306,8 @@ audio_track_clear(struct audio_softc *sc
 	track->outbuf.used = 0;
 
 	/* Clear counters. */
+	track->stamp = 0;
+	track->last_stamp = 0;
 	track->dropframes = 0;
 
 	audio_track_lock_exit(track);
@@ -7773,7 +7770,7 @@ audiogetinfo(struct audio_softc *sc, str
 
 	if (ptrack) {
 		pi->seek = ptrack->usrbuf.used;
-		pi->samples = ptrack->usrbuf_stamp;
+		pi->samples = ptrack->stamp * ptrack->usrbuf_blksize;
 		pi->eof = ptrack->eofcounter;
 		pi->error = (ptrack->dropframes != 0) ? 1 : 0;
 		pi->open = 1;
@@ -7784,7 +7781,7 @@ audiogetinfo(struct audio_softc *sc, str
 
 	if (rtrack) {
 		ri->seek = audio_track_readablebytes(rtrack);
-		ri->samples = rtrack->usrbuf_stamp;
+		ri->samples = rtrack->stamp * rtrack->usrbuf_blksize;
 		ri->eof = 0;
 		ri->error = (rtrack->dropframes != 0) ? 1 : 0;
 		ri->open = 1;

Index: src/sys/dev/audio/audiodef.h
diff -u src/sys/dev/audio/audiodef.h:1.17 src/sys/dev/audio/audiodef.h:1.18
--- src/sys/dev/audio/audiodef.h:1.17	Wed Apr 20 06:05:22 2022
+++ src/sys/dev/audio/audiodef.h	Wed Apr 20 07:11:13 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: audiodef.h,v 1.17 2022/04/20 06:05:22 isaki Exp $	*/
+/*	$NetBSD: audiodef.h,v 1.18 2022/04/20 07:11:13 isaki Exp $	*/
 
 /*
  * Copyright (C) 2017 Tetsuya Isaki. All rights reserved.
@@ -121,8 +121,6 @@ struct audio_track {
 	u_int		usrbuf_blksize;	/* usrbuf block size in bytes */
 	struct uvm_object *uobj;
 	bool		mmapped;	/* device is 

CVS commit: src/sys/dev/audio

2022-04-20 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Wed Apr 20 07:11:14 UTC 2022

Modified Files:
src/sys/dev/audio: audio.c audiodef.h

Log Message:
audio(4): Rework AUDIO_GETOOFFS.
- Count .samples/.deltablks in blocks.  It makes .deltablks integer wrap
  around safe.
- Remove suspicious one block offset from .offset.  I added the offset
  because it was observed so on NetBSD7.  But according to manpage, it
  should not be.  And it looks fine without the offset.
- Related to that, remove a comment in AUDIO_WSEEK.
  Limit the user-visible buffer to usrbuf only.


To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/sys/dev/audio/audio.c
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/audio/audiodef.h

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



CVS commit: src/sys/dev/audio

2022-04-20 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Wed Apr 20 06:05:22 UTC 2022

Modified Files:
src/sys/dev/audio: audio.c audiodef.h

Log Message:
audio(4): Make recording buffer more robust.
Previously, main buffer in recording track was usrbuf, which is the closest
buffer to the userland.  Because, this buffer arrangement was symmetrical
with the playback track, and had affinity with the past implementation.
However, in the current implementation, read(2) (from user application)
takes recorded block out from inputbuf, which is the closest buffer to
rmixer, to usrbuf.  So it was not good way to use the usrbuf as main buffer.
Now, usrbuf in recording track holds only fragment bytes in order to
transfer to the userland, and main buffer in recording track is the inputbuf,
the closest to rmixer.

Buffer size of the inputbuf is also modified.  Previously, it was less than
64KB or at least 4 blocks.  This had affinity with playback track and the
past implementation.  But this was not appropriate for both formats with
too large frames or too small frames.  In large frames (for example,
192kHz/12ch), 184KB buffer would be allocated but it corresponds to only
40msec.  In opposite, in small frames (for example, 8000Hz/1ch), 64KB
buffer would be allocated and it corresponds to 4.1 seconds.  But for such
machines that have 8000Hz/1ch device, in-kernel 64KB memory would probably
be expensive.
Now, inputbuf will always be allocated 16(NBLKIN) blocks, regardless of its
hardware format.  It corresponds to 160msec on modern archs (if blk_ms=10),
or 640msec on antique archs (if blk_ms=40).


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/sys/dev/audio/audio.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/audio/audiodef.h

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



CVS commit: src/sys/dev/audio

2022-04-20 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Wed Apr 20 06:05:22 UTC 2022

Modified Files:
src/sys/dev/audio: audio.c audiodef.h

Log Message:
audio(4): Make recording buffer more robust.
Previously, main buffer in recording track was usrbuf, which is the closest
buffer to the userland.  Because, this buffer arrangement was symmetrical
with the playback track, and had affinity with the past implementation.
However, in the current implementation, read(2) (from user application)
takes recorded block out from inputbuf, which is the closest buffer to
rmixer, to usrbuf.  So it was not good way to use the usrbuf as main buffer.
Now, usrbuf in recording track holds only fragment bytes in order to
transfer to the userland, and main buffer in recording track is the inputbuf,
the closest to rmixer.

Buffer size of the inputbuf is also modified.  Previously, it was less than
64KB or at least 4 blocks.  This had affinity with playback track and the
past implementation.  But this was not appropriate for both formats with
too large frames or too small frames.  In large frames (for example,
192kHz/12ch), 184KB buffer would be allocated but it corresponds to only
40msec.  In opposite, in small frames (for example, 8000Hz/1ch), 64KB
buffer would be allocated and it corresponds to 4.1 seconds.  But for such
machines that have 8000Hz/1ch device, in-kernel 64KB memory would probably
be expensive.
Now, inputbuf will always be allocated 16(NBLKIN) blocks, regardless of its
hardware format.  It corresponds to 160msec on modern archs (if blk_ms=10),
or 640msec on antique archs (if blk_ms=40).


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/sys/dev/audio/audio.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/audio/audiodef.h

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

Modified files:

Index: src/sys/dev/audio/audio.c
diff -u src/sys/dev/audio/audio.c:1.125 src/sys/dev/audio/audio.c:1.126
--- src/sys/dev/audio/audio.c:1.125	Wed Apr 20 04:41:29 2022
+++ src/sys/dev/audio/audio.c	Wed Apr 20 06:05:22 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.125 2022/04/20 04:41:29 isaki Exp $	*/
+/*	$NetBSD: audio.c,v 1.126 2022/04/20 06:05:22 isaki Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -181,7 +181,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.125 2022/04/20 04:41:29 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.126 2022/04/20 06:05:22 isaki Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -608,7 +608,8 @@ static void audio_rintr(void *);
 
 static int audio_query_devinfo(struct audio_softc *, mixer_devinfo_t *);
 
-static __inline int audio_track_readablebytes(const audio_track_t *);
+static int audio_track_inputblk_as_usrbyte(const audio_track_t *, int);
+static int audio_track_readablebytes(const audio_track_t *);
 static int audio_file_setinfo(struct audio_softc *, audio_file_t *,
 	const struct audio_info *);
 static int audio_track_setinfo_check(audio_track_t *,
@@ -2775,10 +2776,10 @@ audio_read(struct audio_softc *sc, struc
 		int bytes;
 
 		TRACET(3, track,
-		"while resid=%zd input=%d/%d/%d usrbuf=%d/%d/H%d",
+		"while resid=%zd input=%d/%d/%d usrbuf=%d/%d/C%d",
 		uio->uio_resid,
 		input->head, input->used, input->capacity,
-		usrbuf->head, usrbuf->used, track->usrbuf_usedhigh);
+		usrbuf->head, usrbuf->used, usrbuf->capacity);
 
 		/* Wait when buffers are empty. */
 		mutex_enter(sc->sc_lock);
@@ -2805,34 +2806,27 @@ audio_read(struct audio_softc *sc, struc
 		mutex_exit(sc->sc_lock);
 
 		audio_track_lock_enter(track);
-		/* Convert as many blocks as possible. */
-		while (usrbuf->used <=
-		track->usrbuf_usedhigh - track->usrbuf_blksize &&
-		input->used > 0) {
+		/* Convert one block if possible. */
+		if (usrbuf->used == 0 && input->used > 0) {
 			audio_track_record(track);
 		}
 
 		/* uiomove from usrbuf as many bytes as possible. */
 		bytes = uimin(usrbuf->used, uio->uio_resid);
-		while (bytes > 0) {
-			int head = usrbuf->head;
-			int len = uimin(bytes, usrbuf->capacity - head);
-			error = uiomove((uint8_t *)usrbuf->mem + head, len,
-			uio);
-			if (error) {
-audio_track_lock_exit(track);
-device_printf(sc->sc_dev,
-"%s: uiomove(%d) failed: errno=%d\n",
-__func__, len, error);
-goto abort;
-			}
-			auring_take(usrbuf, len);
-			track->useriobytes += len;
-			TRACET(3, track, "uiomove(len=%d) usrbuf=%d/%d/C%d",
-			len,
-			usrbuf->head, usrbuf->used, usrbuf->capacity);
-			bytes -= len;
+		error = uiomove((uint8_t *)usrbuf->mem + usrbuf->head, bytes,
+		uio);
+		if (error) {
+			audio_track_lock_exit(track);
+			device_printf(sc->sc_dev,
+			"%s: uiomove(%d) failed: errno=%d\n",
+			__func__, bytes, error);
+			goto abort;
 		}
+		auring_take(usrbuf, bytes);
+		track->useriobytes += bytes;
+		TRACET(3, track, "uiomove(len=%d) usrbuf=%d/%d/C%d",
+		bytes,
+