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

2020-12-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Dec  4 07:12:57 UTC 2020

Modified Files:
src/sys/arch/arm/arm32: bus_dma.c

Log Message:
Use __func__ in panic calls (and misc style changes)


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/sys/arch/arm/arm32/bus_dma.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/arm32/bus_dma.c
diff -u src/sys/arch/arm/arm32/bus_dma.c:1.125 src/sys/arch/arm/arm32/bus_dma.c:1.126
--- src/sys/arch/arm/arm32/bus_dma.c:1.125	Fri Dec  4 07:11:35 2020
+++ src/sys/arch/arm/arm32/bus_dma.c	Fri Dec  4 07:12:57 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.125 2020/12/04 07:11:35 skrll Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.126 2020/12/04 07:12:57 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2020 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #include "opt_cputypes.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.125 2020/12/04 07:11:35 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.126 2020/12/04 07:12:57 skrll Exp $");
 
 #include 
 
@@ -883,6 +883,7 @@ _bus_dmamap_sync_segment(vaddr_t va, pad
 		cpu_dcache_inv_range(va, len);
 		cpu_sdcache_inv_range(va, pa, len);
 		break;
+
 	case BUS_DMASYNC_POSTREAD:
 		STAT_INCR(sync_postread);
 		cpu_dcache_inv_range(va, len);
@@ -1049,7 +1050,7 @@ _bus_dmamap_sync(bus_dma_tag_t t, bus_dm
 	 */
 	if ((ops & (BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE)) != 0 &&
 	(ops & (BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE)) != 0)
-		panic("_bus_dmamap_sync: mix PRE and POST");
+		panic("%s: mix PRE and POST", __func__);
 
 	KASSERTMSG(offset < map->dm_mapsize,
 	"offset %lu mapsize %lu",
@@ -1110,24 +,28 @@ _bus_dmamap_sync(bus_dma_tag_t t, bus_dm
 		case _BUS_DMA_BUFTYPE_LINEAR:
 			memcpy(dataptr, cookie->id_origlinearbuf + offset, len);
 			break;
+
 		case _BUS_DMA_BUFTYPE_MBUF:
 			m_copydata(cookie->id_origmbuf, offset, len, dataptr);
 			break;
+
 		case _BUS_DMA_BUFTYPE_UIO:
-			_bus_dma_uiomove(dataptr, cookie->id_origuio, len, UIO_WRITE);
+			_bus_dma_uiomove(dataptr, cookie->id_origuio, len,
+			UIO_WRITE);
 			break;
+
 #ifdef DIAGNOSTIC
 		case _BUS_DMA_BUFTYPE_RAW:
-			panic("_bus_dmamap_sync(pre): _BUS_DMA_BUFTYPE_RAW");
+			panic("%s:(pre): _BUS_DMA_BUFTYPE_RAW", __func__);
 			break;
 
 		case _BUS_DMA_BUFTYPE_INVALID:
-			panic("_bus_dmamap_sync(pre): _BUS_DMA_BUFTYPE_INVALID");
+			panic("%s(pre): _BUS_DMA_BUFTYPE_INVALID", __func__);
 			break;
 
 		default:
-			panic("_bus_dmamap_sync(pre): map %p: unknown buffer type %d\n",
-			map, map->_dm_buftype);
+			panic("%s(pre): map %p: unknown buffer type %d\n",
+			__func__, map, map->_dm_buftype);
 			break;
 #endif /* DIAGNOSTIC */
 		}
@@ -1207,12 +1212,12 @@ _bus_dmamap_sync(bus_dma_tag_t t, bus_dm
 		break;
 
 	case _BUS_DMA_BUFTYPE_INVALID:
-		panic("_bus_dmamap_sync: _BUS_DMA_BUFTYPE_INVALID");
+		panic("%s: _BUS_DMA_BUFTYPE_INVALID", __func__);
 		break;
 
 	default:
-		panic("_bus_dmamap_sync: map %p: unknown buffer type %d\n",
-		map, map->_dm_buftype);
+		panic("%s: map %p: unknown buffer type %d\n", __func__, map,
+		map->_dm_buftype);
 	}
 
 	/* Drain the write buffer. */
@@ -1241,17 +1246,18 @@ _bus_dmamap_sync(bus_dma_tag_t t, bus_dm
 	case _BUS_DMA_BUFTYPE_UIO:
 		_bus_dma_uiomove(dataptr, cookie->id_origuio, len, UIO_READ);
 		break;
+
 #ifdef DIAGNOSTIC
 	case _BUS_DMA_BUFTYPE_RAW:
-		panic("_bus_dmamap_sync(post): _BUS_DMA_BUFTYPE_RAW");
+		panic("%s(post): _BUS_DMA_BUFTYPE_RAW", __func__);
 		break;
 
 	case _BUS_DMA_BUFTYPE_INVALID:
-		panic("_bus_dmamap_sync(post): _BUS_DMA_BUFTYPE_INVALID");
+		panic("%s(post): _BUS_DMA_BUFTYPE_INVALID", __func__);
 		break;
 
 	default:
-		panic("_bus_dmamap_sync(post): map %p: unknown buffer type %d\n",
+		panic("%s(post): map %p: unknown buffer type %d\n", __func__,
 		map, map->_dm_buftype);
 		break;
 #endif



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

2020-12-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Dec  4 07:11:35 UTC 2020

Modified Files:
src/sys/arch/arm/arm32: bus_dma.c

Log Message:
Update stats in the coherent case.  Reported by jmcneill.


To generate a diff of this commit:
cvs rdiff -u -r1.124 -r1.125 src/sys/arch/arm/arm32/bus_dma.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/arm32/bus_dma.c
diff -u src/sys/arch/arm/arm32/bus_dma.c:1.124 src/sys/arch/arm/arm32/bus_dma.c:1.125
--- src/sys/arch/arm/arm32/bus_dma.c:1.124	Sat Oct 24 14:51:59 2020
+++ src/sys/arch/arm/arm32/bus_dma.c	Fri Dec  4 07:11:35 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.124 2020/10/24 14:51:59 skrll Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.125 2020/12/04 07:11:35 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2020 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #include "opt_cputypes.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.124 2020/10/24 14:51:59 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.125 2020/12/04 07:11:35 skrll Exp $");
 
 #include 
 
@@ -1135,6 +1135,29 @@ _bus_dmamap_sync(bus_dma_tag_t t, bus_dm
 
 	/* Skip cache frobbing if mapping was COHERENT */
 	if ((map->_dm_flags & _BUS_DMAMAP_COHERENT)) {
+		switch (ops) {
+		case BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE:
+			STAT_INCR(sync_prereadwrite);
+			break;
+
+		case BUS_DMASYNC_PREREAD:
+			STAT_INCR(sync_preread);
+			break;
+
+		case BUS_DMASYNC_PREWRITE:
+			STAT_INCR(sync_prewrite);
+			break;
+
+		case BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE:
+			STAT_INCR(sync_postreadwrite);
+			break;
+
+		case BUS_DMASYNC_POSTREAD:
+			STAT_INCR(sync_postread);
+			break;
+
+		/* BUS_DMASYNC_POSTWRITE was aleady handled as a fastpath */
+		}
 		/*
 		 * Drain the write buffer of DMA operators.
 		 * 1) when cpu->device (prewrite)



CVS commit: src/sys/netinet

2020-12-03 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Dec  4 00:44:39 UTC 2020

Modified Files:
src/sys/netinet: files.ipfilter

Log Message:
Build ip_sync.c with -Wno-error to avoid failing due to excessive stack
usage.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/netinet/files.ipfilter

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

Modified files:

Index: src/sys/netinet/files.ipfilter
diff -u src/sys/netinet/files.ipfilter:1.15 src/sys/netinet/files.ipfilter:1.16
--- src/sys/netinet/files.ipfilter:1.15	Fri Mar 23 21:30:18 2012
+++ src/sys/netinet/files.ipfilter	Fri Dec  4 00:44:39 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: files.ipfilter,v 1.15 2012/03/23 21:30:18 christos Exp $
+#	$NetBSD: files.ipfilter,v 1.16 2020/12/04 00:44:39 thorpej Exp $
 
 defflag	opt_ipfilter.h	IPFILTER_LOG		# logging of ip packets
 defflag	opt_ipfilter.h	IPFILTER_DEFAULT_BLOCK
@@ -41,3 +41,4 @@ file	external/bsd/ipf/netinet/ip_fil_com
 file	external/bsd/ipf/netinet/radix_ipf.c		ipfilter
 
 makeoptions	ipfilter	CPPFLAGS+="-I$S/external/bsd/ipf"
+makeoptions	ipfilter	"CWARNFLAGS.ip_sync.c"+="-Wno-error"



CVS commit: src/sys/lib/libx86emu

2020-12-03 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Dec  4 00:43:00 UTC 2020

Modified Files:
src/sys/lib/libx86emu: files.x86emu

Log Message:
Build x86emu.c with -fno-inline, otherwise all of the auto-inlining
the compiler does causes stack usage to exceed the limits we've set.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/lib/libx86emu/files.x86emu

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

Modified files:

Index: src/sys/lib/libx86emu/files.x86emu
diff -u src/sys/lib/libx86emu/files.x86emu:1.5 src/sys/lib/libx86emu/files.x86emu:1.6
--- src/sys/lib/libx86emu/files.x86emu:1.5	Thu Sep  3 02:46:04 2015
+++ src/sys/lib/libx86emu/files.x86emu	Fri Dec  4 00:43:00 2020
@@ -11,3 +11,4 @@ buildprefix
 prefix
 
 makeoptions	x86emu	CPPFLAGS+="-I$S/../common/include"
+makeoptions	x86emu	"COPTS.x86emu.c"+="-fno-inline"



CVS commit: src/sys/dist/pf/net

2020-12-03 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Dec  4 00:41:10 UTC 2020

Modified Files:
src/sys/dist/pf/net: pf_table.c

Log Message:
In pfr_fix_anchor(), change an overlapping bcopy() call to a memmove()
call.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dist/pf/net/pf_table.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/dist/pf/net/pf_table.c
diff -u src/sys/dist/pf/net/pf_table.c:1.18 src/sys/dist/pf/net/pf_table.c:1.19
--- src/sys/dist/pf/net/pf_table.c:1.18	Wed Feb 14 16:07:55 2018
+++ src/sys/dist/pf/net/pf_table.c	Fri Dec  4 00:41:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pf_table.c,v 1.18 2018/02/14 16:07:55 maya Exp $	*/
+/*	$NetBSD: pf_table.c,v 1.19 2020/12/04 00:41:10 thorpej Exp $	*/
 /*	$OpenBSD: pf_table.c,v 1.70 2007/05/23 11:53:45 markus Exp $	*/
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pf_table.c,v 1.18 2018/02/14 16:07:55 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pf_table.c,v 1.19 2020/12/04 00:41:10 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1786,7 +1786,7 @@ pfr_fix_anchor(char *anchor)
 		off = 1;
 		while (*++path == '/')
 			off++;
-		bcopy(path, anchor, siz - off);
+		memmove(anchor, path, siz - off);
 		memset(anchor + siz - off, 0, off);
 	}
 	if (anchor[siz - 1])



CVS commit: src/sys/dev/ic

2020-12-03 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Dec  4 00:38:08 UTC 2020

Modified Files:
src/sys/dev/ic: ibm561.c

Log Message:
- malloc(9) -> kmem(9)
- In ibm561_set_cmap(), allocating 3K on the stack is not polite; allocate
  a temporary buffer for the cmap data using kmem_alloc().


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/ic/ibm561.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/ic/ibm561.c
diff -u src/sys/dev/ic/ibm561.c:1.13 src/sys/dev/ic/ibm561.c:1.14
--- src/sys/dev/ic/ibm561.c:1.13	Wed Jun 24 20:17:55 2020
+++ src/sys/dev/ic/ibm561.c	Fri Dec  4 00:38:08 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ibm561.c,v 1.13 2020/06/24 20:17:55 jdolecek Exp $ */
+/* $NetBSD: ibm561.c,v 1.14 2020/12/04 00:38:08 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,14 +30,14 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ibm561.c,v 1.13 2020/06/24 20:17:55 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ibm561.c,v 1.14 2020/12/04 00:38:08 thorpej Exp $");
 
 #include 
 #include 
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 #include 
@@ -141,7 +141,7 @@ ibm561_register(
 {
 	struct ibm561data *data;
 
-	data = malloc(sizeof *data, M_DEVBUF, M_WAITOK|M_ZERO);
+	data = kmem_zalloc(sizeof *data, KM_SLEEP);
 	data->cookie = v;
 	data->ramdac_sched_update = sched_update;
 	data->ramdac_wr = wr;
@@ -255,26 +255,30 @@ ibm561_set_cmap(struct ramdac_cookie *rc
 {
 	struct ibm561data *data = (struct ibm561data *)rc;
 	u_int count, index;
-	uint8_t r[IBM561_NCMAP_ENTRIES];
-	uint8_t g[IBM561_NCMAP_ENTRIES];
-	uint8_t b[IBM561_NCMAP_ENTRIES];
+	uint8_t *cmap_entries, *r, *g, *b;
 	int s, error;
 
 	if (cmapp->index >= IBM561_NCMAP_ENTRIES ||
 	cmapp->count > IBM561_NCMAP_ENTRIES - cmapp->index)
 		return (EINVAL);
 
+	cmap_entries = kmem_alloc(IBM561_NCMAP_ENTRIES * 3, KM_SLEEP);
+	r = _entries[0 * IBM561_NCMAP_ENTRIES];
+	g = _entries[1 * IBM561_NCMAP_ENTRIES];
+	b = _entries[2 * IBM561_NCMAP_ENTRIES];
+
 	index = cmapp->index;
 	count = cmapp->count;
 	error = copyin(cmapp->red, [index], count);
 	if (error)
-		return error;
+		goto out;
 	error = copyin(cmapp->green, [index], count);
 	if (error)
-		return error;
+		goto out;
 	error = copyin(cmapp->blue, [index], count);
 	if (error)
-		return error;
+		goto out;
+
 	s = spltty();
 	memcpy(>cmap_r[index], [index], count);
 	memcpy(>cmap_g[index], [index], count);
@@ -282,7 +286,10 @@ ibm561_set_cmap(struct ramdac_cookie *rc
 	data->changed |= CHANGED_CMAP;
 	data->ramdac_sched_update(data->cookie, ibm561_update);
 	splx(s);
-	return (0);
+
+ out:
+	kmem_free(cmap_entries, IBM561_NCMAP_ENTRIES * 3);
+	return (error);
 }
 
 int



CVS commit: src/sys/compat/linux/common

2020-12-03 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Dec  4 00:26:16 UTC 2020

Modified Files:
src/sys/compat/linux/common: linux_misc_notalpha.c

Log Message:
Rewrite linux_sys_alarm() to use dogetitimer() / dosetitimer(), rather
than fiddling with process timers directly.


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 \
src/sys/compat/linux/common/linux_misc_notalpha.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/compat/linux/common/linux_misc_notalpha.c
diff -u src/sys/compat/linux/common/linux_misc_notalpha.c:1.110 src/sys/compat/linux/common/linux_misc_notalpha.c:1.111
--- src/sys/compat/linux/common/linux_misc_notalpha.c:1.110	Thu Nov 29 17:40:12 2018
+++ src/sys/compat/linux/common/linux_misc_notalpha.c	Fri Dec  4 00:26:16 2020
@@ -1,7 +1,7 @@
-/*	$NetBSD: linux_misc_notalpha.c,v 1.110 2018/11/29 17:40:12 maxv Exp $	*/
+/*	$NetBSD: linux_misc_notalpha.c,v 1.111 2020/12/04 00:26:16 thorpej Exp $	*/
 
 /*-
- * Copyright (c) 1995, 1998, 2008 The NetBSD Foundation, Inc.
+ * Copyright (c) 1995, 1998, 2008, 2020 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_misc_notalpha.c,v 1.110 2018/11/29 17:40:12 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_misc_notalpha.c,v 1.111 2020/12/04 00:26:16 thorpej Exp $");
 
 /*
  * Note that we must NOT include "opt_compat_linux32.h" here,
@@ -88,9 +88,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_misc_n
 
 /*
  * Alarm. This is a libc call which uses setitimer(2) in NetBSD.
- * Fiddle with the timers to make it work.
- *
- * XXX This shouldn't be dicking about with the ptimer stuff directly.
+ * Do the same here.
  */
 int
 linux_sys_alarm(struct lwp *l, const struct linux_sys_alarm_args *uap, register_t *retval)
@@ -99,98 +97,28 @@ linux_sys_alarm(struct lwp *l, const str
 		syscallarg(unsigned int) secs;
 	} */
 	struct proc *p = l->l_proc;
-	struct timespec now;
-	struct itimerspec *itp, it;
-	struct ptimer *ptp, *spare;
-	extern kmutex_t timer_lock;
-	struct ptimers *pts;
-
-	if ((pts = p->p_timers) == NULL)
-		pts = timers_alloc(p);
-	spare = NULL;
-
- retry:
-	mutex_spin_enter(_lock);
-	if (pts && pts->pts_timers[ITIMER_REAL])
-		itp = >pts_timers[ITIMER_REAL]->pt_time;
-	else
-		itp = NULL;
-	/*
-	 * Clear any pending timer alarms.
-	 */
-	if (itp) {
-		callout_stop(>pts_timers[ITIMER_REAL]->pt_ch);
-		timespecclear(>it_interval);
-		getnanotime();
-		if (timespecisset(>it_value) &&
-		timespeccmp(>it_value, , >))
-			timespecsub(>it_value, , >it_value);
-		/*
-		 * Return how many seconds were left (rounded up)
-		 */
-		retval[0] = itp->it_value.tv_sec;
-		if (itp->it_value.tv_nsec)
-			retval[0]++;
-	} else {
-		retval[0] = 0;
-	}
+	struct itimerval itv, oitv;
+	int error;
 
-	/*
-	 * alarm(0) just resets the timer.
-	 */
-	if (SCARG(uap, secs) == 0) {
-		if (itp)
-			timespecclear(>it_value);
-		mutex_spin_exit(_lock);
-		return 0;
+	timerclear(_interval);
+	itv.it_value.tv_sec = SCARG(uap, secs);
+	itv.it_value.tv_usec = 0;
+	if (itv.it_value.tv_sec < 0) {
+		return EINVAL;
 	}
 
-	/*
-	 * Check the new alarm time for sanity, and set it.
-	 */
-	timespecclear(_interval);
-	it.it_value.tv_sec = SCARG(uap, secs);
-	it.it_value.tv_nsec = 0;
-	if (itimespecfix(_value) || itimespecfix(_interval)) {
-		mutex_spin_exit(_lock);
-		return (EINVAL);
+	if ((error = dogetitimer(p, ITIMER_REAL, )) != 0) {
+		return error;
 	}
-
-	ptp = pts->pts_timers[ITIMER_REAL];
-	if (ptp == NULL) {
-		if (spare == NULL) {
-			mutex_spin_exit(_lock);
-			spare = pool_get(_pool, PR_WAITOK);
-			memset(spare, 0, sizeof(*spare));
-			goto retry;
-		}
-		ptp = spare;
-		spare = NULL;
-		ptp->pt_ev.sigev_notify = SIGEV_SIGNAL;
-		ptp->pt_ev.sigev_signo = SIGALRM;
-		ptp->pt_overruns = 0;
-		ptp->pt_proc = p;
-		ptp->pt_type = CLOCK_REALTIME;
-		ptp->pt_entry = CLOCK_REALTIME;
-		ptp->pt_active = 0;
-		ptp->pt_queued = 0;
-		callout_init(>pt_ch, CALLOUT_MPSAFE);
-		pts->pts_timers[ITIMER_REAL] = ptp;
+	if (oitv.it_value.tv_usec) {
+		oitv.it_value.tv_sec++;
 	}
 
-	if (timespecisset(_value)) {
-		/*
-		 * Don't need to check tvhzto() return value, here.
-		 * callout_reset() does it for us.
-		 */
-		getnanotime();
-		timespecadd(_value, , _value);
-		callout_reset(>pt_ch, tshzto(_value),
-		realtimerexpire, ptp);
+	if ((error = dosetitimer(p, ITIMER_REAL, )) != 0) {
+		return error;
 	}
-	ptp->pt_time = it;
-	mutex_spin_exit(_lock);
 
+	*retval = oitv.it_value.tv_sec;
 	return 0;
 }
 #endif /* !COMPAT_LINUX32 */



CVS commit: src/lib/libossaudio

2020-12-03 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Thu Dec  3 22:10:21 UTC 2020

Modified Files:
src/lib/libossaudio: soundcard.h

Log Message:
Add some missing channel order related ioctl defines.

These are no-ops (unimplemented) on both FreeBSD and Solaris
and the one piece of code I've found that uses it seems to assume the
call will fail so it should be safe to leave this returning EINVAL.

However, it does need the definitions to compile...


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/lib/libossaudio/soundcard.h

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

Modified files:

Index: src/lib/libossaudio/soundcard.h
diff -u src/lib/libossaudio/soundcard.h:1.32 src/lib/libossaudio/soundcard.h:1.33
--- src/lib/libossaudio/soundcard.h:1.32	Tue Nov  3 09:33:53 2020
+++ src/lib/libossaudio/soundcard.h	Thu Dec  3 22:10:21 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: soundcard.h,v 1.32 2020/11/03 09:33:53 nia Exp $	*/
+/*	$NetBSD: soundcard.h,v 1.33 2020/12/03 22:10:21 nia Exp $	*/
 
 /*-
  * Copyright (c) 1997, 2020 The NetBSD Foundation, Inc.
@@ -358,6 +358,21 @@ typedef struct buffmem_desc {
 #define SNDCTL_DSP_CURRENT_IPTR		_IOR ('P',35, oss_count_t)
 #define SNDCTL_DSP_CURRENT_OPTR		_IOR ('P',36, oss_count_t)
 
+#define SNDCTL_DSP_GET_CHNORDER		_IOR ('P',42, unsigned long long)
+#define SNDCTL_DSP_SET_CHNORDER		_IOWR ('P',42, unsigned long long)
+
+#define CHID_UNDEF	0
+#define CHID_L		1
+#define CHID_R		2
+#define CHID_C		3
+#define CHID_LFE	4
+#define CHID_LS		5
+#define CHID_RS		6
+#define CHID_LR		7
+#define CHID_RR		8
+#define CHNORDER_UNDEF	0xULL
+#define CHNORDER_NORMAL	0x87654321ULL
+
 typedef struct {
 	long long samples;
 	int fifo_samples;



CVS commit: src/usr.bin/make

2020-12-03 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Dec  3 18:43:02 UTC 2020

Modified Files:
src/usr.bin/make: Makefile

Log Message:
make(1): format coverage summary as a table

This is only used interactively, not in the official builds, therefore
the additional dependency on Perl doesn't matter.  The same result could
have been achieved in any other programming language, but probably not
as concisely.


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/usr.bin/make/Makefile

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/Makefile
diff -u src/usr.bin/make/Makefile:1.106 src/usr.bin/make/Makefile:1.107
--- src/usr.bin/make/Makefile:1.106	Sun Oct 25 13:25:19 2020
+++ src/usr.bin/make/Makefile	Thu Dec  3 18:43:02 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.106 2020/10/25 13:25:19 rillig Exp $
+#	$NetBSD: Makefile,v 1.107 2020/12/03 18:43:02 rillig Exp $
 #	@(#)Makefile	5.2 (Berkeley) 12/28/90
 
 PROG=	make
@@ -43,6 +43,13 @@ USE_COVERAGE?=	no		# works only with gcc
 .if ${USE_COVERAGE} == "yes"
 GCOV?=		gcov
 COPTS+=		--coverage -O0 -ggdb
+GCOV_PERL=	if (/^File '(\S+)'/) {
+GCOV_PERL+=		$$file = $$1; $$func = "";
+GCOV_PERL+=	} elsif (/^Function '(\S+)'/) {
+GCOV_PERL+=		$$func = $$1;
+GCOV_PERL+=	} elsif (/^Lines executed:(\d+\.\d+)% of (\d+)/) {
+GCOV_PERL+=		printf("%6.2f  %5d   %s%s\n", $$1, $$2, $$file, $$func);
+GCOV_PERL+=	}
 LDADD+=		--coverage
 .endif
 CLEANFILES+=	*.gcda *.gcno *.gcov
@@ -170,8 +177,8 @@ test: .MAKE
 	cd ${.CURDIR}/unit-tests \
 	&& MAKEFLAGS= ${TEST_MAKE} -r -m / TEST_MAKE=${TEST_MAKE} ${TESTS:DTESTS=${TESTS:Q}} ${.TARGET}
 .if ${USE_COVERAGE} == yes
-	${GCOV} ${GCOV_OPTS} ${SRCS}
-	sed -i 's,^\([^:]*\): *[0-9]*:,\1: ,' *.gcov
+	@${GCOV} ${GCOV_OPTS} ${SRCS} | perl -ne ${GCOV_PERL:Q} | sort -nr
+	@sed -i 's,^\([^:]*\): *[0-9]*:,\1: ,' *.gcov
 .endif
 
 accept sync-mi: .MAKE



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

2020-12-03 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Dec  3 10:23:45 UTC 2020

Modified Files:
src/sys/arch/arm/arm32: db_machdep.c

Log Message:
tlb_print_*() are used only if _ARM_ARCH_7; caught by clang -Wunused-function.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/arm/arm32/db_machdep.c

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

Modified files:

Index: src/sys/arch/arm/arm32/db_machdep.c
diff -u src/sys/arch/arm/arm32/db_machdep.c:1.37 src/sys/arch/arm/arm32/db_machdep.c:1.38
--- src/sys/arch/arm/arm32/db_machdep.c:1.37	Fri Oct 30 18:54:36 2020
+++ src/sys/arch/arm/arm32/db_machdep.c	Thu Dec  3 10:23:45 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_machdep.c,v 1.37 2020/10/30 18:54:36 skrll Exp $	*/
+/*	$NetBSD: db_machdep.c,v 1.38 2020/12/03 10:23:45 rin Exp $	*/
 
 /*
  * Copyright (c) 1996 Mark Brinicombe
@@ -34,7 +34,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.37 2020/10/30 18:54:36 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.38 2020/12/03 10:23:45 rin Exp $");
 
 #include 
 
@@ -220,6 +220,7 @@ db_reset_cmd(db_expr_t addr, bool have_a
 	cpu_reset_address();
 }
 
+#ifdef _ARM_ARCH_7
 static void
 tlb_print_common_header(const char *str)
 {
@@ -405,7 +406,6 @@ tlb_lookup_tlbinfo(void)
 	return NULL;
 }
 
-#ifdef _ARM_ARCH_7
 void
 db_show_tlb_cmd(db_expr_t addr, bool have_addr, db_expr_t count, const char *modif)
 {



CVS commit: src/sys/arch/mips/adm5120/dev

2020-12-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Dec  3 08:48:06 UTC 2020

Modified Files:
src/sys/arch/mips/adm5120/dev: wdc_extio.c

Log Message:
Fix build


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/mips/adm5120/dev/wdc_extio.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/mips/adm5120/dev/wdc_extio.c
diff -u src/sys/arch/mips/adm5120/dev/wdc_extio.c:1.11 src/sys/arch/mips/adm5120/dev/wdc_extio.c:1.12
--- src/sys/arch/mips/adm5120/dev/wdc_extio.c:1.11	Mon Sep  9 22:01:23 2019
+++ src/sys/arch/mips/adm5120/dev/wdc_extio.c	Thu Dec  3 08:48:06 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: wdc_extio.c,v 1.11 2019/09/09 22:01:23 jdolecek Exp $ */
+/*	$NetBSD: wdc_extio.c,v 1.12 2020/12/03 08:48:06 skrll Exp $ */
 
 /*-
  * Copyright (c) 2007 David Young.  All rights reserved.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wdc_extio.c,v 1.11 2019/09/09 22:01:23 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wdc_extio.c,v 1.12 2020/12/03 08:48:06 skrll Exp $");
 
 #include 
 #include 
@@ -245,10 +245,7 @@ wdc_extio_match(device_t parent, cfdata_
 
 	WDC_EXTIO_DPRINTF("%s: enter\n", __func__);
 
-	memset(, 0, sizeof(wdc));
-	memset(, 0, sizeof(ch));
-	ch.ch_atac = _atac;
-	wdc.regs = 
+#if 0
 	wdc.datain_pio = wdc_extio_datain;
 	wdc.dataout_pio = wdc_extio_dataout;
 	if (cf->cf_flags != -1) {
@@ -257,6 +254,7 @@ wdc_extio_match(device_t parent, cfdata_
 		wdc.cap |= cf->cf_flags &
 		(WDC_CAPABILITY_PREATA|WDC_CAPABILITY_NO_EXTRA_RESETS);
 	}
+#endif
 
 	if (wdc_extio_map(ea, , , ) == -1)
 		return 0;



CVS commit: src/sbin/dump

2020-12-03 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu Dec  3 08:25:57 UTC 2020

Modified Files:
src/sbin/dump: dump.h main.c

Log Message:
PR bin/55834

count blocks written in unsigned 64 bit counter
rather than signed int which overflows after 2^31-1
blocks (2TiB) after which neither the 5 minute
status updates or SIGINFO (^T) reports are issued
until the negative numbers increase past 0 and
wildly inaccurate reports would be written.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sbin/dump/dump.h
cvs rdiff -u -r1.77 -r1.78 src/sbin/dump/main.c

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

Modified files:

Index: src/sbin/dump/dump.h
diff -u src/sbin/dump/dump.h:1.58 src/sbin/dump/dump.h:1.59
--- src/sbin/dump/dump.h:1.58	Sun Apr  5 15:25:39 2020
+++ src/sbin/dump/dump.h	Thu Dec  3 08:25:57 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: dump.h,v 1.58 2020/04/05 15:25:39 joerg Exp $	*/
+/*	$NetBSD: dump.h,v 1.59 2020/12/03 08:25:57 kre Exp $	*/
 
 /*-
  * Copyright (c) 1980, 1993
@@ -134,7 +134,7 @@ extern int	unlimited;	/* if set, write t
 extern int	density;	/* density in 0.1" units */
 extern int	notify;		/* notify operator flag */
 extern int	timestamp;	/* timestamp messages */
-extern int	blockswritten;	/* number of blocks written on current tape */
+extern u_int64_t	blockswritten;	/* blocks written on current tape */
 extern int	tapeno;		/* current tape number */
 extern int	is_ufs2;
 

Index: src/sbin/dump/main.c
diff -u src/sbin/dump/main.c:1.77 src/sbin/dump/main.c:1.78
--- src/sbin/dump/main.c:1.77	Sun Apr  5 15:25:39 2020
+++ src/sbin/dump/main.c	Thu Dec  3 08:25:57 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.77 2020/04/05 15:25:39 joerg Exp $	*/
+/*	$NetBSD: main.c,v 1.78 2020/12/03 08:25:57 kre Exp $	*/
 
 /*-
  * Copyright (c) 1980, 1991, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "@(#)main.c	8.6 (Berkeley) 5/1/95";
 #else
-__RCSID("$NetBSD: main.c,v 1.77 2020/04/05 15:25:39 joerg Exp $");
+__RCSID("$NetBSD: main.c,v 1.78 2020/12/03 08:25:57 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -108,7 +108,7 @@ int needswap;
 
 int	timestamp;		/* print message timestamps */
 int	notify;			/* notify operator flag */
-int	blockswritten;		/* number of blocks written on current tape */
+u_int64_t	blockswritten;	/* number of blocks written on current tape */
 int	tapeno;			/* current tape number */
 int	density;		/* density in bytes/0.1" */
 int	ntrec = NTREC;		/* # tape blocks in each tape record */