CVS commit: src/sys/dev/pci

2019-02-28 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Mar  1 07:02:56 UTC 2019

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

Log Message:
 KNF. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/pci/pciconf.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/pciconf.c
diff -u src/sys/dev/pci/pciconf.c:1.39 src/sys/dev/pci/pciconf.c:1.40
--- src/sys/dev/pci/pciconf.c:1.39	Fri Mar  1 05:41:56 2019
+++ src/sys/dev/pci/pciconf.c	Fri Mar  1 07:02:56 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pciconf.c,v 1.39 2019/03/01 05:41:56 msaitoh Exp $	*/
+/*	$NetBSD: pciconf.c,v 1.40 2019/03/01 07:02:56 msaitoh Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pciconf.c,v 1.39 2019/03/01 05:41:56 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pciconf.c,v 1.40 2019/03/01 07:02:56 msaitoh Exp $");
 
 #include "opt_pci.h"
 
@@ -191,7 +191,7 @@ get_io_desc(pciconf_bus_t *pb, bus_size_
 	int	i, n;
 
 	n = pb->niowin;
-	for (i=n; i > 0 && size > pb->pciiowin[i-1].size; i--)
+	for (i = n; i > 0 && size > pb->pciiowin[i-1].size; i--)
 		pb->pciiowin[i] = pb->pciiowin[i-1]; /* struct copy */
 	return >pciiowin[i];
 }
@@ -202,7 +202,7 @@ get_mem_desc(pciconf_bus_t *pb, bus_size
 	int	i, n;
 
 	n = pb->nmemwin;
-	for (i=n; i > 0 && size > pb->pcimemwin[i-1].size; i--)
+	for (i = n; i > 0 && size > pb->pcimemwin[i-1].size; i--)
 		pb->pcimemwin[i] = pb->pcimemwin[i-1]; /* struct copy */
 	return >pcimemwin[i];
 }
@@ -249,7 +249,7 @@ probe_bus(pciconf_bus_t *pb)
 
 		if (pci_conf_debug) {
 			printf("id=%x: Vendor=%x, Product=%x\n",
-			id, PCI_VENDOR(id),PCI_PRODUCT(id));
+			id, PCI_VENDOR(id), PCI_PRODUCT(id));
 		}
 		/* Invalid vendor ID value? */
 		if (PCI_VENDOR(id) == PCI_VENDOR_INVALID)
@@ -257,12 +257,12 @@ probe_bus(pciconf_bus_t *pb)
 
 		bhlcr = pci_conf_read(pb->pc, tag, PCI_BHLC_REG);
 		nfunction = PCI_HDRTYPE_MULTIFN(bhlcr) ? 8 : 1;
-		for (function = 0 ; function < nfunction ; function++) {
+		for (function = 0; function < nfunction; function++) {
 			tag = pci_make_tag(pb->pc, pb->busno, device, function);
 			id = pci_conf_read(pb->pc, tag, PCI_ID_REG);
 			if (PCI_VENDOR(id) == PCI_VENDOR_INVALID)
 continue;
-			if (pb->ndevs+1 < MAX_CONF_DEV) {
+			if (pb->ndevs + 1 < MAX_CONF_DEV) {
 if (pci_conf_debug) {
 	print_tag(pb->pc, tag);
 	printf("Found dev 0x%04x 0x%04x -- "
@@ -344,18 +344,16 @@ query_bus(pciconf_bus_t *parent, pciconf
 	pb->io_32bit = 0;
 	if (parent->io_32bit) {
 		io = pci_conf_read(parent->pc, pd->tag, PCI_BRIDGE_STATIO_REG);
-		if (PCI_BRIDGE_IO_32BITS(io)) {
+		if (PCI_BRIDGE_IO_32BITS(io))
 			pb->io_32bit = 1;
-		}
 	}
 
 	pb->pmem_64bit = 0;
 	if (parent->pmem_64bit) {
 		pmem = pci_conf_read(parent->pc, pd->tag,
 		PCI_BRIDGE_PREFETCHMEM_REG);
-		if (PCI_BRIDGE_PREFETCHMEM_64BITS(pmem)) {
+		if (PCI_BRIDGE_PREFETCHMEM_64BITS(pmem))
 			pb->pmem_64bit = 1;
-		}
 	}
 
 	if (probe_bus(pb)) {
@@ -364,7 +362,7 @@ query_bus(pciconf_bus_t *parent, pciconf
 	}
 
 	/* We have found all subordinate busses now, reprogram busreg. */
-	pb->last_busno = pb->next_busno-1;
+	pb->last_busno = pb->next_busno - 1;
 	parent->next_busno = pb->next_busno;
 	set_busreg(parent->pc, pd->tag, parent->busno, pb->busno,
 		   pb->last_busno);
@@ -397,7 +395,7 @@ query_bus(pciconf_bus_t *parent, pciconf
 			 parent->nmemwin);
 			goto err;
 		}
-		pb->mem_total |= pb->mem_align-1; /* Round up */
+		pb->mem_total |= pb->mem_align - 1; /* Round up */
 		pm = get_mem_desc(parent, pb->mem_total);
 		pm->dev = pd;
 		pm->reg = 0;
@@ -415,7 +413,7 @@ query_bus(pciconf_bus_t *parent, pciconf
 			printf("pciconf: too many MEM windows\n");
 			goto err;
 		}
-		pb->pmem_total |= pb->pmem_align-1; /* Round up */
+		pb->pmem_total |= pb->pmem_align - 1; /* Round up */
 		pm = get_mem_desc(parent, pb->pmem_total);
 		pm->dev = pd;
 		pm->reg = 0;
@@ -716,7 +714,7 @@ setup_iowins(pciconf_bus_t *pb)
 	pciconf_win_t	*pi;
 	pciconf_dev_t	*pd;
 
-	for (pi=pb->pciiowin; pi < >pciiowin[pb->niowin] ; pi++) {
+	for (pi = pb->pciiowin; pi < >pciiowin[pb->niowin]; pi++) {
 		if (pi->size == 0)
 			continue;
 
@@ -766,7 +764,7 @@ setup_memwins(pciconf_bus_t *pb)
 	pcireg_t	base;
 	struct extent	*ex;
 
-	for (pm=pb->pcimemwin; pm < >pcimemwin[pb->nmemwin] ; pm++) {
+	for (pm = pb->pcimemwin; pm < >pcimemwin[pb->nmemwin]; pm++) {
 		if (pm->size == 0)
 			continue;
 
@@ -824,7 +822,7 @@ setup_memwins(pciconf_bus_t *pb)
 			}
 		}
 	}
-	for (pm=pb->pcimemwin; pm < >pcimemwin[pb->nmemwin] ; pm++) {
+	for (pm = pb->pcimemwin; pm < >pcimemwin[pb->nmemwin]; pm++) {
 		if (pm->reg == PCI_MAPREG_ROM && pm->address != -1) {
 			pd = pm->dev;
 			if (!(pd->enable & PCI_CONF_MAP_ROM))
@@ -1025,7 +1023,7 @@ configure_bus(pciconf_bus_t *pb)
 	/*
 	 * Configure the latency for the devices, and enable 

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

2019-02-28 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Fri Mar  1 06:14:52 UTC 2019

Modified Files:
src/common/lib/libc/atomic: atomic_nand_16_cas.c atomic_nand_32_cas.c
atomic_nand_8_cas.c

Log Message:
Add missing alias for __atomic_fetch_nand_N.
XXX I'm not sure why does llvm/sparc call __atomic instead of
__sync though.
XXX atomic_*_cas.c should be more symmetric...


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/common/lib/libc/atomic/atomic_nand_16_cas.c \
src/common/lib/libc/atomic/atomic_nand_8_cas.c
cvs rdiff -u -r1.1 -r1.2 src/common/lib/libc/atomic/atomic_nand_32_cas.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/atomic/atomic_nand_16_cas.c
diff -u src/common/lib/libc/atomic/atomic_nand_16_cas.c:1.2 src/common/lib/libc/atomic/atomic_nand_16_cas.c:1.3
--- src/common/lib/libc/atomic/atomic_nand_16_cas.c:1.2	Fri Feb 21 16:06:48 2014
+++ src/common/lib/libc/atomic/atomic_nand_16_cas.c	Fri Mar  1 06:14:52 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_nand_16_cas.c,v 1.2 2014/02/21 16:06:48 martin Exp $	*/
+/*	$NetBSD: atomic_nand_16_cas.c,v 1.3 2019/03/01 06:14:52 isaki Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -61,3 +61,5 @@ nand_and_fetch_2(volatile uint16_t *addr
 	} while (atomic_cas_16(addr, old, new) != old);
 	return new;
 }
+
+__strong_alias(__atomic_fetch_nand_2,__sync_fetch_and_nand_2)
Index: src/common/lib/libc/atomic/atomic_nand_8_cas.c
diff -u src/common/lib/libc/atomic/atomic_nand_8_cas.c:1.2 src/common/lib/libc/atomic/atomic_nand_8_cas.c:1.3
--- src/common/lib/libc/atomic/atomic_nand_8_cas.c:1.2	Fri Feb 21 16:06:48 2014
+++ src/common/lib/libc/atomic/atomic_nand_8_cas.c	Fri Mar  1 06:14:52 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_nand_8_cas.c,v 1.2 2014/02/21 16:06:48 martin Exp $	*/
+/*	$NetBSD: atomic_nand_8_cas.c,v 1.3 2019/03/01 06:14:52 isaki Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -61,3 +61,5 @@ nand_and_fetch_1(volatile uint8_t *addr,
 	} while (atomic_cas_8(addr, old, new) != old);
 	return new;
 }
+
+__strong_alias(__atomic_fetch_nand_1,__sync_fetch_and_nand_1)

Index: src/common/lib/libc/atomic/atomic_nand_32_cas.c
diff -u src/common/lib/libc/atomic/atomic_nand_32_cas.c:1.1 src/common/lib/libc/atomic/atomic_nand_32_cas.c:1.2
--- src/common/lib/libc/atomic/atomic_nand_32_cas.c:1.1	Fri Feb 21 10:52:50 2014
+++ src/common/lib/libc/atomic/atomic_nand_32_cas.c	Fri Mar  1 06:14:52 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_nand_32_cas.c,v 1.1 2014/02/21 10:52:50 martin Exp $	*/
+/*	$NetBSD: atomic_nand_32_cas.c,v 1.2 2019/03/01 06:14:52 isaki Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -59,3 +59,5 @@ nand_and_fetch_4(volatile uint32_t *addr
 	} while (atomic_cas_32(addr, old, new) != old);
 	return new;
 }
+
+__strong_alias(__atomic_fetch_nand_4,__sync_fetch_and_nand_4)



CVS commit: src/bin/sh

2019-02-28 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Mar  1 06:15:02 UTC 2019

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

Log Message:
The previous commit was obviously made by a broken mindless automoton
with an IQ that underflows when one attempts to enter it as an
unnormalised 160 bit long long double...

Whoever would believe that (~0 & anything) was a meaningful thing
to write?   And three times in one #define.   That could not possibly
have been me, could it?

Simplify, simplify, simplify.   NFC.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/bin/sh/redir.c

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

Modified files:

Index: src/bin/sh/redir.c
diff -u src/bin/sh/redir.c:1.65 src/bin/sh/redir.c:1.66
--- src/bin/sh/redir.c:1.65	Fri Mar  1 05:23:35 2019
+++ src/bin/sh/redir.c	Fri Mar  1 06:15:01 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: redir.c,v 1.65 2019/03/01 05:23:35 kre Exp $	*/
+/*	$NetBSD: redir.c,v 1.66 2019/03/01 06:15:01 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)redir.c	8.2 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: redir.c,v 1.65 2019/03/01 05:23:35 kre Exp $");
+__RCSID("$NetBSD: redir.c,v 1.66 2019/03/01 06:15:01 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -764,8 +764,7 @@ static const struct flgnames {
 O_ALT_IO|O_DIRECT|O_NOSIGPIPE)
 
 #ifndef	O_CLOEXEC
-# define O_CLOEXEC	((~0 & ~ALLFLAGS) ^	 \
-((~0 & ~ALLFLAGS) & ((~0 & ~ALLFLAGS) - 1)))
+# define O_CLOEXEC	((~ALLFLAGS) ^ ((~ALLFLAGS) & ((~ALLFLAGS) - 1)))
 #endif
 
 	/* for any system we support, close on exec is always defined */



CVS commit: src/sys/dev/pci

2019-02-28 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Mar  1 05:41:56 UTC 2019

Modified Files:
src/sys/dev/pci: pccbb.c pci_map.c pciconf.c

Log Message:
No functional change:
 - u_int* -> uint*
 - KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.212 -r1.213 src/sys/dev/pci/pccbb.c
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/pci/pci_map.c
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/pci/pciconf.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/pccbb.c
diff -u src/sys/dev/pci/pccbb.c:1.212 src/sys/dev/pci/pccbb.c:1.213
--- src/sys/dev/pci/pccbb.c:1.212	Mon Sep  3 16:29:32 2018
+++ src/sys/dev/pci/pccbb.c	Fri Mar  1 05:41:56 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pccbb.c,v 1.212 2018/09/03 16:29:32 riastradh Exp $	*/
+/*	$NetBSD: pccbb.c,v 1.213 2019/03/01 05:41:56 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1998, 1999 and 2000
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pccbb.c,v 1.212 2018/09/03 16:29:32 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pccbb.c,v 1.213 2019/03/01 05:41:56 msaitoh Exp $");
 
 /*
 #define CBB_DEBUG
@@ -54,7 +54,6 @@ __KERNEL_RCSID(0, "$NetBSD: pccbb.c,v 1.
 #include 
 
 #include 
-
 #include 
 
 #include 
@@ -102,8 +101,8 @@ static int pccbbintr_function(struct pcc
 
 static int pccbb_detect_card(struct pccbb_softc *);
 
-static void pccbb_pcmcia_write(struct pccbb_softc *, int, u_int8_t);
-static u_int8_t pccbb_pcmcia_read(struct pccbb_softc *, int);
+static void pccbb_pcmcia_write(struct pccbb_softc *, int, uint8_t);
+static uint8_t pccbb_pcmcia_read(struct pccbb_softc *, int);
 #define Pcic_read(sc, reg) pccbb_pcmcia_read((sc), (reg))
 #define Pcic_write(sc, reg, val) pccbb_pcmcia_write((sc), (reg), (val))
 
@@ -111,26 +110,25 @@ STATIC int cb_reset(struct pccbb_softc *
 STATIC int cb_detect_voltage(struct pccbb_softc *);
 STATIC int cbbprint(void *, const char *);
 
-static int cb_chipset(u_int32_t, int *);
+static int cb_chipset(uint32_t, int *);
 STATIC void pccbb_pcmcia_attach_setup(struct pccbb_softc *,
 struct pcmciabus_attach_args *);
 
 STATIC int pccbb_ctrl(cardbus_chipset_tag_t, int);
-STATIC int pccbb_power(struct pccbb_softc *sc, int);
+STATIC int pccbb_power(struct pccbb_softc *, int);
 STATIC int pccbb_power_ct(cardbus_chipset_tag_t, int);
-STATIC int pccbb_cardenable(struct pccbb_softc * sc, int function);
+STATIC int pccbb_cardenable(struct pccbb_softc *, int);
 static void *pccbb_intr_establish(struct pccbb_softc *,
-int level, int (*ih) (void *), void *sc);
-static void pccbb_intr_disestablish(struct pccbb_softc *, void *ih);
+int, int (*ih) (void *), void *);
+static void pccbb_intr_disestablish(struct pccbb_softc *, void *);
 
 static void *pccbb_cb_intr_establish(cardbus_chipset_tag_t,
-int level, int (*ih) (void *), void *sc);
-static void pccbb_cb_intr_disestablish(cardbus_chipset_tag_t ct, void *ih);
+int, int (*ih) (void *), void *);
+static void pccbb_cb_intr_disestablish(cardbus_chipset_tag_t, void *);
 
 static pcitag_t pccbb_make_tag(cardbus_chipset_tag_t, int, int);
 static pcireg_t pccbb_conf_read(cardbus_chipset_tag_t, pcitag_t, int);
-static void pccbb_conf_write(cardbus_chipset_tag_t, pcitag_t, int,
-pcireg_t);
+static void pccbb_conf_write(cardbus_chipset_tag_t, pcitag_t, int, pcireg_t);
 static void pccbb_chipinit(struct pccbb_softc *);
 static void pccbb_intrinit(struct pccbb_softc *);
 
@@ -154,7 +152,7 @@ STATIC void pccbb_pcmcia_intr_disestabli
 STATIC void pccbb_pcmcia_socket_enable(pcmcia_chipset_handle_t);
 STATIC void pccbb_pcmcia_socket_disable(pcmcia_chipset_handle_t);
 STATIC void pccbb_pcmcia_socket_settype(pcmcia_chipset_handle_t, int);
-STATIC int pccbb_pcmcia_card_detect(pcmcia_chipset_handle_t pch);
+STATIC int pccbb_pcmcia_card_detect(pcmcia_chipset_handle_t);
 
 static int pccbb_pcmcia_wait_ready(struct pccbb_softc *);
 static void pccbb_pcmcia_delay(struct pccbb_softc *, int, const char *);
@@ -165,23 +163,22 @@ static void pccbb_pcmcia_do_mem_map(stru
 /* bus-space allocation and deallocation functions */
 
 static int pccbb_rbus_cb_space_alloc(cardbus_chipset_tag_t, rbus_tag_t,
-bus_addr_t addr, bus_size_t size, bus_addr_t mask, bus_size_t align,
-int flags, bus_addr_t * addrp, bus_space_handle_t * bshp);
+bus_addr_t, bus_size_t, bus_addr_t, bus_size_t,
+int, bus_addr_t *, bus_space_handle_t *);
 static int pccbb_rbus_cb_space_free(cardbus_chipset_tag_t, rbus_tag_t,
 bus_space_handle_t, bus_size_t);
 
 
 
 static int pccbb_open_win(struct pccbb_softc *, bus_space_tag_t,
-bus_addr_t, bus_size_t, bus_space_handle_t, int flags);
+bus_addr_t, bus_size_t, bus_space_handle_t, int);
 static int pccbb_close_win(struct pccbb_softc *, bus_space_tag_t,
 bus_space_handle_t, bus_size_t);
 static int pccbb_winlist_insert(struct pccbb_win_chain_head *, bus_addr_t,
 bus_size_t, bus_space_handle_t, int);
 static int 

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

2019-02-28 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Fri Mar  1 05:39:01 UTC 2019

Modified Files:
src/tests/lib/libc/atomic: t___sync_and.c

Log Message:
Revert previous hack.
Now all libc have __sync_and_and_fetch functions.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/atomic/t___sync_and.c

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

Modified files:

Index: src/tests/lib/libc/atomic/t___sync_and.c
diff -u src/tests/lib/libc/atomic/t___sync_and.c:1.2 src/tests/lib/libc/atomic/t___sync_and.c:1.3
--- src/tests/lib/libc/atomic/t___sync_and.c:1.2	Wed Feb 27 15:32:11 2019
+++ src/tests/lib/libc/atomic/t___sync_and.c	Fri Mar  1 05:39:01 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: t___sync_and.c,v 1.2 2019/02/27 15:32:11 christos Exp $	*/
+/*	$NetBSD: t___sync_and.c,v 1.3 2019/03/01 05:39:01 isaki Exp $	*/
 
 /*
  * Copyright (C) 2019 Tetsuya Isaki. All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t___sync_and.c,v 1.2 2019/02/27 15:32:11 christos Exp $");
+__RCSID("$NetBSD: t___sync_and.c,v 1.3 2019/03/01 05:39:01 isaki Exp $");
 
 #include 
 #include 
@@ -54,7 +54,6 @@ ATF_TC_HEAD(NAME, tc) \
 { \
 	atf_tc_set_md_var(tc, "descr", #NAME); \
 } \
-extern TYPE NAME(volatile TYPE *, TYPE) __attribute__((__weak__)); \
 ATF_TC_BODY(NAME, tc) \
 { \
 	volatile TYPE val; \
@@ -66,8 +65,6 @@ ATF_TC_BODY(NAME, tc) \
 	src = (TYPE)SRC; \
 	expval = (TYPE)EXPECT; \
 	expres = (TYPE)DST; \
-	if (NAME == NULL) \
-		return; \
 	res = NAME(, src); \
 	ATF_REQUIRE_MSG(val == expval, \
 	"val expects 0x%" FMT " but 0x%" FMT, expval, val); \
@@ -88,7 +85,6 @@ ATF_TC_HEAD(NAME, tc) \
 { \
 	atf_tc_set_md_var(tc, "descr", #NAME); \
 } \
-extern TYPE NAME(volatile TYPE *, TYPE) __attribute__((__weak__)); \
 ATF_TC_BODY(NAME, tc) \
 { \
 	volatile TYPE val; \
@@ -98,8 +94,6 @@ ATF_TC_BODY(NAME, tc) \
 	val = (TYPE)DST; \
 	src = (TYPE)SRC; \
 	exp = (TYPE)EXPECT; \
-	if (NAME == NULL) \
-		return; \
 	res = NAME(, src); \
 	ATF_REQUIRE_MSG(val == exp, \
 	"val expects 0x%" FMT " but 0x%" FMT, exp, val); \



CVS commit: src/bin/sh

2019-02-28 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Mar  1 05:23:35 UTC 2019

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

Log Message:
Inspired by (really the need for) Maya's patch to pkgsrc/shells/bash
to allow bash to build fdflags on Solaris 10, here are some mods that
fix that, and some other similar issues in the NetBSD version of fdflags.

The bash implementation of fdflags is based upon the one Christos did for
the NetBSD sh, so the issues are similar ... the NetBSD sh cannot yet
(easily anyway) build on anything except NetBSD, so this change makes
no current difference at all (just adds some compile time tests (#ifdef)
which always work out the way things did before, when built on NetBSD).

However, there is no system on which any modern shell can hope to work
which does not support close on exec, or fcntl(F_SETFD,...) to set it.
The O_CLOEXEC and FD_CLOEXEC definitions might not exist, but close on
exec can still be manipulated.   Since the primary rationale for
the fdflags builtin was to be able to manipulate that state bit from
scripts, it would be annoying to lose that one, and keep all the (less
important) others, just because O_CLOEXEC is not defined, so do the
fix (workaround) a different way than was done in the bash patch.

Further, more than fdflags() will fail if O_CLOEXEC is not defined,
so handle that as well.

Also fix another oddity ... (noticed by reading the code) - if
fcntl(F_GETFL,...) returned any bits set that we don't understand,
the code was supposed to simply print their values as a hex constant,
when fdflags is run with -v.However, the getflags() function was
clearing all bits that the code did not know about ... so there is
no way any unknown bit could ever make it out to be printed.  Handle
that a different way - instead of clearing unknown bits, clear any
bits that get returned which we understand, but do not want to deal
with (stuff like O_WRONLY, which should not be returned from the
fcntl(), but who knows...)   Leave any unknown bits that happen to be
set, set, so that printone() can display them if appropriate.
(This is most likely to happen when running an older shell on a new
kernel where the kernel supports some new flag that the shell has
not been taught to understand).

NFCI that anyone should notice anytime soon.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/bin/sh/redir.c

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

Modified files:

Index: src/bin/sh/redir.c
diff -u src/bin/sh/redir.c:1.64 src/bin/sh/redir.c:1.65
--- src/bin/sh/redir.c:1.64	Sat Feb  9 09:34:43 2019
+++ src/bin/sh/redir.c	Fri Mar  1 05:23:35 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: redir.c,v 1.64 2019/02/09 09:34:43 kre Exp $	*/
+/*	$NetBSD: redir.c,v 1.65 2019/03/01 05:23:35 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)redir.c	8.2 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: redir.c,v 1.64 2019/02/09 09:34:43 kre Exp $");
+__RCSID("$NetBSD: redir.c,v 1.65 2019/03/01 05:23:35 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -78,6 +78,17 @@ __RCSID("$NetBSD: redir.c,v 1.64 2019/02
 # define PIPESIZE PIPE_BUF
 #endif
 
+#ifndef FD_CLOEXEC
+# define FD_CLOEXEC	1	/* well known from before there was a name */
+#endif
+
+#ifndef F_DUPFD_CLOEXEC
+#define F_DUPFD_CLOEXEC	F_DUPFD
+#define CLOEXEC(fd)	(fcntl((fd), F_SETFD, fcntl((fd),F_GETFD) | FD_CLOEXEC))
+#else
+#define CLOEXEC(fd)
+#endif
+
 
 MKINIT
 struct renamelist {
@@ -511,9 +522,14 @@ copyfd(int from, int to, int cloexec)
 {
 	int newfd;
 
-	if (cloexec && to > 2)
+	if (cloexec && to > 2) {
+#ifdef O_CLOEXEC
 		newfd = dup3(from, to, O_CLOEXEC);
-	else
+#else
+		newfd = dup2(from, to);
+		fcntl(newfd, F_SETFD, fcntl(newfd,F_GETFD) | FD_CLOEXEC);
+#endif
+	} else
 		newfd = dup2(from, to);
 
 	return newfd;
@@ -658,13 +674,6 @@ renumber_sh_fd(struct shell_fds *fp)
 	if (fp == NULL)
 		return;
 
-#ifndef	F_DUPFD_CLOEXEC
-#define	F_DUPFD_CLOEXEC	F_DUPFD
-#define	CLOEXEC(fd)	(fcntl((fd), F_SETFD, fcntl((fd),F_GETFD) | FD_CLOEXEC))
-#else
-#define	CLOEXEC(fd)
-#endif
-
 	/*
 	 * if we have had a collision, and the sh fd was a "big" one
 	 * try moving the sh fd base to a higher number (if possible)
@@ -702,41 +711,115 @@ static const struct flgnames {
 } nv[] = {
 #ifdef O_APPEND
 	{ "append",	2,	O_APPEND 	},
+#else
+# define O_APPEND 0
 #endif
 #ifdef O_ASYNC
 	{ "async",	2,	O_ASYNC		},
+#else
+# define O_ASYNC 0
 #endif
 #ifdef O_SYNC
 	{ "sync",	2,	O_SYNC		},
+#else
+# define O_SYNC 0
 #endif
 #ifdef O_NONBLOCK
 	{ "nonblock",	3,	O_NONBLOCK	},
+#else
+# define O_NONBLOCK 0
 #endif
 #ifdef O_FSYNC
 	{ "fsync",	2,	O_FSYNC		},
+#else
+# define O_FSYNC 0
 #endif
 #ifdef O_DSYNC
 	{ "dsync",	2,	O_DSYNC		},
+#else
+# define O_DSYNC 0
 #endif
 #ifdef O_RSYNC
 	{ "rsync",	2,	O_RSYNC		},
+#else
+# define O_RSYNC 0
 #endif
 #ifdef O_ALT_IO
 	{ "altio",	2,	O_ALT_IO	},
+#else
+# define O_ALT_IO 0
 

CVS commit: src/etc/mtree

2019-02-28 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Mar  1 04:39:37 UTC 2019

Added Files:
src/etc/mtree: NetBSD.dist.ofppc

Log Message:
add ./usr/include/ofppc for ofppc builds.

(how many more builds will i find like this?  the end result
is that i think we should generate the ./usr/include/$MACHINE
entry, i think, but i have to survey many ports.)


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/etc/mtree/NetBSD.dist.ofppc

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

Added files:

Index: src/etc/mtree/NetBSD.dist.ofppc
diff -u /dev/null src/etc/mtree/NetBSD.dist.ofppc:1.1
--- /dev/null	Fri Mar  1 04:39:37 2019
+++ src/etc/mtree/NetBSD.dist.ofppc	Fri Mar  1 04:39:37 2019
@@ -0,0 +1,3 @@
+#	$NetBSD: NetBSD.dist.ofppc,v 1.1 2019/03/01 04:39:37 mrg Exp $
+
+./usr/include/ofppc



CVS commit: src/sys/arch/alpha/alpha

2019-02-28 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Mar  1 04:29:20 UTC 2019

Modified Files:
src/sys/arch/alpha/alpha: pmap.c

Log Message:
fix a typo in a comment


To generate a diff of this commit:
cvs rdiff -u -r1.262 -r1.263 src/sys/arch/alpha/alpha/pmap.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/alpha/alpha/pmap.c
diff -u src/sys/arch/alpha/alpha/pmap.c:1.262 src/sys/arch/alpha/alpha/pmap.c:1.263
--- src/sys/arch/alpha/alpha/pmap.c:1.262	Sat Jan 27 23:07:36 2018
+++ src/sys/arch/alpha/alpha/pmap.c	Fri Mar  1 04:29:20 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.262 2018/01/27 23:07:36 chs Exp $ */
+/* $NetBSD: pmap.c,v 1.263 2019/03/01 04:29:20 mrg Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008 The NetBSD Foundation, Inc.
@@ -140,7 +140,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.262 2018/01/27 23:07:36 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.263 2019/03/01 04:29:20 mrg Exp $");
 
 #include 
 #include 
@@ -2245,7 +2245,7 @@ pmap_copy_page(paddr_t src, paddr_t dst)
  * pmap_pageidlezero:		[ INTERFACE ]
  *
  *	Page zero'er for the idle loop.  Returns true if the
- *	page was zero'd, FLASE if we aborted for some reason.
+ *	page was zero'd, FALSE if we aborted for some reason.
  */
 bool
 pmap_pageidlezero(paddr_t pa)



CVS commit: src/sys/kern

2019-02-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Mar  1 03:20:50 UTC 2019

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

Log Message:
no more p_nsems.


To generate a diff of this commit:
cvs rdiff -u -r1.226 -r1.227 src/sys/kern/kern_proc.c

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

Modified files:

Index: src/sys/kern/kern_proc.c
diff -u src/sys/kern/kern_proc.c:1.226 src/sys/kern/kern_proc.c:1.227
--- src/sys/kern/kern_proc.c:1.226	Tue Jan 29 04:28:50 2019
+++ src/sys/kern/kern_proc.c	Thu Feb 28 22:20:50 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_proc.c,v 1.226 2019/01/29 09:28:50 pgoyette Exp $	*/
+/*	$NetBSD: kern_proc.c,v 1.227 2019/03/01 03:20:50 christos Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.226 2019/01/29 09:28:50 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.227 2019/03/01 03:20:50 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_kstack.h"
@@ -2259,7 +2259,6 @@ fill_proc(const struct proc *psrc, struc
 	p->p_vfpid_done = psrc->p_vfpid_done;
 	p->p_lwp_created = psrc->p_lwp_created;
 	p->p_lwp_exited = psrc->p_lwp_exited;
-	p->p_nsems = psrc->p_nsems;
 	COND_SET_VALUE(p->p_path, psrc->p_path, allowaddr);
 	COND_SET_VALUE(p->p_sigctx, psrc->p_sigctx, allowaddr);
 	p->p_nice = psrc->p_nice;



CVS commit: src/share/man/man7

2019-02-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Mar  1 03:05:08 UTC 2019

Modified Files:
src/share/man/man7: sysctl.7

Log Message:
Document kern.uidinfo.semcnt.


To generate a diff of this commit:
cvs rdiff -u -r1.137 -r1.138 src/share/man/man7/sysctl.7

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

Modified files:

Index: src/share/man/man7/sysctl.7
diff -u src/share/man/man7/sysctl.7:1.137 src/share/man/man7/sysctl.7:1.138
--- src/share/man/man7/sysctl.7:1.137	Wed Dec  5 16:15:20 2018
+++ src/share/man/man7/sysctl.7	Thu Feb 28 22:05:08 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sysctl.7,v 1.137 2018/12/05 21:15:20 wiz Exp $
+.\"	$NetBSD: sysctl.7,v 1.138 2019/03/01 03:05:08 christos Exp $
 .\"
 .\" Copyright (c) 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	@(#)sysctl.3	8.4 (Berkeley) 5/9/95
 .\"
-.Dd December 5, 2018
+.Dd February 28, 2019
 .Dt SYSCTL 7
 .Os
 .Sh NAME
@@ -1269,6 +1269,7 @@ Resource usage for the current user.
 .It kern.uidinfo.proccnt	integer	no
 .It kern.uidinfo.lwpcnt	integer	no
 .It kern.uidinfo.lockcnt	integer	no
+.It kern.uidinfo.semcnt	integer	no
 .It kern.uidinfo.sbsize	integer	no
 .El
 .Bl -tag -width "123456"
@@ -1279,6 +1280,8 @@ Returns the number of active threads for
 of each process is not counted.
 .It Li kern.uidinfo.lockcnt
 Number of locks held by the current user.
+.It Li kern.uidinfo.semcnt
+Number of semaphores held by the current user.
 .It Li kern.uidinfo.sbsize
 Number of bytes in socket buffers allocated to the current user.
 .El



CVS commit: src/sys

2019-02-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Mar  1 03:03:19 UTC 2019

Modified Files:
src/sys/kern: kern_uidinfo.c uipc_sem.c
src/sys/sys: param.h proc.h uidinfo.h

Log Message:
PR/53998: Joel Bertrand:  Limit the number of semaphores on a
per-user basis not a per-process.  We cannot really keep track on
a per-process basis because a parent process can create the semaphore
and a child can free it taking credit for it.  There is also a
similar issue about resource exhaustion if we limited the number
of lwps per process as opposed to per user (which we don't).


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/kern/kern_uidinfo.c
cvs rdiff -u -r1.54 -r1.55 src/sys/kern/uipc_sem.c
cvs rdiff -u -r1.582 -r1.583 src/sys/sys/param.h
cvs rdiff -u -r1.350 -r1.351 src/sys/sys/proc.h
cvs rdiff -u -r1.3 -r1.4 src/sys/sys/uidinfo.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/kern/kern_uidinfo.c
diff -u src/sys/kern/kern_uidinfo.c:1.10 src/sys/kern/kern_uidinfo.c:1.11
--- src/sys/kern/kern_uidinfo.c:1.10	Sat Mar 18 01:49:56 2017
+++ src/sys/kern/kern_uidinfo.c	Thu Feb 28 22:03:19 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_uidinfo.c,v 1.10 2017/03/18 05:49:56 riastradh Exp $	*/
+/*	$NetBSD: kern_uidinfo.c,v 1.11 2019/03/01 03:03:19 christos Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1991, 1993
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_uidinfo.c,v 1.10 2017/03/18 05:49:56 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_uidinfo.c,v 1.11 2019/03/01 03:03:19 christos Exp $");
 
 #include 
 #include 
@@ -63,6 +63,7 @@ sysctl_kern_uidinfo_cnt(SYSCTLFN_ARGS)
 		_MEM(proccnt),
 		_MEM(lwpcnt),
 		_MEM(lockcnt),
+		_MEM(semcnt),
 		_MEM(sbsize),
 #undef _MEM
 	};
@@ -119,6 +120,12 @@ sysctl_kern_uidinfo_setup(void)
 		   CTL_CREATE, CTL_EOL);
 	sysctl_createv(_uidinfo_sysctllog, 0, , ,
 		   CTLFLAG_PERMANENT,
+		   CTLTYPE_QUAD, "semcnt",
+		   SYSCTL_DESCR("Number of semaphores used for the current user"),
+		   sysctl_kern_uidinfo_cnt, 0, NULL, 0,
+		   CTL_CREATE, CTL_EOL);
+	sysctl_createv(_uidinfo_sysctllog, 0, , ,
+		   CTLFLAG_PERMANENT,
 		   CTLTYPE_QUAD, "sbsize",
 		   SYSCTL_DESCR("Socket buffers used for the current user"),
 		   sysctl_kern_uidinfo_cnt, 0, NULL, 0,
@@ -219,6 +226,22 @@ chglwpcnt(uid_t uid, int diff)
 	return lwpcnt;
 }
 
+/*
+ * Change the count associated with number of semaphores
+ * a given user is using.
+ */
+int
+chgsemcnt(uid_t uid, int diff)
+{
+	struct uidinfo *uip;
+	long semcnt;
+
+	uip = uid_find(uid);
+	semcnt = atomic_add_long_nv(>ui_semcnt, diff);
+	KASSERT(semcnt >= 0);
+	return semcnt;
+}
+
 int
 chgsbsize(struct uidinfo *uip, u_long *hiwat, u_long to, rlim_t xmax)
 {

Index: src/sys/kern/uipc_sem.c
diff -u src/sys/kern/uipc_sem.c:1.54 src/sys/kern/uipc_sem.c:1.55
--- src/sys/kern/uipc_sem.c:1.54	Thu Feb 21 16:49:23 2019
+++ src/sys/kern/uipc_sem.c	Thu Feb 28 22:03:19 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_sem.c,v 1.54 2019/02/21 21:49:23 christos Exp $	*/
+/*	$NetBSD: uipc_sem.c,v 1.55 2019/03/01 03:03:19 christos Exp $	*/
 
 /*-
  * Copyright (c) 2011, 2019 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_sem.c,v 1.54 2019/02/21 21:49:23 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_sem.c,v 1.55 2019/03/01 03:03:19 christos Exp $");
 
 #include 
 #include 
@@ -85,6 +85,7 @@ __KERNEL_RCSID(0, "$NetBSD: uipc_sem.c,v
 #include 
 #include 
 #include 
+#include 
 #include 
 
 MODULE(MODULE_CLASS_MISC, ksem, NULL);
@@ -467,8 +468,10 @@ ksem_create(lwp_t *l, const char *name, 
 		len = 0;
 	}
 
-	if (atomic_inc_uint_nv(>l_proc->p_nsems) > SEM_NSEMS_MAX) {
-		atomic_dec_uint(>l_proc->p_nsems);
+	u_int cnt;
+	uid_t uid = kauth_cred_getuid(l->l_cred);
+	if ((cnt = chgsemcnt(uid, 1)) > SEM_NSEMS_MAX) {
+		chgsemcnt(uid, -1);
 		if (kname != NULL)
 			kmem_free(kname, len);
 		return ENOSPC;
@@ -511,7 +514,7 @@ ksem_free(ksem_t *ks)
 	kmem_free(ks, sizeof(ksem_t));
 
 	atomic_dec_uint(_total);
- 	atomic_dec_uint(>p_nsems);	
+	chgsemcnt(kauth_cred_getuid(curproc->p_cred), -1);
 }
 
 #define	KSEM_ID_IS_PSHARED(id)		\

Index: src/sys/sys/param.h
diff -u src/sys/sys/param.h:1.582 src/sys/sys/param.h:1.583
--- src/sys/sys/param.h:1.582	Sun Feb  3 03:02:25 2019
+++ src/sys/sys/param.h	Thu Feb 28 22:03:19 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.582 2019/02/03 08:02:25 pgoyette Exp $	*/
+/*	$NetBSD: param.h,v 1.583 2019/03/01 03:03:19 christos Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -67,7 +67,7 @@
  *	2.99.9		(299000900)
  */
 
-#define	__NetBSD_Version__	899003400	/* NetBSD 8.99.34 */
+#define	__NetBSD_Version__	899003500	/* NetBSD 8.99.35 */
 
 #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \
 (m) * 100) + (p) * 100) <= __NetBSD_Version__)

Index: src/sys/sys/proc.h
diff -u 

CVS commit: src/sys/arch/aarch64/aarch64

2019-02-28 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Mar  1 02:40:01 UTC 2019

Modified Files:
src/sys/arch/aarch64/aarch64: aarch32_syscall.c syscall.c

Log Message:
no need to include opt_multiprocessor.h here.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/aarch64/aarch64/aarch32_syscall.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/aarch64/aarch64/syscall.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/aarch64/aarch64/aarch32_syscall.c
diff -u src/sys/arch/aarch64/aarch64/aarch32_syscall.c:1.1 src/sys/arch/aarch64/aarch64/aarch32_syscall.c:1.2
--- src/sys/arch/aarch64/aarch64/aarch32_syscall.c:1.1	Fri Oct 12 01:28:57 2018
+++ src/sys/arch/aarch64/aarch64/aarch32_syscall.c	Fri Mar  1 02:40:01 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: aarch32_syscall.c,v 1.1 2018/10/12 01:28:57 ryo Exp $	*/
+/*	$NetBSD: aarch32_syscall.c,v 1.2 2019/03/01 02:40:01 mrg Exp $	*/
 
 /*
  * Copyright (c) 2018 Ryo Shimizu 
@@ -27,9 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aarch32_syscall.c,v 1.1 2018/10/12 01:28:57 ryo Exp $");
-
-#include "opt_multiprocessor.h"
+__KERNEL_RCSID(0, "$NetBSD: aarch32_syscall.c,v 1.2 2019/03/01 02:40:01 mrg Exp $");
 
 #include 
 #include 

Index: src/sys/arch/aarch64/aarch64/syscall.c
diff -u src/sys/arch/aarch64/aarch64/syscall.c:1.3 src/sys/arch/aarch64/aarch64/syscall.c:1.4
--- src/sys/arch/aarch64/aarch64/syscall.c:1.3	Tue Jul 17 00:36:30 2018
+++ src/sys/arch/aarch64/aarch64/syscall.c	Fri Mar  1 02:40:01 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: syscall.c,v 1.3 2018/07/17 00:36:30 christos Exp $	*/
+/*	$NetBSD: syscall.c,v 1.4 2019/03/01 02:40:01 mrg Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -29,7 +29,6 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include "opt_multiprocessor.h"
 /* DO NOT INCLUDE opt_compat_XXX.h */
 
 #include 
@@ -62,7 +61,7 @@
 #define EMULNAME(x)	(x)
 #define EMULNAMEU(x)	(x)
 
-__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.3 2018/07/17 00:36:30 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.4 2019/03/01 02:40:01 mrg Exp $");
 
 void
 cpu_spawn_return(struct lwp *l)



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

2019-02-28 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Mar  1 02:38:17 UTC 2019

Modified Files:
src/sys/arch/sparc64/dev: tda.c

Log Message:
make the conversion from degC to uK a macro instead of open
coding it 4 places.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/sparc64/dev/tda.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/sparc64/dev/tda.c
diff -u src/sys/arch/sparc64/dev/tda.c:1.12 src/sys/arch/sparc64/dev/tda.c:1.13
--- src/sys/arch/sparc64/dev/tda.c:1.12	Sat Jun 16 21:22:13 2018
+++ src/sys/arch/sparc64/dev/tda.c	Fri Mar  1 02:38:17 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: tda.c,v 1.12 2018/06/16 21:22:13 thorpej Exp $	*/
+/*	$NetBSD: tda.c,v 1.13 2019/03/01 02:38:17 mrg Exp $	*/
 /*	$OpenBSD: tda.c,v 1.4 2008/02/27 17:25:00 robert Exp $ */
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tda.c,v 1.12 2018/06/16 21:22:13 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tda.c,v 1.13 2019/03/01 02:38:17 mrg Exp $");
 
 #include 
 #include 
@@ -52,10 +52,12 @@ __KERNEL_RCSID(0, "$NetBSD: tda.c,v 1.12
 #define SENSOR_FAN_CPU		0
 #define SENSOR_FAN_SYS		1
 
-#define CPU_TEMP_MAX		(67 * 100 + 27315)
-#define CPU_TEMP_MIN		(57 * 100 + 27315)
-#define SYS_TEMP_MAX		(30 * 100 + 27315)
-#define SYS_TEMP_MIN		(20 * 100 + 27315)
+#define DEGC_TO_mK(c)		(((c) * 100) + 27315)
+
+#define CPU_TEMP_MAX		DEGC_TO_mK(67)
+#define CPU_TEMP_MIN		DEGC_TO_mK(57)
+#define SYS_TEMP_MAX		DEGC_TO_mK(30)
+#define SYS_TEMP_MIN		DEGC_TO_mK(20)
 
 struct tda_softc {
 	device_t		sc_dev;



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

2019-02-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Mar  1 02:33:55 UTC 2019

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

Log Message:
since SX can trigger NMIs dump the status and error registers along with
the rest if sx is present.


To generate a diff of this commit:
cvs rdiff -u -r1.120 -r1.121 src/sys/arch/sparc/sparc/intr.c

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

Modified files:

Index: src/sys/arch/sparc/sparc/intr.c
diff -u src/sys/arch/sparc/sparc/intr.c:1.120 src/sys/arch/sparc/sparc/intr.c:1.121
--- src/sys/arch/sparc/sparc/intr.c:1.120	Mon Feb  4 09:57:39 2019
+++ src/sys/arch/sparc/sparc/intr.c	Fri Mar  1 02:33:55 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.120 2019/02/04 09:57:39 mrg Exp $ */
+/*	$NetBSD: intr.c,v 1.121 2019/03/01 02:33:55 macallan Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -41,10 +41,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.120 2019/02/04 09:57:39 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.121 2019/03/01 02:33:55 macallan Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_sparc_arch.h"
+#include "sx.h"
 
 #include 
 #include 
@@ -70,6 +71,11 @@ __KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.1
 #include 
 #endif
 
+#if NSX > 0
+#include 
+#include 
+#endif
+
 #if defined(MULTIPROCESSOR)
 static int intr_biglock_wrapper(void *);
 
@@ -255,7 +261,10 @@ nmi_hard(void)
 	si = *((uint32_t *)ICR_SI_PEND);
 	snprintb(bits, sizeof(bits), SINTR_BITS, si);
 	printf("cpu%d: NMI: system interrupts: %s\n", cpu_number(), bits);
-		
+
+#if NSX > 0
+	sx_dump();
+#endif
 
 	if ((si & SINTR_M) != 0) {
 		/* ECC memory error */



CVS commit: src/sbin/atactl

2019-02-28 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Mar  1 02:33:43 UTC 2019

Modified Files:
src/sbin/atactl: atactl.c

Log Message:
add some intel specific smart values, and be more specific for
a bunch of micron/crucial values.


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.80 src/sbin/atactl/atactl.c

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

Modified files:

Index: src/sbin/atactl/atactl.c
diff -u src/sbin/atactl/atactl.c:1.79 src/sbin/atactl/atactl.c:1.80
--- src/sbin/atactl/atactl.c:1.79	Wed Dec  5 06:49:54 2018
+++ src/sbin/atactl/atactl.c	Fri Mar  1 02:33:43 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: atactl.c,v 1.79 2018/12/05 06:49:54 mrg Exp $	*/
+/*	$NetBSD: atactl.c,v 1.80 2019/03/01 02:33:43 mrg Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: atactl.c,v 1.79 2018/12/05 06:49:54 mrg Exp $");
+__RCSID("$NetBSD: atactl.c,v 1.80 2019/03/01 02:33:43 mrg Exp $");
 #endif
 
 
@@ -299,7 +299,7 @@ static const struct attr_table {
 	{ 180,  "Unused Reserved Block Count", NULL },
 	{ 181,  "Program Fail Count", NULL },
 	{ 182,  "Erase Fail Count", NULL },
-	{ 183,  "SATA Downshift Error Count", NULL },
+	{ 183,  "Runtime Bad Block", NULL },
 	{ 184,  "End-to-end error", NULL },
 	{ 185,  "Head Stability", NULL },
 	{ 186,  "Induced Op-Vibration Detection", NULL },
@@ -360,6 +360,7 @@ static const struct attr_table micron_sm
 	{   5,		"Reallocated NAND block count", NULL },
 	{ 173,  "Average block erase count", NULL },
 	{ 181,  "Non 4K aligned access count", NULL },
+	{ 183,  "SATA Downshift Error Count", NULL },
 	{ 184,  "Error correction count", NULL },
 	{ 189,  "Factory bad block count", NULL },
 	{ 197,		"Current pending ECC count", NULL },
@@ -372,15 +373,43 @@ static const struct attr_table micron_sm
 };
 
 /*
+ * Intel specific SMART attributes.  Fill me in with more.
+ */
+static const struct attr_table intel_smart_names[] = {
+	{ 183,  "SATA Downshift Error Count", NULL },
+};
+
+/*
  * Vendor-specific SMART attribute table.  Can be used to override
  * a particular attribute name and special printer function, with the
  * default is the main table.
  */
-const struct vendor_name_table {
+static const struct vendor_name_table {
 	const char *name;
 	const struct attr_table *table;
 } vendor_smart_names[] = {
-	{ .name = "Micron", .table = micron_smart_names },
+	{ "Micron",		micron_smart_names },
+	{ "Intel",		intel_smart_names },
+};
+
+/*
+ * Global model -> vendor table.  Extend this to regexp.
+ */
+static const struct model_to_vendor_table {
+	const char *model;
+	const char *vendor;
+} model_to_vendor[] = {
+	{ "Crucial",		"Micron" },
+	{ "Micron",		"Micron" },
+	{ "C300-CT",		"Micron" },
+	{ "C400-MT",		"Micron" },
+	{ "M4-CT",		"Micron" },
+	{ "M500",		"Micron" },
+	{ "M510",		"Micron" },
+	{ "M550",		"Micron" },
+	{ "MTFDDA",		"Micron" },
+	{ "EEFDDA",		"Micron" },
+	{ "INTEL",		"Intel" },
 };
 
 static const struct bitinfo ata_sec_st[] = {
@@ -1009,21 +1038,7 @@ compute_capacity(uint64_t *capacityp, ui
 static const char *
 guess_vendor(void)
 {
-	struct {
-		const char *model;
-		const char *vendor;
-	} model_to_vendor[] = {
-		{ "Crucial", "Micron" },
-		{ "Micron", "Micron" },
-		{ "C300-CT", "Micron" },
-		{ "C400-MT", "Micron" },
-		{ "M4-CT", "Micron" },
-		{ "M500", "Micron" },
-		{ "M510", "Micron" },
-		{ "M550", "Micron" },
-		{ "MTFDDA", "Micron" },
-		{ "EEFDDA", "Micron" },
-	};
+
 	unsigned i;
 
 	for (i = 0; i < __arraycount(model_to_vendor); i++)



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

2019-02-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Mar  1 02:30:42 UTC 2019

Modified Files:
src/sys/arch/sparc/dev: sx.c sxvar.h

Log Message:
adapt to changes in sxreg.h


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/sparc/dev/sx.c \
src/sys/arch/sparc/dev/sxvar.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/arch/sparc/dev/sx.c
diff -u src/sys/arch/sparc/dev/sx.c:1.3 src/sys/arch/sparc/dev/sx.c:1.4
--- src/sys/arch/sparc/dev/sx.c:1.3	Tue Apr 15 10:24:54 2014
+++ src/sys/arch/sparc/dev/sx.c	Fri Mar  1 02:30:42 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: sx.c,v 1.3 2014/04/15 10:24:54 macallan Exp $	*/
+/*	$NetBSD: sx.c,v 1.4 2019/03/01 02:30:42 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sx.c,v 1.3 2014/04/15 10:24:54 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sx.c,v 1.4 2019/03/01 02:30:42 macallan Exp $");
 
 #include "locators.h"
 
@@ -49,6 +49,7 @@ __KERNEL_RCSID(0, "$NetBSD: sx.c,v 1.3 2
 #include 
 #include 
 #include 
+#include "opt_sx.h"
 
 /* autoconfiguration driver */
 static	int sx_match(device_t, struct cfdata *, void *);
@@ -57,6 +58,8 @@ static	void sx_attach(device_t, device_t
 CFATTACH_DECL_NEW(sx, sizeof(struct sx_softc),
 sx_match, sx_attach, NULL, NULL);
 
+static struct sx_softc *sx0 = NULL;
+
 static int
 sx_match(device_t parent, struct cfdata *cf, void *aux)
 {
@@ -90,7 +93,7 @@ sx_attach(device_t parent, device_t self
 	id = sx_read(sc, SX_ID);
 	aprint_normal_dev(self, "architecture rev. %d chip rev. %d\n",
 	(id & SX_ARCHITECTURE_MASK),
-	(id & SX_CHIP_REVISION) >> 8);
+	(id & SX_CHIP_REVISION) >> 3);
 
 	/* stop the processor */
 	sx_write(sc, SX_CONTROL_STATUS, 0);
@@ -114,6 +117,8 @@ sx_attach(device_t parent, device_t self
 	/* ... and start the processor again */
 	sx_write(sc, SX_CONTROL_STATUS, SX_PB | SX_GO);
 
+	sx0 = sc;
+
 #ifdef SX_DEBUG
 	sta(0xfc00, ASI_SX, SX_LD(8, 31, 0));
 	for (i = 1; i < 60; i++)
@@ -143,3 +148,15 @@ sx_attach(device_t parent, device_t self
 #endif
 }
 
+void
+sx_dump(void)
+{
+	if (sx0 == NULL)
+		return;
+	printf("SX STATUS: %08x\n",
+	bus_space_read_4(sx0->sc_tag, sx0->sc_regh, SX_CONTROL_STATUS));
+	printf("SX ERROR : %08x\n",
+	bus_space_read_4(sx0->sc_tag, sx0->sc_regh, SX_ERROR));
+	printf("SX DIAG  : %08x\n",
+	bus_space_read_4(sx0->sc_tag, sx0->sc_regh, SX_DIAGNOSTICS));
+}
Index: src/sys/arch/sparc/dev/sxvar.h
diff -u src/sys/arch/sparc/dev/sxvar.h:1.3 src/sys/arch/sparc/dev/sxvar.h:1.4
--- src/sys/arch/sparc/dev/sxvar.h:1.3	Sun Jun 29 03:57:10 2014
+++ src/sys/arch/sparc/dev/sxvar.h	Fri Mar  1 02:30:42 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: sxvar.h,v 1.3 2014/06/29 03:57:10 tsutsui Exp $	*/
+/*	$NetBSD: sxvar.h,v 1.4 2019/03/01 02:30:42 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -51,4 +51,6 @@ sx_read(struct sx_softc *sc, int addr)
 	return bus_space_read_4(sc->sc_tag, sc->sc_regh, addr);
 }
 
+void sx_dump(void);
+
 #endif



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

2019-02-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Mar  1 02:28:27 UTC 2019

Modified Files:
src/sys/arch/sparc/conf: files.sparc

Log Message:
defflag SX_DEBUG


To generate a diff of this commit:
cvs rdiff -u -r1.158 -r1.159 src/sys/arch/sparc/conf/files.sparc

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

Modified files:

Index: src/sys/arch/sparc/conf/files.sparc
diff -u src/sys/arch/sparc/conf/files.sparc:1.158 src/sys/arch/sparc/conf/files.sparc:1.159
--- src/sys/arch/sparc/conf/files.sparc:1.158	Wed Dec 19 13:57:49 2018
+++ src/sys/arch/sparc/conf/files.sparc	Fri Mar  1 02:28:27 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: files.sparc,v 1.158 2018/12/19 13:57:49 maxv Exp $
+#	$NetBSD: files.sparc,v 1.159 2019/03/01 02:28:27 macallan Exp $
 
 # @(#)files.sparc	8.1 (Berkeley) 7/19/93
 # sparc-specific configuration info
@@ -122,6 +122,7 @@ file	arch/sparc/sparc/memecc.c		eccmemct
 device sx {}
 attach sx at mainbus
 file	arch/sparc/dev/sx.c			sx needs-flag
+defflag	opt_sx.h	SX_DEBUG
 
 device tctrl: sysmon_envsys, sysmon_power, sysmon_taskq
 attach tctrl at obio



CVS commit: xsrc/external/mit/xf86-video-suncg14/dist/src

2019-02-28 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Fri Mar  1 02:22:27 UTC 2019

Modified Files:
xsrc/external/mit/xf86-video-suncg14/dist/src: cg14_accel.c

Log Message:
poll SX_BZ instead of SX_MT, also complain and dump register info if CG14Wait()
times out.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c

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

Modified files:

Index: xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.13 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.14
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.13	Thu Dec  7 19:23:22 2017
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c	Fri Mar  1 02:22:27 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: cg14_accel.c,v 1.13 2017/12/07 19:23:22 macallan Exp $ */
+/* $NetBSD: cg14_accel.c,v 1.14 2019/03/01 02:22:27 macallan Exp $ */
 /*
  * Copyright (c) 2013 Michael Lorenz
  * All rights reserved.
@@ -69,8 +69,17 @@ static void CG14Copy8(PixmapPtr, int, in
 static inline void
 CG14Wait(Cg14Ptr p)
 {
-	/* we just wait until the instruction queue is empty */
-	while ((read_sx_reg(p, SX_CONTROL_STATUS) & SX_MT) != 0) {};
+	int bail = 1000;
+	/* we wait for the busy bit to clear */
+	while (((read_sx_reg(p, SX_CONTROL_STATUS) & SX_BZ) != 0) &&
+	   (bail > 0)) {
+		bail--;
+	};
+	if (bail == 0) {
+		xf86Msg(X_ERROR, "SX wait for idle timed out %08x %08x\n",
+		read_sx_reg(p, SX_CONTROL_STATUS),
+		read_sx_reg(p, SX_ERROR));
+	}
 }
 
 static void



CVS commit: src/external/mpl/bind

2019-02-28 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Feb 28 22:18:21 UTC 2019

Modified Files:
src/external/mpl/bind: Makefile.inc
src/external/mpl/bind/lib/libisc: Makefile

Log Message:
Disable warning about atomic alignment for all bind. It's used too
often.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/mpl/bind/Makefile.inc
cvs rdiff -u -r1.7 -r1.8 src/external/mpl/bind/lib/libisc/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/mpl/bind/Makefile.inc
diff -u src/external/mpl/bind/Makefile.inc:1.3 src/external/mpl/bind/Makefile.inc:1.4
--- src/external/mpl/bind/Makefile.inc:1.3	Wed Jan  9 16:54:58 2019
+++ src/external/mpl/bind/Makefile.inc	Thu Feb 28 22:18:21 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.3 2019/01/09 16:54:58 christos Exp $
+#	$NetBSD: Makefile.inc,v 1.4 2019/02/28 22:18:21 joerg Exp $
 
 .if !defined(BIND9_MAKEFILE_INC)
 BIND9_MAKEFILE_INC=yes
@@ -9,7 +9,8 @@ USE_FORT?= yes	# network client/server
 
 WARNS?=	1
 
-CWARNFLAGS.clang+=	-Wno-unused-value -Wno-parentheses
+CWARNFLAGS.clang+=	-Wno-unused-value -Wno-parentheses \
+			-Wno-atomic-alignment
 
 .include 
 

Index: src/external/mpl/bind/lib/libisc/Makefile
diff -u src/external/mpl/bind/lib/libisc/Makefile:1.7 src/external/mpl/bind/lib/libisc/Makefile:1.8
--- src/external/mpl/bind/lib/libisc/Makefile:1.7	Thu Feb 28 17:40:06 2019
+++ src/external/mpl/bind/lib/libisc/Makefile	Thu Feb 28 22:18:21 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.7 2019/02/28 17:40:06 christos Exp $
+#	$NetBSD: Makefile,v 1.8 2019/02/28 22:18:21 joerg Exp $
 
 LIB=isc
 #USE_SHLIBDIR=   yes
@@ -36,21 +36,11 @@ SRCS=		assertions.c base32.c base64.c bi
 		taskpool.c timer.c tm.c version.c \
 		${UNIX_SRCS} ${PTHREAD_SRCS} ${CRYPTO_SRCS}
 
-
-
 .if (${USE_INET6} == "no")
 CPPFLAGS.net.c=	-Wno-error
 SRCS+=		ipv6.c
 .endif
 
-# On certain flavors of arm we don't have native atomics only ones
-# libcall ones which are inefficient. But this should not be an
-# error anyway.
-COPTS.mem.c+= ${${ACTIVE_CC} == "clang":? -Wno-error-atomic-alignment :}
-COPTS.counter.c+= ${${ACTIVE_CC} == "clang":? -Wno-error-atomic-alignment :}
-
-
-
 LDADD+=-lz
 DPADD+=${LIBZ}
 



CVS commit: src/usr.bin/tip

2019-02-28 Thread Andreas Gustafsson
Module Name:src
Committed By:   gson
Date:   Thu Feb 28 17:41:27 UTC 2019

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

Log Message:
Make xgetchar() return an int like getchar() does, and remove needless cast.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/usr.bin/tip/tip.c

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

Modified files:

Index: src/usr.bin/tip/tip.c
diff -u src/usr.bin/tip/tip.c:1.61 src/usr.bin/tip/tip.c:1.62
--- src/usr.bin/tip/tip.c:1.61	Fri Feb 22 22:25:22 2019
+++ src/usr.bin/tip/tip.c	Thu Feb 28 17:41:27 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: tip.c,v 1.61 2019/02/22 22:25:22 uwe Exp $	*/
+/*	$NetBSD: tip.c,v 1.62 2019/02/28 17:41:27 gson Exp $	*/
 
 /*
  * Copyright (c) 1983, 1993
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)tip.c	8.1 (Berkeley) 6/6/93";
 #endif
-__RCSID("$NetBSD: tip.c,v 1.61 2019/02/22 22:25:22 uwe Exp $");
+__RCSID("$NetBSD: tip.c,v 1.62 2019/02/28 17:41:27 gson Exp $");
 #endif /* not lint */
 
 /*
@@ -332,7 +332,7 @@ intprompt(int dummy __unused)
 /*
  * getchar() wrapper that checks for EOF on the local end.
  */
-static char
+static int
 xgetchar(void)
 {
 	int c = getchar();
@@ -341,7 +341,7 @@ xgetchar(void)
 		/* NOTREACHED */
 	}
 
-	return (char)c & STRIP_PAR;
+	return c & STRIP_PAR;
 }
 
 



CVS commit: src/external/mpl/bind/lib/libisc

2019-02-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Feb 28 17:40:06 UTC 2019

Modified Files:
src/external/mpl/bind/lib/libisc: Makefile

Log Message:
one more for the atomic references on clang.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/mpl/bind/lib/libisc/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/mpl/bind/lib/libisc/Makefile
diff -u src/external/mpl/bind/lib/libisc/Makefile:1.6 src/external/mpl/bind/lib/libisc/Makefile:1.7
--- src/external/mpl/bind/lib/libisc/Makefile:1.6	Sun Feb 24 15:01:33 2019
+++ src/external/mpl/bind/lib/libisc/Makefile	Thu Feb 28 12:40:06 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.6 2019/02/24 20:01:33 christos Exp $
+#	$NetBSD: Makefile,v 1.7 2019/02/28 17:40:06 christos Exp $
 
 LIB=isc
 #USE_SHLIBDIR=   yes
@@ -47,6 +47,7 @@ SRCS+=		ipv6.c
 # libcall ones which are inefficient. But this should not be an
 # error anyway.
 COPTS.mem.c+= ${${ACTIVE_CC} == "clang":? -Wno-error-atomic-alignment :}
+COPTS.counter.c+= ${${ACTIVE_CC} == "clang":? -Wno-error-atomic-alignment :}
 
 
 



CVS commit: src/sys/dev

2019-02-28 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Thu Feb 28 16:56:35 UTC 2019

Modified Files:
src/sys/dev/i2c: sdtemp.c
src/sys/dev/pci: if_wm.c if_wmreg.h pci_subr.c

Log Message:
Typo (s/vaule/value/)


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/i2c/sdtemp.c
cvs rdiff -u -r1.628 -r1.629 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.112 -r1.113 src/sys/dev/pci/if_wmreg.h
cvs rdiff -u -r1.210 -r1.211 src/sys/dev/pci/pci_subr.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/i2c/sdtemp.c
diff -u src/sys/dev/i2c/sdtemp.c:1.34 src/sys/dev/i2c/sdtemp.c:1.35
--- src/sys/dev/i2c/sdtemp.c:1.34	Sat Jun 16 21:22:13 2018
+++ src/sys/dev/i2c/sdtemp.c	Thu Feb 28 16:56:35 2019
@@ -1,4 +1,4 @@
-/*  $NetBSD: sdtemp.c,v 1.34 2018/06/16 21:22:13 thorpej Exp $*/
+/*  $NetBSD: sdtemp.c,v 1.35 2019/02/28 16:56:35 khorben Exp $*/
 
 /*
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sdtemp.c,v 1.34 2018/06/16 21:22:13 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdtemp.c,v 1.35 2019/02/28 16:56:35 khorben Exp $");
 
 #include 
 #include 
@@ -297,7 +297,7 @@ sdtemp_attach(device_t parent, device_t 
 	 * IDT's devices and some Microchip's devices have the resolution
 	 * register in the vendor specific registers area. The devices'
 	 * resolution bits in the capability register are not the maximum
-	 * resolution but the current vaule of the setting.
+	 * resolution but the current value of the setting.
 	 */
 	if (sdtemp_dev_table[i].sdtemp_config != NULL)
 		sdtemp_dev_table[i].sdtemp_config(sc);

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.628 src/sys/dev/pci/if_wm.c:1.629
--- src/sys/dev/pci/if_wm.c:1.628	Sat Feb 23 11:41:08 2019
+++ src/sys/dev/pci/if_wm.c	Thu Feb 28 16:56:35 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.628 2019/02/23 11:41:08 kamil Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.629 2019/02/28 16:56:35 khorben Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.628 2019/02/23 11:41:08 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.629 2019/02/28 16:56:35 khorben Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -13482,7 +13482,7 @@ wm_nvm_version(struct wm_softc *sc)
 	 *	82572EI	0x5069	5.6.9?
 	 *	82574L	0x1080	1.8.0?	(the spec update notes about 2.1.4)
 	 *		0x2013	2.1.3?
-	 *	82583	0x10a0	1.10.0? (document says it's default vaule)
+	 *	82583	0x10a0	1.10.0? (document says it's default value)
 	 */
 
 	/*

Index: src/sys/dev/pci/if_wmreg.h
diff -u src/sys/dev/pci/if_wmreg.h:1.112 src/sys/dev/pci/if_wmreg.h:1.113
--- src/sys/dev/pci/if_wmreg.h:1.112	Thu Jan 31 05:20:49 2019
+++ src/sys/dev/pci/if_wmreg.h	Thu Feb 28 16:56:35 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wmreg.h,v 1.112 2019/01/31 05:20:49 msaitoh Exp $	*/
+/*	$NetBSD: if_wmreg.h,v 1.113 2019/02/28 16:56:35 khorben Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -1493,7 +1493,7 @@ struct livengood_tcpip_ctxdesc {
 #define WM_INVM_DATA_REG(reg)	(0x12120 + 4*(reg))
 #define INVM_SIZE			64 /* Number of INVM Data Registers */
 
-/* iNVM default vaule */
+/* iNVM default value */
 #define NVM_INIT_CTRL_2_DEFAULT_I211	0x7243
 #define NVM_INIT_CTRL_4_DEFAULT_I211	0x00c1
 #define NVM_LED_1_CFG_DEFAULT_I211	0x0184

Index: src/sys/dev/pci/pci_subr.c
diff -u src/sys/dev/pci/pci_subr.c:1.210 src/sys/dev/pci/pci_subr.c:1.211
--- src/sys/dev/pci/pci_subr.c:1.210	Fri Nov 30 10:18:37 2018
+++ src/sys/dev/pci/pci_subr.c	Thu Feb 28 16:56:35 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_subr.c,v 1.210 2018/11/30 10:18:37 msaitoh Exp $	*/
+/*	$NetBSD: pci_subr.c,v 1.211 2019/02/28 16:56:35 khorben Exp $	*/
 
 /*
  * Copyright (c) 1997 Zubin D. Dittia.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.210 2018/11/30 10:18:37 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.211 2019/02/28 16:56:35 khorben Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -3726,7 +3726,7 @@ pci_conf_print_tph_req_cap(const pcireg_
 		printf("Device Specific Mode\n");
 		break;
 	default:
-		printf("(reserved vaule)\n");
+		printf("(reserved value)\n");
 		break;
 	}
 	printf("  TPH Requester Enable: ");
@@ -3741,7 +3741,7 @@ pci_conf_print_tph_req_cap(const pcireg_
 		printf("TPH and Extended TPH");
 		break;
 	default:
-		printf("(reserved vaule)\n");
+		printf("(reserved value)\n");
 		break;
 	}
 



CVS commit: src/external/gpl3/gcc/lib/libgcc/arch/riscv64

2019-02-28 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Feb 28 09:50:03 UTC 2019

Modified Files:
src/external/gpl3/gcc/lib/libgcc/arch/riscv64: gthr-defs.mk

Log Message:
basic mknative bootstrap-libgcc for riscv64


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/external/gpl3/gcc/lib/libgcc/arch/riscv64/gthr-defs.mk

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

Modified files:

Index: src/external/gpl3/gcc/lib/libgcc/arch/riscv64/gthr-defs.mk
diff -u src/external/gpl3/gcc/lib/libgcc/arch/riscv64/gthr-defs.mk:1.2 src/external/gpl3/gcc/lib/libgcc/arch/riscv64/gthr-defs.mk:1.3
--- src/external/gpl3/gcc/lib/libgcc/arch/riscv64/gthr-defs.mk:1.2	Wed Feb 27 08:22:43 2019
+++ src/external/gpl3/gcc/lib/libgcc/arch/riscv64/gthr-defs.mk	Thu Feb 28 09:50:02 2019
@@ -1,9 +1,9 @@
 # This file is automatically generated.  DO NOT EDIT!
-# Generated from: NetBSD: mknative-gcc,v 1.97 2019/02/01 09:27:23 mrg Exp 
+# Generated from: NetBSD: mknative-gcc,v 1.101 2019/02/23 06:54:45 mrg Exp 
 # Generated from: NetBSD: mknative.common,v 1.16 2018/04/15 15:13:37 christos Exp 
 #
 G_enable_execute_stack=enable-execute-stack-mprotect.c
 G_unwind_header=unwind-generic.h
 G_md_unwind_header=no-unwind.h
-G_sfp_machine_header=no-sfp-machine.h
+G_sfp_machine_header=riscv/sfp-machine.h
 G_thread_header=gthr-posix.h



CVS commit: src/external/gpl3/gcc/usr.bin/gcc/arch/riscv64

2019-02-28 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Feb 28 09:49:14 UTC 2019

Modified Files:
src/external/gpl3/gcc/usr.bin/gcc/arch/riscv64: auto-host.h tm.h

Log Message:
basic mknative bootstrap-libgcc for riscv64


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/external/gpl3/gcc/usr.bin/gcc/arch/riscv64/auto-host.h
cvs rdiff -u -r1.2 -r1.3 src/external/gpl3/gcc/usr.bin/gcc/arch/riscv64/tm.h

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

Modified files:

Index: src/external/gpl3/gcc/usr.bin/gcc/arch/riscv64/auto-host.h
diff -u src/external/gpl3/gcc/usr.bin/gcc/arch/riscv64/auto-host.h:1.3 src/external/gpl3/gcc/usr.bin/gcc/arch/riscv64/auto-host.h:1.4
--- src/external/gpl3/gcc/usr.bin/gcc/arch/riscv64/auto-host.h:1.3	Sun Feb 10 07:57:22 2019
+++ src/external/gpl3/gcc/usr.bin/gcc/arch/riscv64/auto-host.h	Thu Feb 28 09:49:14 2019
@@ -1,5 +1,5 @@
 /* This file is automatically generated.  DO NOT EDIT! */
-/* Generated from: NetBSD: mknative-gcc,v 1.100 2019/02/09 03:57:00 mrg Exp  */
+/* Generated from: NetBSD: mknative-gcc,v 1.101 2019/02/23 06:54:45 mrg Exp  */
 /* Generated from: NetBSD: mknative.common,v 1.16 2018/04/15 15:13:37 christos Exp  */
 
 /* auto-host.h.  Generated from config.in by configure.  */
@@ -1802,7 +1802,7 @@
 
 
 /* Define if your target C library provides sys/sdt.h */
-/* #undef HAVE_SYS_SDT_H */
+#define HAVE_SYS_SDT_H 1
 
 /* Define to 1 if you have the  header file. */
 #ifndef USED_FOR_TARGET

Index: src/external/gpl3/gcc/usr.bin/gcc/arch/riscv64/tm.h
diff -u src/external/gpl3/gcc/usr.bin/gcc/arch/riscv64/tm.h:1.2 src/external/gpl3/gcc/usr.bin/gcc/arch/riscv64/tm.h:1.3
--- src/external/gpl3/gcc/usr.bin/gcc/arch/riscv64/tm.h:1.2	Sun Feb 10 07:57:22 2019
+++ src/external/gpl3/gcc/usr.bin/gcc/arch/riscv64/tm.h	Thu Feb 28 09:49:14 2019
@@ -1,5 +1,5 @@
 /* This file is automatically generated.  DO NOT EDIT! */
-/* Generated from: NetBSD: mknative-gcc,v 1.100 2019/02/09 03:57:00 mrg Exp  */
+/* Generated from: NetBSD: mknative-gcc,v 1.101 2019/02/23 06:54:45 mrg Exp  */
 /* Generated from: NetBSD: mknative.common,v 1.16 2018/04/15 15:13:37 christos Exp  */
 
 #ifndef GCC_TM_H
@@ -19,6 +19,12 @@
 #ifndef NETBSD_ENABLE_PTHREADS
 # define NETBSD_ENABLE_PTHREADS
 #endif
+#ifndef CHAR_FAST8
+# define CHAR_FAST8 1
+#endif
+#ifndef SHORT_FAST16
+# define SHORT_FAST16 1
+#endif
 #ifdef IN_GCC
 # include "options.h"
 # include "insn-constants.h"



CVS commit: src/libexec/httpd

2019-02-28 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Feb 28 09:16:42 UTC 2019

Modified Files:
src/libexec/httpd: CHANGES bozohttpd.c

Log Message:
call this bozohttpd 20190228, and merge the CHANGES entries from the
previous release.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/libexec/httpd/CHANGES
cvs rdiff -u -r1.112 -r1.113 src/libexec/httpd/bozohttpd.c

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

Modified files:

Index: src/libexec/httpd/CHANGES
diff -u src/libexec/httpd/CHANGES:1.39 src/libexec/httpd/CHANGES:1.40
--- src/libexec/httpd/CHANGES:1.39	Sun Jan 27 04:40:57 2019
+++ src/libexec/httpd/CHANGES	Thu Feb 28 09:16:42 2019
@@ -1,10 +1,11 @@
-$NetBSD: CHANGES,v 1.39 2019/01/27 04:40:57 dholland Exp $
+$NetBSD: CHANGES,v 1.40 2019/02/28 09:16:42 mrg Exp $
 
-changes in bozohttpd 20190121:
+changes in bozohttpd 20190228:
+	o  extend timeout facility to ssl and stop servers hanging forever
+	   if the client never sends anything.  reported by Steffen in netbsd
+	   PR#50655.
 	o  don't display special files in the directory index.  they aren't
 	   served, but links to them are generated.
-
-changes in bozohttpd 20190116:
 	o  fix CGI '+' parameter handling, some error checking, and a double
 	   free.  from rajeev_v_pil...@yahoo.com
 	o  more directory indexing clean up.  from rajeev_v_pil...@yahoo.com

Index: src/libexec/httpd/bozohttpd.c
diff -u src/libexec/httpd/bozohttpd.c:1.112 src/libexec/httpd/bozohttpd.c:1.113
--- src/libexec/httpd/bozohttpd.c:1.112	Thu Feb 28 08:28:21 2019
+++ src/libexec/httpd/bozohttpd.c	Thu Feb 28 09:16:42 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: bozohttpd.c,v 1.112 2019/02/28 08:28:21 mrg Exp $	*/
+/*	$NetBSD: bozohttpd.c,v 1.113 2019/02/28 09:16:42 mrg Exp $	*/
 
 /*	$eterna: bozohttpd.c,v 1.178 2011/11/18 09:21:15 mrg Exp $	*/
 
@@ -109,7 +109,7 @@
 #define INDEX_HTML		"index.html"
 #endif
 #ifndef SERVER_SOFTWARE
-#define SERVER_SOFTWARE		"bozohttpd/20190121"
+#define SERVER_SOFTWARE		"bozohttpd/20190228"
 #endif
 #ifndef PUBLIC_HTML
 #define PUBLIC_HTML		"public_html"



CVS commit: src/libexec/httpd

2019-02-28 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Feb 28 08:28:22 UTC 2019

Modified Files:
src/libexec/httpd: auth-bozo.c bozohttpd.8 bozohttpd.c bozohttpd.h
dir-index-bozo.c ssl-bozo.c

Log Message:
add ssl specific timeout value (30s).  if SSL_accept() doesn't
work with in this timeout value, ssl setup now fails.

mostly different from, but inspired from the patch in PR 50655


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/libexec/httpd/auth-bozo.c
cvs rdiff -u -r1.78 -r1.79 src/libexec/httpd/bozohttpd.8
cvs rdiff -u -r1.111 -r1.112 src/libexec/httpd/bozohttpd.c
cvs rdiff -u -r1.58 -r1.59 src/libexec/httpd/bozohttpd.h
cvs rdiff -u -r1.31 -r1.32 src/libexec/httpd/dir-index-bozo.c
cvs rdiff -u -r1.25 -r1.26 src/libexec/httpd/ssl-bozo.c

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

Modified files:

Index: src/libexec/httpd/auth-bozo.c
diff -u src/libexec/httpd/auth-bozo.c:1.23 src/libexec/httpd/auth-bozo.c:1.24
--- src/libexec/httpd/auth-bozo.c:1.23	Tue Jan 22 05:32:57 2019
+++ src/libexec/httpd/auth-bozo.c	Thu Feb 28 08:28:21 2019
@@ -1,9 +1,9 @@
-/*	$NetBSD: auth-bozo.c,v 1.23 2019/01/22 05:32:57 mrg Exp $	*/
+/*	$NetBSD: auth-bozo.c,v 1.24 2019/02/28 08:28:21 mrg Exp $	*/
 
 /*	$eterna: auth-bozo.c,v 1.17 2011/11/18 09:21:15 mrg Exp $	*/
 
 /*
- * Copyright (c) 1997-2018 Matthew R. Green
+ * Copyright (c) 1997-2019 Matthew R. Green
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Index: src/libexec/httpd/bozohttpd.8
diff -u src/libexec/httpd/bozohttpd.8:1.78 src/libexec/httpd/bozohttpd.8:1.79
--- src/libexec/httpd/bozohttpd.8:1.78	Thu Jan 17 07:46:16 2019
+++ src/libexec/httpd/bozohttpd.8	Thu Feb 28 08:28:21 2019
@@ -1,8 +1,8 @@
-.\"	$NetBSD: bozohttpd.8,v 1.78 2019/01/17 07:46:16 mrg Exp $
+.\"	$NetBSD: bozohttpd.8,v 1.79 2019/02/28 08:28:21 mrg Exp $
 .\"
 .\"	$eterna: bozohttpd.8,v 1.101 2011/11/18 01:25:11 mrg Exp $
 .\"
-.\" Copyright (c) 1997-2018 Matthew R. Green
+.\" Copyright (c) 1997-2019 Matthew R. Green
 .\" All rights reserved.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
@@ -26,7 +26,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd January 7, 2019
+.Dd February 27, 2019
 .Dt BOZOHTTPD 8
 .Os
 .Sh NAME
@@ -245,11 +245,13 @@ to
 The valid values of
 .Ar type
 are
+.Dq ssl timeout ,
 .Dq initial timeout ,
 .Dq header timeout ,
 and
 .Dq request timeout .
-The default values are 30 seconds, 10 seconds and 600 seconds, respectively.
+The default values are 30 seconds, 30 seconds, 10 seconds and 600 seconds,
+respectively.
 .It Fl t Ar chrootdir
 Makes
 .Nm

Index: src/libexec/httpd/bozohttpd.c
diff -u src/libexec/httpd/bozohttpd.c:1.111 src/libexec/httpd/bozohttpd.c:1.112
--- src/libexec/httpd/bozohttpd.c:1.111	Tue Jan 22 05:32:57 2019
+++ src/libexec/httpd/bozohttpd.c	Thu Feb 28 08:28:21 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: bozohttpd.c,v 1.111 2019/01/22 05:32:57 mrg Exp $	*/
+/*	$NetBSD: bozohttpd.c,v 1.112 2019/02/28 08:28:21 mrg Exp $	*/
 
 /*	$eterna: bozohttpd.c,v 1.178 2011/11/18 09:21:15 mrg Exp $	*/
 
@@ -137,7 +137,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -148,6 +147,9 @@
 
 #include "bozohttpd.h"
 
+#ifndef SSL_TIMEOUT
+#define	SSL_TIMEOUT		"30"	/* wait for 30 seconds for ssl handshake  */
+#endif
 #ifndef INITIAL_TIMEOUT
 #define	INITIAL_TIMEOUT		"30"	/* wait for 30 seconds initially */
 #endif
@@ -183,7 +185,7 @@ struct {
 	{ NULL,   NULL },
 };
 
-volatile sig_atomic_t	timeout_hit;
+volatile sig_atomic_t	bozo_timeout_hit;
 
 /*
  * check there's enough space in the prefs and names arrays.
@@ -371,18 +373,19 @@ bozo_clean_request(bozo_httpreq_t *reque
 static void
 alarmer(int sig)
 {
-	timeout_hit = 1;
+	bozo_timeout_hit = 1;
 }
 
 
 /*
- * set a timeout for "initial", "header", or "request".
+ * set a timeout for "ssl", "initial", "header", or "request".
  */
 int
 bozo_set_timeout(bozohttpd_t *httpd, bozoprefs_t *prefs,
 		 const char *target, const char *val)
 {
 	const char **cur, *timeouts[] = {
+		"ssl timeout",
 		"initial timeout",
 		"header timeout",
 		"request timeout",
@@ -602,14 +605,10 @@ bozo_read_request(bozohttpd_t *httpd)
 	/*
 	 * if we're in daemon mode, bozo_daemon_fork() will return here twice
 	 * for each call.  once in the child, returning 0, and once in the
-	 * parent, returning 1.  for each child, then we can setup SSL, and
-	 * the parent can signal the caller there was no request to process
-	 * and it will wait for another.
+	 * parent, returning 1 for each child.
 	 */
 	if (bozo_daemon_fork(httpd))
 		return NULL;
-	if (bozo_ssl_accept(httpd))
-		return NULL;
 
 	request = bozomalloc(httpd, sizeof(*request));
 	memset(request, 0, sizeof(*request));
@@ -685,6 +684,14 @@ bozo_read_request(bozohttpd_t *httpd)
 		goto cleanup;
 	}
 
+	/*
+	 *