CVS commit: src/sys/modules/examples

2020-01-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jan 30 07:58:34 UTC 2020

Modified Files:
src/sys/modules/examples/luareadhappy: luareadhappy.c
src/sys/modules/examples/mapper: mapper.c
src/sys/modules/examples/panic_string: panic_string.c
src/sys/modules/examples/ping: ping.c
src/sys/modules/examples/readhappy_mpsafe: readhappy_mpsafe.c

Log Message:
Align major numbers in example modules with sys/conf/majors

Patch submitted by: Aditya Vardhan Padala (silv3r)


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/modules/examples/luareadhappy/luareadhappy.c
cvs rdiff -u -r1.1 -r1.2 src/sys/modules/examples/mapper/mapper.c
cvs rdiff -u -r1.1 -r1.2 src/sys/modules/examples/panic_string/panic_string.c
cvs rdiff -u -r1.1 -r1.2 src/sys/modules/examples/ping/ping.c
cvs rdiff -u -r1.1 -r1.2 \
src/sys/modules/examples/readhappy_mpsafe/readhappy_mpsafe.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/luareadhappy/luareadhappy.c
diff -u src/sys/modules/examples/luareadhappy/luareadhappy.c:1.1 src/sys/modules/examples/luareadhappy/luareadhappy.c:1.2
--- src/sys/modules/examples/luareadhappy/luareadhappy.c:1.1	Sat Apr 15 04:27:30 2017
+++ src/sys/modules/examples/luareadhappy/luareadhappy.c	Thu Jan 30 07:58:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: luareadhappy.c,v 1.1 2017/04/15 04:27:30 kamil Exp $	*/
+/*	$NetBSD: luareadhappy.c,v 1.2 2020/01/30 07:58:33 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: luareadhappy.c,v 1.1 2017/04/15 04:27:30 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: luareadhappy.c,v 1.2 2020/01/30 07:58:33 kamil Exp $");
 
 #include 
 #include 
@@ -42,7 +42,7 @@ __KERNEL_RCSID(0, "$NetBSD: luareadhappy
  * happy numbers.
  *
  * To use this device you need to do:
- * mknod /dev/happy c 210 0
+ * mknod /dev/happy c 351 0
  *
  * Commentary:
  * A happy number is a number defined by the following process: Starting with
@@ -189,7 +189,7 @@ happy_modcmd(modcmd_t cmd, void *arg __u
 {
 	/* The major should be verified and changed if needed to avoid
 	 * conflicts with other devices. */
-	int cmajor = 210, bmajor = -1;
+	int cmajor = 351, bmajor = -1;
 
 	switch (cmd) {
 	case MODULE_CMD_INIT:

Index: src/sys/modules/examples/mapper/mapper.c
diff -u src/sys/modules/examples/mapper/mapper.c:1.1 src/sys/modules/examples/mapper/mapper.c:1.2
--- src/sys/modules/examples/mapper/mapper.c:1.1	Thu Jan 17 20:47:42 2019
+++ src/sys/modules/examples/mapper/mapper.c	Thu Jan 30 07:58:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: mapper.c,v 1.1 2019/01/17 20:47:42 kamil Exp $	*/
+/*	$NetBSD: mapper.c,v 1.2 2020/01/30 07:58:33 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mapper.c,v 1.1 2019/01/17 20:47:42 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mapper.c,v 1.2 2020/01/30 07:58:33 kamil Exp $");
 
 #include 
 #include 
@@ -42,7 +42,7 @@ __KERNEL_RCSID(0, "$NetBSD: mapper.c,v 1
 /*
  * Creating a device /dev/mapper for demonstration.
  * To use this device you need to do:
- * 	mknod /dev/mapper c 210 0
+ * 	mknod /dev/mapper c 351 0
  *
  */
 
@@ -121,7 +121,7 @@ mapper_modcmd(modcmd_t cmd, void *arg __
 {
 	/* The major should be verified and changed if needed to avoid
 	 * conflicts with other devices. */
-	int cmajor = 210, bmajor = -1;
+	int cmajor = 351, bmajor = -1;
 
 	switch (cmd) {
 	case MODULE_CMD_INIT:

Index: src/sys/modules/examples/panic_string/panic_string.c
diff -u src/sys/modules/examples/panic_string/panic_string.c:1.1 src/sys/modules/examples/panic_string/panic_string.c:1.2
--- src/sys/modules/examples/panic_string/panic_string.c:1.1	Tue May 29 16:53:56 2018
+++ src/sys/modules/examples/panic_string/panic_string.c	Thu Jan 30 07:58:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: panic_string.c,v 1.1 2018/05/29 16:53:56 kamil Exp $	*/
+/*	$NetBSD: panic_string.c,v 1.2 2020/01/30 07:58:33 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: panic_string.c,v 1.1 2018/05/29 16:53:56 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: panic_string.c,v 1.2 2020/01/30 07:58:33 kamil Exp $");
 
 #include 
 #include 
@@ -46,7 +46,7 @@ __KERNEL_RCSID(0, "$NetBSD: panic_string
  * user input.
  *
  * To use this device you need to do:
- *  mknod /dev/panic c 210 0
+ *  mknod /dev/panic c 351 0
  *
  * To write to the device you might need:
  *  chmod 666 /dev/panic
@@ -173,7 +173,7 @@ panic_string_modcmd(modcmd_t cmd, void *
 {
 	/* The major should be verified and changed if needed to avoid
 	 * conflicts with other devices. */
-	int cmajor = 210, bmajor = -1;
+	int cmajor = 351, bmajor = -1;
 
 	switch (cmd) {
 	case MODULE_CMD_INIT:

Index: 

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

2020-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jan 30 06:30:52 UTC 2020

Modified Files:
src/sys/arch/mac68k/dev: if_mc.c

Log Message:
Fix more typos


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/mac68k/dev/if_mc.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/dev/if_mc.c
diff -u src/sys/arch/mac68k/dev/if_mc.c:1.54 src/sys/arch/mac68k/dev/if_mc.c:1.55
--- src/sys/arch/mac68k/dev/if_mc.c:1.54	Thu Jan 30 06:28:46 2020
+++ src/sys/arch/mac68k/dev/if_mc.c	Thu Jan 30 06:30:52 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mc.c,v 1.54 2020/01/30 06:28:46 martin Exp $	*/
+/*	$NetBSD: if_mc.c,v 1.55 2020/01/30 06:30:52 martin Exp $	*/
 
 /*-
  * Copyright (c) 1997 David Huang 
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mc.c,v 1.54 2020/01/30 06:28:46 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mc.c,v 1.55 2020/01/30 06:30:52 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_inet.h"
@@ -491,12 +491,12 @@ mc_tint(struct mc_softc *sc)
 
 	if (xmtfs & MORE)
 		/* Real number is unknown. */
-		if_statadd_ref(nsr, if_collisons, 2);
+		if_statadd_ref(nsr, if_collisions, 2);
 	else if (xmtfs & ONE)
 		if_statinc_ref(nsr, if_collisions);
 	else if (xmtfs & RTRY) {
 		printf("%s: excessive collisions\n", device_xname(sc->sc_dev));
-		if_statadd_ref(nsr, if_collsions, 16);
+		if_statadd_ref(nsr, if_collisions, 16);
 		if_statinc_ref(nsr, if_oerrors);
 	}
 



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

2020-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jan 30 06:28:46 UTC 2020

Modified Files:
src/sys/arch/mac68k/dev: if_mc.c

Log Message:
Fix typo


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/mac68k/dev/if_mc.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/dev/if_mc.c
diff -u src/sys/arch/mac68k/dev/if_mc.c:1.53 src/sys/arch/mac68k/dev/if_mc.c:1.54
--- src/sys/arch/mac68k/dev/if_mc.c:1.53	Wed Jan 29 05:25:41 2020
+++ src/sys/arch/mac68k/dev/if_mc.c	Thu Jan 30 06:28:46 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mc.c,v 1.53 2020/01/29 05:25:41 thorpej Exp $	*/
+/*	$NetBSD: if_mc.c,v 1.54 2020/01/30 06:28:46 martin Exp $	*/
 
 /*-
  * Copyright (c) 1997 David Huang 
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mc.c,v 1.53 2020/01/29 05:25:41 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mc.c,v 1.54 2020/01/30 06:28:46 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_inet.h"
@@ -491,7 +491,7 @@ mc_tint(struct mc_softc *sc)
 
 	if (xmtfs & MORE)
 		/* Real number is unknown. */
-		if_statadd_ref(nsr, if_collsions, 2);
+		if_statadd_ref(nsr, if_collisons, 2);
 	else if (xmtfs & ONE)
 		if_statinc_ref(nsr, if_collisions);
 	else if (xmtfs & RTRY) {



CVS commit: src/sys/arch/powerpc/booke/dev

2020-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jan 30 06:27:13 UTC 2020

Modified Files:
src/sys/arch/powerpc/booke/dev: pq3etsec.c

Log Message:
Fix typo


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/powerpc/booke/dev/pq3etsec.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/powerpc/booke/dev/pq3etsec.c
diff -u src/sys/arch/powerpc/booke/dev/pq3etsec.c:1.48 src/sys/arch/powerpc/booke/dev/pq3etsec.c:1.49
--- src/sys/arch/powerpc/booke/dev/pq3etsec.c:1.48	Wed Jan 29 05:35:28 2020
+++ src/sys/arch/powerpc/booke/dev/pq3etsec.c	Thu Jan 30 06:27:13 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pq3etsec.c,v 1.48 2020/01/29 05:35:28 thorpej Exp $	*/
+/*	$NetBSD: pq3etsec.c,v 1.49 2020/01/30 06:27:13 martin Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -41,7 +41,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pq3etsec.c,v 1.48 2020/01/29 05:35:28 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pq3etsec.c,v 1.49 2020/01/30 06:27:13 martin Exp $");
 
 #include 
 #include 
@@ -2226,7 +2226,7 @@ pq3etsec_txq_consume(
 			if (m->m_flags & M_HASFCB)
 m_adj(m, sizeof(struct txfcb));
 			bpf_mtap(ifp, m, BPF_D_OUT);
-			net_stats_ref_t nsr = IF_STAT_GETREF(ifp);
+			net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
 			if_statinc_ref(nsr, if_opackets);
 			if_statadd_ref(nsr, if_obytes, m->m_pkthdr.len);
 			if (m->m_flags & M_MCAST)



CVS commit: src/sys/arch/sgimips/hpc

2020-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jan 30 06:25:46 UTC 2020

Modified Files:
src/sys/arch/sgimips/hpc: if_sq.c

Log Message:
Fix typo


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/sgimips/hpc/if_sq.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/sgimips/hpc/if_sq.c
diff -u src/sys/arch/sgimips/hpc/if_sq.c:1.53 src/sys/arch/sgimips/hpc/if_sq.c:1.54
--- src/sys/arch/sgimips/hpc/if_sq.c:1.53	Wed Jan 29 05:37:08 2020
+++ src/sys/arch/sgimips/hpc/if_sq.c	Thu Jan 30 06:25:46 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_sq.c,v 1.53 2020/01/29 05:37:08 thorpej Exp $	*/
+/*	$NetBSD: if_sq.c,v 1.54 2020/01/30 06:25:46 martin Exp $	*/
 
 /*
  * Copyright (c) 2001 Rafal K. Boni
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_sq.c,v 1.53 2020/01/29 05:37:08 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_sq.c,v 1.54 2020/01/30 06:25:46 martin Exp $");
 
 
 #include 
@@ -1074,7 +1074,7 @@ sq_txintr(struct sq_softc *sc)
 
 	SQ_TRACE(SQ_TXINTR_ENTER, sc, sc->sc_prevtx, status);
 
-	net_stats_ref_t nsr = IF_STAT_GETREF(ifp);
+	net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
 	tmp = (sc->hpc_regs->enetx_ctl_active >> shift) | TXSTAT_GOOD;
 	if ((status & tmp) == 0) {
 		if (status & TXSTAT_COLL)



CVS commit: src/sys/dev/pci

2020-01-29 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Jan 30 06:10:26 UTC 2020

Modified Files:
src/sys/dev/pci: if_txp.c if_wpi.c if_xge.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/dev/pci/if_txp.c
cvs rdiff -u -r1.87 -r1.88 src/sys/dev/pci/if_wpi.c
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/pci/if_xge.c

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

Modified files:

Index: src/sys/dev/pci/if_txp.c
diff -u src/sys/dev/pci/if_txp.c:1.62 src/sys/dev/pci/if_txp.c:1.63
--- src/sys/dev/pci/if_txp.c:1.62	Fri Dec  6 07:12:39 2019
+++ src/sys/dev/pci/if_txp.c	Thu Jan 30 06:10:26 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_txp.c,v 1.62 2019/12/06 07:12:39 maxv Exp $ */
+/* $NetBSD: if_txp.c,v 1.63 2020/01/30 06:10:26 thorpej Exp $ */
 
 /*
  * Copyright (c) 2001
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_txp.c,v 1.62 2019/12/06 07:12:39 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_txp.c,v 1.63 2020/01/30 06:10:26 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -684,7 +684,7 @@ txp_rx_reclaim(struct txp_softc *sc, str
 		if (rxd->rx_flags & RX_FLAGS_ERROR) {
 			printf("%s: error 0x%x\n", device_xname(sc->sc_dev),
 			le32toh(rxd->rx_stat));
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			goto next;
 		}
 
@@ -883,7 +883,7 @@ txp_tx_reclaim(struct txp_softc *sc, str
 m_freem(m);
 txd->tx_addrlo = 0;
 txd->tx_addrhi = 0;
-ifp->if_opackets++;
+if_statinc(ifp, if_opackets);
 			}
 		}
 		ifp->if_flags &= ~IFF_OACTIVE;
@@ -1362,13 +1362,16 @@ txp_tick(void *vsc)
 		goto out;
 	ext = (struct txp_ext_desc *)(rsp + 1);
 
-	ifp->if_ierrors += ext[3].ext_2 + ext[3].ext_3 + ext[3].ext_4 +
-	ext[4].ext_1 + ext[4].ext_4;
-	ifp->if_oerrors += ext[0].ext_1 + ext[1].ext_1 + ext[1].ext_4 +
-	ext[2].ext_1;
-	ifp->if_collisions += ext[0].ext_2 + ext[0].ext_3 + ext[1].ext_2 +
-	ext[1].ext_3;
-	ifp->if_opackets += rsp->rsp_par2;
+	net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
+	if_statadd_ref(nsr, if_ierrors,
+	ext[3].ext_2 + ext[3].ext_3 + ext[3].ext_4 +
+	ext[4].ext_1 + ext[4].ext_4);
+	if_statadd_ref(nsr, if_oerrors,
+	ext[0].ext_1 + ext[1].ext_1 + ext[1].ext_4 + ext[2].ext_1);
+	if_statadd_ref(nsr, if_collisions,
+	ext[0].ext_2 + ext[0].ext_3 + ext[1].ext_2 + ext[1].ext_3);
+	if_statadd_ref(nsr, if_opackets, rsp->rsp_par2);
+	IF_STAT_PUTREF(ifp);
 
 out:
 	if (rsp != NULL)

Index: src/sys/dev/pci/if_wpi.c
diff -u src/sys/dev/pci/if_wpi.c:1.87 src/sys/dev/pci/if_wpi.c:1.88
--- src/sys/dev/pci/if_wpi.c:1.87	Sun Nov 10 21:16:36 2019
+++ src/sys/dev/pci/if_wpi.c	Thu Jan 30 06:10:26 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wpi.c,v 1.87 2019/11/10 21:16:36 chs Exp $	*/
+/*	$NetBSD: if_wpi.c,v 1.88 2020/01/30 06:10:26 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wpi.c,v 1.87 2019/11/10 21:16:36 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wpi.c,v 1.88 2020/01/30 06:10:26 thorpej Exp $");
 
 /*
  * Driver for Intel PRO/Wireless 3945ABG 802.11 network adapters.
@@ -1495,7 +1495,7 @@ wpi_rx_intr(struct wpi_softc *sc, struct
 
 	if (stat->len > WPI_STAT_MAXLEN) {
 		aprint_error_dev(sc->sc_dev, "invalid rx statistic header\n");
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 
@@ -1514,7 +1514,7 @@ wpi_rx_intr(struct wpi_softc *sc, struct
 	if ((le32toh(tail->flags) & WPI_RX_NOERROR) != WPI_RX_NOERROR) {
 		DPRINTF(("rx tail flags error %x\n",
 		le32toh(tail->flags)));
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 
@@ -1523,14 +1523,14 @@ wpi_rx_intr(struct wpi_softc *sc, struct
 			
 	MGETHDR(mnew, M_DONTWAIT, MT_DATA);
 	if (mnew == NULL) {
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 
 	rbuf = wpi_alloc_rbuf(sc);
 	if (rbuf == NULL) {
 		m_freem(mnew);
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 
@@ -1548,7 +1548,7 @@ wpi_rx_intr(struct wpi_softc *sc, struct
 		device_printf(sc->sc_dev,
 		"couldn't load rx mbuf: %d\n", error);
 		m_freem(mnew);
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 
 		error = bus_dmamap_load(sc->sc_dmat, data->map,
 		mtod(data->m, void *), WPI_RBUF_SIZE, NULL,
@@ -1655,9 +1655,9 @@ wpi_tx_intr(struct wpi_softc *sc, struct
 	}
 
 	if ((le32toh(stat->status) & 0xff) != 1)
-		ifp->if_oerrors++;
+		if_statinc(ifp, if_oerrors);
 	else
-		ifp->if_opackets++;
+		if_statinc(ifp, if_opackets);
 
 	bus_dmamap_unload(sc->sc_dmat, data->map);
 	m_freem(data->m);
@@ -2122,12 +2122,12 @@ wpi_start(struct ifnet *ifp)
 
 			/* management frames go into ring 0 */
 			if (sc->txq[0].queued > sc->txq[0].count - 8) {
-ifp->if_oerrors++;
+if_statinc(ifp, if_oerrors);
 continue;
 			}
 			bpf_mtap3(ic->ic_rawbpf, m0, BPF_D_OUT);
 			if (wpi_tx_data(sc, m0, ni, 0) != 0) {
-ifp->if_oerrors++;
+if_statinc(ifp, if_oerrors);

CVS commit: src/sys/dev/pci

2020-01-29 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Jan 30 06:03:35 UTC 2020

Modified Files:
src/sys/dev/pci: if_ipw.c if_iwi.c if_iwm.c if_iwn.c if_rtwn.c if_sk.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/sys/dev/pci/if_ipw.c
cvs rdiff -u -r1.112 -r1.113 src/sys/dev/pci/if_iwi.c
cvs rdiff -u -r1.83 -r1.84 src/sys/dev/pci/if_iwm.c
cvs rdiff -u -r1.92 -r1.93 src/sys/dev/pci/if_iwn.c
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/pci/if_rtwn.c
cvs rdiff -u -r1.103 -r1.104 src/sys/dev/pci/if_sk.c

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

Modified files:

Index: src/sys/dev/pci/if_ipw.c
diff -u src/sys/dev/pci/if_ipw.c:1.72 src/sys/dev/pci/if_ipw.c:1.73
--- src/sys/dev/pci/if_ipw.c:1.72	Sun Feb  3 03:19:27 2019
+++ src/sys/dev/pci/if_ipw.c	Thu Jan 30 06:03:34 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ipw.c,v 1.72 2019/02/03 03:19:27 mrg Exp $	*/
+/*	$NetBSD: if_ipw.c,v 1.73 2020/01/30 06:03:34 thorpej Exp $	*/
 /*	FreeBSD: src/sys/dev/ipw/if_ipw.c,v 1.15 2005/11/13 17:17:40 damien Exp 	*/
 
 /*-
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ipw.c,v 1.72 2019/02/03 03:19:27 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ipw.c,v 1.73 2020/01/30 06:03:34 thorpej Exp $");
 
 /*-
  * Intel(R) PRO/Wireless 2100 MiniPCI driver
@@ -1035,7 +1035,7 @@ ipw_data_intr(struct ipw_softc *sc, stru
 	MGETHDR(mnew, M_DONTWAIT, MT_DATA);
 	if (mnew == NULL) {
 		aprint_error_dev(sc->sc_dev, "could not allocate rx mbuf\n");
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 
@@ -1043,7 +1043,7 @@ ipw_data_intr(struct ipw_softc *sc, stru
 	if (!(mnew->m_flags & M_EXT)) {
 		aprint_error_dev(sc->sc_dev, "could not allocate rx mbuf cluster\n");
 		m_freem(mnew);
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 
@@ -1067,7 +1067,7 @@ ipw_data_intr(struct ipw_softc *sc, stru
 			panic("%s: unable to remap rx buf",
 			device_xname(sc->sc_dev));
 		}
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 
@@ -1237,7 +1237,7 @@ ipw_tx_intr(struct ipw_softc *sc)
 		sbd = >stbd_list[i];
 
 		if (sbd->type == IPW_SBD_TYPE_DATA)
-			ifp->if_opackets++;
+			if_statinc(ifp, if_opackets);
 
 		ipw_release_sbd(sc, sbd);
 		sc->txfree++;
@@ -1559,7 +1559,7 @@ ipw_start(struct ifnet *ifp)
 
 		if (ipw_tx_start(ifp, m0, ni) != 0) {
 			ieee80211_free_node(ni);
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			break;
 		}
 
@@ -1579,7 +1579,7 @@ ipw_watchdog(struct ifnet *ifp)
 	if (sc->sc_tx_timer > 0) {
 		if (--sc->sc_tx_timer == 0) {
 			aprint_error_dev(sc->sc_dev, "device timeout\n");
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			ifp->if_flags &= ~IFF_UP;
 			ipw_stop(ifp, 1);
 			return;

Index: src/sys/dev/pci/if_iwi.c
diff -u src/sys/dev/pci/if_iwi.c:1.112 src/sys/dev/pci/if_iwi.c:1.113
--- src/sys/dev/pci/if_iwi.c:1.112	Sun Nov 10 21:16:36 2019
+++ src/sys/dev/pci/if_iwi.c	Thu Jan 30 06:03:34 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_iwi.c,v 1.112 2019/11/10 21:16:36 chs Exp $  */
+/*	$NetBSD: if_iwi.c,v 1.113 2020/01/30 06:03:34 thorpej Exp $  */
 /*	$OpenBSD: if_iwi.c,v 1.111 2010/11/15 19:11:57 damien Exp $	*/
 
 /*-
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_iwi.c,v 1.112 2019/11/10 21:16:36 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iwi.c,v 1.113 2020/01/30 06:03:34 thorpej Exp $");
 
 /*-
  * Intel(R) PRO/Wireless 2200BG/2225BG/2915ABG driver
@@ -1156,7 +1156,7 @@ iwi_frame_intr(struct iwi_softc *sc, str
 	if (le16toh(frame->len) < sizeof (struct ieee80211_frame) ||
 	le16toh(frame->len) > MCLBYTES) {
 		DPRINTF(("%s: bad frame length\n", device_xname(sc->sc_dev)));
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 
@@ -1171,7 +1171,7 @@ iwi_frame_intr(struct iwi_softc *sc, str
 	 * end of the ring to the front instead of dropping.
 	 */
 	if ((m_new = iwi_alloc_rx_buf(sc)) == NULL) {
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 
@@ -1183,7 +1183,7 @@ iwi_frame_intr(struct iwi_softc *sc, str
 		aprint_error_dev(sc->sc_dev,
 		"could not load rx buf DMA map\n");
 		m_freem(m_new);
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		error = bus_dmamap_load_mbuf(sc->sc_dmat, data->map,
 		data->m, BUS_DMA_READ | BUS_DMA_NOWAIT);
 		if (error)
@@ -1455,7 +1455,7 @@ iwi_tx_intr(struct iwi_softc *sc, struct
 
 		DPRINTFN(15, ("tx done idx=%u\n", txq->next));
 
-		ifp->if_opackets++;
+		if_statinc(ifp, if_opackets);
 
 		txq->queued--;
 		txq->next = (txq->next + 1) % txq->count;
@@ -1629,7 +1629,7 @@ iwi_tx_start(struct ifnet *ifp, struct m
 		if (in->in_station == -1) {	/* h/w table is full */
 			m_freem(m0);
 			ieee80211_free_node(ni);
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			return 0;
 		}
 		iwi_write_ibssnode(sc, in);
@@ -1782,7 +1782,7 @@ iwi_start(struct ifnet *ifp)
 
 		if (m0->m_len < sizeof (struct 

CVS commit: src/sys/dev/pci

2020-01-29 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Jan 30 05:42:00 UTC 2020

Modified Files:
src/sys/dev/pci: if_et.c if_jme.c if_msk.c if_nfe.c if_sip.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/pci/if_et.c
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/pci/if_jme.c
cvs rdiff -u -r1.96 -r1.97 src/sys/dev/pci/if_msk.c
cvs rdiff -u -r1.72 -r1.73 src/sys/dev/pci/if_nfe.c
cvs rdiff -u -r1.175 -r1.176 src/sys/dev/pci/if_sip.c

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

Modified files:

Index: src/sys/dev/pci/if_et.c
diff -u src/sys/dev/pci/if_et.c:1.28 src/sys/dev/pci/if_et.c:1.29
--- src/sys/dev/pci/if_et.c:1.28	Thu Nov 28 17:09:10 2019
+++ src/sys/dev/pci/if_et.c	Thu Jan 30 05:42:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_et.c,v 1.28 2019/11/28 17:09:10 maxv Exp $	*/
+/*	$NetBSD: if_et.c,v 1.29 2020/01/30 05:42:00 thorpej Exp $	*/
 /*	$OpenBSD: if_et.c,v 1.12 2008/07/11 09:29:02 kevlo $	*/
 /*
  * Copyright (c) 2007 The DragonFly Project.  All rights reserved.
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_et.c,v 1.28 2019/11/28 17:09:10 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_et.c,v 1.29 2020/01/30 05:42:00 thorpej Exp $");
 
 #include "opt_inet.h"
 #include "vlan.h"
@@ -1197,7 +1197,7 @@ et_start(struct ifnet *ifp)
 		}
 
 		if (et_encap(sc, )) {
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			ifp->if_flags |= IFF_OACTIVE;
 			break;
 		}
@@ -1796,13 +1796,13 @@ et_rxeof(struct et_softc *sc)
 		CSR_WRITE_4(sc, ET_RXSTAT_POS, rxstat_pos);
 
 		if (ring_idx >= ET_RX_NRING) {
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			aprint_error_dev(sc->sc_dev, "invalid ring index %d\n",
 			ring_idx);
 			continue;
 		}
 		if (buf_idx >= ET_RX_NDESC) {
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			aprint_error_dev(sc->sc_dev, "invalid buf index %d\n",
 			buf_idx);
 			continue;
@@ -1817,7 +1817,7 @@ et_rxeof(struct et_softc *sc)
 		if (rbd->rbd_newbuf(rbd, buf_idx, 0) == 0) {
 			if (buflen < ETHER_CRC_LEN) {
 m_freem(m);
-ifp->if_ierrors++;
+if_statinc(ifp, if_ierrors);
 			} else {
 m->m_pkthdr.len = m->m_len = buflen -
 ETHER_CRC_LEN;
@@ -1826,7 +1826,7 @@ et_rxeof(struct et_softc *sc)
 if_percpuq_enqueue(ifp->if_percpuq, m);
 			}
 		} else {
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 		}
 
 		rx_ring = >sc_rx_ring[ring_idx];
@@ -2018,7 +2018,7 @@ et_txeof(struct et_softc *sc)
 			bus_dmamap_unload(sc->sc_dmat, tb->tb_dmap);
 			m_freem(tb->tb_mbuf);
 			tb->tb_mbuf = NULL;
-			ifp->if_opackets++;
+			if_statinc(ifp, if_opackets);
 		}
 
 		if (++tbd->tbd_start_index == ET_TX_NDESC) {

Index: src/sys/dev/pci/if_jme.c
diff -u src/sys/dev/pci/if_jme.c:1.46 src/sys/dev/pci/if_jme.c:1.47
--- src/sys/dev/pci/if_jme.c:1.46	Mon Sep 23 06:50:04 2019
+++ src/sys/dev/pci/if_jme.c	Thu Jan 30 05:42:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_jme.c,v 1.46 2019/09/23 06:50:04 maxv Exp $	*/
+/*	$NetBSD: if_jme.c,v 1.47 2020/01/30 05:42:00 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2008 Manuel Bouyer.  All rights reserved.
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_jme.c,v 1.46 2019/09/23 06:50:04 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_jme.c,v 1.47 2020/01/30 05:42:00 thorpej Exp $");
 
 
 #include 
@@ -1095,7 +1095,7 @@ jme_intr_rx(jme_softc_t *sc) {
 			printf("rx error flags 0x%x buflen 0x%x\n",
 			flags, buflen);
 #endif
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			/* reuse the mbufs */
 			for (seg = 0; seg < nsegs; seg++) {
 m = sc->jme_rxmbuf[i];
@@ -1139,7 +1139,7 @@ jme_intr_rx(jme_softc_t *sc) {
 JME_DESC_INC(sc->jme_rx_cons, JME_NBUFS);
 i = sc->jme_rx_cons;
 			}
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			continue;
 		}
 
@@ -1595,13 +1595,14 @@ jme_txeof(struct jme_softc *sc)
 			break;
 
 		if ((status & (JME_TD_TMOUT | JME_TD_RETRY_EXP)) != 0)
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 		else {
-			ifp->if_opackets++;
-			if ((status & JME_TD_COLLISION) != 0)
-ifp->if_collisions +=
+			if_statinc(ifp, if_opackets);
+			if ((status & JME_TD_COLLISION) != 0) {
+if_statadd(ifp, if_collisions,
 le32toh(desc->buflen) &
-JME_TD_BUF_LEN_MASK;
+JME_TD_BUF_LEN_MASK);
+			}
 		}
 		/*
 		 * Only the first descriptor of multi-descriptor
@@ -1673,7 +1674,7 @@ nexttx:
 		/* try to add this mbuf to the TX ring */
 		if (jme_encap(sc, _head)) {
 			if (mb_head == NULL) {
-ifp->if_oerrors++;
+if_statinc(ifp, if_oerrors);
 /* packet dropped, try next one */
 goto nexttx;
 			}
@@ -1726,7 +1727,7 @@ jme_ifwatchdog(struct ifnet *ifp)
 	if ((ifp->if_flags & IFF_RUNNING) == 0)
 		return;
 	printf("%s: device timeout\n", device_xname(sc->jme_dev));
-	ifp->if_oerrors++;
+	if_statinc(ifp, if_oerrors);
 	jme_init(ifp, 0);
 }
 

Index: 

CVS commit: src/sys/dev/pci

2020-01-29 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Jan 30 05:24:53 UTC 2020

Modified Files:
src/sys/dev/pci: if_cas.c if_dge.c if_ste.c if_stge.c if_tl.c if_vge.c
if_vr.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/pci/if_cas.c
cvs rdiff -u -r1.56 -r1.57 src/sys/dev/pci/if_dge.c
cvs rdiff -u -r1.58 -r1.59 src/sys/dev/pci/if_ste.c
cvs rdiff -u -r1.77 -r1.78 src/sys/dev/pci/if_stge.c
cvs rdiff -u -r1.118 -r1.119 src/sys/dev/pci/if_tl.c
cvs rdiff -u -r1.78 -r1.79 src/sys/dev/pci/if_vge.c
cvs rdiff -u -r1.131 -r1.132 src/sys/dev/pci/if_vr.c

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

Modified files:

Index: src/sys/dev/pci/if_cas.c
diff -u src/sys/dev/pci/if_cas.c:1.37 src/sys/dev/pci/if_cas.c:1.38
--- src/sys/dev/pci/if_cas.c:1.37	Thu Dec 26 17:51:08 2019
+++ src/sys/dev/pci/if_cas.c	Thu Jan 30 05:24:53 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_cas.c,v 1.37 2019/12/26 17:51:08 msaitoh Exp $	*/
+/*	$NetBSD: if_cas.c,v 1.38 2020/01/30 05:24:53 thorpej Exp $	*/
 /*	$OpenBSD: if_cas.c,v 1.29 2009/11/29 16:19:38 kettenis Exp $	*/
 
 /*
@@ -44,7 +44,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_cas.c,v 1.37 2019/12/26 17:51:08 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cas.c,v 1.38 2020/01/30 05:24:53 thorpej Exp $");
 
 #ifndef _MODULE
 #include "opt_inet.h"
@@ -842,20 +842,24 @@ cas_tick(void *arg)
 	int s;
 	uint32_t v;
 
+	net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
+
 	/* unload collisions counters */
 	v = bus_space_read_4(t, mac, CAS_MAC_EXCESS_COLL_CNT) +
 	bus_space_read_4(t, mac, CAS_MAC_LATE_COLL_CNT);
-	ifp->if_collisions += v +
+	if_statadd_ref(nsr, if_collisions, v +
 	bus_space_read_4(t, mac, CAS_MAC_NORM_COLL_CNT) +
-	bus_space_read_4(t, mac, CAS_MAC_FIRST_COLL_CNT);
-	ifp->if_oerrors += v;
+	bus_space_read_4(t, mac, CAS_MAC_FIRST_COLL_CNT));
+	if_statadd_ref(nsr, if_oerrors, v);
 
 	/* read error counters */
-	ifp->if_ierrors +=
+	if_statadd_ref(nsr, if_ierrors,
 	bus_space_read_4(t, mac, CAS_MAC_RX_LEN_ERR_CNT) +
 	bus_space_read_4(t, mac, CAS_MAC_RX_ALIGN_ERR) +
 	bus_space_read_4(t, mac, CAS_MAC_RX_CRC_ERR_CNT) +
-	bus_space_read_4(t, mac, CAS_MAC_RX_CODE_VIOL);
+	bus_space_read_4(t, mac, CAS_MAC_RX_CODE_VIOL));
+
+	IF_STAT_PUTREF(ifp);
 
 	/* clear the hardware counters */
 	bus_space_write_4(t, mac, CAS_MAC_NORM_COLL_CNT, 0);
@@ -1416,7 +1420,7 @@ cas_rint(struct cas_softc *sc)
 m->m_pkthdr.csum_flags = 0;
 if_percpuq_enqueue(ifp->if_percpuq, m);
 			} else
-ifp->if_ierrors++;
+if_statinc(ifp, if_ierrors);
 		}
 
 		len = CAS_RC0_DATA_LEN(word[0]);
@@ -1446,7 +1450,7 @@ cas_rint(struct cas_softc *sc)
 m->m_pkthdr.csum_flags = 0;
 if_percpuq_enqueue(ifp->if_percpuq, m);
 			} else
-ifp->if_ierrors++;
+if_statinc(ifp, if_ierrors);
 		}
 
 		if (word[0] & CAS_RC0_SPLIT)
@@ -1586,7 +1590,7 @@ cas_intr(void *v)
 		 * due to a silicon bug so handle them silently.
 		 */
 		if (rxstat & CAS_MAC_RX_OVERFLOW) {
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			cas_init(ifp);
 		}
 #ifdef CAS_DEBUG
@@ -1612,7 +1616,7 @@ cas_watchdog(struct ifnet *ifp)
 		bus_space_read_4(sc->sc_memt, sc->sc_memh, CAS_MAC_RX_CONFIG)));
 
 	log(LOG_ERR, "%s: device timeout\n", device_xname(sc->sc_dev));
-	++ifp->if_oerrors;
+	if_statinc(ifp, if_oerrors);
 
 	/* Try to get more packets going. */
 	cas_init(ifp);
@@ -2131,7 +2135,7 @@ cas_tint(struct cas_softc *sc, uint32_t 
 			bus_dmamap_unload(sc->sc_dmatag, sd->sd_map);
 			m_freem(sd->sd_mbuf);
 			sd->sd_mbuf = NULL;
-			ifp->if_opackets++;
+			if_statinc(ifp, if_opackets);
 		}
 		sc->sc_tx_cnt--;
 		if (++cons == CAS_NTXDESC)

Index: src/sys/dev/pci/if_dge.c
diff -u src/sys/dev/pci/if_dge.c:1.56 src/sys/dev/pci/if_dge.c:1.57
--- src/sys/dev/pci/if_dge.c:1.56	Sun Nov 10 21:16:36 2019
+++ src/sys/dev/pci/if_dge.c	Thu Jan 30 05:24:53 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_dge.c,v 1.56 2019/11/10 21:16:36 chs Exp $ */
+/*	$NetBSD: if_dge.c,v 1.57 2020/01/30 05:24:53 thorpej Exp $ */
 
 /*
  * Copyright (c) 2004, SUNET, Swedish University Computer Network.
@@ -80,7 +80,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_dge.c,v 1.56 2019/11/10 21:16:36 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_dge.c,v 1.57 2020/01/30 05:24:53 thorpej Exp $");
 
 
 
@@ -1425,7 +1425,7 @@ dge_watchdog(struct ifnet *ifp)
 		printf("%s: device timeout (txfree %d txsfree %d txnext %d)\n",
 		device_xname(sc->sc_dev), sc->sc_txfree, sc->sc_txsfree,
 		sc->sc_txnext);
-		ifp->if_oerrors++;
+		if_statinc(ifp, if_oerrors);
 
 		/* Reset the interface. */
 		(void) dge_init(ifp);
@@ -1622,7 +1622,7 @@ dge_txintr(struct dge_softc *sc)
 		device_xname(sc->sc_dev), i, txs->txs_firstdesc,
 		txs->txs_lastdesc));
 
-		ifp->if_opackets++;
+		if_statinc(ifp, if_opackets);
 		sc->sc_txfree += txs->txs_ndesc;
 		bus_dmamap_sync(sc->sc_dmat, 

CVS commit: src/sys/dev/ic

2020-01-29 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Jan 30 04:56:11 UTC 2020

Modified Files:
src/sys/dev/ic: seeq8005.c sgec.c smc83c170.c smc90cx6.c smc91cxx.c
wi.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/dev/ic/seeq8005.c
cvs rdiff -u -r1.51 -r1.52 src/sys/dev/ic/sgec.c
cvs rdiff -u -r1.91 -r1.92 src/sys/dev/ic/smc83c170.c
cvs rdiff -u -r1.74 -r1.75 src/sys/dev/ic/smc90cx6.c
cvs rdiff -u -r1.103 -r1.104 src/sys/dev/ic/smc91cxx.c
cvs rdiff -u -r1.254 -r1.255 src/sys/dev/ic/wi.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/seeq8005.c
diff -u src/sys/dev/ic/seeq8005.c:1.65 src/sys/dev/ic/seeq8005.c:1.66
--- src/sys/dev/ic/seeq8005.c:1.65	Sun Nov 10 21:16:35 2019
+++ src/sys/dev/ic/seeq8005.c	Thu Jan 30 04:56:11 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: seeq8005.c,v 1.65 2019/11/10 21:16:35 chs Exp $ */
+/* $NetBSD: seeq8005.c,v 1.66 2020/01/30 04:56:11 thorpej Exp $ */
 
 /*
  * Copyright (c) 2000, 2001 Ben Harris
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: seeq8005.c,v 1.65 2019/11/10 21:16:35 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: seeq8005.c,v 1.66 2020/01/30 04:56:11 thorpej Exp $");
 
 #include 
 #include 
@@ -1077,27 +1077,27 @@ ea_txint(struct seeq8005_softc *sc)
 			 * The 8004 contains a 4 bit collision count
 			 * in the status register.
 			 */
-
+#if 0
 			/* This appears to be broken on 80C04.AE */
-/*			ifp->if_collisions +=
+			if_statadd(ifp, if_collisions,
 			(txstatus >> SEEQ_TXSTAT_COLLISIONS_SHIFT)
-			& SEEQ_TXSTAT_COLLISION_MASK;*/
+			& SEEQ_TXSTAT_COLLISION_MASK;
+#endif
 
 			/* Use the TX Collision register */
 			ea_select_buffer(sc, SEEQ_BUFCODE_TX_COLLS);
 			colls = bus_space_read_1(iot, ioh, SEEQ_BUFWIN);
-			ifp->if_collisions += colls;
+			if_statadd(ifp, if_collisions, colls);
 			break;
 		}
 		case SEEQ_8005:
 			/* We known there was at least 1 collision */
-			ifp->if_collisions++;
+			if_statinc(ifp, if_collisions);
 			break;
 		}
 	} else if (txstatus & SEEQ_TXSTAT_COLLISION16) {
 		printf("seeq_intr: col16 %x\n", txstatus);
-		ifp->if_collisions += 16;
-		ifp->if_oerrors++;
+		if_statadd2(ifp, if_collisions, 16, if_oerrors, 1);
 	}
 
 	/* Have we completed transmission on the packet ? */
@@ -1107,7 +1107,7 @@ ea_txint(struct seeq8005_softc *sc)
 		ifp->if_flags &= ~IFF_OACTIVE;
 
 		/* Update stats */
-		ifp->if_opackets++;
+		if_statinc(ifp, if_opackets);
 
 		/* Tx next packet */
 
@@ -1155,7 +1155,7 @@ ea_rxint(struct seeq8005_softc *sc)
 		/* Sanity-check the next-packet pointer and flags. */
 		if (__predict_false(ptr < sc->sc_tx_bufsize ||
 		(ctrl & SEEQ_PKTCMD_TX))) {
-			++ifp->if_ierrors;
+			if_statinc(ifp, if_ierrors);
 			log(LOG_ERR,
 			"%s: Rx chain corrupt at %04x (ptr = %04x)\n",
 			device_xname(sc->sc_dev), addr, ptr);
@@ -1181,7 +1181,7 @@ ea_rxint(struct seeq8005_softc *sc)
 		if (__predict_false(status &
 			(SEEQ_RXSTAT_CRC_ERROR | SEEQ_RXSTAT_DRIBBLE_ERROR |
 			 SEEQ_RXSTAT_SHORT_FRAME))) {
-			++ifp->if_ierrors;
+			if_statinc(ifp, if_ierrors);
 			log(LOG_WARNING,
 			"%s: rx packet error at %04x (err=%02x)\n",
 			device_xname(sc->sc_dev), addr, status & 0x0f);
@@ -1195,7 +1195,7 @@ ea_rxint(struct seeq8005_softc *sc)
 		 * wants incoming packets in a single mbuf cluster.
 		 */
 		if (__predict_false(len > MCLBYTES)) {
-			++ifp->if_ierrors;
+			if_statinc(ifp, if_ierrors);
 			log(LOG_ERR,
 			"%s: rx packet size error at %04x (len=%d)\n",
 			device_xname(sc->sc_dev), addr, len);
@@ -1478,7 +1478,7 @@ ea_watchdog(struct ifnet *ifp)
 	log(LOG_ERR, "%s: lost Tx interrupt (status = 0x%04x)\n",
 	device_xname(sc->sc_dev),
 	SEEQ_READ16(sc, sc->sc_iot, sc->sc_ioh, SEEQ_STATUS));
-	ifp->if_oerrors++;
+	if_statinc(ifp, if_oerrors);
 
 	/* Kick the interface */
 

Index: src/sys/dev/ic/sgec.c
diff -u src/sys/dev/ic/sgec.c:1.51 src/sys/dev/ic/sgec.c:1.52
--- src/sys/dev/ic/sgec.c:1.51	Tue May 28 07:41:48 2019
+++ src/sys/dev/ic/sgec.c	Thu Jan 30 04:56:11 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: sgec.c,v 1.51 2019/05/28 07:41:48 msaitoh Exp $ */
+/*  $NetBSD: sgec.c,v 1.52 2020/01/30 04:56:11 thorpej Exp $ */
 /*
  * Copyright (c) 1999 Ludd, University of Lule}, Sweden. All rights reserved.
  *
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sgec.c,v 1.51 2019/05/28 07:41:48 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sgec.c,v 1.52 2020/01/30 04:56:11 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -452,7 +452,7 @@ sgec_intr(struct ze_softc *sc)
 			if (++sc->sc_nextrx == RXDESCS)
 sc->sc_nextrx = 0;
 			if (len < ETHER_MIN_LEN) {
-ifp->if_ierrors++;
+if_statinc(ifp, if_ierrors);
 m_freem(m);
 			} else {
 m_set_rcvif(m, ifp);
@@ -495,7 +495,7 @@ sgec_intr(struct ze_softc *sc)
 			sc->sc_txcnt = 0;
 			sc->sc_inq -= map->dm_nsegs;
 			

CVS commit: src/sys/arch/x86/x86

2020-01-29 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Thu Jan 30 01:49:44 UTC 2020

Modified Files:
src/sys/arch/x86/x86: multiboot2.c

Log Message:
Insert memory map with its real size, not the maximum possible.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/x86/x86/multiboot2.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/x86/x86/multiboot2.c
diff -u src/sys/arch/x86/x86/multiboot2.c:1.3 src/sys/arch/x86/x86/multiboot2.c:1.4
--- src/sys/arch/x86/x86/multiboot2.c:1.3	Tue Dec 10 02:06:07 2019
+++ src/sys/arch/x86/x86/multiboot2.c	Thu Jan 30 01:49:44 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: multiboot2.c,v 1.3 2019/12/10 02:06:07 manu Exp $	*/
+/*	$NetBSD: multiboot2.c,v 1.4 2020/01/30 01:49:44 manu Exp $	*/
 
 /*-
  * Copyright (c) 2005, 2006 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: multiboot2.c,v 1.3 2019/12/10 02:06:07 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: multiboot2.c,v 1.4 2020/01/30 01:49:44 manu Exp $");
 
 #include "opt_multiboot.h"
 
@@ -565,7 +565,7 @@ mbi_mmap(struct multiboot_tag_mmap *mbt)
 	}
 
 	bootinfo_add((struct btinfo_common *)bim, BTINFO_MEMMAP,
-	sizeof(bimbuf));
+	(char*)>entry[bim->num] - (char *)bim);
 
 	return;
 }



CVS commit: src/usr.sbin/postinstall

2020-01-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jan 30 01:39:40 UTC 2020

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
populate autofs files


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/postinstall/postinstall.in

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

Modified files:

Index: src/usr.sbin/postinstall/postinstall.in
diff -u src/usr.sbin/postinstall/postinstall.in:1.12 src/usr.sbin/postinstall/postinstall.in:1.13
--- src/usr.sbin/postinstall/postinstall.in:1.12	Sun Dec 29 17:19:13 2019
+++ src/usr.sbin/postinstall/postinstall.in	Wed Jan 29 20:39:40 2020
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.12 2019/12/29 22:19:13 tsutsui Exp $
+# $NetBSD: postinstall.in,v 1.13 2020/01/30 01:39:40 christos Exp $
 #
 # Copyright (c) 2002-2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1024,6 +1024,40 @@ do_envsys()
 }
 
 #
+#	autofs config files
+#
+additem autofsconfig "automounter configuration files"
+do_autofsconfig()
+{
+	[ -n "$1" ] || err 3 "USAGE: do_autofsconfig fix|check"
+	local autofs_files="
+include_ldap
+include_nis
+special_hosts
+special_media
+special_noauto
+special_null 
+"
+	op="$1"
+	failed=0
+	if [ "$op" = "fix" ]; then
+		mkdir -p "${DEST_DIR}/etc/autofs"
+	fi
+	failed=$(( ${failed} + $? ))
+	populate_dir "$op" false "${SRC_DIR}/etc" \
+	"${DEST_DIR}/etc" \
+	444 \
+	auto_master
+	failed=$(( ${failed} + $? ))
+	populate_dir "$op" false "${SRC_DIR}/etc/autofs" \
+	"${DEST_DIR}/etc/autofs" \
+	444 \
+	${autofs_files}
+	return ${failed}
+}
+
+
+#
 #	X11 fontconfig
 #
 additem fontconfig "X11 font configuration is up to date"



CVS commit: src/doc

2020-01-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jan 30 00:43:58 UTC 2020

Modified Files:
src/doc: HACKS

Log Message:
more like this


To generate a diff of this commit:
cvs rdiff -u -r1.198 -r1.199 src/doc/HACKS

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

Modified files:

Index: src/doc/HACKS
diff -u src/doc/HACKS:1.198 src/doc/HACKS:1.199
--- src/doc/HACKS:1.198	Wed Jan 29 18:44:00 2020
+++ src/doc/HACKS	Wed Jan 29 19:43:58 2020
@@ -1,4 +1,4 @@
-# $NetBSD: HACKS,v 1.198 2020/01/29 23:44:00 christos Exp $
+# $NetBSD: HACKS,v 1.199 2020/01/30 00:43:58 christos Exp $
 #
 # This file is intended to document workarounds for currently unsolved
 # (mostly) compiler bugs.
@@ -973,12 +973,14 @@ descr	rtree.c and tcache.c need to be co
 kcah
 
 port	powerpc
-hack	compile tc.c, logerr.c with -O0 for clang
+hack	compile tc.c, logerr.c, ubsan.c with -O0 for clang
 cdate	Wed Jan 29 17:40:19 EST 2020
 who	christos
 file	src/external/bsd/atf/lib/libatf-c/Makefile: 1.22
 file	src/external/bsd/dhcpcd/sbin/dhcpcd/Makefile: 1.49
-descr	Disable optimization on tc.c, logerr.c crashes:
+file	src/tests/lib/libc/misc/Makefile: 1.5
+
+descr	Disable optimization on tc.c, logerr.c, ubsan.c crashes:
 	lib/libLLVMCodeGen/../../llvm/../../external/apache2/llvm/lib/..\
 	/dist/llvm/include/llvm/CodeGen/MachineFrameInfo.h", line 495, \
 	function "__int64_t llvm::MachineFrameInfo::getObjectOffset(int) const"



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

2020-01-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jan 30 00:42:58 UTC 2020

Modified Files:
src/tests/lib/libc/misc: Makefile

Log Message:
hack for clang/powerpc


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/lib/libc/misc/Makefile

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/misc/Makefile
diff -u src/tests/lib/libc/misc/Makefile:1.5 src/tests/lib/libc/misc/Makefile:1.6
--- src/tests/lib/libc/misc/Makefile:1.5	Sun Sep 29 19:45:00 2019
+++ src/tests/lib/libc/misc/Makefile	Wed Jan 29 19:42:58 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.5 2019/09/29 23:45:00 mrg Exp $
+# $NetBSD: Makefile,v 1.6 2020/01/30 00:42:58 christos Exp $
 
 .include 
 
@@ -28,6 +28,8 @@ CWARNFLAGS.clang+=	-Wno-nullability-comp
 .endif
 COPTS.t_ubsan.c += -Wno-stack-protector
 COPTS.t_ubsanxx.cpp += -Wno-stack-protector
+COPTS.ubsan.c+=${${ACTIVE_CC} == "clang" && ${MACHINE_ARCH} == "powerpc":?  -O0 :}
+
 
 .if defined(HAVE_GCC) && ${HAVE_GCC} >= 7 && ${ACTIVE_CC} == "gcc"
 COPTS.t_ubsan.c+=	-Wno-int-in-bool-context



CVS commit: src/sys/dev/pci

2020-01-29 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Jan 30 00:36:29 UTC 2020

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

Log Message:
Prefer memory space register mapping over IO space. Make an exception for
RTL8169SC, as the FreeBSD driver says memory mapped IO doesn't work there.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/dev/pci/if_re_pci.c

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

Modified files:

Index: src/sys/dev/pci/if_re_pci.c
diff -u src/sys/dev/pci/if_re_pci.c:1.50 src/sys/dev/pci/if_re_pci.c:1.51
--- src/sys/dev/pci/if_re_pci.c:1.50	Thu Nov 14 09:11:35 2019
+++ src/sys/dev/pci/if_re_pci.c	Thu Jan 30 00:36:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_re_pci.c,v 1.50 2019/11/14 09:11:35 msaitoh Exp $	*/
+/*	$NetBSD: if_re_pci.c,v 1.51 2020/01/30 00:36:29 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 1997, 1998-2003
@@ -46,7 +46,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_re_pci.c,v 1.50 2019/11/14 09:11:35 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_re_pci.c,v 1.51 2020/01/30 00:36:29 jmcneill Exp $");
 
 #include 
 
@@ -190,6 +190,7 @@ re_pci_attach(device_t parent, device_t 
 	bus_space_handle_t ioh, memh;
 	bus_size_t iosize, memsize;
 	char intrbuf[PCI_INTRSTR_LEN];
+	bool prefer_io = false;
 
 	sc->sc_dev = self;
 	psc->sc_pc = pa->pa_pc;
@@ -219,16 +220,38 @@ re_pci_attach(device_t parent, device_t 
 		break;
 	}
 
-	if (ioh_valid) {
+	switch (PCI_VENDOR(pa->pa_id)) {
+	case PCI_VENDOR_REALTEK:
+		switch (PCI_PRODUCT(pa->pa_id)) {
+		case PCI_PRODUCT_REALTEK_RT8169SC:
+			prefer_io = true;
+			break;
+		}
+		break;
+	}
+	if (!memh_valid)
+		prefer_io = true;
+
+	if (ioh_valid && prefer_io) {
 		sc->rtk_btag = iot;
 		sc->rtk_bhandle = ioh;
 		sc->rtk_bsize = iosize;
 		if (memh_valid)
 			bus_space_unmap(memt, memh, memsize);
+
+		command = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG);
+		command |= PCI_COMMAND_IO_ENABLE;
+		pci_conf_write(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG, command);
 	} else if (memh_valid) {
 		sc->rtk_btag = memt;
 		sc->rtk_bhandle = memh;
 		sc->rtk_bsize = memsize;
+		if (ioh_valid)
+			bus_space_unmap(iot, ioh, iosize);
+
+		command = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG);
+		command |= PCI_COMMAND_MEM_ENABLE;
+		pci_conf_write(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG, command);
 	} else {
 		aprint_error(": can't map registers\n");
 		return;



CVS commit: src/sys/dev/hdaudio

2020-01-29 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Jan 30 00:21:23 UTC 2020

Modified Files:
src/sys/dev/hdaudio: hdafg.c

Log Message:
Only dump ELD info if HDAFG_HDMI_DEBUG is defined


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/hdaudio/hdafg.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/hdaudio/hdafg.c
diff -u src/sys/dev/hdaudio/hdafg.c:1.19 src/sys/dev/hdaudio/hdafg.c:1.20
--- src/sys/dev/hdaudio/hdafg.c:1.19	Sat Jan 18 12:00:33 2020
+++ src/sys/dev/hdaudio/hdafg.c	Thu Jan 30 00:21:23 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: hdafg.c,v 1.19 2020/01/18 12:00:33 jmcneill Exp $ */
+/* $NetBSD: hdafg.c,v 1.20 2020/01/30 00:21:23 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd 
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.19 2020/01/18 12:00:33 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.20 2020/01/30 00:21:23 jmcneill Exp $");
 
 #include 
 #include 
@@ -889,6 +889,7 @@ hdafg_assoc_dump_dd(struct hdafg_softc *
 			return;
 		}
 
+#ifdef HDAFG_HDMI_DEBUG
 		hda_print(sc, "  ELD version=0x%x", ELD_VER());
 		hda_print1(sc, ",len=%u", hdi.eld.header.baseline_eld_len * 4);
 		hda_print1(sc, ",edid=0x%x", ELD_CEA_EDID_VER());
@@ -914,6 +915,7 @@ hdafg_assoc_dump_dd(struct hdafg_softc *
 CEA_MAX_BITRATE([i]));
 			hda_print1(sc, "\n");
 		}
+#endif
 	}
 }
 



CVS commit: src/doc

2020-01-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jan 29 23:44:00 UTC 2020

Modified Files:
src/doc: HACKS

Log Message:
same hack different place


To generate a diff of this commit:
cvs rdiff -u -r1.197 -r1.198 src/doc/HACKS

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

Modified files:

Index: src/doc/HACKS
diff -u src/doc/HACKS:1.197 src/doc/HACKS:1.198
--- src/doc/HACKS:1.197	Wed Jan 29 17:43:53 2020
+++ src/doc/HACKS	Wed Jan 29 18:44:00 2020
@@ -1,4 +1,4 @@
-# $NetBSD: HACKS,v 1.197 2020/01/29 22:43:53 christos Exp $
+# $NetBSD: HACKS,v 1.198 2020/01/29 23:44:00 christos Exp $
 #
 # This file is intended to document workarounds for currently unsolved
 # (mostly) compiler bugs.
@@ -973,11 +973,12 @@ descr	rtree.c and tcache.c need to be co
 kcah
 
 port	powerpc
-hack	compile tc.c with -O0 for clang
+hack	compile tc.c, logerr.c with -O0 for clang
 cdate	Wed Jan 29 17:40:19 EST 2020
 who	christos
 file	src/external/bsd/atf/lib/libatf-c/Makefile: 1.22
-descr	Disable optimization on tc.c, crashes:
+file	src/external/bsd/dhcpcd/sbin/dhcpcd/Makefile: 1.49
+descr	Disable optimization on tc.c, logerr.c crashes:
 	lib/libLLVMCodeGen/../../llvm/../../external/apache2/llvm/lib/..\
 	/dist/llvm/include/llvm/CodeGen/MachineFrameInfo.h", line 495, \
 	function "__int64_t llvm::MachineFrameInfo::getObjectOffset(int) const"



CVS commit: src/external/bsd/dhcpcd/sbin/dhcpcd

2020-01-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jan 29 23:42:58 UTC 2020

Modified Files:
src/external/bsd/dhcpcd/sbin/dhcpcd: Makefile

Log Message:
Hack for clang/powerpc


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/external/bsd/dhcpcd/sbin/dhcpcd/Makefile

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

Modified files:

Index: src/external/bsd/dhcpcd/sbin/dhcpcd/Makefile
diff -u src/external/bsd/dhcpcd/sbin/dhcpcd/Makefile:1.49 src/external/bsd/dhcpcd/sbin/dhcpcd/Makefile:1.50
--- src/external/bsd/dhcpcd/sbin/dhcpcd/Makefile:1.49	Fri Sep 13 07:58:32 2019
+++ src/external/bsd/dhcpcd/sbin/dhcpcd/Makefile	Wed Jan 29 18:42:57 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.49 2019/09/13 11:58:32 roy Exp $
+# $NetBSD: Makefile,v 1.50 2020/01/29 23:42:57 christos Exp $
 #
 
 WARNS?=		6
@@ -59,6 +59,9 @@ FILESMODE_dhcpcd.conf=		644	# -rw-r--r--
 MAN=			dhcpcd.conf.5 dhcpcd.8 
 CLEANFILES=		dhcpcd.conf.5 dhcpcd.8 
 
+COPTS.logerr.c+=${${ACTIVE_CC} == "clang" && ${MACHINE_ARCH} == "powerpc":? -O0 :}
+
+
 .for f in dhcpcd.conf.5 dhcpcd.8
 ${f}:	${f}.in
 	${TOOL_SED} ${SED_SYS} ${DIST}/src/${f}.in > $@



CVS commit: [netbsd-9] src/doc

2020-01-29 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Jan 29 23:33:15 UTC 2020

Modified Files:
src/doc [netbsd-9]: CHANGES-9.0

Log Message:
 Ticket #673.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.170 -r1.1.2.171 src/doc/CHANGES-9.0

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

Modified files:

Index: src/doc/CHANGES-9.0
diff -u src/doc/CHANGES-9.0:1.1.2.170 src/doc/CHANGES-9.0:1.1.2.171
--- src/doc/CHANGES-9.0:1.1.2.170	Tue Jan 28 11:14:15 2020
+++ src/doc/CHANGES-9.0	Wed Jan 29 23:33:15 2020
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.0,v 1.1.2.170 2020/01/28 11:14:15 martin Exp $
+# $NetBSD: CHANGES-9.0,v 1.1.2.171 2020/01/29 23:33:15 msaitoh Exp $
 
 A complete list of changes from the initial NetBSD 9.0 branch on 2019-07-30
 until the 9.0 release:
@@ -8540,3 +8540,7 @@ sys/dev/ic/rtl81x9var.h1.57
 	  is newly used as RTK_HWREV_8102EL_SPIN1.
 	[msaitoh, ticket #667]
 
+usr.sbin/sysinst/arch/evbarm/md.c		1.15
+
+	Do not compare a char array to NULL, test for empty string instead.
+	[martin, ticket #673]



CVS commit: [netbsd-9] src/usr.sbin/sysinst/arch/evbarm

2020-01-29 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Jan 29 23:31:30 UTC 2020

Modified Files:
src/usr.sbin/sysinst/arch/evbarm [netbsd-9]: md.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #673):
usr.sbin/sysinst/arch/evbarm/md.c: revision 1.15
Do not compare a char array to NULL, test for empty string instead.


To generate a diff of this commit:
cvs rdiff -u -r1.8.2.3 -r1.8.2.4 src/usr.sbin/sysinst/arch/evbarm/md.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.sbin/sysinst/arch/evbarm/md.c
diff -u src/usr.sbin/sysinst/arch/evbarm/md.c:1.8.2.3 src/usr.sbin/sysinst/arch/evbarm/md.c:1.8.2.4
--- src/usr.sbin/sysinst/arch/evbarm/md.c:1.8.2.3	Tue Jan 28 10:17:58 2020
+++ src/usr.sbin/sysinst/arch/evbarm/md.c	Wed Jan 29 23:31:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.8.2.3 2020/01/28 10:17:58 msaitoh Exp $ */
+/*	$NetBSD: md.c,v 1.8.2.4 2020/01/29 23:31:30 msaitoh Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -352,7 +352,7 @@ evbarm_part_defaults(struct pm_devs *my_
 
 	for (i = 0; i < num_usage_infos; i++) {
 		if (infos[i].fs_type == PART_BOOT_TYPE &&
-		infos[i].mount != NULL &&
+		infos[i].mount[0] != 0 &&
 		strcmp(infos[i].mount, PART_BOOT_MOUNT) == 0) {
 			infos[i].size = PART_BOOT_LARGE;
 			return;



CVS commit: src/doc

2020-01-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jan 29 22:43:53 UTC 2020

Modified Files:
src/doc: HACKS

Log Message:
powepc/clang hack


To generate a diff of this commit:
cvs rdiff -u -r1.196 -r1.197 src/doc/HACKS

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

Modified files:

Index: src/doc/HACKS
diff -u src/doc/HACKS:1.196 src/doc/HACKS:1.197
--- src/doc/HACKS:1.196	Sun Nov  3 02:10:42 2019
+++ src/doc/HACKS	Wed Jan 29 17:43:53 2020
@@ -1,4 +1,4 @@
-# $NetBSD: HACKS,v 1.196 2019/11/03 07:10:42 rin Exp $
+# $NetBSD: HACKS,v 1.197 2020/01/29 22:43:53 christos Exp $
 #
 # This file is intended to document workarounds for currently unsolved
 # (mostly) compiler bugs.
@@ -971,3 +971,14 @@ file	src/external/bsd/jemalloc/lib/Makef
 descr	rtree.c and tcache.c need to be compiled with -O0, alternatively,
 	you can compile whole jemalloc with -DJEMALLOC_DEBUG.
 kcah
+
+port	powerpc
+hack	compile tc.c with -O0 for clang
+cdate	Wed Jan 29 17:40:19 EST 2020
+who	christos
+file	src/external/bsd/atf/lib/libatf-c/Makefile: 1.22
+descr	Disable optimization on tc.c, crashes:
+	lib/libLLVMCodeGen/../../llvm/../../external/apache2/llvm/lib/..\
+	/dist/llvm/include/llvm/CodeGen/MachineFrameInfo.h", line 495, \
+	function "__int64_t llvm::MachineFrameInfo::getObjectOffset(int) const"
+kcah



CVS commit: src/external/bsd/atf/lib/libatf-c

2020-01-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jan 29 22:40:44 UTC 2020

Modified Files:
src/external/bsd/atf/lib/libatf-c: Makefile

Log Message:
Hack for clang.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/external/bsd/atf/lib/libatf-c/Makefile

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

Modified files:

Index: src/external/bsd/atf/lib/libatf-c/Makefile
diff -u src/external/bsd/atf/lib/libatf-c/Makefile:1.21 src/external/bsd/atf/lib/libatf-c/Makefile:1.22
--- src/external/bsd/atf/lib/libatf-c/Makefile:1.21	Sun Mar  2 17:50:13 2014
+++ src/external/bsd/atf/lib/libatf-c/Makefile	Wed Jan 29 17:40:44 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.21 2014/03/02 22:50:13 jmmv Exp $
+# $NetBSD: Makefile,v 1.22 2020/01/29 22:40:44 christos Exp $
 
 NOLINT=		# defined
 
@@ -53,6 +53,8 @@ INCSDIR_atf-c.h=/usr/include
 
 MAN=		atf-c-api.3
 
+COPTS.tc.c+=	${${ACTIVE_CC} == "clang" && ${MACHINE_ARCH} == "powerpc":? -O0 :}
+
 .if ${MKSHARE} != "no"
 FILES+=		atf-c.pc
 FILESDIR=	/usr/lib/pkgconfig



CVS commit: src/sys/dev/usb

2020-01-29 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Wed Jan 29 21:52:16 UTC 2020

Modified Files:
src/sys/dev/usb: Makefile

Log Message:
urio(4) was deleted


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/usb/Makefile

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/usb/Makefile
diff -u src/sys/dev/usb/Makefile:1.10 src/sys/dev/usb/Makefile:1.11
--- src/sys/dev/usb/Makefile:1.10	Tue Jul 31 16:44:29 2018
+++ src/sys/dev/usb/Makefile	Wed Jan 29 21:52:16 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.10 2018/07/31 16:44:29 khorben Exp $
+#	$NetBSD: Makefile,v 1.11 2020/01/29 21:52:16 mlelstv Exp $
 
 # use 'make -f Makefile.usbdevs' to make usbdevs.h and usbdevs_data.h
 # _after_ you committed usbdevs. See comment in Makefile.usbdevs
@@ -6,6 +6,6 @@
 INCSDIR= /usr/include/dev/usb
 
 # Only install includes which are used by userland
-INCS=	if_umbreg.h mbim.h ukyopon.h urio.h usb.h usbhid.h utoppy.h
+INCS=	if_umbreg.h mbim.h ukyopon.h usb.h usbhid.h utoppy.h
 
 .include 



CVS commit: src/sys/dev/ic

2020-01-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jan 29 21:11:39 UTC 2020

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

Log Message:
compile without INET


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/sys/dev/ic/gem.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/gem.c
diff -u src/sys/dev/ic/gem.c:1.125 src/sys/dev/ic/gem.c:1.126
--- src/sys/dev/ic/gem.c:1.125	Wed Jan 29 09:47:08 2020
+++ src/sys/dev/ic/gem.c	Wed Jan 29 16:11:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: gem.c,v 1.125 2020/01/29 14:47:08 thorpej Exp $ */
+/*	$NetBSD: gem.c,v 1.126 2020/01/29 21:11:38 christos Exp $ */
 
 /*
  *
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gem.c,v 1.125 2020/01/29 14:47:08 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gem.c,v 1.126 2020/01/29 21:11:38 christos Exp $");
 
 #include "opt_inet.h"
 
@@ -1388,7 +1388,9 @@ gem_start(struct ifnet *ifp)
 	 * until we drain the queue, or use up all available transmit
 	 * descriptors.
 	 */
+#ifdef INET
 next:
+#endif
 	while ((txs = SIMPLEQ_FIRST(>sc_txfreeq)) != NULL &&
 	sc->sc_txfree != 0) {
 		/*



CVS commit: src/lib/libpthread

2020-01-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Jan 29 21:11:25 UTC 2020

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

Log Message:
Use pthread_mutexattr_t and pthread_mutex_t magic fields

Validate _PT_MUTEX_MAGIC in pthread_mutex_t and _PT_MUTEXATTR_MAGIC
in pthread_mutexattr_t accordingly.


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/lib/libpthread/pthread_mutex.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_mutex.c
diff -u src/lib/libpthread/pthread_mutex.c:1.69 src/lib/libpthread/pthread_mutex.c:1.70
--- src/lib/libpthread/pthread_mutex.c:1.69	Wed Jan 29 10:55:23 2020
+++ src/lib/libpthread/pthread_mutex.c	Wed Jan 29 21:11:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_mutex.c,v 1.69 2020/01/29 10:55:23 kamil Exp $	*/
+/*	$NetBSD: pthread_mutex.c,v 1.70 2020/01/29 21:11:24 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2003, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -47,7 +47,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pthread_mutex.c,v 1.69 2020/01/29 10:55:23 kamil Exp $");
+__RCSID("$NetBSD: pthread_mutex.c,v 1.70 2020/01/29 21:11:24 kamil Exp $");
 
 #include 
 #include 
@@ -197,6 +197,9 @@ pthread_mutex_lock(pthread_mutex_t *ptm)
 	if (__predict_false(__uselibcstub))
 		return __libc_mutex_lock_stub(ptm);
 
+	pthread__error(EINVAL, "Invalid mutex",
+	ptm->ptm_magic == _PT_MUTEX_MAGIC);
+
 	self = pthread__self();
 	val = atomic_cas_ptr(>ptm_owner, NULL, self);
 	if (__predict_true(val == NULL)) {
@@ -214,6 +217,9 @@ pthread_mutex_timedlock(pthread_mutex_t*
 	pthread_t self;
 	void *val;
 
+	pthread__error(EINVAL, "Invalid mutex",
+	ptm->ptm_magic == _PT_MUTEX_MAGIC);
+
 	self = pthread__self();
 	val = atomic_cas_ptr(>ptm_owner, NULL, self);
 	if (__predict_true(val == NULL)) {
@@ -298,9 +304,6 @@ pthread__mutex_lock_slow(pthread_mutex_t
 	int serrno;
 	int error;
 
-	pthread__error(EINVAL, "Invalid mutex",
-	ptm->ptm_magic == _PT_MUTEX_MAGIC);
-
 	owner = ptm->ptm_owner;
 	self = pthread__self();
 
@@ -410,6 +413,9 @@ pthread_mutex_trylock(pthread_mutex_t *p
 	if (__predict_false(__uselibcstub))
 		return __libc_mutex_trylock_stub(ptm);
 
+	pthread__error(EINVAL, "Invalid mutex",
+	ptm->ptm_magic == _PT_MUTEX_MAGIC);
+
 	self = pthread__self();
 	val = atomic_cas_ptr(>ptm_owner, NULL, self);
 	if (__predict_true(val == NULL)) {
@@ -450,6 +456,9 @@ pthread_mutex_unlock(pthread_mutex_t *pt
 	if (__predict_false(__uselibcstub))
 		return __libc_mutex_unlock_stub(ptm);
 
+	pthread__error(EINVAL, "Invalid mutex",
+	ptm->ptm_magic == _PT_MUTEX_MAGIC);
+
 #ifndef PTHREAD__ATOMIC_IS_MEMBAR
 	membar_exit();
 #endif
@@ -468,9 +477,6 @@ pthread__mutex_unlock_slow(pthread_mutex
 	pthread_t self, owner, new;
 	int weown, error;
 
-	pthread__error(EINVAL, "Invalid mutex",
-	ptm->ptm_magic == _PT_MUTEX_MAGIC);
-
 	self = pthread__self();
 	owner = ptm->ptm_owner;
 	weown = (MUTEX_OWNER(owner) == (uintptr_t)self);
@@ -725,6 +731,9 @@ pthread_mutexattr_getpshared(const pthre
 int * __restrict pshared)
 {
 
+	pthread__error(EINVAL, "Invalid mutex attribute",
+		attr->ptma_magic == _PT_MUTEXATTR_MAGIC);
+
 	*pshared = PTHREAD_PROCESS_PRIVATE;
 	return 0;
 }
@@ -733,6 +742,9 @@ int
 pthread_mutexattr_setpshared(pthread_mutexattr_t *attr, int pshared)
 {
 
+	pthread__error(EINVAL, "Invalid mutex attribute",
+		attr->ptma_magic == _PT_MUTEXATTR_MAGIC);
+
 	switch(pshared) {
 	case PTHREAD_PROCESS_PRIVATE:
 		return 0;
@@ -772,6 +784,10 @@ pthread__mutex_deferwake(pthread_t self,
 int
 pthread_mutex_getprioceiling(const pthread_mutex_t *ptm, int *ceil) 
 {
+
+	pthread__error(EINVAL, "Invalid mutex",
+	ptm->ptm_magic == _PT_MUTEX_MAGIC);
+
 	*ceil = ptm->ptm_ceiling;
 	return 0;
 }
@@ -781,6 +797,9 @@ pthread_mutex_setprioceiling(pthread_mut
 {
 	int error;
 
+	pthread__error(EINVAL, "Invalid mutex",
+	ptm->ptm_magic == _PT_MUTEX_MAGIC);
+
 	error = pthread_mutex_lock(ptm);
 	if (error == 0) {
 		*old_ceil = ptm->ptm_ceiling;



CVS commit: src/sys/arch

2020-01-29 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Jan 29 19:29:23 UTC 2020

Modified Files:
src/sys/arch/aarch64/aarch64: genassym.cf
src/sys/arch/arm/arm32: genassym.cf

Log Message:
G/C some more


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/aarch64/aarch64/genassym.cf
cvs rdiff -u -r1.84 -r1.85 src/sys/arch/arm/arm32/genassym.cf

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/aarch64/aarch64/genassym.cf
diff -u src/sys/arch/aarch64/aarch64/genassym.cf:1.20 src/sys/arch/aarch64/aarch64/genassym.cf:1.21
--- src/sys/arch/aarch64/aarch64/genassym.cf:1.20	Wed Jan 29 19:21:51 2020
+++ src/sys/arch/aarch64/aarch64/genassym.cf	Wed Jan 29 19:29:23 2020
@@ -1,4 +1,4 @@
-# $NetBSD: genassym.cf,v 1.20 2020/01/29 19:21:51 skrll Exp $
+# $NetBSD: genassym.cf,v 1.21 2020/01/29 19:29:23 skrll Exp $
 #-
 # Copyright (c) 2014 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -286,9 +286,7 @@ define	CI_INTR_DEPTH		offsetof(struct cp
 define	CI_MTX_COUNT		offsetof(struct cpu_info, ci_mtx_count)
 define	CI_SOFTINTS		offsetof(struct cpu_info, ci_softints)
 define	CI_IDLELWP		offsetof(struct cpu_info, ci_data.cpu_idlelwp)
-define	CI_CC_NTRAP		offsetof(struct cpu_info, ci_data.cpu_ntrap)
 define	CI_CC_NINTR		offsetof(struct cpu_info, ci_data.cpu_nintr)
-define	CI_CC_NSOFT		offsetof(struct cpu_info, ci_data.cpu_nsoft)
 
 define	V_RESCHED_KPREEMPT	ilog2(RESCHED_KPREEMPT)
 

Index: src/sys/arch/arm/arm32/genassym.cf
diff -u src/sys/arch/arm/arm32/genassym.cf:1.84 src/sys/arch/arm/arm32/genassym.cf:1.85
--- src/sys/arch/arm/arm32/genassym.cf:1.84	Wed Jan 29 19:21:51 2020
+++ src/sys/arch/arm/arm32/genassym.cf	Wed Jan 29 19:29:23 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.84 2020/01/29 19:21:51 skrll Exp $
+#	$NetBSD: genassym.cf,v 1.85 2020/01/29 19:29:23 skrll Exp $
 
 # Copyright (c) 1982, 1990 The Regents of the University of California.
 # All rights reserved.
@@ -233,9 +233,7 @@ ifdef __HAVE_FAST_SOFTINTS
 define	CI_SOFTINTS		offsetof(struct cpu_info, ci_softints)
 endif
 define	CI_IDLELWP		offsetof(struct cpu_info, ci_data.cpu_idlelwp)
-define	CI_CC_NTRAP		offsetof(struct cpu_info, ci_data.cpu_ntrap)
 define	CI_CC_NINTR		offsetof(struct cpu_info, ci_data.cpu_nintr)
-define	CI_CC_NSOFT		offsetof(struct cpu_info, ci_data.cpu_nsoft)
 ifdef FPU_VFP
 define	CI_VFP_ID		offsetof(struct cpu_info, ci_vfp_id)
 endif



CVS commit: src/sys/arch

2020-01-29 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Jan 29 19:21:51 UTC 2020

Modified Files:
src/sys/arch/aarch64/aarch64: genassym.cf
src/sys/arch/arm/arm32: genassym.cf

Log Message:
G/C


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/aarch64/aarch64/genassym.cf
cvs rdiff -u -r1.83 -r1.84 src/sys/arch/arm/arm32/genassym.cf

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/aarch64/aarch64/genassym.cf
diff -u src/sys/arch/aarch64/aarch64/genassym.cf:1.19 src/sys/arch/aarch64/aarch64/genassym.cf:1.20
--- src/sys/arch/aarch64/aarch64/genassym.cf:1.19	Tue Jan 28 17:33:07 2020
+++ src/sys/arch/aarch64/aarch64/genassym.cf	Wed Jan 29 19:21:51 2020
@@ -1,4 +1,4 @@
-# $NetBSD: genassym.cf,v 1.19 2020/01/28 17:33:07 maxv Exp $
+# $NetBSD: genassym.cf,v 1.20 2020/01/29 19:21:51 skrll Exp $
 #-
 # Copyright (c) 2014 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -275,7 +275,6 @@ define	FPREG_FPCR		offsetof(struct fpreg
 define	FPREG_FPSR		offsetof(struct fpreg, fpsr)
 
 define	CPU_INFO_SIZE		sizeof(struct cpu_info)
-define	CI_CURPRIORITY		offsetof(struct cpu_info, ci_schedstate.spc_curpriority)
 define	CI_CURLWP		offsetof(struct cpu_info, ci_curlwp)
 define	CI_CPL			offsetof(struct cpu_info, ci_cpl)
 define	CI_CPUID		offsetof(struct cpu_info, ci_cpuid)

Index: src/sys/arch/arm/arm32/genassym.cf
diff -u src/sys/arch/arm/arm32/genassym.cf:1.83 src/sys/arch/arm/arm32/genassym.cf:1.84
--- src/sys/arch/arm/arm32/genassym.cf:1.83	Wed Jan  8 17:38:41 2020
+++ src/sys/arch/arm/arm32/genassym.cf	Wed Jan 29 19:21:51 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.83 2020/01/08 17:38:41 ad Exp $
+#	$NetBSD: genassym.cf,v 1.84 2020/01/29 19:21:51 skrll Exp $
 
 # Copyright (c) 1982, 1990 The Regents of the University of California.
 # All rights reserved.
@@ -219,7 +219,6 @@ define	CF_CONTEXT_SWITCH	offsetof(struct
 define	CF_SLEEP		offsetof(struct cpu_functions, cf_sleep)
 define	CF_CONTROL		offsetof(struct cpu_functions, cf_control)
 
-define	CI_CURPRIORITY		offsetof(struct cpu_info, ci_schedstate.spc_curpriority)
 define	CI_ARM_CPUID		offsetof(struct cpu_info, ci_arm_cpuid)
 define	CI_CURLWP		offsetof(struct cpu_info, ci_curlwp)
 define	CI_CPL			offsetof(struct cpu_info, ci_cpl)



CVS commit: src/usr.sbin/sysinst/arch/evbarm

2020-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jan 29 19:04:41 UTC 2020

Modified Files:
src/usr.sbin/sysinst/arch/evbarm: md.c

Log Message:
Do not compare a char array to NULL, test for empty string instead.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/usr.sbin/sysinst/arch/evbarm/md.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.sbin/sysinst/arch/evbarm/md.c
diff -u src/usr.sbin/sysinst/arch/evbarm/md.c:1.14 src/usr.sbin/sysinst/arch/evbarm/md.c:1.15
--- src/usr.sbin/sysinst/arch/evbarm/md.c:1.14	Mon Jan 27 21:21:22 2020
+++ src/usr.sbin/sysinst/arch/evbarm/md.c	Wed Jan 29 19:04:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.14 2020/01/27 21:21:22 martin Exp $ */
+/*	$NetBSD: md.c,v 1.15 2020/01/29 19:04:40 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -352,7 +352,7 @@ evbarm_part_defaults(struct pm_devs *my_
 
 	for (i = 0; i < num_usage_infos; i++) {
 		if (infos[i].fs_type == PART_BOOT_TYPE &&
-		infos[i].mount != NULL &&
+		infos[i].mount[0] != 0 &&
 		strcmp(infos[i].mount, PART_BOOT_MOUNT) == 0) {
 			infos[i].size = PART_BOOT_LARGE;
 			return;



CVS commit: src/doc

2020-01-29 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Wed Jan 29 19:04:12 UTC 2020

Modified Files:
src/doc: CHANGES

Log Message:
Note urio removal


To generate a diff of this commit:
cvs rdiff -u -r1.2645 -r1.2646 src/doc/CHANGES

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2645 src/doc/CHANGES:1.2646
--- src/doc/CHANGES:1.2645	Mon Jan 27 21:14:17 2020
+++ src/doc/CHANGES	Wed Jan 29 19:04:12 2020
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2645 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2646 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -138,3 +138,4 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	OpenSSL: Imported 1.1.1d. [christos 20200122]
 	dhcpcd(8): Import dhcpcd-8.1.6 [roy 20200127]
 	openresolv(8): Import openresolv-3.10.0 [roy 20200127]
+	urio(4): Removed from the tree. [maya 20200129]



CVS commit: src

2020-01-29 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Wed Jan 29 18:39:05 UTC 2020

Modified Files:
src/distrib/sets/lists/comp: mi
src/distrib/sets/lists/man: mi
src/etc: MAKEDEV.tmpl
src/share/man/man4: Makefile usb.4
src/share/man/man8: MAKEDEV.8
src/sys/arch/aarch64/conf: majors.aarch64
src/sys/arch/algor/conf: majors.algor
src/sys/arch/alpha/conf: majors.alpha
src/sys/arch/amd64/conf: ALL XEN3_DOM0 majors.amd64
src/sys/arch/arm/conf: majors.arm32
src/sys/arch/cats/conf: GENERIC
src/sys/arch/cobalt/conf: majors.cobalt
src/sys/arch/epoc32/conf: majors.epoc32
src/sys/arch/evbarm/conf: HDL_G HPT5325 MINI2440 MMNET_GENERIC
MPCSA_GENERIC POGO SHEEVAPLUG SMDK2410 TS7200 TWINTAIL
src/sys/arch/evbmips/conf: majors.evbmips
src/sys/arch/evbppc/conf: OPENBLOCKS266_OPT PMPPC majors.evbppc
src/sys/arch/hpcarm/conf: majors.hpcarm
src/sys/arch/hpcmips/conf: GENERIC VR41XX majors.hpcmips
src/sys/arch/hppa/conf: GENERIC
src/sys/arch/i386/conf: ALL XEN3PAE_DOM0 majors.i386
src/sys/arch/ia64/conf: majors.ia64
src/sys/arch/landisk/conf: GENERIC majors.landisk
src/sys/arch/or1k/conf: majors.or1k
src/sys/arch/playstation2/conf: DEBUG majors.playstation2
src/sys/arch/powerpc/conf: majors.powerpc
src/sys/arch/prep/conf: GENERIC
src/sys/arch/sgimips/conf: majors.sgimips
src/sys/arch/sparc/conf: majors.sparc
src/sys/arch/sparc64/conf: GENERIC majors.sparc64
src/sys/arch/x68k/conf: GENERIC majors.x68k
src/sys/arch/zaurus/conf: majors.zaurus
src/sys/dev/usb: FILES TODO.usbmp usbdevices.config
Removed Files:
src/share/man/man4: urio.4
src/sys/dev/usb: urio.c urio.h

Log Message:
remove urio(4), a driver for the Rio500 MP3 player.

At this point it is highly unlikely this 1999 device still has users,
but it still comes up in the context of maxv's USB-fuzzing (and any device
could pretend to be a urio(4)), so it's best to get rid of it.

Renamed all major entries to obsolete, as was done in previous removals.

This still requires an update to sanitizers, but they're located in
"external", perhaps it should be first committed upstream?

Proposed on tech-kern a month ago.


To generate a diff of this commit:
cvs rdiff -u -r1.2306 -r1.2307 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.1677 -r1.1678 src/distrib/sets/lists/man/mi
cvs rdiff -u -r1.213 -r1.214 src/etc/MAKEDEV.tmpl
cvs rdiff -u -r1.700 -r1.701 src/share/man/man4/Makefile
cvs rdiff -u -r1.9 -r0 src/share/man/man4/urio.4
cvs rdiff -u -r1.110 -r1.111 src/share/man/man4/usb.4
cvs rdiff -u -r1.55 -r1.56 src/share/man/man8/MAKEDEV.8
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/aarch64/conf/majors.aarch64
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/algor/conf/majors.algor
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/alpha/conf/majors.alpha
cvs rdiff -u -r1.142 -r1.143 src/sys/arch/amd64/conf/ALL
cvs rdiff -u -r1.173 -r1.174 src/sys/arch/amd64/conf/XEN3_DOM0
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/amd64/conf/majors.amd64
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/arm/conf/majors.arm32
cvs rdiff -u -r1.177 -r1.178 src/sys/arch/cats/conf/GENERIC
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/cobalt/conf/majors.cobalt
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/epoc32/conf/majors.epoc32
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/evbarm/conf/HDL_G
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/evbarm/conf/HPT5325
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/evbarm/conf/MINI2440
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/evbarm/conf/MMNET_GENERIC
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/evbarm/conf/MPCSA_GENERIC
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/evbarm/conf/POGO
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/evbarm/conf/SHEEVAPLUG
cvs rdiff -u -r1.72 -r1.73 src/sys/arch/evbarm/conf/SMDK2410
cvs rdiff -u -r1.73 -r1.74 src/sys/arch/evbarm/conf/TS7200
cvs rdiff -u -r1.77 -r1.78 src/sys/arch/evbarm/conf/TWINTAIL
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/evbmips/conf/majors.evbmips
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/evbppc/conf/OPENBLOCKS266_OPT
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/evbppc/conf/PMPPC
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/evbppc/conf/majors.evbppc
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/hpcarm/conf/majors.hpcarm
cvs rdiff -u -r1.240 -r1.241 src/sys/arch/hpcmips/conf/GENERIC
cvs rdiff -u -r1.73 -r1.74 src/sys/arch/hpcmips/conf/VR41XX
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/hpcmips/conf/majors.hpcmips
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/hppa/conf/GENERIC
cvs rdiff -u -r1.486 -r1.487 src/sys/arch/i386/conf/ALL
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/i386/conf/XEN3PAE_DOM0
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/i386/conf/majors.i386
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/ia64/conf/majors.ia64
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/landisk/conf/GENERIC
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/landisk/conf/majors.landisk
cvs rdiff -u 

CVS commit: src/lib/libpthread

2020-01-29 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Wed Jan 29 17:11:57 UTC 2020

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

Log Message:
- pthread_join(): remove temporary hack now kernel returns correct errno.

- kill(getpid(), SIGABRT)  ->  _lwp_kill(_lwp_self(), SIGABRT)


To generate a diff of this commit:
cvs rdiff -u -r1.161 -r1.162 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.161 src/lib/libpthread/pthread.c:1.162
--- src/lib/libpthread/pthread.c:1.161	Wed Jan 29 16:03:44 2020
+++ src/lib/libpthread/pthread.c	Wed Jan 29 17:11:57 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread.c,v 1.161 2020/01/29 16:03:44 kamil Exp $	*/
+/*	$NetBSD: pthread.c,v 1.162 2020/01/29 17:11:57 ad Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002, 2003, 2006, 2007, 2008, 2020
@@ -31,7 +31,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pthread.c,v 1.161 2020/01/29 16:03:44 kamil Exp $");
+__RCSID("$NetBSD: pthread.c,v 1.162 2020/01/29 17:11:57 ad Exp $");
 
 #define	__EXPOSE_STACK	1
 
@@ -719,10 +719,6 @@ pthread_join(pthread_t thread, void **va
 	if (thread == self)
 		return EDEADLK;
 
-	/* XXX temporary - kernel should handle. */
-	if ((thread->pt_flags & PT_FLAG_DETACHED) != 0)
-		return EINVAL;
-
 	/* IEEE Std 1003.1 says pthread_join() never returns EINTR. */
 	for (;;) {
 		pthread__testcancel(self);
@@ -1101,8 +1097,7 @@ pthread__assertfunc(const char *file, in
 	function ? "\"" : "");
 
 	_sys_write(STDERR_FILENO, buf, (size_t)len);
-	(void)kill(getpid(), SIGABRT);
-
+	(void)_lwp_kill(_lwp_self(), SIGABRT);
 	_exit(1);
 }
 
@@ -1137,7 +1132,7 @@ pthread__errorfunc(const char *file, int
 		syslog(LOG_DEBUG | LOG_USER, "%s", buf);
 
 	if (pthread__diagassert & DIAGASSERT_ABORT) {
-		(void)kill(getpid(), SIGABRT);
+		(void)_lwp_kill(_lwp_self(), SIGABRT);
 		_exit(1);
 	}
 }



CVS commit: src/lib/libpthread

2020-01-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Jan 29 16:34:09 UTC 2020

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

Log Message:
Check thread->pt_magic with PT_MAGIC promptly


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/lib/libpthread/pthread_misc.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_misc.c
diff -u src/lib/libpthread/pthread_misc.c:1.16 src/lib/libpthread/pthread_misc.c:1.17
--- src/lib/libpthread/pthread_misc.c:1.16	Mon Jan 13 18:22:56 2020
+++ src/lib/libpthread/pthread_misc.c	Wed Jan 29 16:34:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_misc.c,v 1.16 2020/01/13 18:22:56 ad Exp $	*/
+/*	$NetBSD: pthread_misc.c,v 1.17 2020/01/29 16:34:09 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pthread_misc.c,v 1.16 2020/01/13 18:22:56 ad Exp $");
+__RCSID("$NetBSD: pthread_misc.c,v 1.17 2020/01/29 16:34:09 kamil Exp $");
 
 #include 
 #include 
@@ -61,6 +61,9 @@ int
 pthread_getschedparam(pthread_t thread, int *policy, struct sched_param *param)
 {
 
+	pthread__error(EINVAL, "Invalid thread",
+	thread->pt_magic == PT_MAGIC);
+
 	if (pthread__find(thread) != 0)
 		return ESRCH;
 
@@ -76,6 +79,9 @@ pthread_setschedparam(pthread_t thread, 
 {
 	struct sched_param sp;
 
+	pthread__error(EINVAL, "Invalid thread",
+	thread->pt_magic == PT_MAGIC);
+
 	if (pthread__find(thread) != 0)
 		return ESRCH;
 
@@ -90,6 +96,9 @@ int
 pthread_getaffinity_np(pthread_t thread, size_t size, cpuset_t *cpuset)
 {
 
+	pthread__error(EINVAL, "Invalid thread",
+	thread->pt_magic == PT_MAGIC);
+
 	if (pthread__find(thread) != 0)
 		return ESRCH;
 
@@ -103,6 +112,9 @@ int
 pthread_setaffinity_np(pthread_t thread, size_t size, cpuset_t *cpuset)
 {
 
+	pthread__error(EINVAL, "Invalid thread",
+	thread->pt_magic == PT_MAGIC);
+
 	if (pthread__find(thread) != 0)
 		return ESRCH;
 
@@ -117,6 +129,9 @@ pthread_setschedprio(pthread_t thread, i
 {
 	struct sched_param sp;
 
+	pthread__error(EINVAL, "Invalid thread",
+	thread->pt_magic == PT_MAGIC);
+
 	if (pthread__find(thread) != 0)
 		return ESRCH;
 
@@ -131,6 +146,9 @@ int
 pthread_kill(pthread_t thread, int sig)
 {
 
+	pthread__error(EINVAL, "Invalid thread",
+	thread->pt_magic == PT_MAGIC);
+
 	if ((sig < 0) || (sig >= _NSIG))
 		return EINVAL;
 	if (pthread__find(thread) != 0)



CVS commit: src/distrib/sparc/miniroot

2020-01-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jan 29 16:24:21 UTC 2020

Modified Files:
src/distrib/sparc/miniroot: Makefile.inc

Log Message:
bump a little for llvm


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/distrib/sparc/miniroot/Makefile.inc

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

Modified files:

Index: src/distrib/sparc/miniroot/Makefile.inc
diff -u src/distrib/sparc/miniroot/Makefile.inc:1.30 src/distrib/sparc/miniroot/Makefile.inc:1.31
--- src/distrib/sparc/miniroot/Makefile.inc:1.30	Fri Aug  2 08:04:45 2019
+++ src/distrib/sparc/miniroot/Makefile.inc	Wed Jan 29 11:24:21 2020
@@ -1,6 +1,6 @@
-#	$NetBSD: Makefile.inc,v 1.30 2019/08/02 12:04:45 joerg Exp $
+#	$NetBSD: Makefile.inc,v 1.31 2020/01/29 16:24:21 christos Exp $
 
-IMAGESIZE=	9900k
+IMAGESIZE=	10m
 DBG=		${${ACTIVE_CC} == "clang":? -Oz -fomit-frame-pointer : -Os } -fno-unwind-tables
 
 MAKEFS_FLAGS+=   -o density=4k



CVS commit: src/lib/libpthread

2020-01-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Jan 29 16:03:44 UTC 2020

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

Log Message:
Chack thread->pt_magic with PT_MAGIC promptly

Rearrange some checks to avoid verifying pthread_t after using it.


To generate a diff of this commit:
cvs rdiff -u -r1.160 -r1.161 src/lib/libpthread/pthread.c
cvs rdiff -u -r1.2 -r1.3 src/lib/libpthread/pthread_getcpuclockid.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.160 src/lib/libpthread/pthread.c:1.161
--- src/lib/libpthread/pthread.c:1.160	Wed Jan 29 15:31:14 2020
+++ src/lib/libpthread/pthread.c	Wed Jan 29 16:03:44 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread.c,v 1.160 2020/01/29 15:31:14 kamil Exp $	*/
+/*	$NetBSD: pthread.c,v 1.161 2020/01/29 16:03:44 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002, 2003, 2006, 2007, 2008, 2020
@@ -31,7 +31,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pthread.c,v 1.160 2020/01/29 15:31:14 kamil Exp $");
+__RCSID("$NetBSD: pthread.c,v 1.161 2020/01/29 16:03:44 kamil Exp $");
 
 #define	__EXPOSE_STACK	1
 
@@ -597,6 +597,9 @@ pthread_suspend_np(pthread_t thread)
 {
 	pthread_t self;
 
+	pthread__error(EINVAL, "Invalid thread",
+	thread->pt_magic == PT_MAGIC);
+
 	self = pthread__self();
 	if (self == thread) {
 		return EDEADLK;
@@ -611,6 +614,9 @@ pthread_suspend_np(pthread_t thread)
 int
 pthread_resume_np(pthread_t thread)
 {
+
+	pthread__error(EINVAL, "Invalid thread",
+	thread->pt_magic == PT_MAGIC);
  
 	if (pthread__find(thread) != 0)
 		return ESRCH;
@@ -702,14 +708,14 @@ pthread_join(pthread_t thread, void **va
 {
 	pthread_t self;
 
+	pthread__error(EINVAL, "Invalid thread",
+	thread->pt_magic == PT_MAGIC);
+
 	self = pthread__self();
 
 	if (pthread__find(thread) != 0)
 		return ESRCH;
 
-	if (thread->pt_magic != PT_MAGIC)
-		return EINVAL;
-
 	if (thread == self)
 		return EDEADLK;
 
@@ -764,9 +770,16 @@ pthread__reap(pthread_t thread)
 int
 pthread_equal(pthread_t t1, pthread_t t2)
 {
+
 	if (__predict_false(__uselibcstub))
 		return __libc_thr_equal_stub(t1, t2);
 
+	pthread__error(EINVAL, "Invalid thread",
+	t1->pt_magic == PT_MAGIC);
+
+	pthread__error(EINVAL, "Invalid thread",
+	t2->pt_magic == PT_MAGIC);
+
 	/* Nothing special here. */
 	return (t1 == t2);
 }
@@ -777,12 +790,12 @@ pthread_detach(pthread_t thread)
 {
 	int error;
 
+	pthread__error(EINVAL, "Invalid thread",
+	thread->pt_magic == PT_MAGIC);
+
 	if (pthread__find(thread) != 0)
 		return ESRCH;
 
-	if (thread->pt_magic != PT_MAGIC)
-		return EINVAL;
-
 	pthread_mutex_lock(>pt_lock);
 	if ((thread->pt_flags & PT_FLAG_DETACHED) != 0) {
 		error = EINVAL;
@@ -806,12 +819,12 @@ int
 pthread_getname_np(pthread_t thread, char *name, size_t len)
 {
 
+	pthread__error(EINVAL, "Invalid thread",
+	thread->pt_magic == PT_MAGIC);
+
 	if (pthread__find(thread) != 0)
 		return ESRCH;
 
-	if (thread->pt_magic != PT_MAGIC)
-		return EINVAL;
-
 	pthread_mutex_lock(>pt_lock);
 	if (thread->pt_name == NULL)
 		name[0] = '\0';
@@ -829,12 +842,12 @@ pthread_setname_np(pthread_t thread, con
 	char *oldname, *cp, newname[PTHREAD_MAX_NAMELEN_NP];
 	int namelen;
 
+	pthread__error(EINVAL, "Invalid thread",
+	thread->pt_magic == PT_MAGIC);
+
 	if (pthread__find(thread) != 0)
 		return ESRCH;
 
-	if (thread->pt_magic != PT_MAGIC)
-		return EINVAL;
-
 	namelen = snprintf(newname, sizeof(newname), name, arg);
 	if (namelen >= PTHREAD_MAX_NAMELEN_NP)
 		return EINVAL;
@@ -870,6 +883,9 @@ int
 pthread_cancel(pthread_t thread)
 {
 
+	pthread__error(EINVAL, "Invalid thread",
+	thread->pt_magic == PT_MAGIC);
+
 	if (pthread__find(thread) != 0)
 		return ESRCH;
 	pthread_mutex_lock(>pt_lock);

Index: src/lib/libpthread/pthread_getcpuclockid.c
diff -u src/lib/libpthread/pthread_getcpuclockid.c:1.2 src/lib/libpthread/pthread_getcpuclockid.c:1.3
--- src/lib/libpthread/pthread_getcpuclockid.c:1.2	Sat Mar  4 11:16:33 2017
+++ src/lib/libpthread/pthread_getcpuclockid.c	Wed Jan 29 16:03:44 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_getcpuclockid.c,v 1.2 2017/03/04 11:16:33 njoly Exp $	*/
+/*	$NetBSD: pthread_getcpuclockid.c,v 1.3 2020/01/29 16:03:44 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: pthread_getcpuclockid.c,v 1.2 2017/03/04 11:16:33 njoly Exp $");
+__RCSID("$NetBSD: pthread_getcpuclockid.c,v 1.3 2020/01/29 16:03:44 kamil Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include 
@@ -45,6 +45,9 @@ pthread_getcpuclockid(pthread_t thread, 
 {
 	int error = 0, saved_errno;
 
+	pthread__error(EINVAL, "Invalid thread",
+	thread->pt_magic == PT_MAGIC);
+
 	saved_errno = errno;
 	if (clock_getcpuclockid2(P_LWPID, (id_t)thread->pt_lid, clock_id) == -1)
 		error = errno;



CVS commit: src/sys

2020-01-29 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Wed Jan 29 15:47:52 UTC 2020

Modified Files:
src/sys/compat/common: kern_50.c kern_time_60.c
src/sys/compat/netbsd32: netbsd32_compat_50.c netbsd32_compat_60.c
netbsd32_lwp.c
src/sys/kern: kern_exec.c kern_exit.c kern_fork.c kern_lwp.c
kern_proc.c sys_lwp.c
src/sys/sys: lwp.h proc.h

Log Message:
- Track LWPs in a per-process radixtree.  It uses no extra memory in the
  single threaded case.  Replace scans of p->p_lwps with lookups in the
  tree.  Find free LIDs for new LWPs in the tree.  Replace the hashed sleep
  queues for park/unpark with lookups in the tree under cover of a RW lock.

- lwp_wait(): if waiting on a specific LWP, find the LWP via tree lookup and
  return EINVAL if it's detached, not ESRCH.

- Group the locks in struct proc at the end of the struct in their own cache
  line.

- Add some comments.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/compat/common/kern_50.c \
src/sys/compat/common/kern_time_60.c
cvs rdiff -u -r1.44 -r1.45 src/sys/compat/netbsd32/netbsd32_compat_50.c
cvs rdiff -u -r1.5 -r1.6 src/sys/compat/netbsd32/netbsd32_compat_60.c
cvs rdiff -u -r1.21 -r1.22 src/sys/compat/netbsd32/netbsd32_lwp.c
cvs rdiff -u -r1.489 -r1.490 src/sys/kern/kern_exec.c
cvs rdiff -u -r1.281 -r1.282 src/sys/kern/kern_exit.c
cvs rdiff -u -r1.217 -r1.218 src/sys/kern/kern_fork.c
cvs rdiff -u -r1.222 -r1.223 src/sys/kern/kern_lwp.c
cvs rdiff -u -r1.239 -r1.240 src/sys/kern/kern_proc.c
cvs rdiff -u -r1.73 -r1.74 src/sys/kern/sys_lwp.c
cvs rdiff -u -r1.199 -r1.200 src/sys/sys/lwp.h
cvs rdiff -u -r1.357 -r1.358 src/sys/sys/proc.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/compat/common/kern_50.c
diff -u src/sys/compat/common/kern_50.c:1.2 src/sys/compat/common/kern_50.c:1.3
--- src/sys/compat/common/kern_50.c:1.2	Sun Jan 27 02:08:39 2019
+++ src/sys/compat/common/kern_50.c	Wed Jan 29 15:47:51 2020
@@ -1,7 +1,7 @@
-/*	$NetBSD: kern_50.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $	*/
+/*	$NetBSD: kern_50.c,v 1.3 2020/01/29 15:47:51 ad Exp $	*/
 
 /*-
- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
+ * Copyright (c) 2008, 2009, 2020 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_50.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_50.c,v 1.3 2020/01/29 15:47:51 ad Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -80,12 +80,12 @@ compat_50_sys__lwp_park(struct lwp *l,
 	}
 
 	if (SCARG(uap, unpark) != 0) {
-		error = lwp_unpark(SCARG(uap, unpark), SCARG(uap, unparkhint));
+		error = lwp_unpark((uap, unpark), 1);
 		if (error != 0)
 			return error;
 	}
 
-	return lwp_park(CLOCK_REALTIME, TIMER_ABSTIME, tsp, SCARG(uap, hint));
+	return lwp_park(CLOCK_REALTIME, TIMER_ABSTIME, tsp);
 }
 
 static int
Index: src/sys/compat/common/kern_time_60.c
diff -u src/sys/compat/common/kern_time_60.c:1.2 src/sys/compat/common/kern_time_60.c:1.3
--- src/sys/compat/common/kern_time_60.c:1.2	Sun Jan 27 02:08:39 2019
+++ src/sys/compat/common/kern_time_60.c	Wed Jan 29 15:47:51 2020
@@ -1,7 +1,7 @@
-/*	$NetBSD: kern_time_60.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $	*/
+/*	$NetBSD: kern_time_60.c,v 1.3 2020/01/29 15:47:51 ad Exp $	*/
 
 /*-
- * Copyright (c) 2013 The NetBSD Foundation, Inc.
+ * Copyright (c) 2013, 2020 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_time_60.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time_60.c,v 1.3 2020/01/29 15:47:51 ad Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -75,12 +75,12 @@ compat_60_sys__lwp_park(struct lwp *l,
 	}
 
 	if (SCARG(uap, unpark) != 0) {
-		error = lwp_unpark(SCARG(uap, unpark), SCARG(uap, unparkhint));
+		error = lwp_unpark((uap, unpark), 1);
 		if (error != 0)
 			return error;
 	}
 
-	return lwp_park(CLOCK_REALTIME, TIMER_ABSTIME, tsp, SCARG(uap, hint));
+	return lwp_park(CLOCK_REALTIME, TIMER_ABSTIME, tsp);
 }
 
 int

Index: src/sys/compat/netbsd32/netbsd32_compat_50.c
diff -u src/sys/compat/netbsd32/netbsd32_compat_50.c:1.44 src/sys/compat/netbsd32/netbsd32_compat_50.c:1.45
--- src/sys/compat/netbsd32/netbsd32_compat_50.c:1.44	Wed Jan  1 14:52:38 2020
+++ src/sys/compat/netbsd32/netbsd32_compat_50.c	Wed Jan 29 15:47:51 2020
@@ -1,7 +1,7 @@
-/*	$NetBSD: netbsd32_compat_50.c,v 1.44 2020/01/01 14:52:38 maxv Exp $	*/
+/*	$NetBSD: netbsd32_compat_50.c,v 1.45 2020/01/29 15:47:51 ad Exp $	*/
 
 /*-
- * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * 

CVS commit: src/lib/libpthread

2020-01-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Jan 29 15:31:14 UTC 2020

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

Log Message:
Revert previous

Two assignments are correct.


To generate a diff of this commit:
cvs rdiff -u -r1.159 -r1.160 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.159 src/lib/libpthread/pthread.c:1.160
--- src/lib/libpthread/pthread.c:1.159	Wed Jan 29 15:15:00 2020
+++ src/lib/libpthread/pthread.c	Wed Jan 29 15:31:14 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread.c,v 1.159 2020/01/29 15:15:00 kamil Exp $	*/
+/*	$NetBSD: pthread.c,v 1.160 2020/01/29 15:31:14 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002, 2003, 2006, 2007, 2008, 2020
@@ -31,7 +31,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pthread.c,v 1.159 2020/01/29 15:15:00 kamil Exp $");
+__RCSID("$NetBSD: pthread.c,v 1.160 2020/01/29 15:31:14 kamil Exp $");
 
 #define	__EXPOSE_STACK	1
 
@@ -362,9 +362,8 @@ pthread__getstack(pthread_t newthread, c
 		newthread->pt_stack.ss_size == stacksize &&
 		newthread->pt_guardsize == guardsize)
 			return 0;
-#ifdef __MACHINE_STACK_GROWS_UP
 		stackbase2 = newthread->pt_stack.ss_sp;
-#else
+#ifndef __MACHINE_STACK_GROWS_UP
 		stackbase2 = (char *)stackbase2 - newthread->pt_guardsize;
 #endif
 		munmap(stackbase2,



CVS commit: src/lib/libpthread

2020-01-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Jan 29 15:15:00 UTC 2020

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

Log Message:
Do not set stackbase2 twice for !__MACHINE_STACK_GROWS_UP


To generate a diff of this commit:
cvs rdiff -u -r1.158 -r1.159 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.158 src/lib/libpthread/pthread.c:1.159
--- src/lib/libpthread/pthread.c:1.158	Tue Jan 28 09:23:15 2020
+++ src/lib/libpthread/pthread.c	Wed Jan 29 15:15:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread.c,v 1.158 2020/01/28 09:23:15 ad Exp $	*/
+/*	$NetBSD: pthread.c,v 1.159 2020/01/29 15:15:00 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002, 2003, 2006, 2007, 2008, 2020
@@ -31,7 +31,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pthread.c,v 1.158 2020/01/28 09:23:15 ad Exp $");
+__RCSID("$NetBSD: pthread.c,v 1.159 2020/01/29 15:15:00 kamil Exp $");
 
 #define	__EXPOSE_STACK	1
 
@@ -362,8 +362,9 @@ pthread__getstack(pthread_t newthread, c
 		newthread->pt_stack.ss_size == stacksize &&
 		newthread->pt_guardsize == guardsize)
 			return 0;
+#ifdef __MACHINE_STACK_GROWS_UP
 		stackbase2 = newthread->pt_stack.ss_sp;
-#ifndef __MACHINE_STACK_GROWS_UP
+#else
 		stackbase2 = (char *)stackbase2 - newthread->pt_guardsize;
 #endif
 		munmap(stackbase2,



CVS commit: src/lib/libpthread

2020-01-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Jan 29 15:07:46 UTC 2020

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

Log Message:
Use pthread_condattr_t and pthread_cond_t magic fields

Validate _PT_CONDATTR_MAGIC and _PT_COND_MAGIC respectively.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/lib/libpthread/pthread_cond.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_cond.c
diff -u src/lib/libpthread/pthread_cond.c:1.66 src/lib/libpthread/pthread_cond.c:1.67
--- src/lib/libpthread/pthread_cond.c:1.66	Mon Jan 13 18:22:56 2020
+++ src/lib/libpthread/pthread_cond.c	Wed Jan 29 15:07:46 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_cond.c,v 1.66 2020/01/13 18:22:56 ad Exp $	*/
+/*	$NetBSD: pthread_cond.c,v 1.67 2020/01/29 15:07:46 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -46,7 +46,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pthread_cond.c,v 1.66 2020/01/13 18:22:56 ad Exp $");
+__RCSID("$NetBSD: pthread_cond.c,v 1.67 2020/01/29 15:07:46 kamil Exp $");
 
 #include 
 #include 
@@ -78,6 +78,10 @@ __strong_alias(__libc_cond_destroy,pthre
 static clockid_t
 pthread_cond_getclock(const pthread_cond_t *cond)
 {
+
+	pthread__error(EINVAL, "Invalid condition variable",
+	cond->ptc_magic == _PT_COND_MAGIC);
+
 	return cond->ptc_private ? 
 	*(clockid_t *)cond->ptc_private : CLOCK_REALTIME;
 }
@@ -222,9 +226,6 @@ pthread__cond_wake_one(pthread_cond_t *c
 	pthread_mutex_t *mutex;
 	lwpid_t lid;
 
-	pthread__error(EINVAL, "Invalid condition variable",
-	cond->ptc_magic == _PT_COND_MAGIC);
-
 	/*
 	 * Pull the first thread off the queue.  If the current thread
 	 * is associated with the condition variable, remove it without
@@ -278,6 +279,9 @@ pthread_cond_signal(pthread_cond_t *cond
 	if (__predict_false(__uselibcstub))
 		return __libc_cond_signal_stub(cond);
 
+	pthread__error(EINVAL, "Invalid condition variable",
+	cond->ptc_magic == _PT_COND_MAGIC);
+
 	if (__predict_true(PTQ_EMPTY(>ptc_waiters)))
 		return 0;
 	return pthread__cond_wake_one(cond);
@@ -291,9 +295,6 @@ pthread__cond_wake_all(pthread_cond_t *c
 	u_int max;
 	size_t nwaiters;
 
-	pthread__error(EINVAL, "Invalid condition variable",
-	cond->ptc_magic == _PT_COND_MAGIC);
-
 	/*
 	 * Try to defer waking threads (see pthread_cond_signal()).
 	 * Only transfer waiters for which there is no pending wakeup.
@@ -328,6 +329,9 @@ pthread_cond_broadcast(pthread_cond_t *c
 	if (__predict_false(__uselibcstub))
 		return __libc_cond_broadcast_stub(cond);
 
+	pthread__error(EINVAL, "Invalid condition variable",
+	cond->ptc_magic == _PT_COND_MAGIC);
+
 	if (__predict_true(PTQ_EMPTY(>ptc_waiters)))
 		return 0;
 	return pthread__cond_wake_all(cond);
@@ -353,6 +357,10 @@ pthread_condattr_init(pthread_condattr_t
 int
 pthread_condattr_setclock(pthread_condattr_t *attr, clockid_t clck)
 {
+
+	pthread__error(EINVAL, "Invalid condition variable attribute",
+	attr->ptca_magic == _PT_CONDATTR_MAGIC);
+
 	switch (clck) {
 	case CLOCK_MONOTONIC:
 	case CLOCK_REALTIME:
@@ -371,6 +379,10 @@ int
 pthread_condattr_getclock(const pthread_condattr_t *__restrict attr,
 clockid_t *__restrict clock_id)
 {
+
+	pthread__error(EINVAL, "Invalid condition variable attribute",
+	attr->ptca_magic == _PT_CONDATTR_MAGIC);
+
 	if (attr == NULL || attr->ptca_private == NULL)
 		return EINVAL;
 	*clock_id = *(clockid_t *)attr->ptca_private;
@@ -396,6 +408,9 @@ pthread_condattr_getpshared(const pthrea
 int * __restrict pshared)
 {
 
+	pthread__error(EINVAL, "Invalid condition variable attribute",
+	attr->ptca_magic == _PT_CONDATTR_MAGIC);
+
 	*pshared = PTHREAD_PROCESS_PRIVATE;
 	return 0;
 }
@@ -404,6 +419,9 @@ int
 pthread_condattr_setpshared(pthread_condattr_t *attr, int pshared)
 {
 
+	pthread__error(EINVAL, "Invalid condition variable attribute",
+	attr->ptca_magic == _PT_CONDATTR_MAGIC);
+
 	switch(pshared) {
 	case PTHREAD_PROCESS_PRIVATE:
 		return 0;



CVS commit: src/sys/dev/ic

2020-01-29 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 15:06:12 UTC 2020

Modified Files:
src/sys/dev/ic: rt2560.c rt2661.c rt2860.c rtl8169.c rtl81x9.c rtw.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/ic/rt2560.c
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/ic/rt2661.c
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/ic/rt2860.c
cvs rdiff -u -r1.161 -r1.162 src/sys/dev/ic/rtl8169.c
cvs rdiff -u -r1.107 -r1.108 src/sys/dev/ic/rtl81x9.c
cvs rdiff -u -r1.134 -r1.135 src/sys/dev/ic/rtw.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/rt2560.c
diff -u src/sys/dev/ic/rt2560.c:1.37 src/sys/dev/ic/rt2560.c:1.38
--- src/sys/dev/ic/rt2560.c:1.37	Sun Nov 10 21:16:35 2019
+++ src/sys/dev/ic/rt2560.c	Wed Jan 29 15:06:12 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rt2560.c,v 1.37 2019/11/10 21:16:35 chs Exp $	*/
+/*	$NetBSD: rt2560.c,v 1.38 2020/01/29 15:06:12 thorpej Exp $	*/
 /*	$OpenBSD: rt2560.c,v 1.15 2006/04/20 20:31:12 miod Exp $  */
 /*	$FreeBSD: rt2560.c,v 1.3 2006/03/21 21:15:43 damien Exp $*/
 
@@ -24,7 +24,7 @@
  * http://www.ralinktech.com/
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rt2560.c,v 1.37 2019/11/10 21:16:35 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rt2560.c,v 1.38 2020/01/29 15:06:12 thorpej Exp $");
 
 
 #include 
@@ -1098,13 +1098,13 @@ rt2560_tx_intr(struct rt2560_softc *sc)
 ieee80211_rssadapt_raise_rate(ic,
 >rssadapt, >id);
 			}
-			ifp->if_opackets++;
+			if_statinc(ifp, if_opackets);
 			break;
 
 		case RT2560_TX_SUCCESS_RETRY:
 			DPRINTFN(9, ("data frame sent after %u retries\n",
 			(le32toh(desc->flags) >> 5) & 0x7));
-			ifp->if_opackets++;
+			if_statinc(ifp, if_opackets);
 			break;
 
 		case RT2560_TX_FAIL_RETRY:
@@ -1114,7 +1114,7 @@ rt2560_tx_intr(struct rt2560_softc *sc)
 ieee80211_rssadapt_lower_rate(ic, data->ni,
 >rssadapt, >id);
 			}
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			break;
 
 		case RT2560_TX_FAIL_INVALID:
@@ -1123,7 +1123,7 @@ rt2560_tx_intr(struct rt2560_softc *sc)
 			aprint_error_dev(sc->sc_dev,
 			"sending data frame failed 0x%08x\n",
 			le32toh(desc->flags));
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 		}
 
 		bus_dmamap_sync(sc->sc_dmat, data->map, 0,
@@ -1261,13 +1261,13 @@ rt2560_decryption_intr(struct rt2560_sof
 			break;
 
 		if (data->drop) {
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			goto skip;
 		}
 
 		if ((le32toh(desc->flags) & RT2560_RX_CIPHER_MASK) != 0 &&
 		(le32toh(desc->flags) & RT2560_RX_ICV_ERROR)) {
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			goto skip;
 		}
 
@@ -1280,14 +1280,14 @@ rt2560_decryption_intr(struct rt2560_sof
 		 */
 		MGETHDR(mnew, M_DONTWAIT, MT_DATA);
 		if (mnew == NULL) {
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			goto skip;
 		}
 
 		MCLGET(mnew, M_DONTWAIT);
 		if (!(mnew->m_flags & M_EXT)) {
 			m_freem(mnew);
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			goto skip;
 		}
 
@@ -1311,7 +1311,7 @@ rt2560_decryption_intr(struct rt2560_sof
 			}
 			/* physical address may have changed */
 			desc->physaddr = htole32(data->map->dm_segs->ds_addr);
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			goto skip;
 		}
 
@@ -2150,7 +2150,7 @@ rt2560_start(struct ifnet *ifp)
 
 			if (rt2560_tx_data(sc, m0, ni) != 0) {
 ieee80211_free_node(ni);
-ifp->if_oerrors++;
+if_statinc(ifp, if_oerrors);
 break;
 			}
 		}
@@ -2171,7 +2171,7 @@ rt2560_watchdog(struct ifnet *ifp)
 		if (--sc->sc_tx_timer == 0) {
 			aprint_error_dev(sc->sc_dev, "device timeout\n");
 			rt2560_init(ifp);
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			return;
 		}
 		ifp->if_timer = 1;

Index: src/sys/dev/ic/rt2661.c
diff -u src/sys/dev/ic/rt2661.c:1.42 src/sys/dev/ic/rt2661.c:1.43
--- src/sys/dev/ic/rt2661.c:1.42	Sun Nov 10 21:16:35 2019
+++ src/sys/dev/ic/rt2661.c	Wed Jan 29 15:06:12 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rt2661.c,v 1.42 2019/11/10 21:16:35 chs Exp $	*/
+/*	$NetBSD: rt2661.c,v 1.43 2020/01/29 15:06:12 thorpej Exp $	*/
 /*	$OpenBSD: rt2661.c,v 1.17 2006/05/01 08:41:11 damien Exp $	*/
 /*	$FreeBSD: rt2560.c,v 1.5 2006/06/02 19:59:31 csjp Exp $	*/
 
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rt2661.c,v 1.42 2019/11/10 21:16:35 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rt2661.c,v 1.43 2020/01/29 15:06:12 thorpej Exp $");
 
 
 #include 
@@ -946,7 +946,7 @@ rt2661_tx_intr(struct rt2661_softc *sc)
 			rn->amn.amn_txcnt++;
 			if (retrycnt > 0)
 rn->amn.amn_retrycnt++;
-			ifp->if_opackets++;
+			if_statinc(ifp, if_opackets);
 			break;
 
 		case RT2661_TX_RETRY_FAIL:
@@ -954,13 +954,13 @@ rt2661_tx_intr(struct rt2661_softc *sc)
 			"retries)\n"));
 			rn->amn.amn_txcnt++;
 			rn->amn.amn_retrycnt++;
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			break;
 
 		default:
 			/* 

CVS commit: src/sys/dev/ic

2020-01-29 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 15:00:39 UTC 2020

Modified Files:
src/sys/dev/ic: malo.c mb86950.c mb86960.c mtd803.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/ic/malo.c
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/ic/mb86950.c
cvs rdiff -u -r1.93 -r1.94 src/sys/dev/ic/mb86960.c
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/ic/mtd803.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/malo.c
diff -u src/sys/dev/ic/malo.c:1.17 src/sys/dev/ic/malo.c:1.18
--- src/sys/dev/ic/malo.c:1.17	Sun Nov 10 21:16:35 2019
+++ src/sys/dev/ic/malo.c	Wed Jan 29 15:00:39 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: malo.c,v 1.17 2019/11/10 21:16:35 chs Exp $ */
+/*	$NetBSD: malo.c,v 1.18 2020/01/29 15:00:39 thorpej Exp $ */
 /*	$OpenBSD: malo.c,v 1.92 2010/08/27 17:08:00 jsg Exp $ */
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: malo.c,v 1.17 2019/11/10 21:16:35 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: malo.c,v 1.18 2020/01/29 15:00:39 thorpej Exp $");
 
 #include 
 #include 
@@ -1043,14 +1043,14 @@ malo_start(struct ifnet *ifp)
 
 			if (m0->m_len < sizeof (*eh) &&
 			(m0 = m_pullup(m0, sizeof (*eh))) == NULL) {
-ifp->if_oerrors++;
+if_statinc(ifp, if_oerrors);
 continue;
 			}
 			eh = mtod(m0, struct ether_header *);
 			ni = ieee80211_find_txnode(ic, eh->ether_dhost);
 			if (ni == NULL) {
 m_freem(m0);
-ifp->if_oerrors++;
+if_statinc(ifp, if_oerrors);
 continue;
 			}
 
@@ -1066,7 +1066,7 @@ malo_start(struct ifnet *ifp)
 
 			if (malo_tx_data(sc, m0, ni) != 0) {
 ieee80211_free_node(ni);
-ifp->if_oerrors++;
+if_statinc(ifp, if_oerrors);
 break;
 			}
 		}
@@ -1352,12 +1352,12 @@ malo_tx_intr(struct malo_softc *sc)
 		case MALO_TXD_STATUS_OK:
 			DPRINTF(2, "%s: data frame was sent successfully\n",
 			device_xname(sc->sc_dev));
-			ifp->if_opackets++;
+			if_statinc(ifp, if_opackets);
 			break;
 		default:
 			DPRINTF(1, "%s: data frame sending error\n",
 			device_xname(sc->sc_dev));
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			break;
 		}
 
@@ -1415,7 +1415,7 @@ malo_tx_data(struct malo_softc *sc, stru
 	if (m0->m_len < sizeof(struct ieee80211_frame)) {
 		m0 = m_pullup(m0, sizeof(struct ieee80211_frame));
 		if (m0 == NULL) {
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			return (ENOBUFS);
 		}
 	}
@@ -1555,14 +1555,14 @@ malo_rx_intr(struct malo_softc *sc)
 
 		MGETHDR(mnew, M_DONTWAIT, MT_DATA);
 		if (mnew == NULL) {
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			goto skip;
 		}
 
 		MCLGET(mnew, M_DONTWAIT);
 		if (!(mnew->m_flags & M_EXT)) {
 			m_freem(mnew);
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			goto skip;
 		}
 
@@ -1582,7 +1582,7 @@ malo_rx_intr(struct malo_softc *sc)
 panic("%s: could not load old rx mbuf",
 device_xname(sc->sc_dev));
 			}
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			goto skip;
 		}
 

Index: src/sys/dev/ic/mb86950.c
diff -u src/sys/dev/ic/mb86950.c:1.32 src/sys/dev/ic/mb86950.c:1.33
--- src/sys/dev/ic/mb86950.c:1.32	Wed May 29 10:07:29 2019
+++ src/sys/dev/ic/mb86950.c	Wed Jan 29 15:00:39 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: mb86950.c,v 1.32 2019/05/29 10:07:29 msaitoh Exp $	*/
+/*	$NetBSD: mb86950.c,v 1.33 2020/01/29 15:00:39 thorpej Exp $	*/
 
 /*
  * All Rights Reserved, Copyright (C) Fujitsu Limited 1995
@@ -67,7 +67,7 @@
   */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mb86950.c,v 1.32 2019/05/29 10:07:29 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mb86950.c,v 1.33 2020/01/29 15:00:39 thorpej Exp $");
 
 /*
  * Device driver for Fujitsu mb86950 based Ethernet cards.
@@ -415,7 +415,7 @@ mb86950_watchdog(struct ifnet *ifp)
 	 * Don't know how many packets are lost by this accident.
 	 *  ... So just errors = errors + 1
 	 */
-	ifp->if_oerrors++;
+	if_statinc(ifp, if_oerrors);
 
 	mb86950_reset(sc);
 }
@@ -735,12 +735,12 @@ mb86950_tint(struct mb86950_softc *sc, u
 
 	if (tstat & (TX_UNDERFLO | TX_BUS_WR_ERR)) {
 		/* XXX What do we need to do here? reset ? */
-		ifp->if_oerrors++;
+		if_statinc(ifp, if_oerrors);
 	}
 
 	/* Excessive collision */
 	if (tstat & TX_16COL) {
-		ifp->if_collisions += 16;
+		if_statadd(ifp, if_collisions, 16);
 		/* 16 collisions means that the packet has been thrown away. */
 		if (sc->txb_sched > 0)
 			sc->txb_sched--;
@@ -749,7 +749,7 @@ mb86950_tint(struct mb86950_softc *sc, u
 	/* Transmission complete. */
 	if (tstat & TX_DONE) {
 		/* Successfully transmitted packets ++. */
-		ifp->if_opackets++;
+		if_statinc(ifp, if_opackets);
 		if (sc->txb_sched > 0)
 			sc->txb_sched--;
 
@@ -757,7 +757,7 @@ mb86950_tint(struct mb86950_softc *sc, u
 		if (tstat & TX_COL) {
 			col = (bus_space_read_1(bst, bsh, DLCR_TX_MODE)
 			& COL_MASK) >> 4;
-			ifp->if_collisions = ifp->if_collisions + col;
+			

CVS commit: src/sys/dev/ic

2020-01-29 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 14:53:41 UTC 2020

Modified Files:
src/sys/dev/ic: lan9118.c lemac.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/ic/lan9118.c
cvs rdiff -u -r1.54 -r1.55 src/sys/dev/ic/lemac.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/lan9118.c
diff -u src/sys/dev/ic/lan9118.c:1.35 src/sys/dev/ic/lan9118.c:1.36
--- src/sys/dev/ic/lan9118.c:1.35	Thu May 30 02:32:18 2019
+++ src/sys/dev/ic/lan9118.c	Wed Jan 29 14:53:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: lan9118.c,v 1.35 2019/05/30 02:32:18 msaitoh Exp $	*/
+/*	$NetBSD: lan9118.c,v 1.36 2020/01/29 14:53:40 thorpej Exp $	*/
 /*
  * Copyright (c) 2008 KIYOHARA Takashi
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lan9118.c,v 1.35 2019/05/30 02:32:18 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lan9118.c,v 1.36 2020/01/29 14:53:40 thorpej Exp $");
 
 /*
  * The LAN9118 Family
@@ -328,17 +328,17 @@ lan9118_intr(void *arg)
 		}
 #endif
 		if (int_sts & LAN9118_INT_RXE) {
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			aprint_error_ifnet(ifp, "Receive Error\n");
 		}
 		if (int_sts & (LAN9118_INT_TSFL|LAN9118_INT_SW_INT)) /* TX Status FIFO Level */
 			lan9118_txintr(sc);
 		if (int_sts & LAN9118_INT_RXDF_INT) {
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			aprint_error_ifnet(ifp, "RX Dropped Frame Interrupt\n");
 		}
 		if (int_sts & LAN9118_INT_RSFF) {
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			aprint_error_ifnet(ifp, "RX Status FIFO Full\n");
 		}
 		if (int_sts & LAN9118_INT_RSFL) /* RX Status FIFO Level */
@@ -691,7 +691,7 @@ lan9118_watchdog(struct ifnet *ifp)
 	lan9118_txintr(sc);
 
 	aprint_error_ifnet(ifp, "watchdog timeout\n");
-	ifp->if_oerrors++;
+	if_statinc(ifp, if_oerrors);
 
 	lan9118_init(ifp);
 }
@@ -968,7 +968,7 @@ lan9118_rxintr(struct lan9118_softc *sc)
 aprint_error_dev(sc->sc_dev, "CRC Error\n");
 
 dropit:
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			/*
 			 * Receive Data FIFO Fast Forward
 			 * When performing a fast-forward, there must be at
@@ -1054,7 +1054,7 @@ lan9118_txintr(struct lan9118_softc *sc)
 "Late Collision\n");
 			if (tx_status & LAN9118_TXS_ECOL) {
 /* Rearch 16 collision */
-ifp->if_collisions += 16;
+if_statadd(ifp, if_collisions, 16);
 aprint_error_dev(sc->sc_dev,
 "Excessive Collision\n");
 			}
@@ -1067,9 +1067,9 @@ lan9118_txintr(struct lan9118_softc *sc)
 "Excessive Deferral\n");
 			if (tx_status & LAN9118_TXS_DEFERRED)
 aprint_error_dev(sc->sc_dev, "Deferred\n");
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 		} else
-			ifp->if_opackets++;
+			if_statinc(ifp, if_opackets);
 	}
 
 	tdfree = LAN9118_TX_FIFO_INF_TDFREE(tx_fifo_inf);

Index: src/sys/dev/ic/lemac.c
diff -u src/sys/dev/ic/lemac.c:1.54 src/sys/dev/ic/lemac.c:1.55
--- src/sys/dev/ic/lemac.c:1.54	Wed May 29 10:07:29 2019
+++ src/sys/dev/ic/lemac.c	Wed Jan 29 14:53:40 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: lemac.c,v 1.54 2019/05/29 10:07:29 msaitoh Exp $ */
+/* $NetBSD: lemac.c,v 1.55 2020/01/29 14:53:40 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1994, 1995, 1997 Matt Thomas 
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lemac.c,v 1.54 2019/05/29 10:07:29 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lemac.c,v 1.55 2020/01/29 14:53:40 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -151,16 +151,16 @@ lemac_tne_intr(lemac_softc_t *sc)
 	sc->sc_cntrs.cntr_tne_intrs++;
 	while (txcount-- > 0) {
 		unsigned txsts = LEMAC_INB(sc, LEMAC_REG_TDQ);
-		sc->sc_if.if_opackets++;		/* another one done */
+		if_statinc(>sc_if, if_opackets);	/* another one done */
 		if ((txsts & (LEMAC_TDQ_LCL | LEMAC_TDQ_NCL))
 		|| (txsts & LEMAC_TDQ_COL) == LEMAC_TDQ_EXCCOL) {
 			if (txsts & LEMAC_TDQ_NCL)
 sc->sc_flags &= ~LEMAC_LINKUP;
-			sc->sc_if.if_oerrors++;
+			if_statinc(>sc_if, if_oerrors);
 		} else {
 			sc->sc_flags |= LEMAC_LINKUP;
 			if ((txsts & LEMAC_TDQ_COL) != LEMAC_TDQ_NOCOL)
-sc->sc_if.if_collisions++;
+if_statinc(>sc_if, if_collisions);
 		}
 	}
 	sc->sc_if.if_flags &= ~IFF_OACTIVE;
@@ -179,7 +179,7 @@ lemac_txd_intr(lemac_softc_t *sc, unsign
 
 	sc->sc_cntrs.cntr_txd_intrs++;
 	if (sc->sc_txctl & LEMAC_TX_STP) {
-		sc->sc_if.if_oerrors++;
+		if_statinc(>sc_if, if_oerrors);
 		/* return page to free queue */
 		LEMAC_OUTB(sc, LEMAC_REG_FMQ, LEMAC_INB(sc, LEMAC_REG_TDQ));
 	}
@@ -252,7 +252,7 @@ lemac_input(lemac_softc_t *sc, bus_addr_
 	struct mbuf *m;
 
 	if (length - sizeof(eh) > ETHERMTU || length - sizeof(eh) < ETHERMIN) {
-		sc->sc_if.if_ierrors++;
+		if_statinc(>sc_if, if_ierrors);
 		return;
 	}
 	if (LEMAC_USE_PIO_MODE(sc))
@@ -262,14 +262,14 @@ lemac_input(lemac_softc_t *sc, bus_addr_
 
 	MGETHDR(m, M_DONTWAIT, 

CVS commit: src/sys/dev/ic

2020-01-29 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 14:49:44 UTC 2020

Modified Files:
src/sys/dev/ic: i82557.c i82586.c i82596.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.156 -r1.157 src/sys/dev/ic/i82557.c
cvs rdiff -u -r1.87 -r1.88 src/sys/dev/ic/i82586.c
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/ic/i82596.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/i82557.c
diff -u src/sys/dev/ic/i82557.c:1.156 src/sys/dev/ic/i82557.c:1.157
--- src/sys/dev/ic/i82557.c:1.156	Wed Oct 30 07:26:28 2019
+++ src/sys/dev/ic/i82557.c	Wed Jan 29 14:49:44 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: i82557.c,v 1.156 2019/10/30 07:26:28 msaitoh Exp $	*/
+/*	$NetBSD: i82557.c,v 1.157 2020/01/29 14:49:44 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 1999, 2001, 2002 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i82557.c,v 1.156 2019/10/30 07:26:28 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i82557.c,v 1.157 2020/01/29 14:49:44 thorpej Exp $");
 
 #include 
 #include 
@@ -1436,7 +1436,7 @@ fxp_rxintr(struct fxp_softc *sc)
 		} else {
 			if (fxp_add_rfabuf(sc, rxmap, 1) != 0) {
  dropit:
-ifp->if_ierrors++;
+if_statinc(ifp, if_ierrors);
 FXP_INIT_RFABUF(sc, m);
 continue;
 			}
@@ -1474,26 +1474,28 @@ fxp_tick(void *arg)
 
 	s = splnet();
 
+	net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
+
 	FXP_CDSTATSSYNC(sc, BUS_DMASYNC_POSTREAD);
 
-	ifp->if_opackets += le32toh(sp->tx_good);
-	ifp->if_collisions += le32toh(sp->tx_total_collisions);
+	if_statadd_ref(nsr, if_opackets, le32toh(sp->tx_good));
+	if_statadd_ref(nsr, if_collisions, le32toh(sp->tx_total_collisions));
 	if (sp->rx_good) {
 		sc->sc_rxidle = 0;
 	} else if (sc->sc_flags & FXPF_RECV_WORKAROUND) {
 		sc->sc_rxidle++;
 	}
-	ifp->if_ierrors +=
+	if_statadd_ref(nsr, if_ierrors,
 	le32toh(sp->rx_crc_errors) +
 	le32toh(sp->rx_alignment_errors) +
 	le32toh(sp->rx_rnr_errors) +
-	le32toh(sp->rx_overrun_errors);
+	le32toh(sp->rx_overrun_errors));
 	/*
 	 * If any transmit underruns occurred, bump up the transmit
 	 * threshold by another 512 bytes (64 * 8).
 	 */
 	if (sp->tx_underruns) {
-		ifp->if_oerrors += le32toh(sp->tx_underruns);
+		if_statadd_ref(nsr, if_oerrors, le32toh(sp->tx_underruns));
 		if (tx_threshold < 192)
 			tx_threshold += 64;
 	}
@@ -1504,6 +1506,8 @@ fxp_tick(void *arg)
 	}
 #endif
 
+	IF_STAT_PUTREF(ifp);
+
 	/*
 	 * If we haven't received any packets in FXP_MAX_RX_IDLE seconds,
 	 * then assume the receiver has locked up and attempt to clear
@@ -1652,7 +1656,7 @@ fxp_watchdog(struct ifnet *ifp)
 	struct fxp_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);
 
 	(void) fxp_init(ifp);
 }

Index: src/sys/dev/ic/i82586.c
diff -u src/sys/dev/ic/i82586.c:1.87 src/sys/dev/ic/i82586.c:1.88
--- src/sys/dev/ic/i82586.c:1.87	Sun Nov 10 21:16:35 2019
+++ src/sys/dev/ic/i82586.c	Wed Jan 29 14:49:44 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: i82586.c,v 1.87 2019/11/10 21:16:35 chs Exp $	*/
+/*	$NetBSD: i82586.c,v 1.88 2020/01/29 14:49:44 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -137,7 +137,7 @@ Mode of operation:
 */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i82586.c,v 1.87 2019/11/10 21:16:35 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i82586.c,v 1.88 2020/01/29 14:49:44 thorpej Exp $");
 
 
 #include 
@@ -281,7 +281,7 @@ i82586_watchdog(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);
 
 	i82586_reset(sc, 1);
 }
@@ -401,11 +401,11 @@ i82586_count_errors(struct ie_softc *sc)
 {
 	int scb = sc->scb;
 
-	sc->sc_ethercom.ec_if.if_ierrors +=
+	if_statadd(>sc_ethercom.ec_if, if_ierrors,
 	sc->ie_bus_read16(sc, IE_SCB_ERRCRC(scb)) +
 	sc->ie_bus_read16(sc, IE_SCB_ERRALN(scb)) +
 	sc->ie_bus_read16(sc, IE_SCB_ERRRES(scb)) +
-	sc->ie_bus_read16(sc, IE_SCB_ERROVR(scb));
+	sc->ie_bus_read16(sc, IE_SCB_ERROVR(scb)));
 
 	/* Clear error counters */
 	sc->ie_bus_write16(sc, IE_SCB_ERRCRC(scb), 0);
@@ -588,7 +588,7 @@ static	int timesthru = 1024;
 			i82586_drop_frames(sc);
 			if ((status & IE_FD_RNR) != 0)
 sc->rnr_expect = 1;
-			sc->sc_ethercom.ec_if.if_ierrors++;
+			if_statinc(>sc_ethercom.ec_if, if_ierrors);
 		} else if (ie_readframe(sc, i) != 0)
 			return (1);
 	}
@@ -638,13 +638,13 @@ static	int timesthru = 1024;
 return (1);
 
 			i82586_start_transceiver(sc);
-			sc->sc_ethercom.ec_if.if_ierrors++;
+			if_statinc(>sc_ethercom.ec_if, if_ierrors);
 			return (0);
 		} else
 			printf("%s: receiver not ready; scbstatus=0x%x\n",
 device_xname(sc->sc_dev), scbstatus);
 
-		sc->sc_ethercom.ec_if.if_ierrors++;
+		if_statinc(>sc_ethercom.ec_if, if_ierrors);

CVS commit: src/sys/dev/ic

2020-01-29 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 14:47:08 UTC 2020

Modified Files:
src/sys/dev/ic: gem.c hd64570.c hme.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.124 -r1.125 src/sys/dev/ic/gem.c
cvs rdiff -u -r1.54 -r1.55 src/sys/dev/ic/hd64570.c
cvs rdiff -u -r1.105 -r1.106 src/sys/dev/ic/hme.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/gem.c
diff -u src/sys/dev/ic/gem.c:1.124 src/sys/dev/ic/gem.c:1.125
--- src/sys/dev/ic/gem.c:1.124	Tue Dec 24 05:00:19 2019
+++ src/sys/dev/ic/gem.c	Wed Jan 29 14:47:08 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: gem.c,v 1.124 2019/12/24 05:00:19 msaitoh Exp $ */
+/*	$NetBSD: gem.c,v 1.125 2020/01/29 14:47:08 thorpej Exp $ */
 
 /*
  *
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gem.c,v 1.124 2019/12/24 05:00:19 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gem.c,v 1.125 2020/01/29 14:47:08 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -1642,15 +1642,17 @@ gem_tint(struct gem_softc *sc)
 	int progress = 0;
 	uint32_t v;
 
+	net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
+
 	DPRINTF(sc, ("%s: gem_tint\n", device_xname(sc->sc_dev)));
 
 	/* Unload collision counters ... */
 	v = bus_space_read_4(t, mac, GEM_MAC_EXCESS_COLL_CNT) +
 	bus_space_read_4(t, mac, GEM_MAC_LATE_COLL_CNT);
-	ifp->if_collisions += v +
+	if_statadd_ref(nsr, if_collisions, v +
 	bus_space_read_4(t, mac, GEM_MAC_NORM_COLL_CNT) +
-	bus_space_read_4(t, mac, GEM_MAC_FIRST_COLL_CNT);
-	ifp->if_oerrors += v;
+	bus_space_read_4(t, mac, GEM_MAC_FIRST_COLL_CNT));
+	if_statadd_ref(nsr, if_oerrors, v);
 
 	/* ... then clear the hardware counters. */
 	bus_space_write_4(t, mac, GEM_MAC_NORM_COLL_CNT, 0);
@@ -1720,10 +1722,12 @@ gem_tint(struct gem_softc *sc)
 
 		SIMPLEQ_INSERT_TAIL(>sc_txfreeq, txs, txs_q);
 
-		ifp->if_opackets++;
+		if_statinc_ref(nsr, if_opackets);
 		progress = 1;
 	}
 
+	IF_STAT_PUTREF(ifp);
+
 #if 0
 	DPRINTF(sc, ("gem_tint: GEM_TX_STATE_MACHINE %x "
 		"GEM_TX_DATA_PTR %" PRIx64 "GEM_TX_COMPLETION %" PRIx32 "\n",
@@ -1810,7 +1814,7 @@ gem_rint(struct gem_softc *sc)
 		progress++;
 
 		if (rxstat & GEM_RD_BAD_CRC) {
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			aprint_error_dev(sc->sc_dev,
 			"receive error: CRC error\n");
 			GEM_INIT_RXDESC(sc, i);
@@ -1840,7 +1844,7 @@ gem_rint(struct gem_softc *sc)
 		m = rxs->rxs_mbuf;
 		if (gem_add_rxbuf(sc, i) != 0) {
 			GEM_COUNTER_INCR(sc, sc_ev_rxnobuf);
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			aprint_error_dev(sc->sc_dev,
 			"receive error: RX no buffer space\n");
 			GEM_INIT_RXDESC(sc, i);
@@ -1979,11 +1983,11 @@ swcsum:
 		sc->sc_rxptr, bus_space_read_4(t, h, GEM_RX_COMPLETION)));
 
 	/* Read error counters ... */
-	ifp->if_ierrors +=
+	if_statadd(ifp, if_ierrors,
 	bus_space_read_4(t, h, GEM_MAC_RX_LEN_ERR_CNT) +
 	bus_space_read_4(t, h, GEM_MAC_RX_ALIGN_ERR) +
 	bus_space_read_4(t, h, GEM_MAC_RX_CRC_ERR_CNT) +
-	bus_space_read_4(t, h, GEM_MAC_RX_CODE_VIOL);
+	bus_space_read_4(t, h, GEM_MAC_RX_CODE_VIOL));
 
 	/* ... then clear the hardware counters. */
 	bus_space_write_4(t, h, GEM_MAC_RX_LEN_ERR_CNT, 0);
@@ -,7 +2226,7 @@ gem_intr(void *v)
 		 * RX FIFO write and read pointers.
 		 */
 		if (rxstat & GEM_MAC_RX_OVERFLOW) {
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			aprint_error_dev(sc->sc_dev,
 			"receive error: RX overflow sc->rxptr %d, complete %d\n", sc->sc_rxptr, bus_space_read_4(t, h, GEM_RX_COMPLETION));
 			sc->sc_rx_fifo_wr_ptr =
@@ -2324,7 +2328,7 @@ gem_watchdog(struct ifnet *ifp)
 		bus_space_read_4(sc->sc_bustag, sc->sc_h1, GEM_MAC_RX_CONFIG)));
 
 	log(LOG_ERR, "%s: device timeout\n", device_xname(sc->sc_dev));
-	++ifp->if_oerrors;
+	if_statinc(ifp, if_oerrors);
 
 	/* Try to get more packets going. */
 	gem_init(ifp);

Index: src/sys/dev/ic/hd64570.c
diff -u src/sys/dev/ic/hd64570.c:1.54 src/sys/dev/ic/hd64570.c:1.55
--- src/sys/dev/ic/hd64570.c:1.54	Tue Jun 26 06:48:00 2018
+++ src/sys/dev/ic/hd64570.c	Wed Jan 29 14:47:08 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: hd64570.c,v 1.54 2018/06/26 06:48:00 msaitoh Exp $	*/
+/*	$NetBSD: hd64570.c,v 1.55 2020/01/29 14:47:08 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1999 Christian E. Hopps
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hd64570.c,v 1.54 2018/06/26 06:48:00 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hd64570.c,v 1.55 2020/01/29 14:47:08 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -878,15 +878,18 @@ sca_output(
 			IF_ENQUEUE(ifq, m);
 	} else
 		IFQ_ENQUEUE(>if_snd, m, error);
+	net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
 	if (error != 0) {
+		if_statinc_ref(nsr, if_oerrors);
+		if_statinc_ref(nsr, if_collisions);
+		IF_STAT_PUTREF(ifp);
 		splx(s);
-		ifp->if_oerrors++;
-		ifp->if_collisions++;
 		return (error);
 	}
-	ifp->if_obytes += len;
+	if_statadd_ref(nsr, if_obytes, 

CVS commit: src/lib/libpthread

2020-01-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Jan 29 14:41:57 UTC 2020

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

Log Message:
Use pthread_barrierattr_t and pthread_barrier_t magic fields

Set respectively _PT_BARRIER_DEAD for pthread_barrier_destroy() and
_PT_BARRIERATTR_DEAD for pthread_barrierattr_destroy().

Validate _PT_BARRIER_MAGIC in pthread_barrier_t and _PT_BARRIERATTR_MAGIC
in pthread_barrierattr_t accordingly.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/lib/libpthread/pthread_barrier.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_barrier.c
diff -u src/lib/libpthread/pthread_barrier.c:1.20 src/lib/libpthread/pthread_barrier.c:1.21
--- src/lib/libpthread/pthread_barrier.c:1.20	Sun Jul  3 14:24:58 2016
+++ src/lib/libpthread/pthread_barrier.c	Wed Jan 29 14:41:57 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_barrier.c,v 1.20 2016/07/03 14:24:58 christos Exp $	*/
+/*	$NetBSD: pthread_barrier.c,v 1.21 2020/01/29 14:41:57 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2003, 2006, 2007, 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pthread_barrier.c,v 1.20 2016/07/03 14:24:58 christos Exp $");
+__RCSID("$NetBSD: pthread_barrier.c,v 1.21 2020/01/29 14:41:57 kamil Exp $");
 
 #include 
 
@@ -41,9 +41,9 @@ int
 pthread_barrier_init(pthread_barrier_t *barrier,
 		 const pthread_barrierattr_t *attr, unsigned int count)
 {
-	
-	if (attr != NULL && attr->ptba_magic != _PT_BARRIERATTR_MAGIC)
-		return EINVAL;
+
+	pthread__error(EINVAL, "Invalid barrier attribute",
+	attr == NULL || attr->ptba_magic == _PT_BARRIERATTR_MAGIC);
 	if (count == 0)
 		return EINVAL;
 
@@ -59,10 +59,13 @@ int
 pthread_barrier_destroy(pthread_barrier_t *barrier)
 {
 
-	if (barrier->ptb_magic != _PT_BARRIER_MAGIC)
-		return EINVAL;
+	pthread__error(EINVAL, "Invalid barrier",
+	barrier->ptb_magic == _PT_BARRIER_MAGIC);
 	if (barrier->ptb_curcount != 0)
 		return EBUSY;
+
+	barrier->ptb_magic = _PT_BARRIER_DEAD;
+
 	return 0;
 }
 
@@ -73,8 +76,8 @@ pthread_barrier_wait(pthread_barrier_t *
 	pthread_t self;
 	unsigned int gen;
 
-	if (barrier->ptb_magic != _PT_BARRIER_MAGIC)
-		return EINVAL;
+	pthread__error(EINVAL, "Invalid barrier",
+	barrier->ptb_magic == _PT_BARRIER_MAGIC);
 
 	/*
 	 * A single arbitrary thread is supposed to return
@@ -123,6 +126,9 @@ pthread_barrierattr_getpshared(const pth
 int * __restrict pshared)
 {
 
+	pthread__error(EINVAL, "Invalid barrier attribute",
+	attr->ptba_magic == _PT_BARRIERATTR_MAGIC);
+
 	*pshared = PTHREAD_PROCESS_PRIVATE;
 	return 0;
 }
@@ -131,6 +137,9 @@ int
 pthread_barrierattr_setpshared(pthread_barrierattr_t *attr, int pshared)
 {
 
+	pthread__error(EINVAL, "Invalid barrier attribute",
+	attr->ptba_magic == _PT_BARRIERATTR_MAGIC);
+
 	switch(pshared) {
 	case PTHREAD_PROCESS_PRIVATE:
 		return 0;
@@ -153,8 +162,8 @@ int
 pthread_barrierattr_destroy(pthread_barrierattr_t *attr)
 {
 
-	if (attr->ptba_magic != _PT_BARRIERATTR_MAGIC)
-		return EINVAL;
+	pthread__error(EINVAL, "Invalid barrier attribute",
+	attr->ptba_magic == _PT_BARRIERATTR_MAGIC);
 	attr->ptba_magic = _PT_BARRIERATTR_DEAD;
 	return 0;
 }



CVS commit: src/sys/dev/ic

2020-01-29 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 14:18:54 UTC 2020

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

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.200 -r1.201 src/sys/dev/ic/tulip.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/tulip.c
diff -u src/sys/dev/ic/tulip.c:1.200 src/sys/dev/ic/tulip.c:1.201
--- src/sys/dev/ic/tulip.c:1.200	Sun Nov 10 21:16:35 2019
+++ src/sys/dev/ic/tulip.c	Wed Jan 29 14:18:54 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: tulip.c,v 1.200 2019/11/10 21:16:35 chs Exp $	*/
+/*	$NetBSD: tulip.c,v 1.201 2020/01/29 14:18:54 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2002 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tulip.c,v 1.200 2019/11/10 21:16:35 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tulip.c,v 1.201 2020/01/29 14:18:54 thorpej Exp $");
 
 
 #include 
@@ -940,10 +940,10 @@ tlp_watchdog(struct ifnet *ifp)
 	if (doing_setup && doing_transmit) {
 		printf("%s: filter setup and transmit timeout\n",
 		device_xname(sc->sc_dev));
-		ifp->if_oerrors++;
+		if_statinc(ifp, if_oerrors);
 	} else if (doing_transmit) {
 		printf("%s: transmit timeout\n", device_xname(sc->sc_dev));
-		ifp->if_oerrors++;
+		if_statinc(ifp, if_oerrors);
 	} else if (doing_setup)
 		printf("%s: filter setup timeout\n", device_xname(sc->sc_dev));
 	else
@@ -1251,7 +1251,7 @@ tlp_rxintr(struct tulip_softc *sc)
 		 * If any collisions were seen on the wire, count one.
 		 */
 		if (rxstat & TDSTAT_Rx_CS)
-			ifp->if_collisions++;
+			if_statinc(ifp, if_collisions);
 
 		/*
 		 * If an error occurred, update stats, clear the status
@@ -1279,7 +1279,7 @@ tlp_rxintr(struct tulip_softc *sc)
 			if (rxstat & (bit))\
 aprint_error_dev(sc->sc_dev,		\
 "receive error: %s\n", str)
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			PRINTERR(TDSTAT_Rx_DE, "descriptor error");
 			PRINTERR(TDSTAT_Rx_RF, "runt frame");
 			PRINTERR(TDSTAT_Rx_TL, "frame too long");
@@ -1308,7 +1308,7 @@ tlp_rxintr(struct tulip_softc *sc)
 		 */
 		m = rxs->rxs_mbuf;
 		if (tlp_add_rxbuf(sc, i) != 0) {
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			TULIP_INIT_RXDESC(sc, i);
 			bus_dmamap_sync(sc->sc_dmat, rxs->rxs_dmamap, 0,
 			rxs->rxs_dmamap->dm_mapsize, BUS_DMASYNC_PREREAD);
@@ -1324,7 +1324,7 @@ tlp_rxintr(struct tulip_softc *sc)
 		MGETHDR(m, M_DONTWAIT, MT_DATA);
 		if (m == NULL) {
  dropit:
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			TULIP_INIT_RXDESC(sc, i);
 			bus_dmamap_sync(sc->sc_dmat, rxs->rxs_dmamap, 0,
 			rxs->rxs_dmamap->dm_mapsize, BUS_DMASYNC_PREREAD);
@@ -1491,18 +1491,20 @@ tlp_txintr(struct tulip_softc *sc)
 		if (txstat & TDSTAT_Tx_LC)
 			sc->sc_stats.ts_tx_lc++;
 #endif
-
+		net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
 		if (txstat & (TDSTAT_Tx_UF | TDSTAT_Tx_TO))
-			ifp->if_oerrors++;
+			if_statinc_ref(nsr, if_oerrors);
 
 		if (txstat & TDSTAT_Tx_EC)
-			ifp->if_collisions += 16;
+			if_statadd_ref(nsr, if_collisions, 16);
 		else
-			ifp->if_collisions += TDSTAT_Tx_COLLISIONS(txstat);
+			if_statadd_ref(nsr, if_collisions,
+			TDSTAT_Tx_COLLISIONS(txstat));
 		if (txstat & TDSTAT_Tx_LC)
-			ifp->if_collisions++;
+			if_statinc_ref(nsr, if_collisions);
 
-		ifp->if_opackets++;
+		if_statinc_ref(nsr, if_opackets);
+		IF_STAT_PUTREF(ifp);
 	}
 
 	/*



CVS commit: src/sys/dev/ic

2020-01-29 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 14:17:27 UTC 2020

Modified Files:
src/sys/dev/ic: elink3.c elinkxl.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.149 -r1.150 src/sys/dev/ic/elink3.c
cvs rdiff -u -r1.133 -r1.134 src/sys/dev/ic/elinkxl.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/elink3.c
diff -u src/sys/dev/ic/elink3.c:1.149 src/sys/dev/ic/elink3.c:1.150
--- src/sys/dev/ic/elink3.c:1.149	Wed May 29 06:17:28 2019
+++ src/sys/dev/ic/elink3.c	Wed Jan 29 14:17:27 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: elink3.c,v 1.149 2019/05/29 06:17:28 msaitoh Exp $	*/
+/*	$NetBSD: elink3.c,v 1.150 2020/01/29 14:17:27 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: elink3.c,v 1.149 2019/05/29 06:17:28 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: elink3.c,v 1.150 2020/01/29 14:17:27 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -1123,7 +1123,7 @@ startagain:
 	 */
 	if (len + pad > ETHER_MAX_LEN) {
 		/* packet is obviously too large: toss it */
-		++ifp->if_oerrors;
+		if_statinc(ifp, if_oerrors);
 		IFQ_DEQUEUE(>if_snd, m0);
 		m_freem(m0);
 		goto readcheck;
@@ -1229,7 +1229,7 @@ startagain:
 
 	splx(sh);
 
-	++ifp->if_opackets;
+	if_statinc(ifp, if_opackets);
 
 readcheck:
 	if ((bus_space_read_2(iot, ioh, ep_w1_reg(sc, ELINK_W1_RX_STATUS)) &
@@ -1318,6 +1318,7 @@ eptxstat(struct ep_softc *sc)
 {
 	bus_space_tag_t iot = sc->sc_iot;
 	bus_space_handle_t ioh = sc->sc_ioh;
+	struct ifnet *ifp = >sc_ethercom.ec_if;
 	int i;
 
 	/*
@@ -1330,13 +1331,13 @@ eptxstat(struct ep_softc *sc)
 		0x0);
 
 		if (i & TXS_JABBER) {
-			++sc->sc_ethercom.ec_if.if_oerrors;
+			if_statinc(ifp, if_oerrors);
 			if (sc->sc_ethercom.ec_if.if_flags & IFF_DEBUG)
 printf("%s: jabber (%x)\n",
    device_xname(sc->sc_dev), i);
 			epreset(sc);
 		} else if (i & TXS_UNDERRUN) {
-			++sc->sc_ethercom.ec_if.if_oerrors;
+			if_statinc(ifp, if_oerrors);
 			if (sc->sc_ethercom.ec_if.if_flags & IFF_DEBUG)
 printf("%s: fifo underrun (%x) @%d\n",
    device_xname(sc->sc_dev), i,
@@ -1347,7 +1348,7 @@ eptxstat(struct ep_softc *sc)
 			sc->tx_succ_ok = 0;
 			epreset(sc);
 		} else if (i & TXS_MAX_COLLISION) {
-			++sc->sc_ethercom.ec_if.if_collisions;
+			if_statinc(ifp, if_collisions);
 			bus_space_write_2(iot, ioh, ELINK_COMMAND, TX_ENABLE);
 			sc->sc_ethercom.ec_if.if_flags &= ~IFF_OACTIVE;
 		} else
@@ -1472,7 +1473,7 @@ again:
 		return;
 
 	if (len & ERR_RX) {
-		++ifp->if_ierrors;
+		if_statinc(ifp, if_ierrors);
 		goto abort;
 	}
 
@@ -1481,7 +1482,7 @@ again:
 	/* Pull packet off interface. */
 	m = epget(sc, len);
 	if (m == 0) {
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		goto abort;
 	}
 
@@ -1713,7 +1714,7 @@ epwatchdog(struct ifnet *ifp)
 	struct ep_softc *sc = ifp->if_softc;
 
 	log(LOG_ERR, "%s: device timeout\n", device_xname(sc->sc_dev));
-	++sc->sc_ethercom.ec_if.if_oerrors;
+	if_statinc(ifp, if_oerrors);
 
 	epreset(sc);
 }

Index: src/sys/dev/ic/elinkxl.c
diff -u src/sys/dev/ic/elinkxl.c:1.133 src/sys/dev/ic/elinkxl.c:1.134
--- src/sys/dev/ic/elinkxl.c:1.133	Wed Oct 30 07:26:28 2019
+++ src/sys/dev/ic/elinkxl.c	Wed Jan 29 14:17:27 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: elinkxl.c,v 1.133 2019/10/30 07:26:28 msaitoh Exp $	*/
+/*	$NetBSD: elinkxl.c,v 1.134 2020/01/29 14:17:27 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: elinkxl.c,v 1.133 2019/10/30 07:26:28 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: elinkxl.c,v 1.134 2020/01/29 14:17:27 thorpej Exp $");
 
 #include 
 #include 
@@ -86,7 +86,6 @@ void ex_read(struct ex_softc *);
 void ex_reset(struct ex_softc *);
 void ex_set_mc(struct ex_softc *);
 void ex_getstats(struct ex_softc *);
-void ex_printstats(struct ex_softc *);
 void ex_tick(void *);
 
 static int ex_eeprom_busy(struct ex_softc *);
@@ -814,7 +813,7 @@ ex_txstat(struct ex_softc *sc)
 		/* Resetting takes a while and we will do more than wait. */
 
 		ifp->if_flags &= ~IFF_OACTIVE;
-		++sc->sc_ethercom.ec_if.if_oerrors;
+		if_statinc(ifp, if_oerrors);
 		aprint_error_dev(sc->sc_dev, "%s%s%s",
 		(err & TXS_UNDERRUN) ? " transmit underrun" : "",
 		(err & TXS_JABBER) ? " jabber" : "",
@@ -834,7 +833,7 @@ ex_txstat(struct ex_softc *sc)
 		}
 		aprint_error("\n");
 		if (err & TXS_MAX_COLLISION)
-			++sc->sc_ethercom.ec_if.if_collisions;
+			if_statinc(ifp, if_collisions);
 
 		/* Wait for TX_RESET to finish. */
 		ex_waitcmd(sc);
@@ -843,7 +842,7 @@ ex_txstat(struct ex_softc *sc)
 		ex_setup_tx(sc);
 	} else {
 		if (err & TXS_MAX_COLLISION)
-			++sc->sc_ethercom.ec_if.if_collisions;
+			if_statinc(ifp, if_collisions);
 		sc->sc_ethercom.ec_if.if_flags &= ~IFF_OACTIVE;
 	}
 
@@ -1367,7 +1366,7 @@ ex_intr(void 

CVS commit: src/sys/dev/ic

2020-01-29 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 14:14:56 UTC 2020

Modified Files:
src/sys/dev/ic: bwfm.c bwi.c cs89x0.c dm9000.c dp8390.c dp83932.c
dwc_gmac.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/ic/bwfm.c
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/ic/bwi.c
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/ic/cs89x0.c
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/ic/dm9000.c
cvs rdiff -u -r1.95 -r1.96 src/sys/dev/ic/dp8390.c
cvs rdiff -u -r1.44 -r1.45 src/sys/dev/ic/dp83932.c
cvs rdiff -u -r1.68 -r1.69 src/sys/dev/ic/dwc_gmac.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/bwfm.c
diff -u src/sys/dev/ic/bwfm.c:1.19 src/sys/dev/ic/bwfm.c:1.20
--- src/sys/dev/ic/bwfm.c:1.19	Fri Dec 27 09:22:20 2019
+++ src/sys/dev/ic/bwfm.c	Wed Jan 29 14:14:55 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: bwfm.c,v 1.19 2019/12/27 09:22:20 msaitoh Exp $ */
+/* $NetBSD: bwfm.c,v 1.20 2020/01/29 14:14:55 thorpej Exp $ */
 /* $OpenBSD: bwfm.c,v 1.5 2017/10/16 22:27:16 patrick Exp $ */
 /*
  * Copyright (c) 2010-2016 Broadcom Corporation
@@ -329,7 +329,7 @@ bwfm_start(struct ifnet *ifp)
 			break;
 		}
 		if (error != 0) {
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			m_freem(m);
 			continue;
 		}
@@ -511,7 +511,7 @@ bwfm_watchdog(struct ifnet *ifp)
 	if (sc->sc_tx_timer > 0) {
 		if (--sc->sc_tx_timer == 0) {
 			printf("%s: device timeout\n", DEVNAME(sc));
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			return;
 		}
 		ifp->if_timer = 1;

Index: src/sys/dev/ic/bwi.c
diff -u src/sys/dev/ic/bwi.c:1.36 src/sys/dev/ic/bwi.c:1.37
--- src/sys/dev/ic/bwi.c:1.36	Sat Dec 22 14:07:53 2018
+++ src/sys/dev/ic/bwi.c	Wed Jan 29 14:14:55 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: bwi.c,v 1.36 2018/12/22 14:07:53 maxv Exp $	*/
+/*	$NetBSD: bwi.c,v 1.37 2020/01/29 14:14:55 thorpej Exp $	*/
 /*	$OpenBSD: bwi.c,v 1.74 2008/02/25 21:13:30 mglocker Exp $	*/
 
 /*
@@ -48,7 +48,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bwi.c,v 1.36 2018/12/22 14:07:53 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bwi.c,v 1.37 2020/01/29 14:14:55 thorpej Exp $");
 
 #include 
 #include 
@@ -7420,7 +7420,7 @@ bwi_start(struct ifnet *ifp)
 			if (m->m_len < sizeof(*eh)) {
 m = m_pullup(m, sizeof(*eh));
 if (m == NULL) {
-	ifp->if_oerrors++;
+	if_statinc(ifp, if_oerrors);
 	continue;
 }
 			}
@@ -7428,7 +7428,7 @@ bwi_start(struct ifnet *ifp)
 
 			ni = ieee80211_find_txnode(ic, eh->ether_dhost);
 			if (ni == NULL) {
-ifp->if_oerrors++;
+if_statinc(ifp, if_oerrors);
 m_freem(m);
 continue;
 			}
@@ -7450,7 +7450,7 @@ bwi_start(struct ifnet *ifp)
 DPRINTF(sc, BWI_DBG_MISC,
 "%s: discard, classification failure\n",
 __func__);
-ifp->if_oerrors++;
+if_statinc(ifp, if_oerrors);
 m_freem(m);
 ieee80211_free_node(ni);
 continue;
@@ -7458,7 +7458,7 @@ bwi_start(struct ifnet *ifp)
 
 			/* [TRC: XXX wi(4) and awi(4) do this; iwi(4)
 			   doesn't.] */
-			ifp->if_opackets++;
+			if_statinc(ifp, if_opackets);
 
 			/* [TRC: XXX When should the packet be
 			   filtered?  Different drivers appear to do it
@@ -7467,7 +7467,7 @@ bwi_start(struct ifnet *ifp)
 			bpf_mtap(ifp, m, BPF_D_OUT);
 			m = ieee80211_encap(ic, m, ni);
 			if (m == NULL) {
-ifp->if_oerrors++;
+if_statinc(ifp, if_oerrors);
 ieee80211_free_node(ni);
 continue;
 			}
@@ -7478,7 +7478,7 @@ bwi_start(struct ifnet *ifp)
 		/* [TRC: XXX What about ic->ic_flags & IEEE80211_F_PRIVACY?] */
 		if (wh->i_fc[1] & IEEE80211_FC1_WEP) {
 			if (ieee80211_crypto_encap(ic, ni, m) == NULL) {
-ifp->if_oerrors++;
+if_statinc(ifp, if_oerrors);
 m_freem(m);
 ieee80211_free_node(ni);
 continue;
@@ -7488,7 +7488,7 @@ bwi_start(struct ifnet *ifp)
 
 		if (bwi_encap(sc, idx, m, , mgt_pkt) != 0) {
 			/* 'm' is freed in bwi_encap() if we reach here */
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			if (ni != NULL)
 ieee80211_free_node(ni);
 			continue;
@@ -7524,7 +7524,7 @@ bwi_watchdog(struct ifnet *ifp)
 	if (sc->sc_tx_timer) {
 		if (--sc->sc_tx_timer == 0) {
 			aprint_error_dev(sc->sc_dev, "device timeout\n");
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			/* TODO */
 			/* [TRC: XXX TODO what?  Stop the device?
 			   Bring it down?  iwi(4) does this.] */
@@ -8475,7 +8475,7 @@ bwi_rxeof(struct bwi_softc *sc, int end_
 		rb->rb_dmap->dm_mapsize, BUS_DMASYNC_POSTREAD);
 
 		if (bwi_newbuf(sc, idx, 0)) {
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			goto next;
 		}
 
@@ -8491,7 +8491,7 @@ bwi_rxeof(struct bwi_softc *sc, int end_
 		if (buflen < BWI_FRAME_MIN_LEN(wh_ofs)) {
 			aprint_error_dev(sc->sc_dev, "short frame %d,"
 			" hdr_extra %d\n", buflen, hdr_extra);
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			m_freem(m);
 			goto next;
 		}
@@ -9395,7 +9395,7 

CVS commit: src/sys/dev/ic

2020-01-29 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 14:09:58 UTC 2020

Modified Files:
src/sys/dev/ic: aic6915.c an.c arn5008.c arn9003.c ath.c athn.c atw.c
awi.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/ic/aic6915.c
cvs rdiff -u -r1.72 -r1.73 src/sys/dev/ic/an.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/ic/arn5008.c
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/ic/arn9003.c
cvs rdiff -u -r1.129 -r1.130 src/sys/dev/ic/ath.c
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/ic/athn.c
cvs rdiff -u -r1.169 -r1.170 src/sys/dev/ic/atw.c
cvs rdiff -u -r1.99 -r1.100 src/sys/dev/ic/awi.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/aic6915.c
diff -u src/sys/dev/ic/aic6915.c:1.40 src/sys/dev/ic/aic6915.c:1.41
--- src/sys/dev/ic/aic6915.c:1.40	Wed Oct 30 07:26:28 2019
+++ src/sys/dev/ic/aic6915.c	Wed Jan 29 14:09:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: aic6915.c,v 1.40 2019/10/30 07:26:28 msaitoh Exp $	*/
+/*	$NetBSD: aic6915.c,v 1.41 2020/01/29 14:09:58 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aic6915.c,v 1.40 2019/10/30 07:26:28 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aic6915.c,v 1.41 2020/01/29 14:09:58 thorpej Exp $");
 
 
 #include 
@@ -502,7 +502,7 @@ sf_watchdog(struct ifnet *ifp)
 	struct sf_softc *sc = ifp->if_softc;
 
 	printf("%s: device timeout\n", device_xname(sc->sc_dev));
-	ifp->if_oerrors++;
+	if_statinc(ifp, if_oerrors);
 
 	(void) sf_init(ifp);
 
@@ -746,7 +746,7 @@ sf_rxintr(struct sf_softc *sc)
 		 */
 		m = ds->ds_mbuf;
 		if (sf_add_rxbuf(sc, rxidx) != 0) {
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			SF_INIT_RXDESC(sc, rxidx);
 			bus_dmamap_sync(sc->sc_dmat, ds->ds_dmamap, 0,
 			ds->ds_dmamap->dm_mapsize, BUS_DMASYNC_PREREAD);
@@ -762,7 +762,7 @@ sf_rxintr(struct sf_softc *sc)
 		MGETHDR(m, M_DONTWAIT, MT_DATA);
 		if (m == NULL) {
  dropit:
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			SF_INIT_RXDESC(sc, rxidx);
 			bus_dmamap_sync(sc->sc_dmat, ds->ds_dmamap, 0,
 			ds->ds_dmamap->dm_mapsize, BUS_DMASYNC_PREREAD);
@@ -846,19 +846,26 @@ sf_stats_update(struct sf_softc *sc)
 		sf_genreg_write(sc, SF_STATS_BASE + (i * sizeof(uint32_t)), 0);
 	}
 
-	ifp->if_opackets += stats.TransmitOKFrames;
+	net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
 
-	ifp->if_collisions += stats.SingleCollisionFrames +
-	stats.MultipleCollisionFrames;
+	if_statadd_ref(nsr, if_opackets, stats.TransmitOKFrames);
 
-	ifp->if_oerrors += stats.TransmitAbortDueToExcessiveCollisions +
+	if_statadd_ref(nsr, if_collisions,
+	stats.SingleCollisionFrames +
+	stats.MultipleCollisionFrames);
+
+	if_statadd_ref(nsr, if_oerrors,
+	stats.TransmitAbortDueToExcessiveCollisions +
 	stats.TransmitAbortDueToExcessingDeferral +
-	stats.FramesLostDueToInternalTransmitErrors;
+	stats.FramesLostDueToInternalTransmitErrors);
 
-	ifp->if_ierrors += stats.ReceiveCRCErrors + stats.AlignmentErrors +
+	if_statadd_ref(nsr, if_ierrors,
+	stats.ReceiveCRCErrors + stats.AlignmentErrors +
 	stats.ReceiveFramesTooLong + stats.ReceiveFramesTooShort +
 	stats.ReceiveFramesJabbersError +
-	stats.FramesLostDueToInternalReceiveErrors;
+	stats.FramesLostDueToInternalReceiveErrors);
+
+	IF_STAT_PUTREF(ifp);
 }
 
 /*

Index: src/sys/dev/ic/an.c
diff -u src/sys/dev/ic/an.c:1.72 src/sys/dev/ic/an.c:1.73
--- src/sys/dev/ic/an.c:1.72	Mon Sep 23 17:37:04 2019
+++ src/sys/dev/ic/an.c	Wed Jan 29 14:09:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: an.c,v 1.72 2019/09/23 17:37:04 maxv Exp $	*/
+/*	$NetBSD: an.c,v 1.73 2020/01/29 14:09:58 thorpej Exp $	*/
 /*
  * Copyright (c) 1997, 1998, 1999
  *	Bill Paul .  All rights reserved.
@@ -77,7 +77,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: an.c,v 1.72 2019/09/23 17:37:04 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: an.c,v 1.73 2020/01/29 14:09:58 thorpej Exp $");
 
 
 #include 
@@ -755,7 +755,7 @@ an_start(struct ifnet *ifp)
 			break;
 		}
 		IFQ_DEQUEUE(>if_snd, m);
-		ifp->if_opackets++;
+		if_statinc(ifp, if_opackets);
 		bpf_mtap(ifp, m, BPF_D_OUT);
 		eh = mtod(m, struct ether_header *);
 		ni = ieee80211_find_txnode(ic, eh->ether_dhost);
@@ -853,7 +853,7 @@ an_start(struct ifnet *ifp)
 		sc->sc_txnext = cur;
 		continue;
 bad:
-		ifp->if_oerrors++;
+		if_statinc(ifp, if_oerrors);
 		m_freem(m);
 	}
 }
@@ -891,7 +891,7 @@ an_watchdog(struct ifnet *ifp)
 	if (sc->sc_tx_timer) {
 		if (--sc->sc_tx_timer == 0) {
 			printf("%s: device timeout\n", ifp->if_xname);
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			an_init(ifp);
 			return;
 		}
@@ -1390,7 +1390,7 @@ an_rx_intr(struct an_softc *sc)
 	/* First read in the frame header */
 	if (an_read_bap(sc, fid, 0, , sizeof(frmhdr)) != 0) {
 		CSR_WRITE_2(sc, AN_EVENT_ACK, AN_EV_RX);
-		ifp->if_ierrors++;
+		

CVS commit: src/sys/dev/pcmcia

2020-01-29 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 13:54:42 UTC 2020

Modified Files:
src/sys/dev/pcmcia: if_cnw.c if_malo_pcmcia.c if_ray.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/dev/pcmcia/if_cnw.c
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/pcmcia/if_malo_pcmcia.c
cvs rdiff -u -r1.96 -r1.97 src/sys/dev/pcmcia/if_ray.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/pcmcia/if_cnw.c
diff -u src/sys/dev/pcmcia/if_cnw.c:1.67 src/sys/dev/pcmcia/if_cnw.c:1.68
--- src/sys/dev/pcmcia/if_cnw.c:1.67	Fri Dec  6 07:12:39 2019
+++ src/sys/dev/pcmcia/if_cnw.c	Wed Jan 29 13:54:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_cnw.c,v 1.67 2019/12/06 07:12:39 maxv Exp $	*/
+/*	$NetBSD: if_cnw.c,v 1.68 2020/01/29 13:54:41 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@@ -105,7 +105,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_cnw.c,v 1.67 2019/12/06 07:12:39 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cnw.c,v 1.68 2020/01/29 13:54:41 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -668,7 +668,7 @@ cnw_start(struct ifnet *ifp)
 		bpf_mtap(ifp, m0, BPF_D_OUT);
 
 		cnw_transmit(sc, m0);
-		++ifp->if_opackets;
+		if_statinc(ifp, if_opackets);
 		ifp->if_timer = 3; /* start watchdog timer */
 
 		microtime(>sc_txlast);
@@ -844,7 +844,7 @@ cnw_recv(struct cnw_softc *sc)
 
 		/* Did we manage to get the packet from the interface? */
 		if (m == 0) {
-			++ifp->if_ierrors;
+			if_statinc(ifp, if_ierrors);
 			return;
 		}
 
@@ -957,7 +957,7 @@ cnw_intr(void *arg)
 			}
 
 			if (tser & CNW_TSER_ERROR) {
-++ifp->if_oerrors;
+if_statinc(ifp, if_oerrors);
 WAIT_WOC(sc);
 bus_space_write_1(sc->sc_memt, sc->sc_memh,
 sc->sc_memoff + CNW_EREG_TSERW,
@@ -1120,7 +1120,7 @@ cnw_watchdog(struct ifnet *ifp)
 	struct cnw_softc *sc = ifp->if_softc;
 
 	printf("%s: device timeout; card reset\n", device_xname(sc->sc_dev));
-	++ifp->if_oerrors;
+	if_statinc(ifp, if_oerrors);
 	cnw_init(sc);
 }
 

Index: src/sys/dev/pcmcia/if_malo_pcmcia.c
diff -u src/sys/dev/pcmcia/if_malo_pcmcia.c:1.24 src/sys/dev/pcmcia/if_malo_pcmcia.c:1.25
--- src/sys/dev/pcmcia/if_malo_pcmcia.c:1.24	Sun Nov 10 21:16:36 2019
+++ src/sys/dev/pcmcia/if_malo_pcmcia.c	Wed Jan 29 13:54:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_malo_pcmcia.c,v 1.24 2019/11/10 21:16:36 chs Exp $	*/
+/*	$NetBSD: if_malo_pcmcia.c,v 1.25 2020/01/29 13:54:41 thorpej Exp $	*/
 /*  $OpenBSD: if_malo.c,v 1.65 2009/03/29 21:53:53 sthen Exp $ */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_malo_pcmcia.c,v 1.24 2019/11/10 21:16:36 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_malo_pcmcia.c,v 1.25 2020/01/29 13:54:41 thorpej Exp $");
 
 #ifdef _MODULE
 #include 
@@ -525,7 +525,7 @@ cmalo_start(struct ifnet *ifp)
 	bpf_mtap(ifp, m, BPF_D_OUT);
 
 	if (cmalo_tx(sc, m) != 0)
-		ifp->if_oerrors++;
+		if_statinc(ifp, if_oerrors);
 }
 
 static int
@@ -1046,7 +1046,7 @@ cmalo_rx(struct malo_softc *sc)
 	rxdesc->pkglen, ETHER_ALIGN, ifp);
 	if (m == NULL) {
 		DPRINTF(1, "RX m_devget failed\n");
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 
@@ -1110,7 +1110,7 @@ cmalo_tx_done(struct malo_softc *sc)
 	DPRINTF(2, "%s: TX done\n", device_xname(sc->sc_dev));
 
 	s = splnet();
-	ifp->if_opackets++;
+	if_statinc(ifp, if_opackets);
 	ifp->if_flags &= ~IFF_OACTIVE;
 	ifp->if_timer = 0;
 	cmalo_start(ifp);

Index: src/sys/dev/pcmcia/if_ray.c
diff -u src/sys/dev/pcmcia/if_ray.c:1.96 src/sys/dev/pcmcia/if_ray.c:1.97
--- src/sys/dev/pcmcia/if_ray.c:1.96	Mon Jan  6 07:15:03 2020
+++ src/sys/dev/pcmcia/if_ray.c	Wed Jan 29 13:54:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ray.c,v 1.96 2020/01/06 07:15:03 msaitoh Exp $	*/
+/*	$NetBSD: if_ray.c,v 1.97 2020/01/29 13:54:41 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2000 Christian E. Hopps
@@ -57,7 +57,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ray.c,v 1.96 2020/01/06 07:15:03 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ray.c,v 1.97 2020/01/29 13:54:41 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -1113,7 +1113,7 @@ ray_intr_start(struct ray_softc *sc)
 			RAY_DPRINTF((
 			"%s: mbuf too long %ld\n", ifp->if_xname,
 			(u_long)pktlen));
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			m_freem(m0);
 			continue;
 		}
@@ -1125,7 +1125,7 @@ ray_intr_start(struct ray_softc *sc)
 		if (!m0) {
 			RAY_DPRINTF(( "%s: couldn\'t pullup ether header\n",
 			ifp->if_xname));
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			continue;
 		}
 		RAY_DPRINTF(("%s: got pulled up mbuf 0x%lx\n", ifp->if_xname,
@@ -1138,7 +1138,7 @@ ray_intr_start(struct ray_softc *sc)
 			/* don't support llc for windows compat operation */
 			if (et <= ETHERMTU) {
 m_freem(m0);
-ifp->if_oerrors++;
+if_statinc(ifp, if_oerrors);
 continue;
 			}
 			tmplen = 

CVS commit: src/lib/libpthread

2020-01-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Jan 29 13:47:31 UTC 2020

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

Log Message:
Use the pta_magic field in pthread attribute

Set PT_ATTR_DEAD on pthread_attr_destroy().
Check pta_magic before using pthread_attr_t in a bunch of other functions.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/lib/libpthread/pthread_attr.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_attr.c
diff -u src/lib/libpthread/pthread_attr.c:1.18 src/lib/libpthread/pthread_attr.c:1.19
--- src/lib/libpthread/pthread_attr.c:1.18	Tue Aug  1 12:31:45 2017
+++ src/lib/libpthread/pthread_attr.c	Wed Jan 29 13:47:31 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_attr.c,v 1.18 2017/08/01 12:31:45 martin Exp $	*/
+/*	$NetBSD: pthread_attr.c,v 1.19 2020/01/29 13:47:31 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002, 2003, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pthread_attr.c,v 1.18 2017/08/01 12:31:45 martin Exp $");
+__RCSID("$NetBSD: pthread_attr.c,v 1.19 2020/01/29 13:47:31 kamil Exp $");
 
 #include 
 #include 
@@ -86,9 +86,14 @@ pthread_attr_destroy(pthread_attr_t *att
 {
 	struct pthread_attr_private *p;
 
+	pthread__error(EINVAL, "Invalid attribute",
+	attr->pta_magic == PT_ATTR_MAGIC);
+
 	if ((p = attr->pta_private) != NULL)
 		free(p);
 
+	attr->pta_magic = PT_ATTR_DEAD;
+
 	return 0;
 }
 
@@ -98,6 +103,9 @@ pthread_attr_get_np(pthread_t thread, pt
 {
 	struct pthread_attr_private *p;
 
+	pthread__error(EINVAL, "Invalid attribute",
+	attr->pta_magic == PT_ATTR_MAGIC);
+
 	p = pthread__attr_init_private(attr);
 	if (p == NULL)
 		return ENOMEM;
@@ -117,6 +125,9 @@ int
 pthread_attr_getdetachstate(const pthread_attr_t *attr, int *detachstate)
 {
 
+	pthread__error(EINVAL, "Invalid attribute",
+	attr->pta_magic == PT_ATTR_MAGIC);
+
 	if (attr->pta_flags & PT_FLAG_DETACHED)
 		*detachstate = PTHREAD_CREATE_DETACHED;
 	else
@@ -130,6 +141,9 @@ int
 pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate)
 {
 
+	pthread__error(EINVAL, "Invalid attribute",
+	attr->pta_magic == PT_ATTR_MAGIC);
+
 	switch (detachstate) {
 	case PTHREAD_CREATE_JOINABLE:
 		attr->pta_flags &= ~PT_FLAG_DETACHED;
@@ -150,6 +164,9 @@ pthread_attr_getguardsize(const pthread_
 {
 	struct pthread_attr_private *p;
 
+	pthread__error(EINVAL, "Invalid attribute",
+	attr->pta_magic == PT_ATTR_MAGIC);
+
 	if ((p = attr->pta_private) == NULL)
 		*guard = pthread__guardsize;
 	else
@@ -164,6 +181,9 @@ pthread_attr_setguardsize(pthread_attr_t
 {
 	struct pthread_attr_private *p;
 
+	pthread__error(EINVAL, "Invalid attribute",
+	attr->pta_magic == PT_ATTR_MAGIC);
+
 	p = pthread__attr_init_private(attr);
 	if (p == NULL)
 		return ENOMEM;
@@ -178,6 +198,9 @@ int
 pthread_attr_getinheritsched(const pthread_attr_t *attr, int *inherit)
 {
 
+	pthread__error(EINVAL, "Invalid attribute",
+	attr->pta_magic == PT_ATTR_MAGIC);
+
 	if (attr->pta_flags & PT_FLAG_EXPLICIT_SCHED)
 		*inherit = PTHREAD_EXPLICIT_SCHED;
 	else
@@ -191,6 +214,9 @@ int
 pthread_attr_setinheritsched(pthread_attr_t *attr, int inherit)
 {
 
+	pthread__error(EINVAL, "Invalid attribute",
+	attr->pta_magic == PT_ATTR_MAGIC);
+
 	switch (inherit) {
 	case PTHREAD_INHERIT_SCHED:
 		attr->pta_flags &= ~PT_FLAG_EXPLICIT_SCHED;
@@ -210,6 +236,9 @@ int
 pthread_attr_getscope(const pthread_attr_t *attr, int *scope)
 {
 
+	pthread__error(EINVAL, "Invalid attribute",
+	attr->pta_magic == PT_ATTR_MAGIC);
+
 	if (attr->pta_flags & PT_FLAG_SCOPE_SYSTEM)
 		*scope = PTHREAD_SCOPE_SYSTEM;
 	else
@@ -223,6 +252,9 @@ int
 pthread_attr_setscope(pthread_attr_t *attr, int scope)
 {
 
+	pthread__error(EINVAL, "Invalid attribute",
+	attr->pta_magic == PT_ATTR_MAGIC);
+
 	switch (scope) {
 	case PTHREAD_SCOPE_PROCESS:
 		attr->pta_flags &= ~PT_FLAG_SCOPE_SYSTEM;
@@ -245,6 +277,9 @@ pthread_attr_setschedparam(pthread_attr_
 	struct pthread_attr_private *p;
 	int error;
 
+	pthread__error(EINVAL, "Invalid attribute",
+	attr->pta_magic == PT_ATTR_MAGIC);
+
 	if (param == NULL)
 		return EINVAL;
 	p = pthread__attr_init_private(attr);
@@ -263,6 +298,9 @@ pthread_attr_getschedparam(const pthread
 {
 	struct pthread_attr_private *p;
 
+	pthread__error(EINVAL, "Invalid attribute",
+	attr->pta_magic == PT_ATTR_MAGIC);
+
 	if (param == NULL)
 		return EINVAL;
 	p = attr->pta_private;
@@ -279,6 +317,8 @@ pthread_attr_setschedpolicy(pthread_attr
 {
 	struct pthread_attr_private *p;
 
+	pthread__error(EINVAL, "Invalid attribute",
+	attr->pta_magic == PT_ATTR_MAGIC);
 
 	switch (policy) {
 	case SCHED_OTHER:
@@ -300,6 +340,9 @@ pthread_attr_getschedpolicy(const pthrea
 {
 	struct pthread_attr_private *p;
 
+	pthread__error(EINVAL, "Invalid attribute",
+	attr->pta_magic == PT_ATTR_MAGIC);
+
 	p = attr->pta_private;
 	if (p 

CVS commit: src/tests/lib/libpthread

2020-01-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Jan 29 13:40:23 UTC 2020

Modified Files:
src/tests/lib/libpthread: t_join.c

Log Message:
Fix the t_join test

For pthread_attr_get_np() attr should be initialized prior to the call by
using pthread_attr_init(3). pthread_getattr_np() does this
automatically so switch to it.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/tests/lib/libpthread/t_join.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/libpthread/t_join.c
diff -u src/tests/lib/libpthread/t_join.c:1.9 src/tests/lib/libpthread/t_join.c:1.10
--- src/tests/lib/libpthread/t_join.c:1.9	Sun Jul  2 16:41:33 2017
+++ src/tests/lib/libpthread/t_join.c	Wed Jan 29 13:40:23 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: t_join.c,v 1.9 2017/07/02 16:41:33 joerg Exp $ */
+/* $NetBSD: t_join.c,v 1.10 2020/01/29 13:40:23 kamil Exp $ */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: t_join.c,v 1.9 2017/07/02 16:41:33 joerg Exp $");
+__RCSID("$NetBSD: t_join.c,v 1.10 2020/01/29 13:40:23 kamil Exp $");
 
 #include 
 #include 
@@ -153,7 +153,7 @@ threadfunc2(void *arg)
 
 	j = (uintptr_t)arg;
 
-	ATF_REQUIRE(pthread_attr_get_np(pthread_self(), ) == 0);
+	ATF_REQUIRE(pthread_getattr_np(pthread_self(), ) == 0);
 	ATF_REQUIRE(pthread_attr_getstacksize(, ) == 0);
 	ATF_REQUIRE(stacksize == STACKSIZE * (j + 1));
 	ATF_REQUIRE(pthread_attr_getguardsize(, ) == 0);



CVS commit: src/external/bsd/wpa/dist/src/drivers

2020-01-29 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Jan 29 12:05:08 UTC 2020

Modified Files:
src/external/bsd/wpa/dist/src/drivers: driver_bsd.c

Log Message:
wpa: reduce diff with upstream


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/external/bsd/wpa/dist/src/drivers/driver_bsd.c

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

Modified files:

Index: src/external/bsd/wpa/dist/src/drivers/driver_bsd.c
diff -u src/external/bsd/wpa/dist/src/drivers/driver_bsd.c:1.35 src/external/bsd/wpa/dist/src/drivers/driver_bsd.c:1.36
--- src/external/bsd/wpa/dist/src/drivers/driver_bsd.c:1.35	Wed Jan 29 11:57:36 2020
+++ src/external/bsd/wpa/dist/src/drivers/driver_bsd.c	Wed Jan 29 12:05:08 2020
@@ -9,11 +9,12 @@
 
 #include "includes.h"
 #include 
-#include 
 
 #include "common.h"
 #include "driver.h"
 #include "eloop.h"
+#include "common/ieee802_11_defs.h"
+#include "common/wpa_common.h"
 
 #include 
 #include 
@@ -43,8 +44,6 @@
 #include 
 #endif
 
-#include "common/ieee802_11_defs.h"
-#include "common/wpa_common.h"
 #include "l2_packet/l2_packet.h"
 
 struct bsd_driver_global {
@@ -138,7 +137,7 @@ bsd_get80211(void *priv, struct ieee8021
 	ireq->i_data = arg;
 
 	if (ioctl(drv->global->sock, SIOCG80211, ireq) < 0) {
-		wpa_printf(MSG_ERROR, "ioctl[SIOCS80211, op=%u, "
+		wpa_printf(MSG_ERROR, "ioctl[SIOCG80211, op=%u, "
 			   "arg_len=%u]: %s", op, arg_len, strerror(errno));
 		return -1;
 	}
@@ -1570,7 +1569,7 @@ bsd_global_init(void *ctx)
 #ifdef RO_MSGFILTER
 	if (setsockopt(global->route, PF_ROUTE, RO_MSGFILTER,
 	, sizeof(msgfilter)) < 0)
-		wpa_printf(MSG_ERROR, "setsockopt[PF_ROUTE,RO_MSGFILTER]: %s",
+		wpa_printf(MSG_ERROR, "socket[PF_ROUTE,RO_MSGFILTER]: %s",
 			   strerror(errno));
 #endif
 



CVS commit: src/external/bsd/wpa/dist/src/drivers

2020-01-29 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Jan 29 11:57:36 UTC 2020

Modified Files:
src/external/bsd/wpa/dist/src/drivers: driver_bsd.c

Log Message:
wpa: Fix the maximum size of a route(4) msg to 2048

This mirrors other programs which parse route(4) messages and will
match upstream.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/external/bsd/wpa/dist/src/drivers/driver_bsd.c

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

Modified files:

Index: src/external/bsd/wpa/dist/src/drivers/driver_bsd.c
diff -u src/external/bsd/wpa/dist/src/drivers/driver_bsd.c:1.34 src/external/bsd/wpa/dist/src/drivers/driver_bsd.c:1.35
--- src/external/bsd/wpa/dist/src/drivers/driver_bsd.c:1.34	Wed Jan 29 11:46:47 2020
+++ src/external/bsd/wpa/dist/src/drivers/driver_bsd.c	Wed Jan 29 11:57:36 2020
@@ -51,7 +51,6 @@ struct bsd_driver_global {
 	void		*ctx;
 	int		sock;			/* socket for 802.11 ioctls */
 	int		route;			/* routing socket for events */
-	struct iovec	event_iov[1];
 	struct dl_list	ifaces;			/* list of interfaces */
 };
 
@@ -75,50 +74,6 @@ struct bsd_driver_data {
 
 /* Generic functions for hostapd and wpa_supplicant */
 
-#define IOVEC_BUFSIZ		256
-ssize_t
-recvmsg_realloc(int fd, struct msghdr *msg, int flags)
-{
-	struct iovec *iov;
-	ssize_t slen;
-	size_t len;
-	void *n;
-
-	/* Assume we are reallocing the last iovec. */
-	iov = >msg_iov[msg->msg_iovlen - 1];
-
-	for (;;) {
-		/* Passing MSG_TRUNC should return the actual size needed. */
-		slen = recvmsg(fd, msg, flags | MSG_PEEK | MSG_TRUNC);
-		if (slen == -1)
-			return -1;
-		if (!(msg->msg_flags & MSG_TRUNC))
-			break;
-
-		len = (size_t)slen;
-
-		/* Some kernels return the size of the receive buffer
-		 * on truncation, not the actual size needed.
-		 * So grow the buffer and try again. */
-		if (iov->iov_len == len)
-			len = roundup(len + 1, IOVEC_BUFSIZ);
-		else if (iov->iov_len > len)
-			break;
-		if ((n = realloc(iov->iov_base, len)) == NULL)
-			return -1;
-		iov->iov_base = n;
-		iov->iov_len = len;
-	}
-
-	slen = recvmsg(fd, msg, flags);
-	if (slen != -1 && msg->msg_flags & MSG_TRUNC) {
-		/* This should not be possible ... */
-		errno = ENOBUFS;
-		return -1;
-	}
-	return slen;
-}
-
 static struct bsd_driver_data *
 bsd_get_drvindex(void *priv, unsigned int ifindex)
 {
@@ -662,6 +617,7 @@ bsd_set_opt_ie(void *priv, const u8 *ie,
 static void
 bsd_wireless_event_receive(int sock, void *ctx, void *sock_ctx)
 {
+	char event_buf[2048]; /* max size of a single route(4) msg */
 	struct bsd_driver_global *global = sock_ctx;
 	struct bsd_driver_data *drv;
 	struct if_announcemsghdr *ifan;
@@ -672,9 +628,8 @@ bsd_wireless_event_receive(int sock, voi
 	struct ieee80211_leave_event *leave;
 	struct ieee80211_join_event *join;
 	int n;
-	struct msghdr msg = { .msg_iov = global->event_iov, .msg_iovlen = 1};
 
-	n = recvmsg_realloc(sock, , 0);
+	n = read(sock, event_buf, sizeof(event_buf));
 	if (n < 0) {
 		if (errno != EINTR && errno != EAGAIN)
 			wpa_printf(MSG_ERROR, "%s read() failed: %s",
@@ -682,7 +637,7 @@ bsd_wireless_event_receive(int sock, voi
 		return;
 	}
 
-	rtm = (struct rt_msghdr *) global->event_iov[0].iov_base;
+	rtm = (struct rt_msghdr *) event_buf;
 	if (rtm->rtm_version != RTM_VERSION) {
 		wpa_printf(MSG_DEBUG, "Invalid routing message version=%d",
 			   rtm->rtm_version);
@@ -1639,7 +1594,6 @@ bsd_global_deinit(void *priv)
 	eloop_unregister_read_sock(global->route);
 	(void) close(global->route);
 	(void) close(global->sock);
-	free(global->event_iov[0].iov_base);
 	os_free(global);
 }
 



CVS commit: src/external/bsd/wpa/dist/src/drivers

2020-01-29 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Jan 29 11:45:54 UTC 2020

Modified Files:
src/external/bsd/wpa/dist/src/drivers: driver_bsd.c

Log Message:
wpa: Don't set or remove IFF_UP

Now that both hostapd and wpa_supplicant react to interface flag
changes, there is no need to set or remove IFF_UP.

It should be an administrative flag only.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/external/bsd/wpa/dist/src/drivers/driver_bsd.c

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

Modified files:

Index: src/external/bsd/wpa/dist/src/drivers/driver_bsd.c
diff -u src/external/bsd/wpa/dist/src/drivers/driver_bsd.c:1.32 src/external/bsd/wpa/dist/src/drivers/driver_bsd.c:1.33
--- src/external/bsd/wpa/dist/src/drivers/driver_bsd.c:1.32	Wed Jan 29 11:44:43 2020
+++ src/external/bsd/wpa/dist/src/drivers/driver_bsd.c	Wed Jan 29 11:45:54 2020
@@ -337,9 +337,8 @@ bsd_send_mlme_param(void *priv, const u8
 }
 
 static int
-bsd_ctrl_iface(void *priv, int enable)
+bsd_get_iface_flags(struct bsd_driver_data *drv)
 {
-	struct bsd_driver_data *drv = priv;
 	struct ifreq ifr;
 
 	os_memset(, 0, sizeof(ifr));
@@ -351,24 +350,6 @@ bsd_ctrl_iface(void *priv, int enable)
 		return -1;
 	}
 	drv->flags = ifr.ifr_flags;
-
-	if (enable) {
-		if (ifr.ifr_flags & IFF_UP)
-			return 0;
-		ifr.ifr_flags |= IFF_UP;
-	} else {
-		if (!(ifr.ifr_flags & IFF_UP))
-			return 0;
-		ifr.ifr_flags &= ~IFF_UP;
-	}
-
-	if (ioctl(drv->global->sock, SIOCSIFFLAGS, ) < 0) {
-		wpa_printf(MSG_ERROR, "ioctl[SIOCSIFFLAGS]: %s",
-			   strerror(errno));
-		return -1;
-	}
-
-	drv->flags = ifr.ifr_flags;
 	return 0;
 }
 
@@ -582,7 +563,7 @@ bsd_set_ieee8021x(void *priv, struct wpa
 			   __func__);
 		return -1;
 	}
-	return bsd_ctrl_iface(priv, 1);
+	return 0;
 }
 
 static void
@@ -980,8 +961,7 @@ bsd_init(struct hostapd_data *hapd, stru
 	if (l2_packet_get_own_addr(drv->sock_xmit, params->own_addr))
 		goto bad;
 
-	/* mark down during setup */
-	if (bsd_ctrl_iface(drv, 0) < 0)
+	if (bsd_get_iface_flags(drv) < 0)
 		goto bad;
 
 	if (bsd_set_mediaopt(drv, IFM_OMASK, IFM_IEEE80211_HOSTAP) < 0) {
@@ -1006,8 +986,6 @@ bsd_deinit(void *priv)
 {
 	struct bsd_driver_data *drv = priv;
 
-	if (drv->ifindex != 0)
-		bsd_ctrl_iface(drv, 0);
 	if (drv->sock_xmit != NULL)
 		l2_packet_deinit(drv->sock_xmit);
 	os_free(drv);
@@ -1015,13 +993,6 @@ bsd_deinit(void *priv)
 
 
 static int
-bsd_commit(void *priv)
-{
-	return bsd_ctrl_iface(priv, 1);
-}
-
-
-static int
 bsd_set_sta_authorized(void *priv, const u8 *addr,
 		   unsigned int total_flags, unsigned int flags_or,
 		   unsigned int flags_and)
@@ -1274,8 +1245,11 @@ wpa_driver_bsd_scan(void *priv, struct w
 	}
 
 	/* NB: interface must be marked UP to do a scan */
-	if (bsd_ctrl_iface(drv, 1) < 0)
+	if (!(drv->flags & IFF_UP)) {
+		wpa_printf(MSG_DEBUG, "%s: interface is not up, cannot scan",
+		   __func__);
 		return -1;
+	}
 
 #ifdef IEEE80211_IOC_SCAN_MAX_SSID
 	os_memset(, 0, sizeof(sr));
@@ -1565,7 +1539,7 @@ wpa_driver_bsd_init(void *ctx, const cha
 		goto fail;
 
 	/* Down interface during setup. */
-	if (bsd_ctrl_iface(drv, 0) < 0)
+	if (bsd_get_iface_flags(drv) < 0)
 		goto fail;
 
 	drv->opmode = get80211opmode(drv);
@@ -1586,9 +1560,6 @@ wpa_driver_bsd_deinit(void *priv)
 	if (drv->ifindex != 0 && !drv->if_removed) {
 		wpa_driver_bsd_set_wpa(drv, 0);
 
-		/* NB: mark interface down */
-		bsd_ctrl_iface(drv, 0);
-
 		wpa_driver_bsd_set_wpa_internal(drv, drv->prev_wpa,
 		drv->prev_privacy);
 
@@ -1694,7 +1665,6 @@ const struct wpa_driver_ops wpa_driver_b
 	.sta_disassoc		= bsd_sta_disassoc,
 	.sta_deauth		= bsd_sta_deauth,
 	.sta_set_flags		= bsd_set_sta_authorized,
-	.commit			= bsd_commit,
 #else /* HOSTAPD */
 	.init2			= wpa_driver_bsd_init,
 	.deinit			= wpa_driver_bsd_deinit,



CVS commit: src/external/bsd/wpa/dist/src/drivers

2020-01-29 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Jan 29 11:46:47 UTC 2020

Modified Files:
src/external/bsd/wpa/dist/src/drivers: driver_bsd.c

Log Message:
wpa: Remove an outdated comment

With interface matching support, wpa_supplicant can wait for an
interface to appear.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/external/bsd/wpa/dist/src/drivers/driver_bsd.c

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

Modified files:

Index: src/external/bsd/wpa/dist/src/drivers/driver_bsd.c
diff -u src/external/bsd/wpa/dist/src/drivers/driver_bsd.c:1.33 src/external/bsd/wpa/dist/src/drivers/driver_bsd.c:1.34
--- src/external/bsd/wpa/dist/src/drivers/driver_bsd.c:1.33	Wed Jan 29 11:45:54 2020
+++ src/external/bsd/wpa/dist/src/drivers/driver_bsd.c	Wed Jan 29 11:46:47 2020
@@ -1502,12 +1502,6 @@ wpa_driver_bsd_init(void *ctx, const cha
 	if (drv == NULL)
 		return NULL;
 
-	/*
-	 * NB: We require the interface name be mappable to an index.
-	 * This implies we do not support having wpa_supplicant
-	 * wait for an interface to appear.  This seems ok; that
-	 * doesn't belong here; it's really the job of devd.
-	 */
 	drv->ifindex = if_nametoindex(ifname);
 	if (drv->ifindex == 0) {
 		wpa_printf(MSG_DEBUG, "%s: interface %s does not exist",



CVS commit: src/external/bsd/wpa/dist/src/drivers

2020-01-29 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Jan 29 11:44:43 UTC 2020

Modified Files:
src/external/bsd/wpa/dist/src/drivers: driver_bsd.c

Log Message:
wpa: Share route(4) processing with hostapd and wpa_supplicant.

There is little point in having both and it brings interface
addition/removal and IFF_UP notifications to hostapd.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/external/bsd/wpa/dist/src/drivers/driver_bsd.c

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

Modified files:

Index: src/external/bsd/wpa/dist/src/drivers/driver_bsd.c
diff -u src/external/bsd/wpa/dist/src/drivers/driver_bsd.c:1.31 src/external/bsd/wpa/dist/src/drivers/driver_bsd.c:1.32
--- src/external/bsd/wpa/dist/src/drivers/driver_bsd.c:1.31	Wed Jan 29 11:31:40 2020
+++ src/external/bsd/wpa/dist/src/drivers/driver_bsd.c	Wed Jan 29 11:44:43 2020
@@ -132,7 +132,6 @@ bsd_get_drvindex(void *priv, unsigned in
 	return NULL;
 }
 
-#ifndef HOSTAPD
 static struct bsd_driver_data *
 bsd_get_drvname(void *priv, const char *ifname)
 {
@@ -145,7 +144,6 @@ bsd_get_drvname(void *priv, const char *
 	}
 	return NULL;
 }
-#endif /* HOSTAPD */
 
 static int
 bsd_set80211(void *priv, int op, int val, const void *arg, int arg_len)
@@ -680,6 +678,154 @@ bsd_set_opt_ie(void *priv, const u8 *ie,
 	return 0;
 }
 
+static void
+bsd_wireless_event_receive(int sock, void *ctx, void *sock_ctx)
+{
+	struct bsd_driver_global *global = sock_ctx;
+	struct bsd_driver_data *drv;
+	struct if_announcemsghdr *ifan;
+	struct if_msghdr *ifm;
+	struct rt_msghdr *rtm;
+	union wpa_event_data event;
+	struct ieee80211_michael_event *mic;
+	struct ieee80211_leave_event *leave;
+	struct ieee80211_join_event *join;
+	int n;
+	struct msghdr msg = { .msg_iov = global->event_iov, .msg_iovlen = 1};
+
+	n = recvmsg_realloc(sock, , 0);
+	if (n < 0) {
+		if (errno != EINTR && errno != EAGAIN)
+			wpa_printf(MSG_ERROR, "%s read() failed: %s",
+   __func__, strerror(errno));
+		return;
+	}
+
+	rtm = (struct rt_msghdr *) global->event_iov[0].iov_base;
+	if (rtm->rtm_version != RTM_VERSION) {
+		wpa_printf(MSG_DEBUG, "Invalid routing message version=%d",
+			   rtm->rtm_version);
+		return;
+	}
+	os_memset(, 0, sizeof(event));
+	switch (rtm->rtm_type) {
+	case RTM_IEEE80211:
+		ifan = (struct if_announcemsghdr *) rtm;
+		drv = bsd_get_drvindex(global, ifan->ifan_index);
+		if (drv == NULL)
+			return;
+		switch (ifan->ifan_what) {
+		case RTM_IEEE80211_ASSOC:
+		case RTM_IEEE80211_REASSOC:
+			if (drv->is_ap)
+break;
+			wpa_supplicant_event(drv->ctx, EVENT_ASSOC, NULL);
+			break;
+		case RTM_IEEE80211_DISASSOC:
+			if (drv->is_ap)
+break;
+			wpa_supplicant_event(drv->ctx, EVENT_DISASSOC, NULL);
+			break;
+		case RTM_IEEE80211_SCAN:
+			if (drv->is_ap)
+break;
+			wpa_supplicant_event(drv->ctx, EVENT_SCAN_RESULTS,
+	 NULL);
+			break;
+		case RTM_IEEE80211_LEAVE:
+			leave = (struct ieee80211_leave_event *) [1];
+			drv_event_disassoc(drv->ctx, leave->iev_addr);
+			break;
+		case RTM_IEEE80211_JOIN:
+#ifdef RTM_IEEE80211_REJOIN
+		case RTM_IEEE80211_REJOIN:
+#endif
+			join = (struct ieee80211_join_event *) [1];
+			bsd_new_sta(drv, drv->ctx, join->iev_addr);
+			break;
+		case RTM_IEEE80211_REPLAY:
+			/* ignore */
+			break;
+		case RTM_IEEE80211_MICHAEL:
+			mic = (struct ieee80211_michael_event *) [1];
+			wpa_printf(MSG_DEBUG,
+"Michael MIC failure wireless event: "
+"keyix=%u src_addr=" MACSTR, mic->iev_keyix,
+MAC2STR(mic->iev_src));
+			os_memset(, 0, sizeof(event));
+			event.michael_mic_failure.unicast =
+!IEEE80211_IS_MULTICAST(mic->iev_dst);
+			event.michael_mic_failure.src = mic->iev_src;
+			wpa_supplicant_event(drv->ctx,
+	 EVENT_MICHAEL_MIC_FAILURE, );
+			break;
+		}
+		break;
+	case RTM_IFANNOUNCE:
+		ifan = (struct if_announcemsghdr *) rtm;
+		switch (ifan->ifan_what) {
+		case IFAN_DEPARTURE:
+			drv = bsd_get_drvindex(global, ifan->ifan_index);
+			if (drv)
+drv->if_removed = 1;
+			event.interface_status.ievent = EVENT_INTERFACE_REMOVED;
+			break;
+		case IFAN_ARRIVAL:
+			drv = bsd_get_drvname(global, ifan->ifan_name);
+			if (drv) {
+drv->ifindex = ifan->ifan_index;
+drv->if_removed = 0;
+			}
+			event.interface_status.ievent = EVENT_INTERFACE_ADDED;
+			break;
+		default:
+			wpa_printf(MSG_DEBUG, "RTM_IFANNOUNCE: unknown action");
+			return;
+		}
+		wpa_printf(MSG_DEBUG, "RTM_IFANNOUNCE: Interface '%s' %s",
+			   ifan->ifan_name,
+			   ifan->ifan_what == IFAN_DEPARTURE ?
+"removed" : "added");
+		os_strlcpy(event.interface_status.ifname, ifan->ifan_name,
+			   sizeof(event.interface_status.ifname));
+		if (drv) {
+			wpa_supplicant_event(drv->ctx, EVENT_INTERFACE_STATUS,
+	 );
+			/*
+			 * Set ifindex to zero after sending the event as the
+			 * event might query the driver to ensure a match.
+			 */
+			if (ifan->ifan_what == IFAN_DEPARTURE)
+drv->ifindex = 0;

CVS commit: src/external/bsd/wpa/dist/src/drivers

2020-01-29 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Jan 29 11:31:40 UTC 2020

Modified Files:
src/external/bsd/wpa/dist/src/drivers: driver_bsd.c

Log Message:
wpa: Driver does not need to know about both wpa and hostap contexts

It will either be one or the other.
Fold hapd into ctx to match other drivers.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/external/bsd/wpa/dist/src/drivers/driver_bsd.c

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

Modified files:

Index: src/external/bsd/wpa/dist/src/drivers/driver_bsd.c
diff -u src/external/bsd/wpa/dist/src/drivers/driver_bsd.c:1.30 src/external/bsd/wpa/dist/src/drivers/driver_bsd.c:1.31
--- src/external/bsd/wpa/dist/src/drivers/driver_bsd.c:1.30	Wed Apr 10 17:48:07 2019
+++ src/external/bsd/wpa/dist/src/drivers/driver_bsd.c	Wed Jan 29 11:31:40 2020
@@ -58,14 +58,13 @@ struct bsd_driver_global {
 struct bsd_driver_data {
 	struct dl_list	list;
 	struct bsd_driver_global *global;
-	struct hostapd_data *hapd;	/* back pointer */
+	void	*ctx;
 
 	struct l2_packet_data *sock_xmit;/* raw packet xmit socket */
 	char	ifname[IFNAMSIZ+1];	/* interface name */
 	int	flags;
 	unsigned int ifindex;		/* interface index */
 	int	if_removed;		/* has the interface been removed? */
-	void	*ctx;
 	struct wpa_driver_capa capa;	/* driver capability */
 	int	is_ap;			/* Access point mode */
 	int	prev_roaming;	/* roaming state to restore on deinit */
@@ -843,14 +842,14 @@ bsd_wireless_event_receive(int sock, voi
 			break;
 		case RTM_IEEE80211_LEAVE:
 			leave = (struct ieee80211_leave_event *) [1];
-			drv_event_disassoc(drv->hapd, leave->iev_addr);
+			drv_event_disassoc(drv->ctx, leave->iev_addr);
 			break;
 		case RTM_IEEE80211_JOIN:
 #ifdef RTM_IEEE80211_REJOIN
 		case RTM_IEEE80211_REJOIN:
 #endif
 			join = (struct ieee80211_join_event *) [1];
-			bsd_new_sta(drv, drv->hapd, join->iev_addr);
+			bsd_new_sta(drv, drv->ctx, join->iev_addr);
 			break;
 		case RTM_IEEE80211_REPLAY:
 			/* ignore */
@@ -864,7 +863,7 @@ bsd_wireless_event_receive(int sock, voi
 			os_memset(, 0, sizeof(data));
 			data.michael_mic_failure.unicast = 1;
 			data.michael_mic_failure.src = mic->iev_src;
-			wpa_supplicant_event(drv->hapd,
+			wpa_supplicant_event(drv->ctx,
 	 EVENT_MICHAEL_MIC_FAILURE, );
 			break;
 		}
@@ -876,7 +875,7 @@ static void
 handle_read(void *ctx, const u8 *src_addr, const u8 *buf, size_t len)
 {
 	struct bsd_driver_data *drv = ctx;
-	drv_event_eapol_rx(drv->hapd, src_addr, buf, len);
+	drv_event_eapol_rx(drv->ctx, src_addr, buf, len);
 }
 
 static void *
@@ -897,7 +896,7 @@ bsd_init(struct hostapd_data *hapd, stru
 		goto bad;
 	}
 
-	drv->hapd = hapd;
+	drv->ctx = hapd;
 	drv->global = params->global_priv;
 	os_strlcpy(drv->ifname, params->ifname, sizeof(drv->ifname));
 



CVS commit: src/lib/libpthread

2020-01-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Jan 29 10:55:23 UTC 2020

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

Log Message:
Mark destroyed pthread_mutexattr_t as dead


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/lib/libpthread/pthread_mutex.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_mutex.c
diff -u src/lib/libpthread/pthread_mutex.c:1.68 src/lib/libpthread/pthread_mutex.c:1.69
--- src/lib/libpthread/pthread_mutex.c:1.68	Sat Jan 25 18:30:41 2020
+++ src/lib/libpthread/pthread_mutex.c	Wed Jan 29 10:55:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_mutex.c,v 1.68 2020/01/25 18:30:41 ad Exp $	*/
+/*	$NetBSD: pthread_mutex.c,v 1.69 2020/01/29 10:55:23 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2003, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -47,7 +47,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pthread_mutex.c,v 1.68 2020/01/25 18:30:41 ad Exp $");
+__RCSID("$NetBSD: pthread_mutex.c,v 1.69 2020/01/29 10:55:23 kamil Exp $");
 
 #include 
 #include 
@@ -627,6 +627,8 @@ pthread_mutexattr_destroy(pthread_mutexa
 	pthread__error(EINVAL, "Invalid mutex attribute",
 	attr->ptma_magic == _PT_MUTEXATTR_MAGIC);
 
+	attr->ptma_magic = _PT_MUTEXATTR_DEAD;
+
 	return 0;
 }
 



CVS commit: src/common/lib/libc/string

2020-01-29 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Wed Jan 29 09:18:26 UTC 2020

Modified Files:
src/common/lib/libc/string: bcmp.c memcmp.c

Log Message:
Some boot blocks too big now, only compare in big chunks if !_STANDALONE.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/common/lib/libc/string/bcmp.c
cvs rdiff -u -r1.7 -r1.8 src/common/lib/libc/string/memcmp.c

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

Modified files:

Index: src/common/lib/libc/string/bcmp.c
diff -u src/common/lib/libc/string/bcmp.c:1.9 src/common/lib/libc/string/bcmp.c:1.10
--- src/common/lib/libc/string/bcmp.c:1.9	Mon Jan 27 22:22:03 2020
+++ src/common/lib/libc/string/bcmp.c	Wed Jan 29 09:18:26 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcmp.c,v 1.9 2020/01/27 22:22:03 ad Exp $	*/
+/*	$NetBSD: bcmp.c,v 1.10 2020/01/29 09:18:26 ad Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
 #if 0
 static char sccsid[] = "@(#)bcmp.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: bcmp.c,v 1.9 2020/01/27 22:22:03 ad Exp $");
+__RCSID("$NetBSD: bcmp.c,v 1.10 2020/01/29 09:18:26 ad Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -86,9 +86,11 @@ __RCSID("$NetBSD: bcmp.c,v 1.9 2020/01/2
 int
 bcmp(const void *s1, const void *s2, size_t n)
 {
-	const uintptr_t *b1, *b2;
 	const unsigned char *c1, *c2;
 
+#ifndef _STANDALONE
+	const uintptr_t *b1, *b2;
+
 	b1 = s1;
 	b2 = s2;
 
@@ -105,6 +107,10 @@ bcmp(const void *s1, const void *s2, siz
 
 	c1 = (const unsigned char *)b1;
 	c2 = (const unsigned char *)b2;
+#else
+	c1 = (const unsigned char *)s1;
+	c2 = (const unsigned char *)s2;
+#endif
 
 	if (n != 0) {
 		do {

Index: src/common/lib/libc/string/memcmp.c
diff -u src/common/lib/libc/string/memcmp.c:1.7 src/common/lib/libc/string/memcmp.c:1.8
--- src/common/lib/libc/string/memcmp.c:1.7	Mon Jan 27 22:22:03 2020
+++ src/common/lib/libc/string/memcmp.c	Wed Jan 29 09:18:26 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: memcmp.c,v 1.7 2020/01/27 22:22:03 ad Exp $	*/
+/*	$NetBSD: memcmp.c,v 1.8 2020/01/29 09:18:26 ad Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
 #if 0
 static char sccsid[] = "@(#)memcmp.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: memcmp.c,v 1.7 2020/01/27 22:22:03 ad Exp $");
+__RCSID("$NetBSD: memcmp.c,v 1.8 2020/01/29 09:18:26 ad Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -86,9 +86,11 @@ __RCSID("$NetBSD: memcmp.c,v 1.7 2020/01
 int
 memcmp(const void *s1, const void *s2, size_t n)
 {
-	const uintptr_t *b1, *b2;
 	const unsigned char *c1, *c2;
 
+#ifndef _STANDALONE
+	const uintptr_t *b1, *b2;
+
 	b1 = s1;
 	b2 = s2;
 
@@ -107,6 +109,10 @@ memcmp(const void *s1, const void *s2, s
 
 	c1 = (const unsigned char *)b1;
 	c2 = (const unsigned char *)b2;
+#else
+	c1 = (const unsigned char *)s1;
+	c2 = (const unsigned char *)s2;
+#endif
 
 	if (n != 0) {
 		do {



CVS commit: src/sys/arch/x86/pci

2020-01-29 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Wed Jan 29 08:43:30 UTC 2020

Modified Files:
src/sys/arch/x86/pci: if_vmx.c

Log Message:
Fix missing callout_destroy().  Pointed out by yamaguchi@n.o.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/x86/pci/if_vmx.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/x86/pci/if_vmx.c
diff -u src/sys/arch/x86/pci/if_vmx.c:1.55 src/sys/arch/x86/pci/if_vmx.c:1.56
--- src/sys/arch/x86/pci/if_vmx.c:1.55	Wed Jan 29 02:58:51 2020
+++ src/sys/arch/x86/pci/if_vmx.c	Wed Jan 29 08:43:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vmx.c,v 1.55 2020/01/29 02:58:51 knakahara Exp $	*/
+/*	$NetBSD: if_vmx.c,v 1.56 2020/01/29 08:43:30 knakahara Exp $	*/
 /*	$OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $	*/
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.55 2020/01/29 02:58:51 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.56 2020/01/29 08:43:30 knakahara Exp $");
 
 #include 
 #include 
@@ -667,6 +667,7 @@ vmxnet3_detach(device_t self, int flags)
 		VMXNET3_CORE_LOCK(sc);
 		vmxnet3_stop_locked(sc);
 		callout_halt(>vmx_tick, sc->vmx_mtx);
+		callout_destroy(>vmx_tick);
 		VMXNET3_CORE_UNLOCK(sc);
 
 		ifmedia_delete_instance(>vmx_media, IFM_INST_ANY);