CVS commit: src/sys/dev/pci/ixgbe

2020-02-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Feb  6 06:28:49 UTC 2020

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe.c ixgbe.h

Log Message:
Ensure we don't call workqueue_enqueue() if the pluggable optics
handler is already pending.


To generate a diff of this commit:
cvs rdiff -u -r1.225 -r1.226 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.64 -r1.65 src/sys/dev/pci/ixgbe/ixgbe.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/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.225 src/sys/dev/pci/ixgbe/ixgbe.c:1.226
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.225	Wed Feb  5 07:45:46 2020
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Thu Feb  6 06:28:49 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.225 2020/02/05 07:45:46 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.226 2020/02/06 06:28:49 thorpej Exp $ */
 
 /**
 
@@ -1507,6 +1507,18 @@ ixgbe_is_sfp(struct ixgbe_hw *hw)
 	}
 } /* ixgbe_is_sfp */
 
+static void
+ixgbe_schedule_msf_tasklet(struct adapter *adapter)
+{
+	if (adapter->schedule_wqs_ok) {
+		if (!adapter->msf_pending) {
+			adapter->msf_pending = true;
+			workqueue_enqueue(adapter->msf_wq,
+			>msf_wc, NULL);
+		}
+	}
+}
+
 /
  * ixgbe_config_link
  /
@@ -1523,9 +1535,7 @@ ixgbe_config_link(struct adapter *adapte
 		if (hw->phy.multispeed_fiber) {
 			ixgbe_enable_tx_laser(hw);
 			kpreempt_disable();
-			if (adapter->schedule_wqs_ok)
-workqueue_enqueue(adapter->msf_wq,
->msf_wc, NULL);
+			ixgbe_schedule_msf_tasklet(adapter);
 			kpreempt_enable();
 		}
 		kpreempt_disable();
@@ -3099,9 +3109,7 @@ ixgbe_msix_link(void *arg)
 		(eicr & IXGBE_EICR_GPI_SDP1_BY_MAC(hw))) {
 			IXGBE_WRITE_REG(hw, IXGBE_EICR,
 			IXGBE_EICR_GPI_SDP1_BY_MAC(hw));
-			if (adapter->schedule_wqs_ok)
-workqueue_enqueue(adapter->msf_wq,
->msf_wc, NULL);
+			ixgbe_schedule_msf_tasklet(adapter);
 		}
 	}
 
@@ -4674,8 +4682,7 @@ ixgbe_handle_mod(void *context)
 			goto out;
 		}
 	}
-	if (adapter->schedule_wqs_ok)
-		workqueue_enqueue(adapter->msf_wq, >msf_wc, NULL);
+	ixgbe_schedule_msf_tasklet(adapter);
 out:
 	IXGBE_CORE_UNLOCK(adapter);
 } /* ixgbe_handle_mod */
@@ -4703,6 +4710,7 @@ ixgbe_handle_msf(struct work *wk, void *
 	IFNET_LOCK(ifp);
 
 	IXGBE_CORE_LOCK(adapter);
+	adapter->msf_pending = false;
 	++adapter->msf_sicount.ev_count;
 	/* get_supported_phy_layer will call hw->phy.ops.identify_sfp() */
 	adapter->phy_layer = ixgbe_get_supported_physical_layer(hw);
@@ -4754,6 +4762,7 @@ ixgbe_ifstop(struct ifnet *ifp, int disa
 	IXGBE_CORE_UNLOCK(adapter);
 
 	workqueue_wait(adapter->msf_wq, >msf_wc);
+	adapter->msf_pending = false;
 }
 
 /
@@ -5122,9 +5131,7 @@ ixgbe_legacy_irq(void *arg)
 		(eicr & IXGBE_EICR_GPI_SDP1_BY_MAC(hw))) {
 			IXGBE_WRITE_REG(hw, IXGBE_EICR,
 			IXGBE_EICR_GPI_SDP1_BY_MAC(hw));
-			if (adapter->schedule_wqs_ok)
-workqueue_enqueue(adapter->msf_wq,
->msf_wc, NULL);
+			ixgbe_schedule_msf_tasklet(adapter);
 		}
 	}
 

Index: src/sys/dev/pci/ixgbe/ixgbe.h
diff -u src/sys/dev/pci/ixgbe/ixgbe.h:1.64 src/sys/dev/pci/ixgbe/ixgbe.h:1.65
--- src/sys/dev/pci/ixgbe/ixgbe.h:1.64	Wed Feb  5 07:45:46 2020
+++ src/sys/dev/pci/ixgbe/ixgbe.h	Thu Feb  6 06:28:49 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.h,v 1.64 2020/02/05 07:45:46 msaitoh Exp $ */
+/* $NetBSD: ixgbe.h,v 1.65 2020/02/06 06:28:49 thorpej Exp $ */
 
 /**
   SPDX-License-Identifier: BSD-3-Clause
@@ -515,6 +515,7 @@ struct adapter {
 	void			*mod_si;   /* SFP tasklet */
 	struct workqueue	*msf_wq;   /* Multispeed Fiber */
 	struct work		 msf_wc;
+	bool			 msf_pending;
 	void			*mbx_si;   /* VF -> PF mailbox interrupt */
 
 	/* Flow Director */



CVS commit: src/sys/arch/macppc/dev

2020-02-05 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Feb  6 02:17:24 UTC 2020

Modified Files:
src/sys/arch/macppc/dev: lmu.c

Log Message:
listen to PMF events in order to turn off keyboard lights when the lid is
closed or the screen is blanked


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/macppc/dev/lmu.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/macppc/dev/lmu.c
diff -u src/sys/arch/macppc/dev/lmu.c:1.1 src/sys/arch/macppc/dev/lmu.c:1.2
--- src/sys/arch/macppc/dev/lmu.c:1.1	Fri Jan 10 06:24:17 2020
+++ src/sys/arch/macppc/dev/lmu.c	Thu Feb  6 02:17:24 2020
@@ -1,4 +1,4 @@
- /* $NetBSD: lmu.c,v 1.1 2020/01/10 06:24:17 macallan Exp $ */
+ /* $NetBSD: lmu.c,v 1.2 2020/02/06 02:17:24 macallan Exp $ */
 
 /*-
  * Copyright (c) 2020 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lmu.c,v 1.1 2020/01/10 06:24:17 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lmu.c,v 1.2 2020/02/06 02:17:24 macallan Exp $");
 
 #include 
 #include 
@@ -56,7 +56,8 @@ struct lmu_softc {
 	struct sysmon_envsys *sc_sme;
 	envsys_data_t	sc_sensors[2];
 	callout_t	sc_adjust;
-	int sc_thresh, sc_hyst;
+	int sc_thresh, sc_hyst, sc_level;
+	int		sc_lid_state, sc_video_state;
 };
 
 static int	lmu_match(device_t, cfdata_t, void *);
@@ -76,6 +77,38 @@ static const struct device_compatible_en
 	{ NULL,			0 }
 };
 
+static void
+lmu_lid_open(device_t dev)
+{
+	struct lmu_softc * const sc = device_private(dev);
+
+	sc->sc_lid_state = true;
+}
+
+static void
+lmu_lid_close(device_t dev)
+{
+	struct lmu_softc * const sc = device_private(dev);
+
+	sc->sc_lid_state = false;
+}
+
+static void
+lmu_video_on(device_t dev)
+{
+	struct lmu_softc * const sc = device_private(dev);
+
+	sc->sc_video_state = true;
+}
+
+static void
+lmu_video_off(device_t dev)
+{
+	struct lmu_softc * const sc = device_private(dev);
+
+	sc->sc_video_state = false;
+}
+
 static int
 lmu_match(device_t parent, cfdata_t match, void *aux)
 {
@@ -103,6 +136,17 @@ lmu_attach(device_t parent, device_t sel
 	aprint_naive("\n");
 	aprint_normal(": ambient light sensor\n");
 
+	sc->sc_lid_state = true;
+	pmf_event_register(sc->sc_dev, PMFE_CHASSIS_LID_OPEN,
+	lmu_lid_open, true);
+	pmf_event_register(sc->sc_dev, PMFE_CHASSIS_LID_CLOSE,
+	lmu_lid_close, true);
+	sc->sc_video_state = true;
+	pmf_event_register(sc->sc_dev, PMFE_DISPLAY_ON,
+	lmu_video_on, true);
+	pmf_event_register(sc->sc_dev, PMFE_DISPLAY_OFF,
+	lmu_video_off, true);
+
 	sc->sc_sme = sysmon_envsys_create();
 	sc->sc_sme->sme_name = device_xname(self);
 	sc->sc_sme->sme_cookie = sc;
@@ -127,6 +171,7 @@ lmu_attach(device_t parent, device_t sel
 	/* TODO: make this adjustable via sysctl */
 	sc->sc_thresh = 300;
 	sc->sc_hyst = 30;
+	sc->sc_level = 100;
 
 	callout_init(>sc_adjust, 0);
 	callout_setfunc(>sc_adjust, lmu_adjust, sc);
@@ -189,10 +234,11 @@ lmu_adjust(void *cookie)
 	right = lmu_get_brightness(sc, 0);
 	b = left > right ? left : right;
 
-	if (b > (sc->sc_thresh + sc->sc_hyst)) {
+	if ((b > (sc->sc_thresh + sc->sc_hyst)) ||
+	   !(sc->sc_lid_state && sc->sc_video_state)) {
 		lmu_set_brightness(sc, 0);
 	} else if (b < sc->sc_thresh) {
-		lmu_set_brightness(sc, 100);
+		lmu_set_brightness(sc, sc->sc_level);
 	}
 
 	callout_schedule(>sc_adjust, hz * 2);	



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

2020-02-05 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Feb  6 01:37:46 UTC 2020

Modified Files:
src/sys/arch/evbarm/conf: GENERIC GENERIC64

Log Message:
add MIDI sequencer device.  now midiplay works on usb midi devices.


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/sys/arch/evbarm/conf/GENERIC
cvs rdiff -u -r1.135 -r1.136 src/sys/arch/evbarm/conf/GENERIC64

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

Modified files:

Index: src/sys/arch/evbarm/conf/GENERIC
diff -u src/sys/arch/evbarm/conf/GENERIC:1.72 src/sys/arch/evbarm/conf/GENERIC:1.73
--- src/sys/arch/evbarm/conf/GENERIC:1.72	Sun Jan 26 06:51:06 2020
+++ src/sys/arch/evbarm/conf/GENERIC	Thu Feb  6 01:37:46 2020
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC,v 1.72 2020/01/26 06:51:06 mrg Exp $
+#	$NetBSD: GENERIC,v 1.73 2020/02/06 01:37:46 mrg Exp $
 #
 #	GENERIC ARM (aarch32) kernel
 #
@@ -767,5 +767,6 @@ spiflash* at spiflashbus?
 
 include "dev/usb/usbdevices.config"
 midi* 		at midibus?
+pseudo-device	sequencer			# MIDI sequencer
 
 cinclude "arch/evbarm/conf/GENERIC.local"

Index: src/sys/arch/evbarm/conf/GENERIC64
diff -u src/sys/arch/evbarm/conf/GENERIC64:1.135 src/sys/arch/evbarm/conf/GENERIC64:1.136
--- src/sys/arch/evbarm/conf/GENERIC64:1.135	Sun Jan 26 06:51:06 2020
+++ src/sys/arch/evbarm/conf/GENERIC64	Thu Feb  6 01:37:46 2020
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC64,v 1.135 2020/01/26 06:51:06 mrg Exp $
+#	$NetBSD: GENERIC64,v 1.136 2020/02/06 01:37:46 mrg Exp $
 #
 #	GENERIC ARM (aarch64) kernel
 #
@@ -555,6 +555,7 @@ usb*		at usbus?
 
 include "dev/usb/usbdevices.config"
 midi*		at midibus?
+pseudo-device	sequencer			# MIDI sequencer
 
 # Virtio devices
 virtio*		at fdt?			# Virtio MMIO device



CVS commit: src/usr.bin/make

2020-02-05 Thread Simon J. Gerraty
Module Name:src
Committed By:   sjg
Date:   Thu Feb  6 01:13:19 UTC 2020

Modified Files:
src/usr.bin/make: Makefile job.c meta.c

Log Message:
Fix meta_compat mode.

We need to call meta_job_output() from meta_compat_parent()
Also, the need for extra fds for meta mode only applies when
using filemon_ktrace.c.
Since we hope to see more interfaces like that, test for
USE_FILEMON_DEV being not defined.

Reviewed by: riastradh


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/usr.bin/make/Makefile
cvs rdiff -u -r1.196 -r1.197 src/usr.bin/make/job.c
cvs rdiff -u -r1.77 -r1.78 src/usr.bin/make/meta.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/Makefile
diff -u src/usr.bin/make/Makefile:1.68 src/usr.bin/make/Makefile:1.69
--- src/usr.bin/make/Makefile:1.68	Sun Jan 19 19:50:54 2020
+++ src/usr.bin/make/Makefile	Thu Feb  6 01:13:19 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.68 2020/01/19 19:50:54 riastradh Exp $
+#	$NetBSD: Makefile,v 1.69 2020/02/06 01:13:19 sjg Exp $
 #	@(#)Makefile	5.2 (Berkeley) 12/28/90
 
 PROG=	make
@@ -24,7 +24,7 @@ USE_FILEMON ?= ktrace
 
 .PATH:	${.CURDIR}/filemon
 SRCS+=	filemon_${USE_FILEMON}.c
-CPPFLAGS+= -DUSE_FILEMON
+CPPFLAGS+= -DUSE_FILEMON -DUSE_FILEMON_${USE_FILEMON:tu}
 
 .if ${USE_FILEMON} == "dev"
 FILEMON_H ?= /usr/include/dev/filemon/filemon.h
@@ -67,5 +67,5 @@ COPTS.meta.c+=	${GCC_NO_FORMAT_TRUNCATIO
 COPTS.parse.c+=	${GCC_NO_FORMAT_TRUNCATION}
 
 # A simple unit-test driver to help catch regressions
-accept test:
+accept test: .MAKE
 	cd ${.CURDIR}/unit-tests && MAKEFLAGS= ${.MAKE} -r -m / TEST_MAKE=${TEST_MAKE:U${.OBJDIR}/${PROG:T}} ${.TARGET}

Index: src/usr.bin/make/job.c
diff -u src/usr.bin/make/job.c:1.196 src/usr.bin/make/job.c:1.197
--- src/usr.bin/make/job.c:1.196	Sun Jan 19 19:42:32 2020
+++ src/usr.bin/make/job.c	Thu Feb  6 01:13:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.196 2020/01/19 19:42:32 riastradh Exp $	*/
+/*	$NetBSD: job.c,v 1.197 2020/02/06 01:13:19 sjg Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: job.c,v 1.196 2020/01/19 19:42:32 riastradh Exp $";
+static char rcsid[] = "$NetBSD: job.c,v 1.197 2020/02/06 01:13:19 sjg Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)job.c	8.2 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: job.c,v 1.196 2020/01/19 19:42:32 riastradh Exp $");
+__RCSID("$NetBSD: job.c,v 1.197 2020/02/06 01:13:19 sjg Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -362,7 +362,7 @@ const char *malloc_options="A";
 static unsigned
 nfds_per_job(void)
 {
-#ifdef USE_META
+#if defined(USE_FILEMON) && !defined(USE_FILEMON_DEV)
 if (useMeta)
 	return 2;
 #endif
@@ -2145,7 +2145,7 @@ Job_CatchOutput(void)
 	job = jobfds[i];
 	if (job->job_state == JOB_ST_RUNNING)
 	JobDoOutput(job, FALSE);
-#ifdef USE_META
+#if defined(USE_FILEMON) && !defined(USE_FILEMON_DEV)
 	/*
 	 * With meta mode, we may have activity on the job's filemon
 	 * descriptor too, which at the moment is any pollfd other than
@@ -2824,7 +2824,7 @@ watchfd(Job *job)
 jobfds[nfds] = job;
 job->inPollfd = [nfds];
 nfds++;
-#ifdef USE_META
+#if defined(USE_FILEMON) && !defined(USE_FILEMON_DEV)
 if (useMeta) {
 	fds[nfds].fd = meta_job_fd(job);
 	fds[nfds].events = fds[nfds].fd == -1 ? 0 : POLLIN;
@@ -2842,7 +2842,7 @@ clearfd(Job *job)
 	Punt("Unwatching unwatched job");
 i = job->inPollfd - fds;
 nfds--;
-#ifdef USE_META
+#if defined(USE_FILEMON) && !defined(USE_FILEMON_DEV)
 if (useMeta) {
 	/*
 	 * Sanity check: there should be two fds per job, so the job's
@@ -2861,7 +2861,7 @@ clearfd(Job *job)
 	fds[i] = fds[nfds];
 	jobfds[i] = jobfds[nfds];
 	jobfds[i]->inPollfd = [i];
-#ifdef USE_META
+#if defined(USE_FILEMON) && !defined(USE_FILEMON_DEV)
 	if (useMeta) {
 	fds[i + 1] = fds[nfds + 1];
 	jobfds[i + 1] = jobfds[nfds + 1];

Index: src/usr.bin/make/meta.c
diff -u src/usr.bin/make/meta.c:1.77 src/usr.bin/make/meta.c:1.78
--- src/usr.bin/make/meta.c:1.77	Wed Jan 22 21:04:29 2020
+++ src/usr.bin/make/meta.c	Thu Feb  6 01:13:19 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: meta.c,v 1.77 2020/01/22 21:04:29 sjg Exp $ */
+/*  $NetBSD: meta.c,v 1.78 2020/02/06 01:13:19 sjg Exp $ */
 
 /*
  * Implement 'meta' mode.
@@ -716,7 +716,7 @@ meta_job_child(Job *job)
 void
 meta_job_parent(Job *job, pid_t pid)
 {
-#ifdef USE_FILEMON
+#if defined(USE_FILEMON) && !defined(USE_FILEMON_DEV)
 BuildMon *pbm;
 
 if (job != NULL) {
@@ -733,7 +733,7 @@ meta_job_parent(Job *job, pid_t pid)
 int
 meta_job_fd(Job *job)
 {
-#ifdef USE_FILEMON
+#if defined(USE_FILEMON) && !defined(USE_FILEMON_DEV)
 BuildMon *pbm;
 
 if (job != NULL) {
@@ -751,7 +751,7 @@ meta_job_fd(Job *job)
 int
 meta_job_event(Job *job)
 {
-#ifdef USE_FILEMON
+#if 

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

2020-02-05 Thread Robert Swindells
Module Name:src
Committed By:   rjs
Date:   Thu Feb  6 00:32:07 UTC 2020

Modified Files:
src/sys/arch/arm/amlogic: meson_dwmac.c

Log Message:
Match new dtb.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/amlogic/meson_dwmac.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/amlogic/meson_dwmac.c
diff -u src/sys/arch/arm/amlogic/meson_dwmac.c:1.7 src/sys/arch/arm/amlogic/meson_dwmac.c:1.8
--- src/sys/arch/arm/amlogic/meson_dwmac.c:1.7	Sun Jul 21 08:24:32 2019
+++ src/sys/arch/arm/amlogic/meson_dwmac.c	Thu Feb  6 00:32:07 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: meson_dwmac.c,v 1.7 2019/07/21 08:24:32 mrg Exp $ */
+/* $NetBSD: meson_dwmac.c,v 1.8 2020/02/06 00:32:07 rjs Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: meson_dwmac.c,v 1.7 2019/07/21 08:24:32 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: meson_dwmac.c,v 1.8 2020/02/06 00:32:07 rjs Exp $");
 
 #include 
 #include 
@@ -60,6 +60,7 @@ __KERNEL_RCSID(0, "$NetBSD: meson_dwmac.
 static const char * compatible[] = {
 	"amlogic,meson8b-dwmac",
 	"amlogic,meson-gx-dwmac",
+	"amlogic,meson-gxbb-dwmac",
 	NULL
 };
 



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

2020-02-05 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Feb  5 23:43:18 UTC 2020

Modified Files:
src/tests/lib/libc/sys: t_ptrace_wait.c

Log Message:
Refactor signal9 and signal10 tests in t_ptrace_wait*

Remove signal9 and signal10. Reimplement the idea of these test in new
trace_thread_lwpexit_masked_sigtrap, trace_thread_lwpcreate_masked_sigtrap
and trace_thread_lwpcreate_and_exit_masked_sigtrap.

This removes 2 tests directly using low-level lwp APIs.


To generate a diff of this commit:
cvs rdiff -u -r1.152 -r1.153 src/tests/lib/libc/sys/t_ptrace_wait.c

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

Modified files:

Index: src/tests/lib/libc/sys/t_ptrace_wait.c
diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.152 src/tests/lib/libc/sys/t_ptrace_wait.c:1.153
--- src/tests/lib/libc/sys/t_ptrace_wait.c:1.152	Tue Feb  4 21:34:47 2020
+++ src/tests/lib/libc/sys/t_ptrace_wait.c	Wed Feb  5 23:43:18 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.c,v 1.152 2020/02/04 21:34:47 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_wait.c,v 1.153 2020/02/05 23:43:18 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.152 2020/02/04 21:34:47 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.153 2020/02/05 23:43:18 kamil Exp $");
 
 #define __LEGACY_PT_LWPINFO
 
@@ -6395,7 +6395,7 @@ trace_threads_cb(void *arg __unused)
 }
 
 static void
-trace_threads(bool trace_create, bool trace_exit)
+trace_threads(bool trace_create, bool trace_exit, bool masked)
 {
 	const int sigval = SIGSTOP;
 	pid_t child, wpid;
@@ -6408,6 +6408,8 @@ trace_threads(bool trace_create, bool tr
 	const int elen = sizeof(event);
 	struct ptrace_siginfo info;
 
+	sigset_t intmask;
+
 	pthread_t t[TRACE_THREADS_NUM];
 	int rv;
 	size_t n;
@@ -6422,6 +6424,12 @@ trace_threads(bool trace_create, bool tr
 		DPRINTF("Before calling PT_TRACE_ME from child %d\n", getpid());
 		FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
 
+		if (masked) {
+			sigemptyset();
+			sigaddset(, SIGTRAP);
+			sigprocmask(SIG_BLOCK, , NULL);
+		}
+
 		DPRINTF("Before raising %s from child\n", strsignal(sigval));
 		FORKEE_ASSERT(raise(sigval) == 0);
 
@@ -6570,7 +6578,7 @@ trace_threads(bool trace_create, bool tr
 	TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, , 0));
 }
 
-#define TRACE_THREADS(test, trace_create, trace_exit)			\
+#define TRACE_THREADS(test, trace_create, trace_exit, mask)		\
 ATF_TC(test);\
 ATF_TC_HEAD(test, tc)			\
 {	\
@@ -6583,13 +6591,17 @@ ATF_TC_HEAD(test, tc)			\
 ATF_TC_BODY(test, tc)			\
 {	\
 	\
-trace_threads(trace_create, trace_exit);			\
+trace_threads(trace_create, trace_exit, mask);			\
 }
 
-TRACE_THREADS(trace_thread_nolwpevents, false, false)
-TRACE_THREADS(trace_thread_lwpexit, false, true)
-TRACE_THREADS(trace_thread_lwpcreate, true, false)
-TRACE_THREADS(trace_thread_lwpcreate_and_exit, true, true)
+TRACE_THREADS(trace_thread_nolwpevents, false, false, false)
+TRACE_THREADS(trace_thread_lwpexit, false, true, false)
+TRACE_THREADS(trace_thread_lwpcreate, true, false, false)
+TRACE_THREADS(trace_thread_lwpcreate_and_exit, true, true, false)
+
+TRACE_THREADS(trace_thread_lwpexit_masked_sigtrap, false, true, true)
+TRACE_THREADS(trace_thread_lwpcreate_masked_sigtrap, true, false, true)
+TRACE_THREADS(trace_thread_lwpcreate_and_exit_masked_sigtrap, true, true, true)
 
 /// 
 
@@ -7240,217 +7252,6 @@ ATF_TC_BODY(threads_and_exec, tc)
 volatile lwpid_t the_lwp_id = 0;
 
 static void
-lwp_main_func(void *arg)
-{
-	the_lwp_id = _lwp_self();
-	_lwp_exit();
-}
-
-ATF_TC(signal9);
-ATF_TC_HEAD(signal9, tc)
-{
-	atf_tc_set_md_var(tc, "descr",
-	"Verify that masking SIGTRAP in tracee does not stop tracer from "
-	"catching PTRACE_LWP_CREATE breakpoint");
-}
-
-ATF_TC_BODY(signal9, tc)
-{
-	const int exitval = 5;
-	const int sigval = SIGSTOP;
-	const int sigmasked = SIGTRAP;
-	pid_t child, wpid;
-#if defined(TWAIT_HAVE_STATUS)
-	int status;
-#endif
-	sigset_t intmask;
-	ptrace_state_t state;
-	const int slen = sizeof(state);
-	ptrace_event_t event;
-	const int elen = sizeof(event);
-	ucontext_t uc;
-	lwpid_t lid;
-	static const size_t ssize = 16*1024;
-	void *stack;
-
-	DPRINTF("Before forking process PID=%d\n", getpid());
-	SYSCALL_REQUIRE((child = fork()) != -1);
-	if (child == 0) {
-		DPRINTF("Before calling PT_TRACE_ME from child %d\n", getpid());
-		FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
-
-		sigemptyset();
-		sigaddset(, sigmasked);
-		sigprocmask(SIG_BLOCK, , NULL);
-
-		DPRINTF("Before raising %s from child\n", strsignal(sigval));
-		FORKEE_ASSERT(raise(sigval) == 0);
-
-		DPRINTF("Before allocating memory for stack in child\n");
-		FORKEE_ASSERT((stack = malloc(ssize)) != NULL);
-
-		

CVS commit: src/games/battlestar

2020-02-05 Thread Santhosh Raju
Module Name:src
Committed By:   fox
Date:   Wed Feb  5 20:11:54 UTC 2020

Modified Files:
src/games/battlestar: parse.c

Log Message:
games/battlestar: Fix the -Werror=restrict warning.

Replace strcpy(1) with the safer snprintf(3) which guarantees NULL
termination of strings.

Error was reported when build.sh was run with MKLIBCSANITIZER=yes flag.

Reviewed by: kamil@


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/games/battlestar/parse.c

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

Modified files:

Index: src/games/battlestar/parse.c
diff -u src/games/battlestar/parse.c:1.15 src/games/battlestar/parse.c:1.16
--- src/games/battlestar/parse.c:1.15	Fri Jul  1 06:04:54 2005
+++ src/games/battlestar/parse.c	Wed Feb  5 20:11:54 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.15 2005/07/01 06:04:54 jmc Exp $	*/
+/*	$NetBSD: parse.c,v 1.16 2020/02/05 20:11:54 fox Exp $	*/
 
 /*
  * Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)parse.c	8.2 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: parse.c,v 1.15 2005/07/01 06:04:54 jmc Exp $");
+__RCSID("$NetBSD: parse.c,v 1.16 2020/02/05 20:11:54 fox Exp $");
 #endif
 #endif/* not lint */
 
@@ -120,7 +120,7 @@ parse(void)
 			for (i = n + 1; i < wordcount; i++) {
 wordtype[i - 1] = wordtype[i];
 wordvalue[i - 1] = wordvalue[i];
-strcpy(words[i - 1], words[i]);
+snprintf(words[i - 1], WORDLEN, "%s", words[i]);
 			}
 			wordcount--;
 		}
@@ -140,7 +140,7 @@ parse(void)
 			for (i = n + 1; i < wordcount; i++) {
 wordtype[i - 1] = wordtype[i];
 wordvalue[i - 1] = wordvalue[i];
-strcpy(words[i - 1], words[i]);
+snprintf(words[i - 1], WORDLEN, "%s", words[i]);
 			}
 			wordcount--;
 		}
@@ -164,7 +164,7 @@ parse(void)
 wordtype[n + 1] = wordtype[n - 1];
 wordtype[n - 1] = OBJECT;
 strcpy(tmpword, words[n - 1]);
-strcpy(words[n - 1], words[n + 1]);
+snprintf(words[n - 1], WORDLEN, "%s", words[n + 1]);
 strcpy(words[n + 1], tmpword);
 flag = 1;
 		}
@@ -177,7 +177,7 @@ parse(void)
 for (i = n + 1; i < wordcount; i++) {
 	wordtype[i - 1] = wordtype[i + 1];
 	wordvalue[i - 1] = wordvalue[i + 1];
-	strcpy(words[i - 1], words[i + 1]);
+	snprintf(words[i - 1], WORDLEN, "%s", words[i + 1]);
 }
 wordcount--;
 wordcount--;



CVS commit: src/bin/csh

2020-02-05 Thread Santhosh Raju
Module Name:src
Committed By:   fox
Date:   Wed Feb  5 20:06:17 UTC 2020

Modified Files:
src/bin/csh: sem.c

Log Message:
bin/csh: Fix the -Wclobber warning.

Mark the variable as volatile as it can be clobbered when a vfork occurs.

Error was reported when build.sh was run with MKLIBCSANITIZER=yes flag.

Reviewed by: kamil@


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/bin/csh/sem.c

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

Modified files:

Index: src/bin/csh/sem.c
diff -u src/bin/csh/sem.c:1.31 src/bin/csh/sem.c:1.32
--- src/bin/csh/sem.c:1.31	Sat Jan  5 16:54:00 2019
+++ src/bin/csh/sem.c	Wed Feb  5 20:06:17 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: sem.c,v 1.31 2019/01/05 16:54:00 christos Exp $ */
+/* $NetBSD: sem.c,v 1.32 2020/02/05 20:06:17 fox Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)sem.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: sem.c,v 1.31 2019/01/05 16:54:00 christos Exp $");
+__RCSID("$NetBSD: sem.c,v 1.32 2020/02/05 20:06:17 fox Exp $");
 #endif
 #endif /* not lint */
 
@@ -67,7 +67,7 @@ execute(struct command *t, int wtty, int
 struct biltins * volatile bifunc;
 int pv[2], pid;
 sigset_t nsigset;
-int forked;
+volatile int forked;
 
 UNREGISTER(forked);
 UNREGISTER(bifunc);



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

2020-02-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Feb  5 17:13:24 UTC 2020

Modified Files:
src/tests/lib/libc/c063: t_o_search.c

Log Message:
PR misc/54940: do not combine O_SEARCH with O_RDWR, from Kyle Evans.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/lib/libc/c063/t_o_search.c

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

Modified files:

Index: src/tests/lib/libc/c063/t_o_search.c
diff -u src/tests/lib/libc/c063/t_o_search.c:1.7 src/tests/lib/libc/c063/t_o_search.c:1.8
--- src/tests/lib/libc/c063/t_o_search.c:1.7	Wed Feb  5 08:52:46 2020
+++ src/tests/lib/libc/c063/t_o_search.c	Wed Feb  5 17:13:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_o_search.c,v 1.7 2020/02/05 08:52:46 martin Exp $ */
+/*	$NetBSD: t_o_search.c,v 1.8 2020/02/05 17:13:24 martin Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: t_o_search.c,v 1.7 2020/02/05 08:52:46 martin Exp $");
+__RCSID("$NetBSD: t_o_search.c,v 1.8 2020/02/05 17:13:24 martin Exp $");
 
 #include 
 
@@ -257,7 +257,7 @@ ATF_TC_BODY(o_search_notdir, tc)
 	int fd;
 
 	ATF_REQUIRE(mkdir(DIR, 0755) == 0);
-	ATF_REQUIRE((dfd = open(FILE, O_CREAT|O_RDWR|O_SEARCH, 0644)) != -1);
+	ATF_REQUIRE((dfd = open(FILE, O_CREAT|O_SEARCH, 0644)) != -1);
 	ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) == -1);
 	ATF_REQUIRE(errno == ENOTDIR);
 	ATF_REQUIRE(close(dfd) == 0);



CVS commit: src/bin/sh

2020-02-05 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Feb  5 14:56:26 UTC 2020

Modified Files:
src/bin/sh: options.c

Log Message:
Oops, the previous didn't do what was promised.  Rather that ignoring
just "--" for exec & "." it ignored any first arg starting '-'.
Do it properly.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/bin/sh/options.c

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

Modified files:

Index: src/bin/sh/options.c
diff -u src/bin/sh/options.c:1.54 src/bin/sh/options.c:1.55
--- src/bin/sh/options.c:1.54	Tue Feb  4 16:06:59 2020
+++ src/bin/sh/options.c	Wed Feb  5 14:56:25 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: options.c,v 1.54 2020/02/04 16:06:59 kre Exp $	*/
+/*	$NetBSD: options.c,v 1.55 2020/02/05 14:56:25 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)options.c	8.2 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: options.c,v 1.54 2020/02/04 16:06:59 kre Exp $");
+__RCSID("$NetBSD: options.c,v 1.55 2020/02/05 14:56:25 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -616,6 +616,8 @@ nextopt(const char *optstring)
 		argptr++;
 		if (p[0] == '-' && p[1] == '\0')	/* check for "--" */
 			return '\0';
+		if (optstring == NULL)	/* not processing the "option" */
+			argptr--;	/* so make it be an arg again */
 	}
 	if (optstring == NULL)
 		return '\0';



CVS commit: src/lib/libpthread

2020-02-05 Thread Ryo ONODERA
Module Name:src
Committed By:   ryoon
Date:   Wed Feb  5 14:56:04 UTC 2020

Modified Files:
src/lib/libpthread: pthread.c

Log Message:
Remove trailing whiteapaces and tab


To generate a diff of this commit:
cvs rdiff -u -r1.162 -r1.163 src/lib/libpthread/pthread.c

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

Modified files:

Index: src/lib/libpthread/pthread.c
diff -u src/lib/libpthread/pthread.c:1.162 src/lib/libpthread/pthread.c:1.163
--- src/lib/libpthread/pthread.c:1.162	Wed Jan 29 17:11:57 2020
+++ src/lib/libpthread/pthread.c	Wed Feb  5 14:56:04 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread.c,v 1.162 2020/01/29 17:11:57 ad Exp $	*/
+/*	$NetBSD: pthread.c,v 1.163 2020/02/05 14:56:04 ryoon Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002, 2003, 2006, 2007, 2008, 2020
@@ -31,7 +31,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pthread.c,v 1.162 2020/01/29 17:11:57 ad Exp $");
+__RCSID("$NetBSD: pthread.c,v 1.163 2020/02/05 14:56:04 ryoon Exp $");
 
 #define	__EXPOSE_STACK	1
 
@@ -111,7 +111,7 @@ int pthread__nspins;
 int pthread__unpark_max = PTHREAD__UNPARK_MAX;
 int pthread__dbg;	/* set by libpthread_dbg if active */
 
-/* 
+/*
  * We have to initialize the pthread_stack* variables here because
  * mutexes are used before pthread_init() and thus pthread__initmain()
  * are called.  Since mutexes only save the stack pointer and not a
@@ -176,9 +176,9 @@ pthread__init(void)
 
 	/*
 	 * Allocate pthread_keys descriptors before
-	 * reseting __uselibcstub because otherwise 
+	 * reseting __uselibcstub because otherwise
 	 * malloc() will call pthread_keys_create()
-	 * while pthread_keys descriptors are not 
+	 * while pthread_keys descriptors are not
 	 * yet allocated.
 	 */
 	pthread__main = pthread_tsd_init(&__pthread_st_size);
@@ -298,7 +298,7 @@ pthread__start(void)
 	/*
 	 * Per-process timers are cleared by fork(); despite the
 	 * various restrictions on fork() and threads, it's legal to
-	 * fork() before creating any threads. 
+	 * fork() before creating any threads.
 	 */
 	pthread_atfork(NULL, NULL, pthread__child_callback);
 }
@@ -617,7 +617,7 @@ pthread_resume_np(pthread_t thread)
 
 	pthread__error(EINVAL, "Invalid thread",
 	thread->pt_magic == PT_MAGIC);
- 
+
 	if (pthread__find(thread) != 0)
 		return ESRCH;
 	if (_lwp_continue(thread->pt_lid) == 0)
@@ -1089,7 +1089,7 @@ pthread__assertfunc(const char *file, in
 	 * snprintf should not acquire any locks, or we could
 	 * end up deadlocked if the assert caller held locks.
 	 */
-	len = snprintf(buf, 1024, 
+	len = snprintf(buf, 1024,
 	"assertion \"%s\" failed: file \"%s\", line %d%s%s%s\n",
 	expr, file, line,
 	function ? ", function \"" : "",
@@ -1108,7 +1108,7 @@ pthread__errorfunc(const char *file, int
 {
 	char buf[1024];
 	size_t len;
-	
+
 	if (pthread__diagassert == 0)
 		return;
 
@@ -1116,7 +1116,7 @@ pthread__errorfunc(const char *file, int
 	 * snprintf should not acquire any locks, or we could
 	 * end up deadlocked if the assert caller held locks.
 	 */
-	len = snprintf(buf, 1024, 
+	len = snprintf(buf, 1024,
 	"%s: Error detected by libpthread: %s.\n"
 	"Detected by file \"%s\", line %d%s%s%s.\n"
 	"See pthread(3) for information.\n",



CVS commit: src/sys/modules/examples

2020-02-05 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Feb  5 14:10:47 UTC 2020

Modified Files:
src/sys/modules/examples/ping: ping.c
src/sys/modules/examples/ping_block: ping.c

Log Message:
Use ENOTTY as error for an unrecognized ioctl() code, rather than
"magic number" 1.

ok kamil@


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/modules/examples/ping/ping.c
cvs rdiff -u -r1.1 -r1.2 src/sys/modules/examples/ping_block/ping.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/modules/examples/ping/ping.c
diff -u src/sys/modules/examples/ping/ping.c:1.2 src/sys/modules/examples/ping/ping.c:1.3
--- src/sys/modules/examples/ping/ping.c:1.2	Thu Jan 30 07:58:33 2020
+++ src/sys/modules/examples/ping/ping.c	Wed Feb  5 14:10:46 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ping.c,v 1.2 2020/01/30 07:58:33 kamil Exp $	*/
+/*	$NetBSD: ping.c,v 1.3 2020/02/05 14:10:46 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ping.c,v 1.2 2020/01/30 07:58:33 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ping.c,v 1.3 2020/02/05 14:10:46 pgoyette Exp $");
 
 #include 
 #include 
@@ -101,7 +101,7 @@ ping_ioctl(dev_t self __unused, u_long c
 		printf("ping: pong!\n");
 		return 0;
 	default:
-		return 1;
+		return ENOTTY;
 	}
 }
 

Index: src/sys/modules/examples/ping_block/ping.c
diff -u src/sys/modules/examples/ping_block/ping.c:1.1 src/sys/modules/examples/ping_block/ping.c:1.2
--- src/sys/modules/examples/ping_block/ping.c:1.1	Wed Feb  5 13:23:42 2020
+++ src/sys/modules/examples/ping_block/ping.c	Wed Feb  5 14:10:47 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ping.c,v 1.1 2020/02/05 13:23:42 kamil Exp $	*/
+/*	$NetBSD: ping.c,v 1.2 2020/02/05 14:10:47 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ping.c,v 1.1 2020/02/05 13:23:42 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ping.c,v 1.2 2020/02/05 14:10:47 pgoyette Exp $");
 
 #include 
 #include 
@@ -111,7 +111,7 @@ ping_ioctl(dev_t self __unused, u_long c
 		printf("ping: pong!\n");
 		return 0;
 	default:
-		return 1;
+		return ENOTTY;
 	}
 }
 



CVS commit: src/sys/modules/examples

2020-02-05 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Feb  5 13:23:42 UTC 2020

Modified Files:
src/sys/modules/examples: Makefile README
Added Files:
src/sys/modules/examples/ping_block: Makefile cmd_ping.c ping.c ping.h

Log Message:
Import new example kernel module ping_block

Subbmitted by Nisarg Joshi.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/modules/examples/Makefile
cvs rdiff -u -r1.9 -r1.10 src/sys/modules/examples/README
cvs rdiff -u -r0 -r1.1 src/sys/modules/examples/ping_block/Makefile \
src/sys/modules/examples/ping_block/cmd_ping.c \
src/sys/modules/examples/ping_block/ping.c \
src/sys/modules/examples/ping_block/ping.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/modules/examples/Makefile
diff -u src/sys/modules/examples/Makefile:1.7 src/sys/modules/examples/Makefile:1.8
--- src/sys/modules/examples/Makefile:1.7	Thu Jan 17 20:47:42 2019
+++ src/sys/modules/examples/Makefile	Wed Feb  5 13:23:42 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.7 2019/01/17 20:47:42 kamil Exp $
+#	$NetBSD: Makefile,v 1.8 2020/02/05 13:23:42 kamil Exp $
 
 .include 
 
@@ -9,6 +9,7 @@ SUBDIR+=	luareadhappy		# Needs an additi
 SUBDIR+=	mapper			# Needs an additional helper program
 SUBDIR+=	panic_string		# Crashes the system
 SUBDIR+=	ping			# Needs an additional helper program
+SUBDIR+=	ping_block		# Needs an additional helper program
 SUBDIR+=	properties
 SUBDIR+=	readhappy
 SUBDIR+=	readhappy_mpsafe	# Contains an additional helper program

Index: src/sys/modules/examples/README
diff -u src/sys/modules/examples/README:1.9 src/sys/modules/examples/README:1.10
--- src/sys/modules/examples/README:1.9	Thu Jan 17 20:47:42 2019
+++ src/sys/modules/examples/README	Wed Feb  5 13:23:42 2020
@@ -1,4 +1,4 @@
-	$NetBSD: README,v 1.9 2019/01/17 20:47:42 kamil Exp $
+	$NetBSD: README,v 1.10 2020/02/05 13:23:42 kamil Exp $
 
Kernel Developer's Manual
 
@@ -69,6 +69,9 @@ HISTORY
 
  The mapper module first appeared in NetBSD 9.0 and was authored by
  Akul Pillai.
+ 
+ The ping_block module first appeared in NetBSD 10.0 and was authored by
+ Nisarg Joshi.
 
 AUTHORS
  This document was written by Kamil Rytarowski.

Added files:

Index: src/sys/modules/examples/ping_block/Makefile
diff -u /dev/null src/sys/modules/examples/ping_block/Makefile:1.1
--- /dev/null	Wed Feb  5 13:23:42 2020
+++ src/sys/modules/examples/ping_block/Makefile	Wed Feb  5 13:23:42 2020
@@ -0,0 +1,18 @@
+#	$NetBSD: Makefile,v 1.1 2020/02/05 13:23:42 kamil Exp $
+
+.include "../Makefile.inc"
+
+#S?=	/usr/src/sys
+
+KMOD=	ping_block
+SRCS=	ping.c
+
+.include 
+
+# To make use of this module, you'll need to separately build the
+# cmd_ping program, with a Makefile similar to
+#
+#	MKMAN=	NO
+#	PROG=	cmd_ping
+#	.include 
+
Index: src/sys/modules/examples/ping_block/cmd_ping.c
diff -u /dev/null src/sys/modules/examples/ping_block/cmd_ping.c:1.1
--- /dev/null	Wed Feb  5 13:23:42 2020
+++ src/sys/modules/examples/ping_block/cmd_ping.c	Wed Feb  5 13:23:42 2020
@@ -0,0 +1,61 @@
+/*	$NetBSD: cmd_ping.c,v 1.1 2020/02/05 13:23:42 kamil Exp $	*/
+
+/*-
+ * Copyright (c) 2015 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+__RCSID("$NetBSD: cmd_ping.c,v 1.1 2020/02/05 13:23:42 kamil Exp $");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "ping.h"
+
+#define _PATH_DEV_PING "/dev/ping"
+
+int main(int argc, char **argv)
+{
+	int devfd;
+
+	setprogname(argv[0]);
+
+	if ((devfd = open(_PATH_DEV_PING, 

CVS commit: src/sys/arch/newsmips/apbus

2020-02-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Feb  5 13:08:19 UTC 2020

Modified Files:
src/sys/arch/newsmips/apbus: if_sn.c

Log Message:
Fix if_stats access.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/newsmips/apbus/if_sn.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/newsmips/apbus/if_sn.c
diff -u src/sys/arch/newsmips/apbus/if_sn.c:1.48 src/sys/arch/newsmips/apbus/if_sn.c:1.49
--- src/sys/arch/newsmips/apbus/if_sn.c:1.48	Tue Feb  4 07:41:01 2020
+++ src/sys/arch/newsmips/apbus/if_sn.c	Wed Feb  5 13:08:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_sn.c,v 1.48 2020/02/04 07:41:01 skrll Exp $	*/
+/*	$NetBSD: if_sn.c,v 1.49 2020/02/05 13:08:19 martin Exp $	*/
 
 /*
  * National Semiconductor  DP8393X SONIC Driver
@@ -16,7 +16,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_sn.c,v 1.48 2020/02/04 07:41:01 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_sn.c,v 1.49 2020/02/05 13:08:19 martin Exp $");
 
 #include "opt_inet.h"
 
@@ -966,9 +966,9 @@ sonicrxint(struct sn_softc *sc)
 			(char *)sc->rbuf[orra & RBAMASK] +
  (rxpkt_ptr & PGOFSET);
 			if (sonic_read(sc, pkt, len) == 0)
-sc->sc_if.if_ierrors++;
+if_statinc(>sc_if, if_ierrors);
 		} else
-			sc->sc_if.if_ierrors++;
+			if_statinc(>sc_if, if_ierrors);
 
 		/*
 		 * give receive buffer area back to chip.



CVS commit: src/lib/libpthread

2020-02-05 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Feb  5 11:05:10 UTC 2020

Modified Files:
src/lib/libpthread: pthread_int.h pthread_rwlock.c pthread_spin.c

Log Message:
Retire ifdef ERRORCHECK in pthread(3)

It is enabled unconditionally since 2003 and used only for rwlocks and
spinlocks.

LLVM sanitizers make assumptions that these checks are enabled always.


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/lib/libpthread/pthread_int.h
cvs rdiff -u -r1.38 -r1.39 src/lib/libpthread/pthread_rwlock.c
cvs rdiff -u -r1.7 -r1.8 src/lib/libpthread/pthread_spin.c

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

Modified files:

Index: src/lib/libpthread/pthread_int.h
diff -u src/lib/libpthread/pthread_int.h:1.100 src/lib/libpthread/pthread_int.h:1.101
--- src/lib/libpthread/pthread_int.h:1.100	Tue Jan 28 13:08:40 2020
+++ src/lib/libpthread/pthread_int.h	Wed Feb  5 11:05:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_int.h,v 1.100 2020/01/28 13:08:40 ad Exp $	*/
+/*	$NetBSD: pthread_int.h,v 1.101 2020/02/05 11:05:10 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002, 2003, 2006, 2007, 2008, 2020
@@ -36,7 +36,6 @@
 #include 
 
 /* #define PTHREAD__DEBUG */
-#define ERRORCHECK
 
 #include "pthread_types.h"
 #include "pthread_queue.h"

Index: src/lib/libpthread/pthread_rwlock.c
diff -u src/lib/libpthread/pthread_rwlock.c:1.38 src/lib/libpthread/pthread_rwlock.c:1.39
--- src/lib/libpthread/pthread_rwlock.c:1.38	Fri Jan 31 17:52:14 2020
+++ src/lib/libpthread/pthread_rwlock.c	Wed Feb  5 11:05:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_rwlock.c,v 1.38 2020/01/31 17:52:14 kamil Exp $ */
+/*	$NetBSD: pthread_rwlock.c,v 1.39 2020/02/05 11:05:10 kamil Exp $ */
 
 /*-
  * Copyright (c) 2002, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pthread_rwlock.c,v 1.38 2020/01/31 17:52:14 kamil Exp $");
+__RCSID("$NetBSD: pthread_rwlock.c,v 1.39 2020/02/05 11:05:10 kamil Exp $");
 
 #include 
 #include 
@@ -158,10 +158,8 @@ pthread__rwlock_rdlock(pthread_rwlock_t 
 	pthread_t self;
 	int error;
 
-#ifdef ERRORCHECK
 	pthread__error(EINVAL, "Invalid rwlock",
 	ptr->ptr_magic == _PT_RWLOCK_MAGIC);
-#endif
 
 	for (owner = (uintptr_t)ptr->ptr_owner;; owner = next) {
 		/*
@@ -248,10 +246,8 @@ pthread_rwlock_tryrdlock(pthread_rwlock_
 	if (__predict_false(__uselibcstub))
 		return __libc_rwlock_tryrdlock_stub(ptr);
 
-#ifdef ERRORCHECK
 	pthread__error(EINVAL, "Invalid rwlock",
 	ptr->ptr_magic == _PT_RWLOCK_MAGIC);
-#endif
 
 	/*
 	 * Don't get a readlock if there is a writer or if there are waiting
@@ -283,10 +279,8 @@ pthread__rwlock_wrlock(pthread_rwlock_t 
 	self = pthread__self();
 	_DIAGASSERT(((uintptr_t)self & RW_FLAGMASK) == 0);
 
-#ifdef ERRORCHECK
 	pthread__error(EINVAL, "Invalid rwlock",
 	ptr->ptr_magic == _PT_RWLOCK_MAGIC);
-#endif
 
 	for (owner = (uintptr_t)ptr->ptr_owner;; owner = next) {
 		/*
@@ -374,10 +368,8 @@ pthread_rwlock_trywrlock(pthread_rwlock_
 	if (__predict_false(__uselibcstub))
 		return __libc_rwlock_trywrlock_stub(ptr);
 
-#ifdef ERRORCHECK
 	pthread__error(EINVAL, "Invalid rwlock",
 	ptr->ptr_magic == _PT_RWLOCK_MAGIC);
-#endif
 
 	self = pthread__self();
 	_DIAGASSERT(((uintptr_t)self & RW_FLAGMASK) == 0);
@@ -453,10 +445,8 @@ pthread_rwlock_unlock(pthread_rwlock_t *
 	if (__predict_false(__uselibcstub))
 		return __libc_rwlock_unlock_stub(ptr);
 
-#ifdef ERRORCHECK
 	pthread__error(EINVAL, "Invalid rwlock",
 	ptr->ptr_magic == _PT_RWLOCK_MAGIC);
-#endif
 
 #ifndef PTHREAD__ATOMIC_IS_MEMBAR
 	membar_exit();

Index: src/lib/libpthread/pthread_spin.c
diff -u src/lib/libpthread/pthread_spin.c:1.7 src/lib/libpthread/pthread_spin.c:1.8
--- src/lib/libpthread/pthread_spin.c:1.7	Fri Jan 31 17:52:14 2020
+++ src/lib/libpthread/pthread_spin.c	Wed Feb  5 11:05:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_spin.c,v 1.7 2020/01/31 17:52:14 kamil Exp $	*/
+/*	$NetBSD: pthread_spin.c,v 1.8 2020/02/05 11:05:10 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2006, 2007 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pthread_spin.c,v 1.7 2020/01/31 17:52:14 kamil Exp $");
+__RCSID("$NetBSD: pthread_spin.c,v 1.8 2020/02/05 11:05:10 kamil Exp $");
 
 #include 
 #include 
@@ -53,11 +53,10 @@ int
 pthread_spin_init(pthread_spinlock_t *lock, int pshared)
 {
 
-#ifdef ERRORCHECK
 	pthread__error(EINVAL, "Invalid pshared",
 	pshared == PTHREAD_PROCESS_PRIVATE ||
 	pshared == PTHREAD_PROCESS_SHARED);
-#endif
+
 	lock->pts_magic = _PT_SPINLOCK_MAGIC;
 
 	/*
@@ -75,13 +74,11 @@ int
 pthread_spin_destroy(pthread_spinlock_t *lock)
 {
 
-#ifdef ERRORCHECK
 	pthread__error(EINVAL, "Invalid spinlock",
 	lock->pts_magic == _PT_SPINLOCK_MAGIC);
 
 	if (!__SIMPLELOCK_UNLOCKED_P(>pts_spin))
 		return EBUSY;
-#endif
 
 	lock->pts_magic = _PT_SPINLOCK_DEAD;
 
@@ -93,10 +90,8 @@ pthread_spin_lock(pthread_spinlock_t 

CVS commit: src/sys/dev/pci/ixgbe

2020-02-05 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Feb  5 10:07:47 UTC 2020

Modified Files:
src/sys/dev/pci/ixgbe: ixv.c

Log Message:
 Modify note in ixv_update_stats(). VF doesn't count errors by hardware.


To generate a diff of this commit:
cvs rdiff -u -r1.145 -r1.146 src/sys/dev/pci/ixgbe/ixv.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/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.145 src/sys/dev/pci/ixgbe/ixv.c:1.146
--- src/sys/dev/pci/ixgbe/ixv.c:1.145	Tue Feb  4 05:44:15 2020
+++ src/sys/dev/pci/ixgbe/ixv.c	Wed Feb  5 10:07:47 2020
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.145 2020/02/04 05:44:15 thorpej Exp $*/
+/*$NetBSD: ixv.c,v 1.146 2020/02/05 10:07:47 msaitoh Exp $*/
 
 /**
 
@@ -2401,12 +2401,8 @@ ixv_update_stats(struct adapter *adapter
 	stats->vfgotc);
 	UPDATE_STAT_32(IXGBE_VFMPRC, stats->last_vfmprc, stats->vfmprc);
 
-	/* Fill out the OS statistics structure */
-	/*
-	 * NetBSD: Don't override if_{i|o}{packets|bytes|mcasts} with
-	 * adapter->stats counters. It's required to make ifconfig -z
-	 * (SOICZIFDATA) work.
-	 */
+	/* VF doesn't count errors by hardware */
+
 } /* ixv_update_stats */
 
 /



CVS commit: src/sys/kern

2020-02-05 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Feb  5 09:59:51 UTC 2020

Modified Files:
src/sys/kern: kern_ktrace.c

Log Message:
No functional change:

 - s/vaule/value/ in comment.
 - whitespace fixes.
 - KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.173 -r1.174 src/sys/kern/kern_ktrace.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/kern/kern_ktrace.c
diff -u src/sys/kern/kern_ktrace.c:1.173 src/sys/kern/kern_ktrace.c:1.174
--- src/sys/kern/kern_ktrace.c:1.173	Mon Sep  3 16:29:35 2018
+++ src/sys/kern/kern_ktrace.c	Wed Feb  5 09:59:50 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_ktrace.c,v 1.173 2018/09/03 16:29:35 riastradh Exp $	*/
+/*	$NetBSD: kern_ktrace.c,v 1.174 2020/02/05 09:59:50 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_ktrace.c,v 1.173 2018/09/03 16:29:35 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_ktrace.c,v 1.174 2020/02/05 09:59:50 msaitoh Exp $");
 
 #include 
 #include 
@@ -146,7 +146,7 @@ static void	ktrace_thread(void *);
 static int	ktrderefall(struct ktr_desc *, int);
 
 /*
- * Default vaules.
+ * Default values.
  */
 #define	KTD_MAXENTRY		1000	/* XXX: tune */
 #define	KTD_TIMEOUT		5	/* XXX: tune */
@@ -528,7 +528,7 @@ ktealloc(struct ktrace_entry **ktep, voi
 
 void
 ktesethdrlen(struct ktrace_entry *kte, size_t l)
-{	
+{
 	kte->kte_kth.ktr_len = l;
 }
 
@@ -818,7 +818,7 @@ ktr_csw(int out, int user)
 		return;
 
 	/*
-	 * Don't record context switches resulting from blocking on 
+	 * Don't record context switches resulting from blocking on
 	 * locks; it's too easy to get duff results.
 	 */
 	if (l->l_syncobj == _syncobj || l->l_syncobj == _syncobj)
@@ -831,7 +831,7 @@ ktr_csw(int out, int user)
 	 * XXX This is not ideal: it would be better to maintain a pool
 	 * of ktes and actually push this to the kthread when context
 	 * switch happens, however given the points where we are called
-	 * from that is difficult to do. 
+	 * from that is difficult to do.
 	 */
 	if (out) {
 		if (ktrenter(l))
@@ -868,7 +868,7 @@ ktr_csw(int out, int user)
 			kte->kte_kth.ktr_otv.tv_sec = ts->tv_sec;
 			kte->kte_kth.ktr_otv.tv_usec = ts->tv_nsec / 1000;
 			break;
-		case 1: 
+		case 1:
 			kte->kte_kth.ktr_ots.tv_sec = ts->tv_sec;
 			kte->kte_kth.ktr_ots.tv_nsec = ts->tv_nsec;
 			break;
@@ -1141,7 +1141,8 @@ done:
  */
 /* ARGSUSED */
 int
-sys_fktrace(struct lwp *l, const struct sys_fktrace_args *uap, register_t *retval)
+sys_fktrace(struct lwp *l, const struct sys_fktrace_args *uap,
+register_t *retval)
 {
 	/* {
 		syscallarg(int) fd;
@@ -1224,8 +1225,8 @@ ktrops(lwp_t *curl, struct proc *p, int 
 #endif
 
  out:
- 	mutex_exit(_lock);
- 	mutex_exit(p->p_lock);
+	mutex_exit(_lock);
+	mutex_exit(p->p_lock);
 
 	return error ? 0 : 1;
 }



CVS commit: src/sys/dev/pci/ixgbe

2020-02-05 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Feb  5 09:47:16 UTC 2020

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe_vf.c ixgbe_x550.c

Log Message:
No functional change:

 - Fix typos.
 - Remove extra newline.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/pci/ixgbe/ixgbe_vf.c
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/pci/ixgbe/ixgbe_x550.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/ixgbe/ixgbe_vf.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_vf.c:1.22 src/sys/dev/pci/ixgbe/ixgbe_vf.c:1.23
--- src/sys/dev/pci/ixgbe/ixgbe_vf.c:1.22	Fri Sep 20 09:28:37 2019
+++ src/sys/dev/pci/ixgbe/ixgbe_vf.c	Wed Feb  5 09:47:16 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_vf.c,v 1.22 2019/09/20 09:28:37 msaitoh Exp $ */
+/* $NetBSD: ixgbe_vf.c,v 1.23 2020/02/05 09:47:16 msaitoh Exp $ */
 
 /**
   SPDX-License-Identifier: BSD-3-Clause
@@ -475,7 +475,7 @@ s32 ixgbevf_update_xcast_mode(struct ixg
 	 *  On linux's PF driver implementation, the PF replies VF's
 	 * XCAST_MODE_ALLMULTI message not with NACK but with ACK even if the
 	 * virtual function is NOT marked "trust" and act as
-	 * XCAST_MODE_"MULTI". If ixv(4) simply check the return vaule of
+	 * XCAST_MODE_"MULTI". If ixv(4) simply check the return value of
 	 * update_xcast_mode(XCAST_MODE_ALLMULTI), SIOCSADDMULTI success and
 	 * the user may have trouble with some addresses. Fortunately, the
 	 * Linux's PF driver's "ACK" message has not XCAST_MODE_"ALL"MULTI but

Index: src/sys/dev/pci/ixgbe/ixgbe_x550.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_x550.c:1.17 src/sys/dev/pci/ixgbe/ixgbe_x550.c:1.18
--- src/sys/dev/pci/ixgbe/ixgbe_x550.c:1.17	Mon Dec 23 09:36:18 2019
+++ src/sys/dev/pci/ixgbe/ixgbe_x550.c	Wed Feb  5 09:47:16 2020
@@ -2895,7 +2895,7 @@ static s32 ixgbe_setup_sfi_x550a(struct 
  *  @speed: new link speed
  *  @autoneg_wait_to_complete: unused
  *
- *  Configure the the integrated PHY for SFP support.
+ *  Configure the integrated PHY for SFP support.
  **/
 static s32 ixgbe_setup_mac_link_sfp_x550a(struct ixgbe_hw *hw,
 ixgbe_link_speed speed,
@@ -4843,4 +4843,3 @@ bool ixgbe_fw_recovery_mode_X550(struct 
 
 	return !!(fwsm & IXGBE_FWSM_FW_NVM_RECOVERY_MODE);
 }
-



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

2020-02-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Feb  5 08:52:46 UTC 2020

Modified Files:
src/tests/lib/libc/c063: t_o_search.c

Log Message:
PR misc/54939: fix file descriptor leak, patch from Kyle Evans.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/lib/libc/c063/t_o_search.c

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

Modified files:

Index: src/tests/lib/libc/c063/t_o_search.c
diff -u src/tests/lib/libc/c063/t_o_search.c:1.6 src/tests/lib/libc/c063/t_o_search.c:1.7
--- src/tests/lib/libc/c063/t_o_search.c:1.6	Tue Jan 28 07:12:08 2020
+++ src/tests/lib/libc/c063/t_o_search.c	Wed Feb  5 08:52:46 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_o_search.c,v 1.6 2020/01/28 07:12:08 martin Exp $ */
+/*	$NetBSD: t_o_search.c,v 1.7 2020/02/05 08:52:46 martin Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: t_o_search.c,v 1.6 2020/01/28 07:12:08 martin Exp $");
+__RCSID("$NetBSD: t_o_search.c,v 1.7 2020/02/05 08:52:46 martin Exp $");
 
 #include 
 
@@ -260,6 +260,7 @@ ATF_TC_BODY(o_search_notdir, tc)
 	ATF_REQUIRE((dfd = open(FILE, O_CREAT|O_RDWR|O_SEARCH, 0644)) != -1);
 	ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) == -1);
 	ATF_REQUIRE(errno == ENOTDIR);
+	ATF_REQUIRE(close(dfd) == 0);
 }
 
 ATF_TP_ADD_TCS(tp)



CVS commit: src/sys/arch/mac68k/nubus

2020-02-05 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Feb  5 08:36:34 UTC 2020

Modified Files:
src/sys/arch/mac68k/nubus: if_ae_nubus.c

Log Message:
Adopt 


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/mac68k/nubus/if_ae_nubus.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/mac68k/nubus/if_ae_nubus.c
diff -u src/sys/arch/mac68k/nubus/if_ae_nubus.c:1.41 src/sys/arch/mac68k/nubus/if_ae_nubus.c:1.42
--- src/sys/arch/mac68k/nubus/if_ae_nubus.c:1.41	Fri Jan 16 23:43:46 2009
+++ src/sys/arch/mac68k/nubus/if_ae_nubus.c	Wed Feb  5 08:36:34 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ae_nubus.c,v 1.41 2009/01/16 23:43:46 tsutsui Exp $	*/
+/*	$NetBSD: if_ae_nubus.c,v 1.42 2020/02/05 08:36:34 skrll Exp $	*/
 
 /*
  * Copyright (C) 1997 Scott Reynolds
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ae_nubus.c,v 1.41 2009/01/16 23:43:46 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ae_nubus.c,v 1.42 2020/02/05 08:36:34 skrll Exp $");
 
 #include 
 #include 
@@ -502,7 +502,7 @@ ae_nb_watchdog(struct ifnet *ifp)
 	(*via2itab[1])((void *)1);
 
 	log(LOG_ERR, "%s: device timeout\n", device_xname(sc->sc_dev));
-	++ifp->if_oerrors;
+	if_statinc(ifp, if_oerrors);
 
 	dp8390_reset(sc);
 }



CVS commit: src/sys/arch/mac68k/nubus

2020-02-05 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Feb  5 08:36:56 UTC 2020

Modified Files:
src/sys/arch/mac68k/nubus: if_ae_nubus.c

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/mac68k/nubus/if_ae_nubus.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/mac68k/nubus/if_ae_nubus.c
diff -u src/sys/arch/mac68k/nubus/if_ae_nubus.c:1.42 src/sys/arch/mac68k/nubus/if_ae_nubus.c:1.43
--- src/sys/arch/mac68k/nubus/if_ae_nubus.c:1.42	Wed Feb  5 08:36:34 2020
+++ src/sys/arch/mac68k/nubus/if_ae_nubus.c	Wed Feb  5 08:36:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ae_nubus.c,v 1.42 2020/02/05 08:36:34 skrll Exp $	*/
+/*	$NetBSD: if_ae_nubus.c,v 1.43 2020/02/05 08:36:56 skrll Exp $	*/
 
 /*
  * Copyright (C) 1997 Scott Reynolds
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ae_nubus.c,v 1.42 2020/02/05 08:36:34 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ae_nubus.c,v 1.43 2020/02/05 08:36:56 skrll Exp $");
 
 #include 
 #include 
@@ -386,7 +386,7 @@ void
 ae_nubus_intr(void *arg)
 {
 	struct dp8390_softc *sc = arg;
-	
+
 	(void)dp8390_intr(sc);
 }
 



CVS commit: src/sys/dev/qbus

2020-02-05 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Feb  5 08:35:10 UTC 2020

Modified Files:
src/sys/dev/qbus: if_dmc.c

Log Message:
Adopt 


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/qbus/if_dmc.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/qbus/if_dmc.c
diff -u src/sys/dev/qbus/if_dmc.c:1.27 src/sys/dev/qbus/if_dmc.c:1.28
--- src/sys/dev/qbus/if_dmc.c:1.27	Tue Feb  4 07:37:11 2020
+++ src/sys/dev/qbus/if_dmc.c	Wed Feb  5 08:35:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_dmc.c,v 1.27 2020/02/04 07:37:11 skrll Exp $	*/
+/*	$NetBSD: if_dmc.c,v 1.28 2020/02/05 08:35:10 skrll Exp $	*/
 /*
  * Copyright (c) 1982, 1986 Regents of the University of California.
  * All rights reserved.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_dmc.c,v 1.27 2020/02/04 07:37:11 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_dmc.c,v 1.28 2020/02/05 08:35:10 skrll Exp $");
 
 #undef DMCDEBUG	/* for base table dump on fatal error */
 
@@ -580,7 +580,7 @@ dmcxint(void *a)
 			 * Pass packet to type specific
 			 * higher-level input routine.
 			 */
-			ifp->if_ipackets++;
+			if_statinc(ifp, if_ipackets);
 			/* find location in dmcuba struct */
 			ifrw= >sc_ifr[0];
 			for (rp = >sc_rbufs[0]; rp < >sc_rbufs[NRCV]; rp++) {



CVS commit: src/sys/dev/marvell

2020-02-05 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Feb  5 08:34:48 UTC 2020

Modified Files:
src/sys/dev/marvell: if_gfe.c if_mvxpe.c

Log Message:
Adopt 


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/dev/marvell/if_gfe.c
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/marvell/if_mvxpe.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/marvell/if_gfe.c
diff -u src/sys/dev/marvell/if_gfe.c:1.55 src/sys/dev/marvell/if_gfe.c:1.56
--- src/sys/dev/marvell/if_gfe.c:1.55	Tue Feb  4 07:36:55 2020
+++ src/sys/dev/marvell/if_gfe.c	Wed Feb  5 08:34:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gfe.c,v 1.55 2020/02/04 07:36:55 skrll Exp $	*/
+/*	$NetBSD: if_gfe.c,v 1.56 2020/02/05 08:34:48 skrll Exp $	*/
 
 /*
  * Copyright (c) 2002 Allegro Networks, Inc., Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_gfe.c,v 1.55 2020/02/04 07:36:55 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gfe.c,v 1.56 2020/02/05 08:34:48 skrll Exp $");
 
 #include "opt_inet.h"
 
@@ -906,7 +906,7 @@ gfe_rx_get(struct gfe_softc *sc, enum gf
 		(buflen > sc->sc_max_frame_length)) {
 			GE_DPRINTF(sc, ("!"));
 			--rxq->rxq_active;
-			ifp->if_ipackets++;
+			if_statinc(ifp, if_ipackets);
 			if_statinc(ifp, if_ierrors);
 			goto give_it_back;
 		}

Index: src/sys/dev/marvell/if_mvxpe.c
diff -u src/sys/dev/marvell/if_mvxpe.c:1.32 src/sys/dev/marvell/if_mvxpe.c:1.33
--- src/sys/dev/marvell/if_mvxpe.c:1.32	Tue Feb  4 07:36:55 2020
+++ src/sys/dev/marvell/if_mvxpe.c	Wed Feb  5 08:34:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mvxpe.c,v 1.32 2020/02/04 07:36:55 skrll Exp $	*/
+/*	$NetBSD: if_mvxpe.c,v 1.33 2020/02/05 08:34:48 skrll Exp $	*/
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.32 2020/02/04 07:36:55 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.33 2020/02/05 08:34:48 skrll Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -3264,10 +3264,10 @@ mvxpe_update_mib(struct mvxpe_softc *sc)
 
 		switch (mvxpe_mib_list[i].ext) {
 		case MVXPE_MIBEXT_IF_OERRORS:
-			ifp->if_oerrors += val;
+			if_statadd(ifp, if_oerrors,  val);
 			break;
 		case MVXPE_MIBEXT_IF_IERRORS:
-			ifp->if_ierrors += val;
+			if_statadd(ifp, if_ierrors,  val);
 			break;
 		case MVXPE_MIBEXT_IF_COLLISIONS:
 			if_statadd(ifp, if_collisions, val);



CVS commit: src/sys/arch/acorn32/podulebus

2020-02-05 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Feb  5 08:33:19 UTC 2020

Modified Files:
src/sys/arch/acorn32/podulebus: if_ie.c

Log Message:
Adopt 


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/acorn32/podulebus/if_ie.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/acorn32/podulebus/if_ie.c
diff -u src/sys/arch/acorn32/podulebus/if_ie.c:1.47 src/sys/arch/acorn32/podulebus/if_ie.c:1.48
--- src/sys/arch/acorn32/podulebus/if_ie.c:1.47	Wed Feb  5 08:22:23 2020
+++ src/sys/arch/acorn32/podulebus/if_ie.c	Wed Feb  5 08:33:19 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ie.c,v 1.47 2020/02/05 08:22:23 skrll Exp $ */
+/* $NetBSD: if_ie.c,v 1.48 2020/02/05 08:33:19 skrll Exp $ */
 
 /*
  * Copyright (c) 1995 Melvin Tang-Richardson.
@@ -53,7 +53,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ie.c,v 1.47 2020/02/05 08:22:23 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ie.c,v 1.48 2020/02/05 08:33:19 skrll Exp $");
 
 #define IGNORE_ETHER1_IDROM_CHECKSUM
 
@@ -1545,7 +1545,7 @@ ietint(struct ie_softc *sc)
 	printf ( "ie: DMA underrun\n" );
 	if ( status & IE_XS_EXCMAX )
 	printf ( "ie: too many collisions\n" );
-	ifp->if_collisions+=16;
+	if_statadd(ifp, if_collisions, 16);
 }
 /* Done with the buffer */
 sc->xmit_free++;



CVS commit: src/sys/arch/acorn32/podulebus

2020-02-05 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Feb  5 08:22:23 UTC 2020

Modified Files:
src/sys/arch/acorn32/podulebus: if_ie.c

Log Message:
Adopt 


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/acorn32/podulebus/if_ie.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/acorn32/podulebus/if_ie.c
diff -u src/sys/arch/acorn32/podulebus/if_ie.c:1.46 src/sys/arch/acorn32/podulebus/if_ie.c:1.47
--- src/sys/arch/acorn32/podulebus/if_ie.c:1.46	Tue Feb  4 07:40:34 2020
+++ src/sys/arch/acorn32/podulebus/if_ie.c	Wed Feb  5 08:22:23 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ie.c,v 1.46 2020/02/04 07:40:34 skrll Exp $ */
+/* $NetBSD: if_ie.c,v 1.47 2020/02/05 08:22:23 skrll Exp $ */
 
 /*
  * Copyright (c) 1995 Melvin Tang-Richardson.
@@ -53,7 +53,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ie.c,v 1.46 2020/02/04 07:40:34 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ie.c,v 1.47 2020/02/05 08:22:23 skrll Exp $");
 
 #define IGNORE_ETHER1_IDROM_CHECKSUM
 
@@ -679,7 +679,7 @@ iewatchdog(struct ifnet *ifp)
 	struct ie_softc *sc = ifp->if_softc;
 
 	log(LOG_ERR, "%s: device timeout\n", device_xname(sc->sc_dev));
-	++ifp->if_oerrors;
+	if_statinc(ifp, if_oerrors);
 	iereset(sc);
 }
 



CVS commit: src/lib/libc/sys

2020-02-05 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Feb  5 08:14:36 UTC 2020

Modified Files:
src/lib/libc/sys: mkdir.2

Log Message:
Remove trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/lib/libc/sys/mkdir.2

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

Modified files:

Index: src/lib/libc/sys/mkdir.2
diff -u src/lib/libc/sys/mkdir.2:1.31 src/lib/libc/sys/mkdir.2:1.32
--- src/lib/libc/sys/mkdir.2:1.31	Tue Feb  4 18:36:16 2020
+++ src/lib/libc/sys/mkdir.2	Wed Feb  5 08:14:36 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mkdir.2,v 1.31 2020/02/04 18:36:16 christos Exp $
+.\"	$NetBSD: mkdir.2,v 1.32 2020/02/05 08:14:36 wiz Exp $
 .\"
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -55,10 +55,10 @@ and restricted by the
 .Xr umask 2
 of the calling process.
 On
-.Nx 
-all other mode bits 
+.Nx
+all other mode bits
 .Dv ( S_ISUID ,
-.Dv S_ISGID , 
+.Dv S_ISGID ,
 .Dv S_ISTXT )
 are ignored.
 This is implementation defined; for example on Linux