CVS commit: src/usr.bin/m4

2020-06-24 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Thu Jun 25 02:59:20 UTC 2020

Modified Files:
src/usr.bin/m4: m4.1

Log Message:
Use a date that is actually a real date.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/usr.bin/m4/m4.1

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/m4/m4.1
diff -u src/usr.bin/m4/m4.1:1.29 src/usr.bin/m4/m4.1:1.30
--- src/usr.bin/m4/m4.1:1.29	Thu Jun 25 02:58:16 2020
+++ src/usr.bin/m4/m4.1	Thu Jun 25 02:59:20 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: m4.1,v 1.29 2020/06/25 02:58:16 uwe Exp $
+.\"	$NetBSD: m4.1,v 1.30 2020/06/25 02:59:20 uwe Exp $
 .\"	@(#) $OpenBSD: m4.1,v 1.56 2009/10/14 17:19:47 sthen Exp $
 .\"
 .\" Copyright (c) 1989, 1993
@@ -31,7 +31,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd June 25 16, 2020
+.Dd June 25, 2020
 .Dt M4 1
 .Os
 .Sh NAME



CVS commit: src/usr.bin/m4

2020-06-24 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Thu Jun 25 02:58:16 UTC 2020

Modified Files:
src/usr.bin/m4: m4.1

Log Message:
Bump date for previous.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/usr.bin/m4/m4.1

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/m4/m4.1
diff -u src/usr.bin/m4/m4.1:1.28 src/usr.bin/m4/m4.1:1.29
--- src/usr.bin/m4/m4.1:1.28	Thu Jun 25 02:54:50 2020
+++ src/usr.bin/m4/m4.1	Thu Jun 25 02:58:16 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: m4.1,v 1.28 2020/06/25 02:54:50 uwe Exp $
+.\"	$NetBSD: m4.1,v 1.29 2020/06/25 02:58:16 uwe Exp $
 .\"	@(#) $OpenBSD: m4.1,v 1.56 2009/10/14 17:19:47 sthen Exp $
 .\"
 .\" Copyright (c) 1989, 1993
@@ -31,7 +31,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd January 16, 2015
+.Dd June 25 16, 2020
 .Dt M4 1
 .Os
 .Sh NAME



CVS commit: src/usr.bin/m4

2020-06-24 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Thu Jun 25 02:54:50 UTC 2020

Modified Files:
src/usr.bin/m4: m4.1

Log Message:
Fix --error-output to be more like GNU m4.  It's a long version of -o.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/m4/m4.1

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/m4/m4.1
diff -u src/usr.bin/m4/m4.1:1.27 src/usr.bin/m4/m4.1:1.28
--- src/usr.bin/m4/m4.1:1.27	Sun Jan 17 11:24:28 2016
+++ src/usr.bin/m4/m4.1	Thu Jun 25 02:54:50 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: m4.1,v 1.27 2016/01/17 11:24:28 wiz Exp $
+.\"	$NetBSD: m4.1,v 1.28 2020/06/25 02:54:50 uwe Exp $
 .\"	@(#) $OpenBSD: m4.1,v 1.56 2009/10/14 17:19:47 sthen Exp $
 .\"
 .\" Copyright (c) 1989, 1993
@@ -46,7 +46,6 @@
 .Sm on
 .Oc
 .Op Fl d Ar flags
-.Op Fl e Ar filename
 .Op Fl F Ar filename
 .Op Fl I Ar dirname
 .Op Fl L Ar number
@@ -138,8 +137,6 @@ By default, trace is set to
 Warnings make
 .Nm
 exit.
-.It Fl e , Fl Fl error-output Ar filename
-Redirect error output to filename.
 .It Fl F , Fl Fl freeze-state Ar filename
 Save the input state to
 .Ar filename .
@@ -166,7 +163,7 @@ Set unbuffered output, disable tty signa
 .It Fl L , Fl Fl nesting-limit
 Set the nesting limit in macro expansions.
 This is unimplemented and unlimited.
-.It Fl o Ar filename
+.It Fl o , Fl Fl error-output Ar filename
 Send trace output to
 .Ar filename .
 .It Fl P , Fl Fl prefix-builtins



CVS commit: src/usr.bin/m4

2020-06-24 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Thu Jun 25 02:25:53 UTC 2020

Modified Files:
src/usr.bin/m4: extern.h main.c trace.c

Log Message:
Fix --error-output to be more like GNU m4.

GNU m4 --error-output is the same as -o despite the name.  It does NOT
affect warnings, error messages, and 'errprint' output so drop the
misguided bit of code that tried to freopen stderr without closing it
on failure.  Drop -e (which was our local invention) and make merge
--error-output with -o so that both set traceout.  Make trace_file()
preserve the old traceout on error and return error status so that the
caller can emit appropriate warning.

Do not yet support disabling tracing with an empty name, the rest of
the code is not ready, we don't do -o positionally and we don't have
`debugfile'.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/usr.bin/m4/extern.h
cvs rdiff -u -r1.49 -r1.50 src/usr.bin/m4/main.c
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/m4/trace.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/m4/extern.h
diff -u src/usr.bin/m4/extern.h:1.19 src/usr.bin/m4/extern.h:1.20
--- src/usr.bin/m4/extern.h:1.19	Sat Jan 16 18:30:57 2016
+++ src/usr.bin/m4/extern.h	Thu Jun 25 02:25:53 2020
@@ -1,5 +1,5 @@
 /*	$OpenBSD: extern.h,v 1.49 2009/10/14 17:19:47 sthen Exp $	*/
-/*	$NetBSD: extern.h,v 1.19 2016/01/16 18:30:57 christos Exp $	*/
+/*	$NetBSD: extern.h,v 1.20 2020/06/25 02:25:53 uwe Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -146,7 +146,7 @@ extern char *endest;
 /* trace.c */
 extern unsigned int trace_flags;
 #define TRACE_ALL	512
-extern void trace_file(const char *);
+extern int trace_file(const char *);
 extern size_t trace(const char **, int, struct input_file *);
 extern void finish_trace(size_t);
 extern void set_trace_flags(const char *);

Index: src/usr.bin/m4/main.c
diff -u src/usr.bin/m4/main.c:1.49 src/usr.bin/m4/main.c:1.50
--- src/usr.bin/m4/main.c:1.49	Wed Jun 24 16:49:30 2020
+++ src/usr.bin/m4/main.c	Thu Jun 25 02:25:53 2020
@@ -1,5 +1,5 @@
 /*	$OpenBSD: main.c,v 1.77 2009/10/14 17:19:47 sthen Exp $	*/
-/*	$NetBSD: main.c,v 1.49 2020/06/24 16:49:30 uwe Exp $	*/
+/*	$NetBSD: main.c,v 1.50 2020/06/25 02:25:53 uwe Exp $	*/
 
 /*-
  * Copyright (c) 1989, 1993
@@ -42,7 +42,7 @@
 #include "nbtool_config.h"
 #endif
 #include 
-__RCSID("$NetBSD: main.c,v 1.49 2020/06/24 16:49:30 uwe Exp $");
+__RCSID("$NetBSD: main.c,v 1.50 2020/06/25 02:25:53 uwe Exp $");
 #include 
 #include 
 #include 
@@ -196,7 +196,7 @@ onintr(int signo)
 struct option longopts[] = {
 	{ "debug",		optional_argument,	0, 'd' },
 	{ "define",		required_argument,	0, 'D' },
-	{ "error-output",	required_argument,	0, 'e' },
+	{ "error-output",	required_argument,	0, 'o' }, /* sic */
 	{ "fatal-warnings",	no_argument,		0, 'E' },
 	{ "freeze-state",	required_argument,	0, 'F' },
 	{ "gnu",		no_argument,		0, 'g' },
@@ -227,8 +227,8 @@ main(int argc, char *argv[])
 {
 	int c;
 	int n;
+	int error;
 	char *p;
-	FILE *sfp;
 
 	setprogname(argv[0]);
 
@@ -246,7 +246,7 @@ main(int argc, char *argv[])
 	outfile = NULL;
 	resizedivs(MAXOUT);
 
-	while ((c = getopt_long(argc, argv, "D:d:e:EF:GgI:iL:o:PR:Qst:U:v",
+	while ((c = getopt_long(argc, argv, "D:d:EF:GgI:iL:o:PR:Qst:U:v",
 	longopts, NULL)) != -1)
 		switch(c) {
 		case 'D':   /* define something..*/
@@ -263,29 +263,6 @@ main(int argc, char *argv[])
 		case 'E':
 			fatal_warnings++;
 			break;
-		case 'e':
-			/*
-			 * Don't use freopen here because if it fails
-			 * we lose stderr, instead trash it.
-			 */
-			if ((sfp = fopen(optarg, "w+")) == NULL) {
-warn("Can't redirect errors to `%s'", optarg);
-break;
-			}
-			fclose(stderr);
-			memcpy(stderr, sfp, sizeof(*sfp));
-			/*
-			 * XXX: try to avoid the trap set up by the
-			 * kludge above.  When exit flushes and closes
-			 * open streams it may close sfp first and
-			 * when it comes about to flush and close
-			 * stderr, the descriptor is already gone and
-			 * we lose any buffered output.  This actually
-			 * happens on some hosts, breaking autoconf
-			 * tracing.
-			 */
-			setvbuf(stderr, (char *)NULL, _IOLBF, 0);
-			break;
 		case 'F':
 			freeze = optarg;
 #ifndef REAL_FREEZE
@@ -310,7 +287,9 @@ main(int argc, char *argv[])
 			nesting_limit = atoi(optarg);
 			break;
 		case 'o':
-			trace_file(optarg);
+			error = trace_file(optarg);
+			if (error)
+warn("%s", optarg);
 break;
 		case 'P':
 			prefix_builtins = 1;

Index: src/usr.bin/m4/trace.c
diff -u src/usr.bin/m4/trace.c:1.8 src/usr.bin/m4/trace.c:1.9
--- src/usr.bin/m4/trace.c:1.8	Tue Mar 20 20:34:58 2012
+++ src/usr.bin/m4/trace.c	Thu Jun 25 02:25:53 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: trace.c,v 1.8 2012/03/20 20:34:58 matt Exp $	*/
+/*	$NetBSD: trace.c,v 1.9 2020/06/25 02:25:53 uwe Exp $	*/
 /* $OpenBSD: trace.c,v 1.15 2006/03/24 08:03:44 espie Exp $ */
 /*
  * 

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

2020-06-24 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Wed Jun 24 22:28:08 UTC 2020

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

Log Message:
don't try allocating 16KB of scratch space on stack

it's too early for kmem_alloc(), so use static variable in BSS; it's used
post reloc, so don't need to use the RELOC() macros

XXX compile-tested only on i386


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 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.4 src/sys/arch/x86/x86/multiboot2.c:1.5
--- src/sys/arch/x86/x86/multiboot2.c:1.4	Thu Jan 30 01:49:44 2020
+++ src/sys/arch/x86/x86/multiboot2.c	Wed Jun 24 22:28:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: multiboot2.c,v 1.4 2020/01/30 01:49:44 manu Exp $	*/
+/*	$NetBSD: multiboot2.c,v 1.5 2020/06/24 22:28:07 jdolecek Exp $	*/
 
 /*-
  * Copyright (c) 2005, 2006 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: multiboot2.c,v 1.4 2020/01/30 01:49:44 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: multiboot2.c,v 1.5 2020/06/24 22:28:07 jdolecek Exp $");
 
 #include "opt_multiboot.h"
 
@@ -115,7 +115,7 @@ char multiboot_info[16384] = "\0\0\0\0";
 bool multiboot2_enabled = false;
 bool has_syms = false;
 struct multiboot_symbols Multiboot_Symbols;
-
+static char bimbuf[16384];
 
 #define RELOC(type, x) ((type)((vaddr_t)(x) - KERNBASE))
 
@@ -448,7 +448,6 @@ mbi_modules(char *mbi, uint32_t mbi_size
 	size_t bim_len;
 	struct bi_modulelist_entry *bie;
 	struct btinfo_modulelist *bim;
-	char bimbuf[16384];
 
 	bim_len = sizeof(*bim) + (module_count * sizeof(*bie));
 	if (bim_len > sizeof(bimbuf))
@@ -518,7 +517,6 @@ mbi_bootdev(struct multiboot_tag_bootdev
 static void
 mbi_mmap(struct multiboot_tag_mmap *mbt)
 {
-	char bimbuf[16384];
 	struct btinfo_memmap *bim;
 	char *cp;
 
@@ -616,15 +614,14 @@ mbi_efi64(struct multiboot_tag_efi64 *mb
 static void
 mbi_efi_mmap(struct multiboot_tag_efi_mmap *mbt)
 {
-	char biebuf[16384];
-	struct btinfo_efimemmap *bie = (struct btinfo_efimemmap *)biebuf;
+	struct btinfo_efimemmap *bie = (struct btinfo_efimemmap *)bimbuf;
 	size_t bie_len;
 
 	if (mbt->descr_vers != 0)
 		goto out;
 
 	bie_len = sizeof(*bie) + mbt->size - sizeof(*mbt);
-	if (bie_len > sizeof(biebuf))
+	if (bie_len > sizeof(bimbuf))
 		goto out;
 
 	bie->num = (mbt->size - sizeof(*mbt)) / mbt->descr_size;



CVS commit: src/sys/external/bsd/ipf/netinet

2020-06-24 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Wed Jun 24 21:54:57 UTC 2020

Modified Files:
src/sys/external/bsd/ipf/netinet: ip_nat.c

Log Message:
reduce stack usage in ipf_nat_ioctl()

also, in SIOCADNAT, make sure to not leak kernel data


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/external/bsd/ipf/netinet/ip_nat.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/external/bsd/ipf/netinet/ip_nat.c
diff -u src/sys/external/bsd/ipf/netinet/ip_nat.c:1.21 src/sys/external/bsd/ipf/netinet/ip_nat.c:1.22
--- src/sys/external/bsd/ipf/netinet/ip_nat.c:1.21	Mon Feb  4 07:59:01 2019
+++ src/sys/external/bsd/ipf/netinet/ip_nat.c	Wed Jun 24 21:54:57 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_nat.c,v 1.21 2019/02/04 07:59:01 mrg Exp $	*/
+/*	$NetBSD: ip_nat.c,v 1.22 2020/06/24 21:54:57 jdolecek Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -112,7 +112,7 @@ extern struct ifnet vpnif;
 #if !defined(lint)
 #if defined(__NetBSD__)
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_nat.c,v 1.21 2019/02/04 07:59:01 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_nat.c,v 1.22 2020/06/24 21:54:57 jdolecek Exp $");
 #else
 static const char sccsid[] = "@(#)ip_nat.c	1.11 6/5/96 (C) 1995 Darren Reed";
 static const char rcsid[] = "@(#)Id: ip_nat.c,v 1.1.1.2 2012/07/22 13:45:27 darrenr Exp";
@@ -983,7 +983,7 @@ ipf_nat_ioctl(ipf_main_softc_t *softc, v
 	ipf_nat_softc_t *softn = softc->ipf_nat_soft;
 	int error = 0, ret, arg, getlock;
 	ipnat_t *nat, *nt, *n;
-	ipnat_t natd;
+	ipnat_t *natd = NULL;
 	SPL_INT(s);
 
 #if BSD_GE_YEAR(199306) && defined(_KERNEL)
@@ -1017,30 +1017,35 @@ ipf_nat_ioctl(ipf_main_softc_t *softc, v
 
 	if ((cmd == (ioctlcmd_t)SIOCADNAT) || (cmd == (ioctlcmd_t)SIOCRMNAT) ||
 	(cmd == (ioctlcmd_t)SIOCPURGENAT)) {
+		KMALLOC(natd, ipnat_t *);
+		if (natd == NULL) {
+			error = ENOMEM;
+			goto done;
+		}
 		if (mode & NAT_SYSSPACE) {
-			bcopy(data, (char *), sizeof(natd));
-			nat = 
+			bcopy(data, natd, sizeof(*natd));
+			nat = natd;
 			error = 0;
 		} else {
-			bzero(, sizeof(natd));
-			error = ipf_inobj(softc, data, NULL, ,
+			bzero(natd, sizeof(*natd));
+			error = ipf_inobj(softc, data, NULL, natd,
 	  IPFOBJ_IPNAT);
 			if (error != 0)
 goto done;
 
-			if (natd.in_size < sizeof(ipnat_t)) {
+			if (natd->in_size < sizeof(ipnat_t)) {
 error = EINVAL;
 goto done;
 			}
-			KMALLOCS(nt, ipnat_t *, natd.in_size);
+			KMALLOCS(nt, ipnat_t *, natd->in_size);
 			if (nt == NULL) {
 IPFERROR(60070);
 error = ENOMEM;
 goto done;
 			}
-			bzero(nt, natd.in_size);
+			bzero(nt, natd->in_size);
 			error = ipf_inobjsz(softc, data, nt, IPFOBJ_IPNAT,
-	natd.in_size);
+	natd->in_size);
 			if (error)
 goto done;
 			nat = nt;
@@ -1132,7 +1137,13 @@ ipf_nat_ioctl(ipf_main_softc_t *softc, v
 			IPFERROR(60006);
 			error = EPERM;
 		} else if (n != NULL) {
-			natd.in_flineno = n->in_flineno;
+			KMALLOC(natd, ipnat_t *);
+			if (natd == NULL) {
+error = ENOMEM;
+goto done;
+			}
+			bzero(natd, sizeof(*natd));
+			natd->in_flineno = n->in_flineno;
 			(void) ipf_outobj(softc, data, , IPFOBJ_IPNAT);
 			IPFERROR(60007);
 			error = EEXIST;
@@ -1392,6 +1403,8 @@ ipf_nat_ioctl(ipf_main_softc_t *softc, v
 done:
 	if (nat != NULL)
 		ipf_nat_rule_fini(softc, nat);
+	if (natd != NULL)
+		KFREE(natd);
 	if (nt != NULL)
 		KFREES(nt, nt->in_size);
 	return error;



CVS commit: src/sys/dev/usb

2020-06-24 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Wed Jun 24 21:06:39 UTC 2020

Modified Files:
src/sys/dev/usb: if_run.c

Log Message:
disable inlining for couple functions which allocate usb_device_request_t
on stack to reduce total run_init() stack usage from 7KB to 2KB


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/usb/if_run.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/usb/if_run.c
diff -u src/sys/dev/usb/if_run.c:1.41 src/sys/dev/usb/if_run.c:1.42
--- src/sys/dev/usb/if_run.c:1.41	Thu Jun 11 09:56:57 2020
+++ src/sys/dev/usb/if_run.c	Wed Jun 24 21:06:39 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_run.c,v 1.41 2020/06/11 09:56:57 martin Exp $	*/
+/*	$NetBSD: if_run.c,v 1.42 2020/06/24 21:06:39 jdolecek Exp $	*/
 /*	$OpenBSD: if_run.c,v 1.90 2012/03/24 15:11:04 jsg Exp $	*/
 
 /*-
@@ -23,7 +23,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_run.c,v 1.41 2020/06/11 09:56:57 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_run.c,v 1.42 2020/06/24 21:06:39 jdolecek Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -931,7 +931,7 @@ run_free_tx_ring(struct run_softc *sc, i
 	}
 }
 
-static int
+static int __noinline
 run_load_microcode(struct run_softc *sc)
 {
 	usb_device_request_t req;
@@ -1003,7 +1003,7 @@ run_load_microcode(struct run_softc *sc)
 	return 0;
 }
 
-static int
+static int __noinline
 run_reset(struct run_softc *sc)
 {
 	usb_device_request_t req;
@@ -1016,7 +1016,7 @@ run_reset(struct run_softc *sc)
 	return usbd_do_request(sc->sc_udev, , NULL);
 }
 
-static int
+static int __noinline
 run_read(struct run_softc *sc, uint16_t reg, uint32_t *val)
 {
 	uint32_t tmp;
@@ -1056,7 +1056,7 @@ run_write_2(struct run_softc *sc, uint16
 	return usbd_do_request(sc->sc_udev, , NULL);
 }
 
-static int
+static int __noinline
 run_write(struct run_softc *sc, uint16_t reg, uint32_t val)
 {
 	uint32_t tmp = htole32(val);



CVS commit: src/sys/dev/ic

2020-06-24 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Wed Jun 24 20:17:55 UTC 2020

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

Log Message:
actually stop using the stack variable


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/ic/ibm561.c

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

Modified files:

Index: src/sys/dev/ic/ibm561.c
diff -u src/sys/dev/ic/ibm561.c:1.12 src/sys/dev/ic/ibm561.c:1.13
--- src/sys/dev/ic/ibm561.c:1.12	Wed Jun 24 19:55:25 2020
+++ src/sys/dev/ic/ibm561.c	Wed Jun 24 20:17:55 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ibm561.c,v 1.12 2020/06/24 19:55:25 jdolecek Exp $ */
+/* $NetBSD: ibm561.c,v 1.13 2020/06/24 20:17:55 jdolecek Exp $ */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ibm561.c,v 1.12 2020/06/24 19:55:25 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ibm561.c,v 1.13 2020/06/24 20:17:55 jdolecek Exp $");
 
 #include 
 #include 
@@ -165,7 +165,7 @@ ibm561_cninit(
 	u_int8_t (*rd)(void *, u_int),
 	u_int dotclock)
 {
-	struct ibm561data tmp, *data = 
+	struct ibm561data *data = _console_data;
 	memset(data, 0x0, sizeof *data);
 	data->cookie = v;
 	data->ramdac_sched_update = sched_update;



CVS commit: src/sys/dev/ic

2020-06-24 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Wed Jun 24 19:55:25 UTC 2020

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

Log Message:
avoid allocating almost 5k struct ibm561data on stack in ibm561_cninit();
it's too early for kmem_alloc(), so use static variable in BSS


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/ic/ibm561.c

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

Modified files:

Index: src/sys/dev/ic/ibm561.c
diff -u src/sys/dev/ic/ibm561.c:1.11 src/sys/dev/ic/ibm561.c:1.12
--- src/sys/dev/ic/ibm561.c:1.11	Sun Feb 12 16:34:11 2012
+++ src/sys/dev/ic/ibm561.c	Wed Jun 24 19:55:25 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ibm561.c,v 1.11 2012/02/12 16:34:11 matt Exp $ */
+/* $NetBSD: ibm561.c,v 1.12 2020/06/24 19:55:25 jdolecek Exp $ */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ibm561.c,v 1.11 2012/02/12 16:34:11 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ibm561.c,v 1.12 2020/06/24 19:55:25 jdolecek Exp $");
 
 #include 
 #include 
@@ -155,7 +155,7 @@ ibm561_register(
  * initializing the console early on.
  */
 
-struct ibm561data *saved_console_data;
+static struct ibm561data saved_console_data;
 
 void
 ibm561_cninit(
@@ -172,9 +172,7 @@ ibm561_cninit(
 	data->ramdac_wr = wr;
 	data->ramdac_rd = rd;
 	ibm561_set_dotclock((struct ramdac_cookie *)data, dotclock);
-	saved_console_data = data;
 	ibm561_init((struct ramdac_cookie *)data);
-	saved_console_data = NULL;
 }
 
 void
@@ -394,7 +392,7 @@ ibm561_update(void *vp)
 
 	/* XXX see comment above ibm561_cninit() */
 	if (!data)
-		data = saved_console_data;
+		data = _console_data;
 
 	if (data->changed & CHANGED_WTYPE) {
 		ibm561_regbegin(data, IBM561_FB_WINTYPE);



CVS commit: src/sys/dev

2020-06-24 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Wed Jun 24 19:24:44 UTC 2020

Modified Files:
src/sys/dev/ic: ug.c ugvar.h
src/sys/dev/isa: ug_isa.c

Log Message:
rearrange to avoid allocating softc on stack in ug_isa_match()


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/ic/ug.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/ic/ugvar.h
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/isa/ug_isa.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/ug.c
diff -u src/sys/dev/ic/ug.c:1.13 src/sys/dev/ic/ug.c:1.14
--- src/sys/dev/ic/ug.c:1.13	Sun Jun  3 10:04:40 2018
+++ src/sys/dev/ic/ug.c	Wed Jun 24 19:24:44 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ug.c,v 1.13 2018/06/03 10:04:40 maxv Exp $ */
+/* $NetBSD: ug.c,v 1.14 2020/06/24 19:24:44 jdolecek Exp $ */
 
 /*
  * Copyright (c) 2007 Mihai Chelaru 
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ug.c,v 1.13 2018/06/03 10:04:40 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ug.c,v 1.14 2020/06/24 19:24:44 jdolecek Exp $");
 
 #include 
 #include 
@@ -580,13 +580,13 @@ ug2_refresh(struct sysmon_envsys *sme, e
 #undef SENSOR_VALUE
 }
 
-int
-ug2_wait_ready(struct ug_softc *sc)
+static int
+ug2_wait_ready(bus_space_tag_t iot, bus_space_handle_t ioh)
 {
 	int cnt = 0;
 
-	bus_space_write_1(sc->sc_iot, sc->sc_ioh, UG_DATA, 0x1a);
-	while (bus_space_read_1(sc->sc_iot, sc->sc_ioh, UG_DATA) &
+	bus_space_write_1(iot, ioh, UG_DATA, 0x1a);
+	while (bus_space_read_1(iot, ioh, UG_DATA) &
 	UG2_STATUS_BUSY) {
 		if (cnt++ > UG_DELAY_CYCLES)
 			return 0;
@@ -594,12 +594,12 @@ ug2_wait_ready(struct ug_softc *sc)
 	return 1;
 }
 
-int
-ug2_wait_readable(struct ug_softc *sc)
+static int
+ug2_wait_readable(bus_space_tag_t iot, bus_space_handle_t ioh)
 {
 	int cnt = 0;
 
-	while (!(bus_space_read_1(sc->sc_iot, sc->sc_ioh, UG_DATA) &
+	while (!(bus_space_read_1(iot, ioh, UG_DATA) &
 		UG2_STATUS_READY_FOR_READ)) {
 		if (cnt++ > UG_DELAY_CYCLES)
 			return 0;
@@ -608,28 +608,28 @@ ug2_wait_readable(struct ug_softc *sc)
 }
 
 int
-ug2_sync(struct ug_softc *sc)
+ug2_sync(bus_space_tag_t iot, bus_space_handle_t ioh)
 {
 	int cnt = 0;
 
-#define UG2_WAIT_READY if(ug2_wait_ready(sc) == 0) return 0;
+#define UG2_WAIT_READY if(ug2_wait_ready(iot, ioh) == 0) return 0;
 
 	/* Don't sync two times in a row */
-	if(ug_ver != 0) {
+	if (ug_ver != 0) {
 		ug_ver = 0;
 		return 1;
 	}
 
 	UG2_WAIT_READY;
-	bus_space_write_1(sc->sc_iot, sc->sc_ioh, UG_DATA, 0x20);
+	bus_space_write_1(iot, ioh, UG_DATA, 0x20);
 	UG2_WAIT_READY;
-	bus_space_write_1(sc->sc_iot, sc->sc_ioh, UG_CMD, 0x10);
+	bus_space_write_1(iot, ioh, UG_CMD, 0x10);
 	UG2_WAIT_READY;
-	bus_space_write_1(sc->sc_iot, sc->sc_ioh, UG_CMD, 0x00);
+	bus_space_write_1(iot, ioh, UG_CMD, 0x00);
 	UG2_WAIT_READY;
-	if (ug2_wait_readable(sc) == 0)
+	if (ug2_wait_readable(iot, ioh) == 0)
 		return 0;
-	while (bus_space_read_1(sc->sc_iot, sc->sc_ioh, UG_CMD) != 0xAC)
+	while (bus_space_read_1(iot, ioh, UG_CMD) != 0xAC)
 		if (cnt++ > UG_DELAY_CYCLES)
 			return 0;
 	return 1;
@@ -640,24 +640,26 @@ ug2_read(struct ug_softc *sc, uint8_t ba
 	 uint8_t *ret)
 {
 	int i;
+	bus_space_tag_t iot = sc->sc_iot;
+	bus_space_handle_t ioh = sc->sc_ioh;
 
-	if (ug2_sync(sc) == 0)
+	if (ug2_sync(iot, ioh) == 0)
 		return 0;
 
-	bus_space_write_1(sc->sc_iot, sc->sc_ioh, UG_DATA, 0x1A);
+	bus_space_write_1(iot, ioh, UG_DATA, 0x1A);
 	UG2_WAIT_READY;
-	bus_space_write_1(sc->sc_iot, sc->sc_ioh, UG_CMD, bank);
+	bus_space_write_1(iot, ioh, UG_CMD, bank);
 	UG2_WAIT_READY;
-	bus_space_write_1(sc->sc_iot, sc->sc_ioh, UG_CMD, offset);
+	bus_space_write_1(iot, ioh, UG_CMD, offset);
 	UG2_WAIT_READY;
-	bus_space_write_1(sc->sc_iot, sc->sc_ioh, UG_CMD, count);
+	bus_space_write_1(iot, ioh, UG_CMD, count);
 	UG2_WAIT_READY;
 
 #undef UG2_WAIT_READY
 
 	/* Now wait for the results */
 	for (i = 0; i < count; i++) {
-		if (ug2_wait_readable(sc) == 0)
+		if (ug2_wait_readable(sc->sc_iot, sc->sc_ioh) == 0)
 			break;
 		ret[i] = bus_space_read_1(sc->sc_iot, sc->sc_ioh, UG_CMD);
 	}

Index: src/sys/dev/ic/ugvar.h
diff -u src/sys/dev/ic/ugvar.h:1.5 src/sys/dev/ic/ugvar.h:1.6
--- src/sys/dev/ic/ugvar.h:1.5	Sun Jun  3 10:04:40 2018
+++ src/sys/dev/ic/ugvar.h	Wed Jun 24 19:24:44 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ugvar.h,v 1.5 2018/06/03 10:04:40 maxv Exp $ */
+/* $NetBSD: ugvar.h,v 1.6 2020/06/24 19:24:44 jdolecek Exp $ */
 
 /*
  * Copyright (c) 2007 Mihai Chelaru 
@@ -59,9 +59,7 @@ uint8_t ug_read(struct ug_softc *, unsig
 int ug_waitfor(struct ug_softc *, uint16_t, uint8_t);
 void ug_setup_sensors(struct ug_softc *);
 void ug2_attach(device_t);
-int ug2_wait_ready(struct ug_softc *);
-int ug2_wait_readable(struct ug_softc *);
-int ug2_sync(struct ug_softc *);
+int ug2_sync(bus_space_tag_t, bus_space_handle_t);
 int ug2_read(struct ug_softc *, uint8_t, uint8_t, uint8_t, uint8_t*);
 
 /* Envsys */

Index: src/sys/dev/isa/ug_isa.c

CVS commit: src/sys/dev

2020-06-24 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Wed Jun 24 19:11:49 UTC 2020

Modified Files:
src/sys/dev/i2c: lm_i2c.c
src/sys/dev/isa: lm_isa_common.c

Log Message:
avoid stack usage in match routine


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/i2c/lm_i2c.c
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/isa/lm_isa_common.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/lm_i2c.c
diff -u src/sys/dev/i2c/lm_i2c.c:1.5 src/sys/dev/i2c/lm_i2c.c:1.6
--- src/sys/dev/i2c/lm_i2c.c:1.5	Sat Jun 16 21:22:13 2018
+++ src/sys/dev/i2c/lm_i2c.c	Wed Jun 24 19:11:49 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: lm_i2c.c,v 1.5 2018/06/16 21:22:13 thorpej Exp $	*/
+/*	$NetBSD: lm_i2c.c,v 1.6 2020/06/24 19:11:49 jdolecek Exp $	*/
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -30,13 +30,14 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lm_i2c.c,v 1.5 2018/06/16 21:22:13 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lm_i2c.c,v 1.6 2020/06/24 19:11:49 jdolecek Exp $");
 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -65,7 +66,7 @@ lm_i2c_match(device_t parent, cfdata_t m
 {
 	struct i2c_attach_args *ia = aux;
 	int rv = 0;
-	struct lm_i2c_softc sc;
+	struct lm_i2c_softc *sc;
 
 	/* Must supply an address */
 	if (ia->ia_addr < 1)
@@ -74,11 +75,13 @@ lm_i2c_match(device_t parent, cfdata_t m
 	/* XXXJRT filter addresses //at all// please? */
 
 	/* Bus independent probe */
-	sc.sc_lmsc.lm_writereg = lm_i2c_writereg;
-	sc.sc_lmsc.lm_readreg = lm_i2c_readreg;
-	sc.sc_tag = ia->ia_tag;
-	sc.sc_addr = ia->ia_addr;
-	rv = lm_match(_lmsc);
+	sc = kmem_zalloc(sizeof(*sc), KM_SLEEP);
+	sc->sc_lmsc.lm_writereg = lm_i2c_writereg;
+	sc->sc_lmsc.lm_readreg = lm_i2c_readreg;
+	sc->sc_tag = ia->ia_tag;
+	sc->sc_addr = ia->ia_addr;
+	rv = lm_match(>sc_lmsc);
+	kmem_free(sc, sizeof(*sc));
 
 	return rv ? I2C_MATCH_ADDRESS_AND_PROBE : 0;
 }

Index: src/sys/dev/isa/lm_isa_common.c
diff -u src/sys/dev/isa/lm_isa_common.c:1.6 src/sys/dev/isa/lm_isa_common.c:1.7
--- src/sys/dev/isa/lm_isa_common.c:1.6	Fri Aug 18 04:07:51 2017
+++ src/sys/dev/isa/lm_isa_common.c	Wed Jun 24 19:11:49 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: lm_isa_common.c,v 1.6 2017/08/18 04:07:51 msaitoh Exp $ */
+/*	$NetBSD: lm_isa_common.c,v 1.7 2020/06/24 19:11:49 jdolecek Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lm_isa_common.c,v 1.6 2017/08/18 04:07:51 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lm_isa_common.c,v 1.7 2020/06/24 19:11:49 jdolecek Exp $");
 
 #include 
 #include 
@@ -38,6 +38,7 @@ __KERNEL_RCSID(0, "$NetBSD: lm_isa_commo
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -64,7 +65,7 @@ lm_isa_match(device_t parent, cfdata_t m
 {
 	bus_space_handle_t ioh;
 	struct isa_attach_args *ia = aux;
-	struct lm_isa_softc sc;
+	struct lm_isa_softc *sc;
 	int rv;
 
 	/* Must supply an address */
@@ -81,11 +82,13 @@ lm_isa_match(device_t parent, cfdata_t m
 		return 0;
 
 	/* Bus independent probe */
-	sc.lm_iot = ia->ia_iot;
-	sc.lm_ioh = ioh;
-	sc.lmsc.lm_writereg = lm_isa_writereg;
-	sc.lmsc.lm_readreg = lm_isa_readreg;
-	rv = lm_match();
+	sc = kmem_zalloc(sizeof(*sc), KM_SLEEP);
+	sc->lm_iot = ia->ia_iot;
+	sc->lm_ioh = ioh;
+	sc->lmsc.lm_writereg = lm_isa_writereg;
+	sc->lmsc.lm_readreg = lm_isa_readreg;
+	rv = lm_match(>lmsc);
+	kmem_free(sc, sizeof(*sc));
 
 	bus_space_unmap(ia->ia_iot, ioh, 8);
 



CVS commit: src/external/cddl/dtracetoolkit/dist/Man/man1m

2020-06-24 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Wed Jun 24 18:49:01 UTC 2020

Modified Files:
src/external/cddl/dtracetoolkit/dist/Man/man1m: dtruss.1m

Log Message:
No truss here


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/external/cddl/dtracetoolkit/dist/Man/man1m/dtruss.1m

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

Modified files:

Index: src/external/cddl/dtracetoolkit/dist/Man/man1m/dtruss.1m
diff -u src/external/cddl/dtracetoolkit/dist/Man/man1m/dtruss.1m:1.2 src/external/cddl/dtracetoolkit/dist/Man/man1m/dtruss.1m:1.3
--- src/external/cddl/dtracetoolkit/dist/Man/man1m/dtruss.1m:1.2	Wed Jun 24 18:43:38 2020
+++ src/external/cddl/dtracetoolkit/dist/Man/man1m/dtruss.1m	Wed Jun 24 18:49:01 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: dtruss.1m,v 1.2 2020/06/24 18:43:38 sevan Exp $
+.\" $NetBSD: dtruss.1m,v 1.3 2020/06/24 18:49:01 sevan Exp $
 .Dd June 24, 2020
 .Dt DTRUSS 1
 .Os
@@ -101,7 +101,8 @@ descriptions explaining the output.
 dtruss will run forever until Ctrl\-C is hit, or if a command was
 executed dtruss will finish when the command ends.
 .Sh SEE ALSO
-procsystime(1M), dtrace(1M), truss(1)
+.Xr dtrace 1 ,
+.Xr procsystime 1
 .Sh AUTHORS
 .An Brendan Gregg
 [Sydney, Australia]



CVS commit: src/external/cddl/dtracetoolkit/dist/Man/man1m

2020-06-24 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Wed Jun 24 18:43:38 UTC 2020

Modified Files:
src/external/cddl/dtracetoolkit/dist/Man/man1m: dtruss.1m

Log Message:
mdocify


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/external/cddl/dtracetoolkit/dist/Man/man1m/dtruss.1m

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

Modified files:

Index: src/external/cddl/dtracetoolkit/dist/Man/man1m/dtruss.1m
diff -u src/external/cddl/dtracetoolkit/dist/Man/man1m/dtruss.1m:1.1.1.1 src/external/cddl/dtracetoolkit/dist/Man/man1m/dtruss.1m:1.2
--- src/external/cddl/dtracetoolkit/dist/Man/man1m/dtruss.1m:1.1.1.1	Wed Sep 30 22:01:09 2015
+++ src/external/cddl/dtracetoolkit/dist/Man/man1m/dtruss.1m	Wed Jun 24 18:43:38 2020
@@ -1,123 +1,107 @@
-.TH dtruss 1m  "$Date: 2015/09/30 22:01:09 $" "USER COMMANDS"
-.SH NAME
-dtruss \- process syscall details. Uses DTrace.
-.SH SYNOPSIS
-.B dtruss
-[\-acdeflhoLs] [\-t syscall] { \-p PID | \-n name | command }
-.SH DESCRIPTION
-dtruss prints details on process system calls. It is like a DTrace
-version of truss, and has been designed to be less intrusive than
-truss.
-
-Of particular interest is the elapsed times and on cpu times, which
-can identify both system calls that are slow to complete, and those
-which are consuming CPU cycles.
-
-Since this uses DTrace, only the root user or users with the
-dtrace_kernel privilege can run this command.
-.SH OS
-Solaris
-.SH STABILITY
-stable - needs the syscall provider.
-.SH OPTIONS
-.TP
-\-a
+.\" $NetBSD: dtruss.1m,v 1.2 2020/06/24 18:43:38 sevan Exp $
+.Dd June 24, 2020
+.Dt DTRUSS 1
+.Os
+.Sh NAME
+.Nm dtruss
+.Nd process syscall details. Uses DTrace
+.Sh SYNOPSIS
+.Nm
+.Op Fl acdeflhoLs
+.Op Fl t Ar syscall
+.Op Fl p Ar PID | Fl n Ar name | command
+.Sh DESCRIPTION
+.Nm
+prints details on process system calls.
+It is like a DTrace version of truss, and has been designed to be less
+intrusive than truss.
+.Pp
+Of particular interest is the elapsed times and on cpu times, which can
+identify both system calls that are slow to complete, and those which are
+consuming CPU cycles.
+.Pp
+Since this uses DTrace, only the root user or users with the dtrace_kernel
+privilege can run this command.
+.Bl -tag -width Ds
+.It Fl a
 print all details
-.TP
-\-b bufsize
-dynamic variable buffer size. Increase this if you notice dynamic
-variable drop errors. The default is "4m" for 4 megabytes per CPU.
-.TP
-\-c
+.It Fl b Ar bufsize
+dynamic variable buffer size.
+Increase this if you notice dynamic variable drop errors.
+The default is "4m" for 4 megabytes per CPU.
+.It Fl c
 print system call counts
-.TP
-\-d
+.It Fl d
 print relative timestamps, us
-.TP
-\-e
+.It Fl e
 print elapsed times, us
-.TP
-\-f
+.It Fl f
 follow children as they are forked
-.TP
-\-l
+.It Fl l
 force printing of pid/lwpid per line
-.TP
-\-L
+.It Fl L
 don't print pid/lwpid per line
-.TP
-\-n name
+.It Fl n Ar name
 examine processes with this name
-.TP
-\-o
+.It Fl o
 print on-cpu times, us
-.TP
-\-s
+.It Fl s
 print stack backtraces
-.TP
-\-p PID
+.It Fl p Ar PID
 examine this PID
-.TP
-\-t syscall
+.It Fl t Ar syscall
 examine this syscall only
-.PP
-.SH EXAMPLES
-.TP
-run and examine the "df -h" command
-# 
-.B dtruss 
-df -h
-.PP
-.TP
-examine PID 1871
-# 
-.B dtruss
-\-p 1871 
-.PP
-.TP
-examine all processes called "tar"
-#
-.B dtruss
-\-n tar
-.PP
-.TP
-run test.sh and follow children
-#
-.B dtruss
-\-f test.sh
-.TP
-run the "date" command and print elapsed and on cpu times,
-#
-.B dtruss
-\-eo date
-.PP
-.SH FIELDS
-.TP
-PID/LWPID
+.El
+.Pp
+Description of fields
+.Bl -column
+.It PID/LWPID
 Process ID / Lightweight Process ID
-.TP
-RELATIVE
+.It RELATIVE
 relative timestamps to the start of the thread, us (microseconds)
-.TP
-ELAPSD
+.It ELAPSD
 elapsed time for this system call, us
-.TP
-CPU
+.It CPU
 on-cpu time for this system call, us
-.TP
-SYSCALL(args)
+.It SYSCALL(args)
 system call name, with arguments (some may be evaluated)
-.PP
-.SH DOCUMENTATION
-See the DTraceToolkit for further documentation under the 
-Docs directory. The DTraceToolkit docs may include full worked
-examples with verbose descriptions explaining the output.
-.SH EXIT
+.El
+.Sh EXAMPLES
+run and examine the "df -h" command
+.Bd -literal -offset indent
+.Ic dtruss df -h
+.Ed
+.Pp
+examine PID 1871
+.Bd -literal -offset indent
+.Ic dtruss -p 1871
+.Ed
+.Pp
+examine all processes called "tar"
+.Bd -literal -offset indent
+.Ic dtruss -n tar
+.Ed
+.Pp
+run test.sh and follow children
+.Bd -literal -offset indent
+.Ic dtruss -f test.sh
+.Ed
+.Pp
+run the "date" command and print elapsed and on cpu times,
+.Bd -literal -offset indent
+.Ic dtruss -eo date
+.Ed
+.Sh STABILITY
+stable - needs the syscall provider.
+.Sh DOCUMENTATION
+See the DTraceToolkit for further documentation under the Docs directory.
+The DTraceToolkit docs may include full worked examples with verbose

CVS commit: src/sys/arch

2020-06-24 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Jun 24 18:09:37 UTC 2020

Modified Files:
src/sys/arch/amd64/amd64: cpufunc.S
src/sys/arch/i386/i386: cpufunc.S
src/sys/arch/x86/include: pmap.h

Log Message:
remove unused x86_stos


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/amd64/amd64/cpufunc.S
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/i386/i386/cpufunc.S
cvs rdiff -u -r1.122 -r1.123 src/sys/arch/x86/include/pmap.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/amd64/amd64/cpufunc.S
diff -u src/sys/arch/amd64/amd64/cpufunc.S:1.62 src/sys/arch/amd64/amd64/cpufunc.S:1.63
--- src/sys/arch/amd64/amd64/cpufunc.S:1.62	Mon Jun 15 20:27:30 2020
+++ src/sys/arch/amd64/amd64/cpufunc.S	Wed Jun 24 18:09:37 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc.S,v 1.62 2020/06/15 20:27:30 riastradh Exp $	*/
+/*	$NetBSD: cpufunc.S,v 1.63 2020/06/24 18:09:37 maxv Exp $	*/
 
 /*
  * Copyright (c) 1998, 2007, 2008, 2020 The NetBSD Foundation, Inc.
@@ -446,15 +446,6 @@ ENTRY(outl)
 	ret
 END(outl)
 
-ENTRY(x86_stos)
-	movq	%rsi,%rax
-	movq	%rdx,%rcx
-	KMSAN_REP_STOS(8)
-	rep
-	stosq
-	ret
-END(x86_stos)
-
 ENTRY(x86_movs)
 	movq	%rdx,%rcx
 	KMSAN_REP_STOS(8)

Index: src/sys/arch/i386/i386/cpufunc.S
diff -u src/sys/arch/i386/i386/cpufunc.S:1.47 src/sys/arch/i386/i386/cpufunc.S:1.48
--- src/sys/arch/i386/i386/cpufunc.S:1.47	Mon Jun 15 09:09:23 2020
+++ src/sys/arch/i386/i386/cpufunc.S	Wed Jun 24 18:09:37 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc.S,v 1.47 2020/06/15 09:09:23 msaitoh Exp $	*/
+/*	$NetBSD: cpufunc.S,v 1.48 2020/06/24 18:09:37 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2007, 2020 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 #include 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpufunc.S,v 1.47 2020/06/15 09:09:23 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpufunc.S,v 1.48 2020/06/24 18:09:37 maxv Exp $");
 
 #include "opt_xen.h"
 
@@ -354,22 +354,6 @@ ENTRY(outl)
 	ret
 END(outl)
 
-ENTRY(x86_stos)
-	pushl	%ebp
-	movl	%esp,%ebp
-	pushl	%edi
-	pushl	%esi
-	movl	8(%ebp),%edi
-	movl	12(%ebp),%eax
-	movl	16(%ebp),%ecx
-	rep
-	stosl
-	popl	%esi
-	popl	%edi
-	leave
-	ret
-END(x86_stos)
-
 ENTRY(x86_movs)
 	pushl	%ebp
 	movl	%esp,%ebp

Index: src/sys/arch/x86/include/pmap.h
diff -u src/sys/arch/x86/include/pmap.h:1.122 src/sys/arch/x86/include/pmap.h:1.123
--- src/sys/arch/x86/include/pmap.h:1.122	Wed May 27 19:33:40 2020
+++ src/sys/arch/x86/include/pmap.h	Wed Jun 24 18:09:37 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.122 2020/05/27 19:33:40 ad Exp $	*/
+/*	$NetBSD: pmap.h,v 1.123 2020/06/24 18:09:37 maxv Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -612,7 +612,6 @@ extern vaddr_t pmap_direct_end;
 
 #endif /* __HAVE_DIRECT_MAP */
 
-void	x86_stos(void *, long, long);
 void	x86_movs(void *, void *, long);
 
 #endif /* _KERNEL */



CVS commit: src/external/cddl/dtracetoolkit/dist/Man/man1m

2020-06-24 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Wed Jun 24 18:06:01 UTC 2020

Modified Files:
src/external/cddl/dtracetoolkit/dist/Man/man1m: opensnoop.1m

Log Message:
mdocify


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/external/cddl/dtracetoolkit/dist/Man/man1m/opensnoop.1m

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

Modified files:

Index: src/external/cddl/dtracetoolkit/dist/Man/man1m/opensnoop.1m
diff -u src/external/cddl/dtracetoolkit/dist/Man/man1m/opensnoop.1m:1.1.1.1 src/external/cddl/dtracetoolkit/dist/Man/man1m/opensnoop.1m:1.2
--- src/external/cddl/dtracetoolkit/dist/Man/man1m/opensnoop.1m:1.1.1.1	Wed Sep 30 22:01:09 2015
+++ src/external/cddl/dtracetoolkit/dist/Man/man1m/opensnoop.1m	Wed Jun 24 18:06:01 2020
@@ -1,139 +1,120 @@
-.TH opensnoop 1m  "$Date: 2015/09/30 22:01:09 $" "USER COMMANDS"
-.SH NAME
-opensnoop \- snoop file opens as they occur. Uses DTrace.
-.SH SYNOPSIS
-.B opensnoop
-[\-a|\-A|\-ceghsvxZ] [\-f pathname] [\-n name] [\-p PID]
-.SH DESCRIPTION
-opensnoop tracks file opens. As a process issues a file open, details
-such as UID, PID and pathname are printed out. 
-
-The returned file descriptor is printed,
-a value of -1 indicates an error. This can be useful
-for troubleshooting to determine if appliacions are attempting to
-open files that do not exist. 
-
+.\" $NetBSD: opensnoop.1m,v 1.2 2020/06/24 18:06:01 sevan Exp $
+.Dd June 24, 2020
+.Dt OPENSNOOP 1
+.Os
+.Sh NAME
+.Nm opensnoop
+.Nd snoop file opens as they occur. Uses DTrace
+.Sh SYNOPSIS
+.Nm
+.Op Fl a | Fl A | Fl ceghsvxZ
+.Op Fl f Ar pathname
+.Op Fl n Ar name
+.Op Fl p Ar PID
+.Sh DESCRIPTION
+.Nm
+tracks file opens.
+As a process issues a file open, details such as UID, PID and pathname are
+printed out.
+The returned file descriptor is printed, a value of -1 indicates an error.
+This can be useful for troubleshooting to determine if appliacions are
+attempting to open files that do not exist.
 Since this uses DTrace, only the root user or users with the
 dtrace_kernel privilege can run this command.
-.SH OS
-Solaris
-.SH STABILITY
-stable - needs the syscall provider.
-.SH OPTIONS
-.TP
-\-a
+.Bl -tag -width Ds
+.It Fl a
 print all data
-.TP
-\-A
+.It Fl A
 dump all data, space delimited
-.TP
-\-c
+.It Fl c
 print current working directory of process
-.TP
-\-e
+.It Fl e
 print errno value
-.TP
-\-g
+.It Fl g
 print full command arguments
-.TP
-\-s
+.It Fl s
 print start time, us
-.TP
-\-v
+.It Fl v
 print start time, string
-.TP
-\-x
+.It Fl x
 only print failed opens
-.TP
-\-Z
+.It Fl Z
 print zonename
-.TP
-\-f pathname
+.It Fl f Ar pathname
 file pathname to snoop
-.TP
-\-n name
+.It Fl n Ar name
 process name to snoop
-.TP
-\-p PID
+.It Fl p Ar PID
 process ID to snoop
-.PP
-.SH EXAMPLES
-.TP
-Default output, print file opens by process as they occur,
-# 
-.B opensnoop
-.PP
-.TP
-Print human readable timestamps,
-# 
-.B opensnoop
-\-v 
-.PP
-.TP
-See error codes,
-#
-.B opensnoop
-\-e
-.PP
-.TP
-Snoop this file only,
-#
-.B opensnoop
-\-f /etc/passwd
-.PP
-.SH FIELDS
-.TP
-ZONE
+.El
+.Pp
+Description of fields
+.Bl -column
+.It ZONE
 Zone name
-.TP
-UID
+.It UID
 User ID
-.TP
-PID
+.It PID
 Process ID
-.TP
-PPID
+.It PPID
 Parent Process ID
-.TP
-FD
+.It FD
 File Descriptor (-1 is error)
-.TP
-ERR
-errno value (see /usr/include/sys/errno.h)
-.TP
-CWD
+.It ERR
+errno value (see
+.Pa /usr/include/sys/errno.h
+)
+.It CWD
 current working directory of process
-.TP
-PATH
+.It PATH
 pathname for file open
-.TP
-COMM
+.It COMM
 command name for the process
-.TP
-ARGS
+.It ARGS
 argument listing for the process
-.TP
-TIME
+.It TIME
 timestamp for the open event, us
-.TP
-STRTIME
+.It STRTIME
 timestamp for the open event, string
-.SH DOCUMENTATION
-See the DTraceToolkit for further documentation under the 
-Docs directory. The DTraceToolkit docs may include full worked
-examples with verbose descriptions explaining the output.
-.SH EXIT
-opensnoop will run forever until Ctrl\-C is hit. 
-.SH BUGS
-occasionally the pathname for the file open cannot be read
-and the following error will be seen,
-
+.El
+.Sh EXAMPLES
+Default output, print file opens by process as they occur,
+.Bd -literal -offset indent
+.Ic opensnoop
+.Ed
+.Pp
+Print human readable timestamps,
+.Bd -literal -offset indent
+.Ic opensnoop -v
+.Ed
+.Pp
+See error codes,
+.Bd -literal -offset indent
+.Ic opensnoop -e
+.Ed
+.Pp
+Snoop this file only,
+.Bd -literal -offset indent
+.Ic opensnoop -f /etc/passwd
+.Ed
+.Sh STABILITY
+stable - needs the syscall provider.
+.Sh DOCUMENTATION
+See the DTraceToolkit for further documentation under the Docs directory.
+The DTraceToolkit docs may include full worked examples with verbose
+descriptions explaining the output.
+.Sh EXIT
+opensnoop will run forever until Ctrl\-C is hit.
+.Sh SEE ALSO
+.Xr dtrace 1
+.Sh AUTHORS
+.An Brendan Gregg
+[Sydney, Australia]
+.Sh BUGS
+Occasionally the pathname 

CVS commit: src/sys/compat/common

2020-06-24 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Wed Jun 24 17:47:52 UTC 2020

Modified Files:
src/sys/compat/common: tty_60.c

Log Message:
reduce stack usage in compat_60_ptmget_ioctl() - allocate struct ptmget
via kmem_alloc()


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/compat/common/tty_60.c

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

Modified files:

Index: src/sys/compat/common/tty_60.c
diff -u src/sys/compat/common/tty_60.c:1.9 src/sys/compat/common/tty_60.c:1.10
--- src/sys/compat/common/tty_60.c:1.9	Thu Dec 12 02:15:42 2019
+++ src/sys/compat/common/tty_60.c	Wed Jun 24 17:47:52 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: tty_60.c,v 1.9 2019/12/12 02:15:42 pgoyette Exp $	*/
+/*	$NetBSD: tty_60.c,v 1.10 2020/06/24 17:47:52 jdolecek Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tty_60.c,v 1.9 2019/12/12 02:15:42 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty_60.c,v 1.10 2020/06/24 17:47:52 jdolecek Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -42,6 +42,7 @@ __KERNEL_RCSID(0, "$NetBSD: tty_60.c,v 1
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -70,7 +71,7 @@ compat_60_ptmget_ioctl(dev_t dev, u_long
 {
 	int ret;
 	u_long newcmd;
-	struct ptmget pg;
+	struct ptmget *pg;
 	const struct cdevsw *cd = cdevsw_lookup(dev);
 
 	if (cd == NULL || cd->d_ioctl == NULL)
@@ -82,10 +83,16 @@ compat_60_ptmget_ioctl(dev_t dev, u_long
 	default: return ENOTTY;
 	}
 
-	ret = (cd->d_ioctl)(dev, newcmd, , flag, l);
+	pg = kmem_alloc(sizeof(*pg), KM_SLEEP);
+
+	ret = (cd->d_ioctl)(dev, newcmd, pg, flag, l);
 	if (ret != 0)
-		return ret;
-	ret = ptmget_to_ptmget60(, data);
+		goto out;
+
+	ret = ptmget_to_ptmget60(pg, data);
+
+out:
+	kmem_free(pg, sizeof(*pg));
 	return ret;
 }
 



CVS commit: src/bin/mv

2020-06-24 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jun 24 17:00:58 UTC 2020

Modified Files:
src/bin/mv: mv.1

Log Message:
Note that -h is an extension to POSIX.  Bump date.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/bin/mv/mv.1

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

Modified files:

Index: src/bin/mv/mv.1
diff -u src/bin/mv/mv.1:1.31 src/bin/mv/mv.1:1.32
--- src/bin/mv/mv.1:1.31	Wed Jun 24 16:58:12 2020
+++ src/bin/mv/mv.1	Wed Jun 24 17:00:58 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mv.1,v 1.31 2020/06/24 16:58:12 riastradh Exp $
+.\"	$NetBSD: mv.1,v 1.32 2020/06/24 17:00:58 riastradh Exp $
 .\"
 .\" Copyright (c) 1989, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -32,7 +32,7 @@
 .\"
 .\"	@(#)mv.1	8.1 (Berkeley) 5/31/93
 .\"
-.Dd August 10, 2016
+.Dd June 24, 2020
 .Dt MV 1
 .Os
 .Sh NAME
@@ -146,8 +146,10 @@ utility is expected to be
 compatible.
 .Pp
 The
+.Fl h
+and
 .Fl v
-option is an extension to
+options are extensions to
 .St -p1003.2 .
 .Sh HISTORY
 An



CVS commit: src/bin/mv

2020-06-24 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jun 24 16:58:12 UTC 2020

Modified Files:
src/bin/mv: mv.1 mv.c

Log Message:
New mv -h option.

`mv -h source target' just issues rename(source, target) without
discriminating on whether target resolves to a directory; this way
you can atomically replace a symlink to a directory.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/bin/mv/mv.1
cvs rdiff -u -r1.45 -r1.46 src/bin/mv/mv.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/mv/mv.1
diff -u src/bin/mv/mv.1:1.30 src/bin/mv/mv.1:1.31
--- src/bin/mv/mv.1:1.30	Tue Jul  4 06:50:04 2017
+++ src/bin/mv/mv.1	Wed Jun 24 16:58:12 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mv.1,v 1.30 2017/07/04 06:50:04 wiz Exp $
+.\"	$NetBSD: mv.1,v 1.31 2020/06/24 16:58:12 riastradh Exp $
 .\"
 .\" Copyright (c) 1989, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -40,7 +40,7 @@
 .Nd move files
 .Sh SYNOPSIS
 .Nm
-.Op Fl fiv
+.Op Fl fhiv
 .Ar source target
 .Nm
 .Op Fl fiv
@@ -54,7 +54,9 @@ operand to the destination path named by
 .Ar target
 operand.
 This form is assumed when the last operand does not name an already
-existing directory.
+existing directory or when the
+.Fl h
+flag is specified.
 .Pp
 In its second form,
 .Nm
@@ -72,6 +74,11 @@ The following options are available:
 .It Fl f
 Do not prompt for confirmation before overwriting the destination
 path.
+.It Fl h
+Try to rename the source to the target irrespective of whether the
+target may resolve to a directory.
+This option allows atomically replacing a symbolic link to a
+directory.
 .It Fl i
 Causes
 .Nm

Index: src/bin/mv/mv.c
diff -u src/bin/mv/mv.c:1.45 src/bin/mv/mv.c:1.46
--- src/bin/mv/mv.c:1.45	Sun Feb 28 10:59:29 2016
+++ src/bin/mv/mv.c	Wed Jun 24 16:58:12 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: mv.c,v 1.45 2016/02/28 10:59:29 mrg Exp $ */
+/* $NetBSD: mv.c,v 1.46 2020/06/24 16:58:12 riastradh Exp $ */
 
 /*
  * Copyright (c) 1989, 1993, 1994
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 19
 #if 0
 static char sccsid[] = "@(#)mv.c	8.2 (Berkeley) 4/2/94";
 #else
-__RCSID("$NetBSD: mv.c,v 1.45 2016/02/28 10:59:29 mrg Exp $");
+__RCSID("$NetBSD: mv.c,v 1.46 2020/06/24 16:58:12 riastradh Exp $");
 #endif
 #endif /* not lint */
 
@@ -65,7 +65,7 @@ __RCSID("$NetBSD: mv.c,v 1.45 2016/02/28
 
 #include "pathnames.h"
 
-static int fflg, iflg, vflg;
+static int fflg, hflg, iflg, vflg;
 static int stdin_ok;
 static sig_atomic_t pinfo;
 
@@ -93,8 +93,11 @@ main(int argc, char *argv[])
 	setprogname(argv[0]);
 	(void)setlocale(LC_ALL, "");
 
-	while ((ch = getopt(argc, argv, "ifv")) != -1)
+	while ((ch = getopt(argc, argv, "hifv")) != -1)
 		switch (ch) {
+		case 'h':
+			hflg = 1;
+			break;
 		case 'i':
 			fflg = 0;
 			iflg = 1;
@@ -123,7 +126,7 @@ main(int argc, char *argv[])
 	 * If the stat on the target fails or the target isn't a directory,
 	 * try the move.  More than 2 arguments is an error in this case.
 	 */
-	if (stat(argv[argc - 1], ) || !S_ISDIR(sb.st_mode)) {
+	if (hflg || stat(argv[argc - 1], ) || !S_ISDIR(sb.st_mode)) {
 		if (argc > 2)
 			usage();
 		exit(do_move(argv[0], argv[1]));
@@ -419,7 +422,7 @@ copy(char *from, char *to)
 static void
 usage(void)
 {
-	(void)fprintf(stderr, "usage: %s [-fiv] source target\n"
+	(void)fprintf(stderr, "usage: %s [-fhiv] source target\n"
 	"   %s [-fiv] source ... directory\n", getprogname(),
 	getprogname());
 	exit(1);



CVS commit: src/usr.bin/m4

2020-06-24 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Wed Jun 24 16:49:30 UTC 2020

Modified Files:
src/usr.bin/m4: main.c

Log Message:
Try not to lose error output with --error-output.

Try to avoid the trap we set up ourselves while avoiding freopen(3).
When exit flushes and closes open streams it may close sfp first and
when it comes about to flush and close stderr, the descriptor is
already gone and we lose any buffered error output.  This actually
happens on some hosts, breaking --trace output used by autoconf.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/usr.bin/m4/main.c

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

Modified files:

Index: src/usr.bin/m4/main.c
diff -u src/usr.bin/m4/main.c:1.48 src/usr.bin/m4/main.c:1.49
--- src/usr.bin/m4/main.c:1.48	Tue Mar 26 16:41:06 2019
+++ src/usr.bin/m4/main.c	Wed Jun 24 16:49:30 2020
@@ -1,5 +1,5 @@
 /*	$OpenBSD: main.c,v 1.77 2009/10/14 17:19:47 sthen Exp $	*/
-/*	$NetBSD: main.c,v 1.48 2019/03/26 16:41:06 christos Exp $	*/
+/*	$NetBSD: main.c,v 1.49 2020/06/24 16:49:30 uwe Exp $	*/
 
 /*-
  * Copyright (c) 1989, 1993
@@ -42,7 +42,7 @@
 #include "nbtool_config.h"
 #endif
 #include 
-__RCSID("$NetBSD: main.c,v 1.48 2019/03/26 16:41:06 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.49 2020/06/24 16:49:30 uwe Exp $");
 #include 
 #include 
 #include 
@@ -274,6 +274,17 @@ main(int argc, char *argv[])
 			}
 			fclose(stderr);
 			memcpy(stderr, sfp, sizeof(*sfp));
+			/*
+			 * XXX: try to avoid the trap set up by the
+			 * kludge above.  When exit flushes and closes
+			 * open streams it may close sfp first and
+			 * when it comes about to flush and close
+			 * stderr, the descriptor is already gone and
+			 * we lose any buffered output.  This actually
+			 * happens on some hosts, breaking autoconf
+			 * tracing.
+			 */
+			setvbuf(stderr, (char *)NULL, _IOLBF, 0);
 			break;
 		case 'F':
 			freeze = optarg;



CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs

2020-06-24 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Wed Jun 24 16:29:34 UTC 2020

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: dsl_scan.c

Log Message:
reduce stack usage in dsl_scan_recurse() - allocate memory for
temporary zbookmark_phys_t using kmem_alloc() rather than stack;
this recuses several times usually, and this saves 2x
sizeof(zbookmark_phys_t) == 64 bytes per recursion

part of fix for PR kern/55402 by Frank Kardel


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/dsl_scan.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/cddl/osnet/dist/uts/common/fs/zfs/dsl_scan.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/dsl_scan.c:1.2 src/external/cddl/osnet/dist/uts/common/fs/zfs/dsl_scan.c:1.3
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/dsl_scan.c:1.2	Wed Jun 24 16:23:16 2020
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/dsl_scan.c	Wed Jun 24 16:29:34 2020
@@ -397,7 +397,7 @@ static void dsl_scan_visitbp(blkptr_t *b
 dmu_objset_type_t ostype, dmu_tx_t *tx);
 static void dsl_scan_visitdnode(dsl_scan_t *, dsl_dataset_t *ds,
 dmu_objset_type_t ostype,
-dnode_phys_t *dnp, uint64_t object, dmu_tx_t *tx);
+dnode_phys_t *dnp, uint64_t object, dmu_tx_t *tx, zbookmark_phys_t *);
 
 void
 dsl_free(dsl_pool_t *dp, uint64_t txg, const blkptr_t *bp)
@@ -585,9 +585,8 @@ dsl_scan_zil(dsl_pool_t *dp, zil_header_
 /* ARGSUSED */
 static void
 dsl_scan_prefetch(dsl_scan_t *scn, arc_buf_t *buf, blkptr_t *bp,
-uint64_t objset, uint64_t object, uint64_t blkid)
+uint64_t objset, uint64_t object, uint64_t blkid, zbookmark_phys_t *czb)
 {
-	zbookmark_phys_t czb;
 	arc_flags_t flags = ARC_FLAG_NOWAIT | ARC_FLAG_PREFETCH;
 
 	if (zfs_no_scrub_prefetch)
@@ -597,11 +596,11 @@ dsl_scan_prefetch(dsl_scan_t *scn, arc_b
 	(BP_GET_LEVEL(bp) == 0 && BP_GET_TYPE(bp) != DMU_OT_DNODE))
 		return;
 
-	SET_BOOKMARK(, objset, object, BP_GET_LEVEL(bp), blkid);
+	SET_BOOKMARK(czb, objset, object, BP_GET_LEVEL(bp), blkid);
 
 	(void) arc_read(scn->scn_zio_root, scn->scn_dp->dp_spa, bp,
 	NULL, NULL, ZIO_PRIORITY_ASYNC_READ,
-	ZIO_FLAG_CANFAIL | ZIO_FLAG_SCAN_THREAD, , );
+	ZIO_FLAG_CANFAIL | ZIO_FLAG_SCAN_THREAD, , czb);
 }
 
 static boolean_t
@@ -659,6 +658,7 @@ dsl_scan_recurse(dsl_scan_t *scn, dsl_da
 		blkptr_t *cbp;
 		int epb = BP_GET_LSIZE(bp) >> SPA_BLKPTRSHIFT;
 		arc_buf_t *buf;
+		zbookmark_phys_t *czb;
 
 		err = arc_read(NULL, dp->dp_spa, bp, arc_getbuf_func, ,
 		ZIO_PRIORITY_ASYNC_READ, zio_flags, , zb);
@@ -666,19 +666,19 @@ dsl_scan_recurse(dsl_scan_t *scn, dsl_da
 			scn->scn_phys.scn_errors++;
 			return (err);
 		}
+		czb = kmem_alloc(sizeof (*czb), KM_SLEEP);
 		for (i = 0, cbp = buf->b_data; i < epb; i++, cbp++) {
 			dsl_scan_prefetch(scn, buf, cbp, zb->zb_objset,
-			zb->zb_object, zb->zb_blkid * epb + i);
+			zb->zb_object, zb->zb_blkid * epb + i, czb);
 		}
 		for (i = 0, cbp = buf->b_data; i < epb; i++, cbp++) {
-			zbookmark_phys_t czb;
-
-			SET_BOOKMARK(, zb->zb_objset, zb->zb_object,
+			SET_BOOKMARK(czb, zb->zb_objset, zb->zb_object,
 			zb->zb_level - 1,
 			zb->zb_blkid * epb + i);
-			dsl_scan_visitbp(cbp, , dnp,
+			dsl_scan_visitbp(cbp, czb, dnp,
 			ds, scn, ostype, tx);
 		}
+		kmem_free(czb, sizeof (*czb));
 		arc_buf_destroy(buf, );
 	} else if (BP_GET_TYPE(bp) == DMU_OT_DNODE) {
 		arc_flags_t flags = ARC_FLAG_WAIT;
@@ -686,6 +686,7 @@ dsl_scan_recurse(dsl_scan_t *scn, dsl_da
 		int i, j;
 		int epb = BP_GET_LSIZE(bp) >> DNODE_SHIFT;
 		arc_buf_t *buf;
+		zbookmark_phys_t *czb;
 
 		err = arc_read(NULL, dp->dp_spa, bp, arc_getbuf_func, ,
 		ZIO_PRIORITY_ASYNC_READ, zio_flags, , zb);
@@ -693,23 +694,27 @@ dsl_scan_recurse(dsl_scan_t *scn, dsl_da
 			scn->scn_phys.scn_errors++;
 			return (err);
 		}
+		czb = kmem_alloc(sizeof (*czb), KM_SLEEP);
 		for (i = 0, cdnp = buf->b_data; i < epb; i++, cdnp++) {
 			for (j = 0; j < cdnp->dn_nblkptr; j++) {
 blkptr_t *cbp = >dn_blkptr[j];
 dsl_scan_prefetch(scn, buf, cbp,
-zb->zb_objset, zb->zb_blkid * epb + i, j);
+zb->zb_objset, zb->zb_blkid * epb + i, j,
+czb);
 			}
 		}
 		for (i = 0, cdnp = buf->b_data; i < epb; i++, cdnp++) {
 			dsl_scan_visitdnode(scn, ds, ostype,
-			cdnp, zb->zb_blkid * epb + i, tx);
+			cdnp, zb->zb_blkid * epb + i, tx, czb);
 		}
+		kmem_free(czb, sizeof (*czb));
 
 		arc_buf_destroy(buf, );
 	} else if (BP_GET_TYPE(bp) == DMU_OT_OBJSET) {
 		arc_flags_t flags = ARC_FLAG_WAIT;
 		objset_phys_t *osp;
 		arc_buf_t *buf;
+		zbookmark_phys_t *czb;
 
 		err = arc_read(NULL, dp->dp_spa, bp, arc_getbuf_func, ,
 		ZIO_PRIORITY_ASYNC_READ, zio_flags, , zb);
@@ -720,8 +725,9 @@ dsl_scan_recurse(dsl_scan_t *scn, dsl_da
 
 		osp = buf->b_data;
 
+		czb = kmem_alloc(sizeof (*czb), KM_SLEEP);
 		

CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs

2020-06-24 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Wed Jun 24 16:23:16 UTC 2020

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: dsl_scan.c

Log Message:
change dsl_scan_visitbp() to allocate blkptr_t dynamically rather than
on-stack - this function is called recursively, and the 120 bytes per call
add up; also remove unused variable

part of fix for PR kern/55402 by Frank Kardel


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/dsl_scan.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/cddl/osnet/dist/uts/common/fs/zfs/dsl_scan.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/dsl_scan.c:1.1.1.1 src/external/cddl/osnet/dist/uts/common/fs/zfs/dsl_scan.c:1.2
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/dsl_scan.c:1.1.1.1	Mon May 28 20:52:57 2018
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/dsl_scan.c	Wed Jun 24 16:23:16 2020
@@ -778,10 +778,7 @@ dsl_scan_visitbp(blkptr_t *bp, const zbo
 dmu_objset_type_t ostype, dmu_tx_t *tx)
 {
 	dsl_pool_t *dp = scn->scn_dp;
-	arc_buf_t *buf = NULL;
-	blkptr_t bp_toread = *bp;
-
-	/* ASSERT(pbuf == NULL || arc_released(pbuf)); */
+	blkptr_t *bp_toread = NULL;
 
 	if (dsl_scan_check_pause(scn, zb))
 		return;
@@ -803,8 +800,11 @@ dsl_scan_visitbp(blkptr_t *bp, const zbo
 	if (bp->blk_birth <= scn->scn_phys.scn_cur_min_txg)
 		return;
 
-	if (dsl_scan_recurse(scn, ds, ostype, dnp, _toread, zb, tx) != 0)
-		return;
+	bp_toread = kmem_alloc(sizeof (blkptr_t), KM_SLEEP);
+	*bp_toread = *bp;
+
+	if (dsl_scan_recurse(scn, ds, ostype, dnp, bp_toread, zb, tx) != 0)
+		goto out;
 
 	/*
 	 * If dsl_scan_ddt() has aready visited this block, it will have
@@ -813,8 +813,7 @@ dsl_scan_visitbp(blkptr_t *bp, const zbo
 	 */
 	if (ddt_class_contains(dp->dp_spa,
 	scn->scn_phys.scn_ddt_class_max, bp)) {
-		ASSERT(buf == NULL);
-		return;
+		goto out;
 	}
 
 	/*
@@ -827,6 +826,9 @@ dsl_scan_visitbp(blkptr_t *bp, const zbo
 	if (BP_PHYSICAL_BIRTH(bp) <= scn->scn_phys.scn_cur_max_txg) {
 		scan_funcs[scn->scn_phys.scn_func](dp, bp, zb);
 	}
+
+out:
+	kmem_free(bp_toread, sizeof (blkptr_t));
 }
 
 static void



CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs

2020-06-24 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Wed Jun 24 16:16:01 UTC 2020

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: vdev_queue.c

Log Message:
reduce stack usage in vdev_queue_io_to_issue() - zio_t is about 1KB, and
the function potentially recurses into itself

part of fix for PR kern/55402 by Frank Kardel


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.3 -r1.2 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_queue.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/cddl/osnet/dist/uts/common/fs/zfs/vdev_queue.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_queue.c:1.1.1.3 src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_queue.c:1.2
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_queue.c:1.1.1.3	Mon May 28 20:52:59 2018
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_queue.c	Wed Jun 24 16:16:01 2020
@@ -798,7 +798,7 @@ vdev_queue_io_to_issue(vdev_queue_t *vq)
 	zio_priority_t p;
 	avl_index_t idx;
 	avl_tree_t *tree;
-	zio_t search;
+	zio_t *search;
 
 again:
 	ASSERT(MUTEX_HELD(>vq_lock));
@@ -817,10 +817,16 @@ again:
 	 * For FIFO queues (sync), issue the i/o with the lowest timestamp.
 	 */
 	tree = vdev_queue_class_tree(vq, p);
-	search.io_timestamp = 0;
-	search.io_offset = vq->vq_last_offset + 1;
-	VERIFY3P(avl_find(tree, , ), ==, NULL);
-	zio = avl_nearest(tree, idx, AVL_AFTER);
+	search = kmem_zalloc(sizeof (*search), KM_NOSLEEP);
+	if (search) {
+		search->io_offset = vq->vq_last_offset + 1;
+		VERIFY3P(avl_find(tree, , ), ==, NULL);
+		kmem_free(search, sizeof (*search));
+		zio = avl_nearest(tree, idx, AVL_AFTER);
+	} else {
+		/* Can't find nearest, fallback to first */
+		zio = NULL;
+	}
 	if (zio == NULL)
 		zio = avl_first(tree);
 	ASSERT3U(zio->io_priority, ==, p);



CVS commit: src/tests/usr.sbin

2020-06-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jun 24 15:05:45 UTC 2020

Modified Files:
src/tests/usr.sbin/stdethers: Makefile
src/tests/usr.sbin/stdhosts: Makefile

Log Message:
Add input files


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.sbin/stdethers/Makefile
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.sbin/stdhosts/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/usr.sbin/stdethers/Makefile
diff -u src/tests/usr.sbin/stdethers/Makefile:1.2 src/tests/usr.sbin/stdethers/Makefile:1.3
--- src/tests/usr.sbin/stdethers/Makefile:1.2	Wed Jun 24 14:48:47 2020
+++ src/tests/usr.sbin/stdethers/Makefile	Wed Jun 24 15:05:45 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.2 2020/06/24 14:48:47 martin Exp $
+# $NetBSD: Makefile,v 1.3 2020/06/24 15:05:45 martin Exp $
 
 .include 
 
@@ -6,4 +6,7 @@ TESTSDIR=	${TESTSBASE}/usr.sbin/stdether
 
 TESTS_SH=	t_stdethers
 
+FILESDIR=	${TESTSDIR}
+FILES+= 	d_valid.in
+
 .include 

Index: src/tests/usr.sbin/stdhosts/Makefile
diff -u src/tests/usr.sbin/stdhosts/Makefile:1.2 src/tests/usr.sbin/stdhosts/Makefile:1.3
--- src/tests/usr.sbin/stdhosts/Makefile:1.2	Wed Jun 24 14:48:47 2020
+++ src/tests/usr.sbin/stdhosts/Makefile	Wed Jun 24 15:05:45 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.2 2020/06/24 14:48:47 martin Exp $
+# $NetBSD: Makefile,v 1.3 2020/06/24 15:05:45 martin Exp $
 
 .include 
 
@@ -6,4 +6,7 @@ TESTSDIR=	${TESTSBASE}/usr.sbin/stdhosts
 
 TESTS_SH=	t_stdhosts
 
+FILESDIR=	${TESTSDIR}
+FILES+= 	d_ipv6.in
+
 .include 



CVS commit: src/tests/usr.sbin

2020-06-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jun 24 14:48:47 UTC 2020

Modified Files:
src/tests/usr.sbin/stdethers: Makefile
src/tests/usr.sbin/stdhosts: Makefile

Log Message:
Fix directories


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.sbin/stdethers/Makefile
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.sbin/stdhosts/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/usr.sbin/stdethers/Makefile
diff -u src/tests/usr.sbin/stdethers/Makefile:1.1 src/tests/usr.sbin/stdethers/Makefile:1.2
--- src/tests/usr.sbin/stdethers/Makefile:1.1	Wed Jun 24 09:47:18 2020
+++ src/tests/usr.sbin/stdethers/Makefile	Wed Jun 24 14:48:47 2020
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.1 2020/06/24 09:47:18 jruoho Exp $
+# $NetBSD: Makefile,v 1.2 2020/06/24 14:48:47 martin Exp $
 
 .include 
 
-TESTSDIR=	${TESTSBASE}/usr.sbin/t_stdethers
+TESTSDIR=	${TESTSBASE}/usr.sbin/stdethers
 
 TESTS_SH=	t_stdethers
 

Index: src/tests/usr.sbin/stdhosts/Makefile
diff -u src/tests/usr.sbin/stdhosts/Makefile:1.1 src/tests/usr.sbin/stdhosts/Makefile:1.2
--- src/tests/usr.sbin/stdhosts/Makefile:1.1	Wed Jun 24 09:47:18 2020
+++ src/tests/usr.sbin/stdhosts/Makefile	Wed Jun 24 14:48:47 2020
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.1 2020/06/24 09:47:18 jruoho Exp $
+# $NetBSD: Makefile,v 1.2 2020/06/24 14:48:47 martin Exp $
 
 .include 
 
-TESTSDIR=	${TESTSBASE}/usr.sbin/t_stdhosts
+TESTSDIR=	${TESTSBASE}/usr.sbin/stdhosts
 
 TESTS_SH=	t_stdhosts
 



CVS commit: src/tools/compat

2020-06-24 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Wed Jun 24 14:44:44 UTC 2020

Modified Files:
src/tools/compat: configure

Log Message:
Regen: Add AC_MSG_RESULT yes/no to the uio checks.


To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.98 src/tools/compat/configure

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

Modified files:

Index: src/tools/compat/configure
diff -u src/tools/compat/configure:1.97 src/tools/compat/configure:1.98
--- src/tools/compat/configure:1.97	Sat Jun 22 14:40:33 2019
+++ src/tools/compat/configure	Wed Jun 24 14:44:44 2020
@@ -4315,9 +4315,14 @@ enum uio_rw rw;
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 
 $as_echo "#define HAVE_ENUM_UIO_RW 1" >>confdefs.h
 
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
@@ -4339,9 +4344,14 @@ enum uio_seg seg;
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 
 $as_echo "#define HAVE_ENUM_UIO_SEG 1" >>confdefs.h
 
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 



CVS commit: src/tools/compat

2020-06-24 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Wed Jun 24 14:39:01 UTC 2020

Modified Files:
src/tools/compat: configure.ac

Log Message:
Add AC_MSG_RESULT yes/no to the uio checks.


To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.98 src/tools/compat/configure.ac

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

Modified files:

Index: src/tools/compat/configure.ac
diff -u src/tools/compat/configure.ac:1.97 src/tools/compat/configure.ac:1.98
--- src/tools/compat/configure.ac:1.97	Sat Jun 22 13:42:53 2019
+++ src/tools/compat/configure.ac	Wed Jun 24 14:39:01 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: configure.ac,v 1.97 2019/06/22 13:42:53 hannken Exp $
+#	$NetBSD: configure.ac,v 1.98 2020/06/24 14:39:01 uwe Exp $
 #
 # Autoconf definition file for libnbcompat.
 #
@@ -121,8 +121,11 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
 #ifdef HAVE_SYS_UIO_H
 #include 
 #endif]],
-[[enum uio_rw rw;]])],[AC_DEFINE([HAVE_ENUM_UIO_RW], 1,
-			[Define if you have the enum uio_rw type.])],)
+[[enum uio_rw rw;]])],
+[AC_MSG_RESULT(yes)
+ AC_DEFINE([HAVE_ENUM_UIO_RW], 1,
+[Define if you have the enum uio_rw type.])],
+[AC_MSG_RESULT(no)])
 
 AC_MSG_CHECKING([for enum uio_seg])
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
@@ -130,8 +133,11 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
 #ifdef HAVE_SYS_UIO_H
 #include 
 #endif]],
-[[enum uio_seg seg;]])],[AC_DEFINE([HAVE_ENUM_UIO_SEG], 1,
-			[Define if you have the enum uio_seg type.])],)
+[[enum uio_seg seg;]])],
+[AC_MSG_RESULT(yes)
+ AC_DEFINE([HAVE_ENUM_UIO_SEG], 1,
+[Define if you have the enum uio_seg type.])],
+[AC_MSG_RESULT(no)])
 
 dnl XXX - This is UGLY.  Need a better way to homogenize the bitsized types,
 dnl including use of compiler primitive types via AC_CHECK_SIZEOF.



CVS commit: src/sys/arch/xen/xen

2020-06-24 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Wed Jun 24 14:33:08 UTC 2020

Modified Files:
src/sys/arch/xen/xen: if_xennet_xenbus.c

Log Message:
fix tyop in KASSERT() condition which made it an assignment rather than a check

the field indeed is supposed to be set to GRANT_INVALID_REF at this moment,
the grant must be already revoked by this time

pointed out by Taylor R Campbell


To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/sys/arch/xen/xen/if_xennet_xenbus.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/xen/xen/if_xennet_xenbus.c
diff -u src/sys/arch/xen/xen/if_xennet_xenbus.c:1.126 src/sys/arch/xen/xen/if_xennet_xenbus.c:1.127
--- src/sys/arch/xen/xen/if_xennet_xenbus.c:1.126	Thu May 14 13:25:40 2020
+++ src/sys/arch/xen/xen/if_xennet_xenbus.c	Wed Jun 24 14:33:08 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: if_xennet_xenbus.c,v 1.126 2020/05/14 13:25:40 jdolecek Exp $  */
+/*  $NetBSD: if_xennet_xenbus.c,v 1.127 2020/06/24 14:33:08 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -81,7 +81,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.126 2020/05/14 13:25:40 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.127 2020/06/24 14:33:08 jdolecek Exp $");
 
 #include "opt_xen.h"
 #include "opt_nfs_boot.h"
@@ -774,7 +774,7 @@ xennet_alloc_rx_buffer(struct xennet_xen
 		KASSERT(req != NULL);
 		KASSERT(req == >sc_rxreqs[req->rxreq_id]);
 		KASSERT(req->rxreq_m == NULL);
-		KASSERT(req->rxreq_gntref = GRANT_INVALID_REF);
+		KASSERT(req->rxreq_gntref == GRANT_INVALID_REF);
 
 		MGETHDR(m, M_DONTWAIT, MT_DATA);
 		if (__predict_false(m == NULL)) {



CVS commit: src/tests/lib/libprop

2020-06-24 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jun 24 14:28:10 UTC 2020

Modified Files:
src/tests/lib/libprop: t_proplib.c

Log Message:
Fix pasto; use {,U}LLONG{MIN,MAX} correctly in the {u,}llong{min,max}
range checks.

PR lib/55414


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libprop/t_proplib.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/libprop/t_proplib.c
diff -u src/tests/lib/libprop/t_proplib.c:1.3 src/tests/lib/libprop/t_proplib.c:1.4
--- src/tests/lib/libprop/t_proplib.c:1.3	Mon Jun  8 21:31:17 2020
+++ src/tests/lib/libprop/t_proplib.c	Wed Jun 24 14:28:10 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: t_proplib.c,v 1.3 2020/06/08 21:31:17 thorpej Exp $ */
+/* $NetBSD: t_proplib.c,v 1.4 2020/06/24 14:28:10 thorpej Exp $ */
 
 /*
  * Copyright (c) 2008, 2020 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #include 
 __COPYRIGHT("@(#) Copyright (c) 2008, 2020\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_proplib.c,v 1.3 2020/06/08 21:31:17 thorpej Exp $");
+__RCSID("$NetBSD: t_proplib.c,v 1.4 2020/06/24 14:28:10 thorpej Exp $");
 
 #include 
 #include 
@@ -551,16 +551,16 @@ ATF_TC_BODY(prop_number_range_check, tc)
 #endif
 
 	ATF_REQUIRE(prop_number_longlong_value(n_llong_max, _llong) &&
-		val.v_llong == INTPTR_MAX);
+		val.v_llong == LLONG_MAX);
 	ATF_REQUIRE(prop_number_longlong_value(n_llong_min, _llong) &&
-		val.v_llong == INTPTR_MIN);
+		val.v_llong == LLONG_MIN);
 	ATF_REQUIRE(!prop_number_longlong_value(n_ullong_max, _llong));
 
 	ATF_REQUIRE(prop_number_ulonglong_value(n_llong_max, _ullong) &&
-		val.v_ullong == INTPTR_MAX);
+		val.v_ullong == LLONG_MAX);
 	ATF_REQUIRE(!prop_number_ulonglong_value(n_llong_min, _ullong));
 	ATF_REQUIRE(prop_number_ulonglong_value(n_ullong_max, _ullong) &&
-		val.v_ullong == UINTPTR_MAX);
+		val.v_ullong == ULLONG_MAX);
 
 	/* int8_t / uint8_t */
 	ATF_REQUIRE(prop_number_int8_value(n_int8_max, _int8) &&



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

2020-06-24 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Wed Jun 24 12:43:40 UTC 2020

Modified Files:
src/sys/arch/mips/conf: files.octeon

Log Message:
Redo cnmac attachments - cnmacM @ gmxN @ pip0 @ iobus

Missed one file - thanks martin@.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/mips/conf/files.octeon

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

Modified files:

Index: src/sys/arch/mips/conf/files.octeon
diff -u src/sys/arch/mips/conf/files.octeon:1.8 src/sys/arch/mips/conf/files.octeon:1.9
--- src/sys/arch/mips/conf/files.octeon:1.8	Mon Jun 22 02:26:20 2020
+++ src/sys/arch/mips/conf/files.octeon	Wed Jun 24 12:43:40 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: files.octeon,v 1.8 2020/06/22 02:26:20 simonb Exp $
+#	$NetBSD: files.octeon,v 1.9 2020/06/24 12:43:40 simonb Exp $
 
 file	arch/mips/mips/locore_octeon.S
 file	arch/mips/mips/bus_dma.c
@@ -8,15 +8,6 @@ file	arch/mips/mips/mips3_clockintr.c
 file	arch/mips/cavium/octeon_dma.c
 file	arch/mips/cavium/octeon_intr.c
 file	arch/mips/cavium/octeon_misc.c
-file	arch/mips/cavium/dev/octeon_ciu.c
-
-defparam	opt_octeon.h			OCTEON_ECLK
-defparam	opt_octeon.h			CNMAC_RING_MAX
-defparam	opt_octeon.h			CNMAC_RING_MIN
-defflag 	opt_octeon.h			CNMAC_FAST_CRC
-		CNMAC_IPD_RED
-		CNMAC_USENFS
-		OCTEON_USBN_CN31XX_DMA_WORKAROUND
 
 device	mainbus {}
 attach	mainbus at root
@@ -43,11 +34,9 @@ file	arch/mips/cavium/octeon1p_iobus.c	i
 file	arch/mips/cavium/dev/octeon_fpa.c	iobus
 file	arch/mips/cavium/dev/octeon_pow.c	iobus
 file	arch/mips/cavium/dev/octeon_fau.c	iobus
-file	arch/mips/cavium/dev/octeon_pip.c	iobus
 file	arch/mips/cavium/dev/octeon_ipd.c	iobus
 file	arch/mips/cavium/dev/octeon_pko.c	iobus
 file	arch/mips/cavium/dev/octeon_asx.c	iobus
-file	arch/mips/cavium/dev/octeon_smi.c	iobus
 
 # I/O Bus devices
 
@@ -63,12 +52,33 @@ device	octtwsi: i2cbus
 attach	octtwsi at iobus
 file	arch/mips/cavium/dev/octeon_twsi.c	octtwsi
 
-device	octmpi {}
+# XXX rename to octspi?
+device	octmpi: spibus
 attach	octmpi at iobus
 file	arch/mips/cavium/dev/octeon_mpi.c	octmpi
 
+device	octcib {}
+attach	octcib at iobus
+file	arch/mips/cavium/dev/octeon_cib.c	octcib
+
+device	octcit {}
+attach	octcit at iobus
+file	arch/mips/cavium/dev/octeon_cit.c	octcit
+
+device	octciu {}
+attach	octciu at iobus
+file	arch/mips/cavium/dev/octeon_ciu.c	octciu
+
+device	octsmi {}
+attach	octsmi at iobus
+file	arch/mips/cavium/dev/octeon_smi.c	octsmi
+
+device	octpip {}
+attach	octpip at iobus
+file	arch/mips/cavium/dev/octeon_pip.c	octpip
+
 device	octgmx {}
-attach	octgmx at iobus
+attach	octgmx at octpip
 file	arch/mips/cavium/dev/octeon_gmx.c	octgmx
 
 # On-chip ethernet device(s)
@@ -76,9 +86,20 @@ device	cnmac: ether, ifnet, arp, mii
 attach	cnmac at octgmx
 file	arch/mips/cavium/dev/if_cnmac.c		cnmac
 
+# CN3xxx/CN5xxx USB
 attach	dwctwo at iobus with octdwctwo
 file	arch/mips/cavium/dev/octeon_dwctwo.c	octdwctwo
 
+# CN6xxx USB
+device	octuctl {}
+attach	octuctl at iobus with octuctl
+file	arch/mips/cavium/dev/octeon_uctl.c	octuctl
+
+# CN7xxx USB
+device	octxctl {}
+attach	octxctl at iobus with octxctl
+file	arch/mips/cavium/dev/octeon_xctl.c	octuctl
+
 # Boot-Bus
 
 device	bootbus {}
@@ -97,5 +118,5 @@ include "dev/ata/files.ata"
 # Machine-independent USB device support
 include "dev/usb/files.usb"
 
-# Machine-independent PCI device support
-include "dev/pci/files.pci"
+## # Machine-independent PCI device support
+## include "dev/pci/files.pci"



CVS commit: src/tests

2020-06-24 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Wed Jun 24 12:31:26 UTC 2020

Modified Files:
src/tests/usr.bin: Makefile
src/tests/usr.sbin: Makefile

Log Message:
Also install new tests.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/tests/usr.bin/Makefile
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.sbin/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/usr.bin/Makefile
diff -u src/tests/usr.bin/Makefile:1.30 src/tests/usr.bin/Makefile:1.31
--- src/tests/usr.bin/Makefile:1.30	Fri Jan 17 16:25:37 2020
+++ src/tests/usr.bin/Makefile	Wed Jun 24 12:31:26 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.30 2020/01/17 16:25:37 christos Exp $
+#	$NetBSD: Makefile,v 1.31 2020/06/24 12:31:26 jruoho Exp $
 #
 
 .include 
@@ -6,9 +6,9 @@
 TESTSDIR=   ${TESTSBASE}/usr.bin
 
 TESTS_SUBDIRS=	awk basename bzip2 cc cmp config cpio cut \
-		diff dirname find gdb grep gzip id indent \
+		diff dirname find fstat gdb grep gzip id indent \
 		infocmp jot ld m4 make mixerctl mkdep nbperf netpgpverify \
-		pkill pr printf pwhash rump_server shmif_dumpbus sdiff \
+		patch pkill pr printf pwhash rump_server shmif_dumpbus sdiff \
 		sed sort tar tmux tr unifdef uniq vmstat xlint
 
 .if ${MKCXX} != "no"

Index: src/tests/usr.sbin/Makefile
diff -u src/tests/usr.sbin/Makefile:1.4 src/tests/usr.sbin/Makefile:1.5
--- src/tests/usr.sbin/Makefile:1.4	Thu Apr 19 18:51:35 2012
+++ src/tests/usr.sbin/Makefile	Wed Jun 24 12:31:26 2020
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.4 2012/04/19 18:51:35 jruoho Exp $
+# $NetBSD: Makefile,v 1.5 2020/06/24 12:31:26 jruoho Exp $
 .include 
 
 TESTSDIR=   ${TESTSBASE}/usr.sbin
 
-TESTS_SUBDIRS+= mtree tcpdump traceroute useradd
+TESTS_SUBDIRS+= cpuctl mtree stdethers stdhosts tcpdump traceroute useradd
 
 .include 



CVS commit: src/sys/net

2020-06-24 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Jun 24 12:27:51 UTC 2020

Modified Files:
src/sys/net: rtsock_shared.c

Log Message:
Ensure sockaddrs have valid lengths for RO_MISSFILTER.

Thanks to maxv@ for spotting this.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/net/rtsock_shared.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/net/rtsock_shared.c
diff -u src/sys/net/rtsock_shared.c:1.17 src/sys/net/rtsock_shared.c:1.18
--- src/sys/net/rtsock_shared.c:1.17	Fri Mar 13 16:37:12 2020
+++ src/sys/net/rtsock_shared.c	Wed Jun 24 12:27:51 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtsock_shared.c,v 1.17 2020/03/13 16:37:12 christos Exp $	*/
+/*	$NetBSD: rtsock_shared.c,v 1.18 2020/06/24 12:27:51 roy Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rtsock_shared.c,v 1.17 2020/03/13 16:37:12 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock_shared.c,v 1.18 2020/06/24 12:27:51 roy Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -96,6 +96,9 @@ __KERNEL_RCSID(0, "$NetBSD: rtsock_share
 #include 
 #include 
 
+#define _SA_MINSIZE	(offsetof(struct sockaddr, sa_len) + \
+			 sizeof(((struct sockaddr *)0)->sa_len))
+
 #ifdef COMPAT_RTSOCK
 /*
  * These are used when #include-d from compat/common/rtsock_50.c
@@ -244,12 +247,13 @@ COMPATNAME(route_filter)(struct mbuf *m,
 		char *ep = cp + rop->rocb_missfilterlen;
 
 		/* Ensure we can access sa_len */
-		if (m->m_pkthdr.len < sizeof(*rtm) +
-		offsetof(struct sockaddr, sa_len) + sizeof(ss.ss_len))
+		if (m->m_pkthdr.len < sizeof(*rtm) + _SA_MINSIZE)
 			return EINVAL;
 		m_copydata(m, sizeof(*rtm) + offsetof(struct sockaddr, sa_len),
 		sizeof(ss.ss_len), _len);
-		if (m->m_pkthdr.len < sizeof(*rtm) + ss.ss_len)
+		if (ss.ss_len < _SA_MINSIZE ||
+		ss.ss_len > sizeof(ss) ||
+		m->m_pkthdr.len < sizeof(*rtm) + ss.ss_len)
 			return EINVAL;
 		/* Copy out the destination sockaddr */
 		m_copydata(m, sizeof(*rtm), ss.ss_len, );
@@ -1059,6 +1063,9 @@ route_ctloutput(int op, struct socket *s
 	break;
 }
 sa = (struct sockaddr *)cp;
+if (sa->sa_len < _SA_MINSIZE ||
+sa->sa_len >sizeof(struct sockaddr_storage))
+	return EINVAL;
 cp += RT_XROUNDUP(sa->sa_len);
 			}
 			if (cp != ep) {



CVS commit: src/share/man/man5

2020-06-24 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Wed Jun 24 10:30:43 UTC 2020

Modified Files:
src/share/man/man5: rc.conf.5

Log Message:
As bin/55344 was fixed, note the flags also in rc.conf(5).


To generate a diff of this commit:
cvs rdiff -u -r1.181 -r1.182 src/share/man/man5/rc.conf.5

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/man5/rc.conf.5
diff -u src/share/man/man5/rc.conf.5:1.181 src/share/man/man5/rc.conf.5:1.182
--- src/share/man/man5/rc.conf.5:1.181	Mon Jun  3 06:04:20 2019
+++ src/share/man/man5/rc.conf.5	Wed Jun 24 10:30:43 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: rc.conf.5,v 1.181 2019/06/03 06:04:20 msaitoh Exp $
+.\"	$NetBSD: rc.conf.5,v 1.182 2020/06/24 10:30:43 jruoho Exp $
 .\"
 .\" Copyright (c) 1996 Matthew R. Green
 .\" All rights reserved.
@@ -55,7 +55,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd June 3, 2019
+.Dd June 24, 2020
 .Dt RC.CONF 5
 .Os
 .Sh NAME
@@ -899,6 +899,8 @@ Boolean value.
 Runs
 .Xr npfd 8 ,
 the NPF packet filter logging and state synchronization daemon.
+Passes
+.Sy npfd_flags .
 .It Sy net_interfaces
 A string.
 The list of network interfaces to be configured at boot time.



CVS commit: src/sys/compat

2020-06-24 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Wed Jun 24 10:28:17 UTC 2020

Modified Files:
src/sys/compat/common: vfs_syscalls_43.c
src/sys/compat/sunos32: sunos32_misc.c

Log Message:
remove special handling for symbolic links for COMPAT_43 lstat, it's
not necessary; this removes the only places in kernel which did namei
LOOKUP with LOCKPARENT

fixes diagnostic KASSERT() in namei() code

Reported-by: syzbot+628382ecf1438e53d...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/compat/common/vfs_syscalls_43.c
cvs rdiff -u -r1.83 -r1.84 src/sys/compat/sunos32/sunos32_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/sys/compat/common/vfs_syscalls_43.c
diff -u src/sys/compat/common/vfs_syscalls_43.c:1.65 src/sys/compat/common/vfs_syscalls_43.c:1.66
--- src/sys/compat/common/vfs_syscalls_43.c:1.65	Thu Feb 27 18:19:16 2020
+++ src/sys/compat/common/vfs_syscalls_43.c	Wed Jun 24 10:28:16 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls_43.c,v 1.65 2020/02/27 18:19:16 pgoyette Exp $	*/
+/*	$NetBSD: vfs_syscalls_43.c,v 1.66 2020/06/24 10:28:16 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_43.c,v 1.65 2020/02/27 18:19:16 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_43.c,v 1.66 2020/06/24 10:28:16 jdolecek Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -179,69 +179,19 @@ compat_43_sys_lstat(struct lwp *l, const
 		syscallarg(char *) path;
 		syscallarg(struct ostat *) ub;
 	} */
-	struct vnode *vp, *dvp;
-	struct stat sb, sb1;
+	struct stat sb;
 	struct stat43 osb;
 	int error;
-	struct pathbuf *pb;
-	struct nameidata nd;
-	int ndflags;
 
-	error = pathbuf_copyin(SCARG(uap, path), );
-	if (error) {
+	error = do_sys_stat(SCARG(uap, path), NOFOLLOW, );
+	if (error)
 		return error;
-	}
 
-	ndflags = NOFOLLOW | LOCKLEAF | LOCKPARENT | TRYEMULROOT;
-again:
-	NDINIT(, LOOKUP, ndflags, pb);
-	if ((error = namei())) {
-		if (error == EISDIR && (ndflags & LOCKPARENT) != 0) {
-			/*
-			 * Should only happen on '/'. Retry without LOCKPARENT;
-			 * this is safe since the vnode won't be a VLNK.
-			 */
-			ndflags &= ~LOCKPARENT;
-			goto again;
-		}
-		pathbuf_destroy(pb);
-		return (error);
-	}
 	/*
-	 * For symbolic links, always return the attributes of its
+	 * For symbolic links, BSD4.3 returned the attributes of its
 	 * containing directory, except for mode, size, and links.
+	 * This is no longer emulated, the parent directory is not consulted.
 	 */
-	vp = nd.ni_vp;
-	dvp = nd.ni_dvp;
-	pathbuf_destroy(pb);
-	if (vp->v_type != VLNK) {
-		if ((ndflags & LOCKPARENT) != 0) {
-			if (dvp == vp)
-vrele(dvp);
-			else
-vput(dvp);
-		}
-		error = vn_stat(vp, );
-		vput(vp);
-		if (error)
-			return (error);
-	} else {
-		error = vn_stat(dvp, );
-		vput(dvp);
-		if (error) {
-			vput(vp);
-			return (error);
-		}
-		error = vn_stat(vp, );
-		vput(vp);
-		if (error)
-			return (error);
-		sb.st_mode &= ~S_IFDIR;
-		sb.st_mode |= S_IFLNK;
-		sb.st_nlink = sb1.st_nlink;
-		sb.st_size = sb1.st_size;
-		sb.st_blocks = sb1.st_blocks;
-	}
 	cvtstat(, );
 	error = copyout((void *), (void *)SCARG(uap, ub), sizeof (osb));
 	return (error);

Index: src/sys/compat/sunos32/sunos32_misc.c
diff -u src/sys/compat/sunos32/sunos32_misc.c:1.83 src/sys/compat/sunos32/sunos32_misc.c:1.84
--- src/sys/compat/sunos32/sunos32_misc.c:1.83	Sat Oct 26 11:34:48 2019
+++ src/sys/compat/sunos32/sunos32_misc.c	Wed Jun 24 10:28:17 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: sunos32_misc.c,v 1.83 2019/10/26 11:34:48 christos Exp $	*/
+/*	$NetBSD: sunos32_misc.c,v 1.84 2020/06/24 10:28:17 jdolecek Exp $	*/
 /* from :NetBSD: sunos_misc.c,v 1.107 2000/12/01 19:25:10 jdolecek Exp	*/
 
 /*
@@ -77,7 +77,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunos32_misc.c,v 1.83 2019/10/26 11:34:48 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunos32_misc.c,v 1.84 2020/06/24 10:28:17 jdolecek Exp $");
 
 #define COMPAT_SUNOS 1
 
@@ -294,72 +294,19 @@ sunos32_sys_lstat(struct lwp *l, const s
 		syscallarg(const netbsd32_charp) path;
 		syscallarg(netbsd32_stat43p_t) ub;
 	} */
-	struct vnode *vp, *dvp;
-	struct stat sb, sb1;
+	struct stat sb;
 	struct netbsd32_stat43 sb32;
 	int error;
-	struct pathbuf *pb;
-	struct nameidata nd;
-	int ndflags;
-	const char *path;
 
-	path = SCARG_P32(uap, path);
-
-	ndflags = NOFOLLOW | LOCKLEAF | LOCKPARENT | TRYEMULROOT;
-again:
-	error = pathbuf_copyin(path, );
-	if (error) {
+	error = do_sys_stat(SCARG_P32(uap, path), NOFOLLOW, );
+	if (error)
 		return error;
-	}
 
-	NDINIT(, LOOKUP, ndflags, pb);
-	if ((error = namei())) {
-		pathbuf_destroy(pb);
-		if (error == EISDIR && (ndflags & LOCKPARENT) != 0) {
-			/*
-			 * Should only happen on '/'. Retry without LOCKPARENT;
-			 * this is safe since the vnode won't be a VLNK.
-			 */
-		

CVS commit: src/tests

2020-06-24 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Wed Jun 24 10:07:13 UTC 2020

Modified Files:
src/tests/sbin/ifconfig: t_repeated_scan.sh
src/tests/usr.sbin/cpuctl: t_cpuctl.sh

Log Message:
Fix references in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/sbin/ifconfig/t_repeated_scan.sh
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.sbin/cpuctl/t_cpuctl.sh

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

Modified files:

Index: src/tests/sbin/ifconfig/t_repeated_scan.sh
diff -u src/tests/sbin/ifconfig/t_repeated_scan.sh:1.1 src/tests/sbin/ifconfig/t_repeated_scan.sh:1.2
--- src/tests/sbin/ifconfig/t_repeated_scan.sh:1.1	Wed Jun 24 09:11:26 2020
+++ src/tests/sbin/ifconfig/t_repeated_scan.sh	Wed Jun 24 10:07:13 2020
@@ -1,4 +1,4 @@
-# $NetBSD: t_repeated_scan.sh,v 1.1 2020/06/24 09:11:26 jruoho Exp $
+# $NetBSD: t_repeated_scan.sh,v 1.2 2020/06/24 10:07:13 jruoho Exp $
 #
 # Copyright (c) 2020 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -30,7 +30,7 @@
 atf_test_case repeated_scan
 repeated_scan_head() {
 	atf_set "descr" "Test with ifconfig(8) that repeated 802.11 " \
-		"scanning does not cause a panic (PR bin/55389)"
+		"scanning does not cause a panic (PR kern/55389)"
 }
 
 repeated_scan_body() {

Index: src/tests/usr.sbin/cpuctl/t_cpuctl.sh
diff -u src/tests/usr.sbin/cpuctl/t_cpuctl.sh:1.1 src/tests/usr.sbin/cpuctl/t_cpuctl.sh:1.2
--- src/tests/usr.sbin/cpuctl/t_cpuctl.sh:1.1	Wed Jun 24 09:32:41 2020
+++ src/tests/usr.sbin/cpuctl/t_cpuctl.sh	Wed Jun 24 10:07:13 2020
@@ -1,4 +1,4 @@
-# $NetBSD: t_cpuctl.sh,v 1.1 2020/06/24 09:32:41 jruoho Exp $
+# $NetBSD: t_cpuctl.sh,v 1.2 2020/06/24 10:07:13 jruoho Exp $
 #
 # Copyright (c) 2020 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -176,7 +176,7 @@ offline_body() {
 	setcpu "offline" atf_fail "error in setting a CPU offline"
 
 	# Additional check that the boot processor cannot be
-	# set offline, as noted in the cpuctl(9) manual page.
+	# set offline, as noted in the cpuctl(8) manual page.
 	#
 	cpuctl offline 0 >/dev/null 2>&1
 



CVS commit: src

2020-06-24 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Wed Jun 24 10:05:08 UTC 2020

Modified Files:
src/distrib/sets/lists/tests: mi
src/etc/mtree: NetBSD.dist.tests
Added Files:
src/tests/usr.bin/fstat: Makefile t_fstat.sh

Log Message:
Check that fstat(1) works (cf. PR kern/55407).


To generate a diff of this commit:
cvs rdiff -u -r1.847 -r1.848 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.165 -r1.166 src/etc/mtree/NetBSD.dist.tests
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/fstat/Makefile \
src/tests/usr.bin/fstat/t_fstat.sh

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.847 src/distrib/sets/lists/tests/mi:1.848
--- src/distrib/sets/lists/tests/mi:1.847	Wed Jun 24 09:47:17 2020
+++ src/distrib/sets/lists/tests/mi	Wed Jun 24 10:05:07 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.847 2020/06/24 09:47:17 jruoho Exp $
+# $NetBSD: mi,v 1.848 2020/06/24 10:05:07 jruoho Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -4307,6 +4307,10 @@
 ./usr/tests/usr.bin/find/Atffile		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/find/Kyuafile		tests-usr.bin-tests	compattestfile,atf,kyua
 ./usr/tests/usr.bin/find/t_find			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/fstat			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/fstat/Atffile		tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/fstat/Kyuafile		tests-usr.bin-tests	compattestfile,atf,kyua
+./usr/tests/usr.bin/fstat/t_fstat		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/gdbtests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/gdb/Atffile			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/gdb/Kyuafile		tests-usr.bin-tests	compattestfile,atf,kyua

Index: src/etc/mtree/NetBSD.dist.tests
diff -u src/etc/mtree/NetBSD.dist.tests:1.165 src/etc/mtree/NetBSD.dist.tests:1.166
--- src/etc/mtree/NetBSD.dist.tests:1.165	Wed Jun 24 09:47:18 2020
+++ src/etc/mtree/NetBSD.dist.tests	Wed Jun 24 10:05:07 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: NetBSD.dist.tests,v 1.165 2020/06/24 09:47:18 jruoho Exp $
+#	$NetBSD: NetBSD.dist.tests,v 1.166 2020/06/24 10:05:07 jruoho Exp $
 
 ./usr/libdata/debug/usr/tests
 ./usr/libdata/debug/usr/tests/atf
@@ -407,6 +407,7 @@
 ./usr/tests/usr.bin/diff
 ./usr/tests/usr.bin/dirname
 ./usr/tests/usr.bin/find
+./usr/tests/usr.bin/fstat
 ./usr/tests/usr.bin/gdb
 ./usr/tests/usr.bin/grep
 ./usr/tests/usr.bin/gzip

Added files:

Index: src/tests/usr.bin/fstat/Makefile
diff -u /dev/null src/tests/usr.bin/fstat/Makefile:1.1
--- /dev/null	Wed Jun 24 10:05:08 2020
+++ src/tests/usr.bin/fstat/Makefile	Wed Jun 24 10:05:07 2020
@@ -0,0 +1,8 @@
+# $NetBSD: Makefile,v 1.1 2020/06/24 10:05:07 jruoho Exp $
+
+.include 
+
+TESTSDIR=	${TESTSBASE}/usr.bin/fstat
+TESTS_SH=	t_fstat
+
+.include 
Index: src/tests/usr.bin/fstat/t_fstat.sh
diff -u /dev/null src/tests/usr.bin/fstat/t_fstat.sh:1.1
--- /dev/null	Wed Jun 24 10:05:08 2020
+++ src/tests/usr.bin/fstat/t_fstat.sh	Wed Jun 24 10:05:07 2020
@@ -0,0 +1,75 @@
+# $NetBSD: t_fstat.sh,v 1.1 2020/06/24 10:05:07 jruoho Exp $
+#
+# Copyright (c) 2020 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# This code is derived from software contributed to The NetBSD Foundation
+# by Jukka Ruohonen.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#notice, this list of conditions and the following disclaimer in the
+#documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+atf_test_case basic
+basic_head()
+{
+	atf_require_prog fstat
+	atf_set "descr" "Check that fstat(1) works"
+}
+
+basic_body()
+{
+	# If there are chrooted processes running, the following
+	# simple test should catch also those (cf. PR 

CVS commit: src

2020-06-24 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Wed Jun 24 09:47:18 UTC 2020

Modified Files:
src/distrib/sets/lists/tests: mi
src/etc/mtree: NetBSD.dist.tests
Added Files:
src/tests/usr.sbin/stdethers: Makefile d_valid.in t_stdethers.sh
src/tests/usr.sbin/stdhosts: Makefile d_ipv6.in t_stdhosts.sh

Log Message:
Add a few checks for stdethers(8) and stdhosts(8).


To generate a diff of this commit:
cvs rdiff -u -r1.846 -r1.847 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.164 -r1.165 src/etc/mtree/NetBSD.dist.tests
cvs rdiff -u -r0 -r1.1 src/tests/usr.sbin/stdethers/Makefile \
src/tests/usr.sbin/stdethers/d_valid.in \
src/tests/usr.sbin/stdethers/t_stdethers.sh
cvs rdiff -u -r0 -r1.1 src/tests/usr.sbin/stdhosts/Makefile \
src/tests/usr.sbin/stdhosts/d_ipv6.in \
src/tests/usr.sbin/stdhosts/t_stdhosts.sh

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.846 src/distrib/sets/lists/tests/mi:1.847
--- src/distrib/sets/lists/tests/mi:1.846	Wed Jun 24 09:32:41 2020
+++ src/distrib/sets/lists/tests/mi	Wed Jun 24 09:47:17 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.846 2020/06/24 09:32:41 jruoho Exp $
+# $NetBSD: mi,v 1.847 2020/06/24 09:47:17 jruoho Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -4772,6 +4772,16 @@
 ./usr/tests/usr.sbin/mtree/mtree_d_create.out	tests-usr.sbin-tests	compattestfile,atf
 ./usr/tests/usr.sbin/mtree/netbsd6_d_create.out	tests-usr.sbin-tests	compattestfile,atf
 ./usr/tests/usr.sbin/mtree/t_mtree		tests-usr.sbin-tests	compattestfile,atf
+./usr/tests/usr.sbin/stdethers			tests-usr.sbin-tests	compattestfile,atf
+./usr/tests/usr.sbin/stdethers/Atffile		tests-usr.sbin-tests	compattestfile,atf
+./usr/tests/usr.sbin/stdethers/Kyuafile		tests-usr.sbin-tests	compattestfile,atf,kyua
+./usr/tests/usr.sbin/stdethers/d_valid.in	tests-usr.sbin-tests	compattestfile,atf
+./usr/tests/usr.sbin/stdethers/t_stdethers	tests-usr.sbin-tests	compattestfile,atf
+./usr/tests/usr.sbin/stdhosts			tests-usr.sbin-tests	compattestfile,atf
+./usr/tests/usr.sbin/stdhosts/Atffile		tests-usr.sbin-tests	compattestfile,atf
+./usr/tests/usr.sbin/stdhosts/Kyuafile		tests-usr.sbin-tests	compattestfile,atf,kyua
+./usr/tests/usr.sbin/stdhosts/d_ipv6.in		tests-usr.sbin-tests	compattestfile,atf
+./usr/tests/usr.sbin/stdhosts/t_stdhosts	tests-usr.sbin-tests	compattestfile,atf
 ./usr/tests/usr.sbin/tcpdump			tests-usr.sbin-tests	compattestfile,atf
 ./usr/tests/usr.sbin/tcpdump/Atffile		tests-usr.sbin-tests	compattestfile,atf
 ./usr/tests/usr.sbin/tcpdump/Kyuafile		tests-usr.sbin-tests	compattestfile,atf,kyua

Index: src/etc/mtree/NetBSD.dist.tests
diff -u src/etc/mtree/NetBSD.dist.tests:1.164 src/etc/mtree/NetBSD.dist.tests:1.165
--- src/etc/mtree/NetBSD.dist.tests:1.164	Wed Jun 24 09:32:41 2020
+++ src/etc/mtree/NetBSD.dist.tests	Wed Jun 24 09:47:18 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: NetBSD.dist.tests,v 1.164 2020/06/24 09:32:41 jruoho Exp $
+#	$NetBSD: NetBSD.dist.tests,v 1.165 2020/06/24 09:47:18 jruoho Exp $
 
 ./usr/libdata/debug/usr/tests
 ./usr/libdata/debug/usr/tests/atf
@@ -443,6 +443,8 @@
 ./usr/tests/usr.sbin
 ./usr/tests/usr.sbin/cpuctl
 ./usr/tests/usr.sbin/mtree
+./usr/tests/usr.sbin/stdethers
+./usr/tests/usr.sbin/stdhosts
 ./usr/tests/usr.sbin/tcpdump
 ./usr/tests/usr.sbin/traceroute
 ./usr/tests/usr.sbin/useradd

Added files:

Index: src/tests/usr.sbin/stdethers/Makefile
diff -u /dev/null src/tests/usr.sbin/stdethers/Makefile:1.1
--- /dev/null	Wed Jun 24 09:47:18 2020
+++ src/tests/usr.sbin/stdethers/Makefile	Wed Jun 24 09:47:18 2020
@@ -0,0 +1,9 @@
+# $NetBSD: Makefile,v 1.1 2020/06/24 09:47:18 jruoho Exp $
+
+.include 
+
+TESTSDIR=	${TESTSBASE}/usr.sbin/t_stdethers
+
+TESTS_SH=	t_stdethers
+
+.include 
Index: src/tests/usr.sbin/stdethers/d_valid.in
diff -u /dev/null src/tests/usr.sbin/stdethers/d_valid.in:1.1
--- /dev/null	Wed Jun 24 09:47:18 2020
+++ src/tests/usr.sbin/stdethers/d_valid.in	Wed Jun 24 09:47:18 2020
@@ -0,0 +1,7 @@
+00:00:00:00:00:00	a
+01:00:00:00:00:00	b
+00:01:00:00:00:00	c
+00:00:01:00:00:00	d
+00:00:00:01:00:00	e
+00:00:00:00:01:00	f
+00:00:00:00:00:01	g
Index: src/tests/usr.sbin/stdethers/t_stdethers.sh
diff -u /dev/null src/tests/usr.sbin/stdethers/t_stdethers.sh:1.1
--- /dev/null	Wed Jun 24 09:47:18 2020
+++ src/tests/usr.sbin/stdethers/t_stdethers.sh	Wed Jun 24 09:47:18 2020
@@ -0,0 +1,87 @@
+# $NetBSD: t_stdethers.sh,v 1.1 2020/06/24 09:47:18 jruoho Exp $
+#
+# Copyright (c) 2020 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# This code is derived from software contributed to The NetBSD Foundation
+# by Jukka Ruohonen.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain 

CVS commit: src

2020-06-24 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Wed Jun 24 09:32:41 UTC 2020

Modified Files:
src/distrib/sets/lists/tests: mi
src/etc/mtree: NetBSD.dist.tests
Added Files:
src/tests/usr.sbin/cpuctl: Makefile t_cpuctl.sh

Log Message:
Add few basic tests for cpuctl(8). These cover PR kern/45117 and PR bin/54220.
Though, the former is not explicitly tested as it hangs the system.


To generate a diff of this commit:
cvs rdiff -u -r1.845 -r1.846 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.163 -r1.164 src/etc/mtree/NetBSD.dist.tests
cvs rdiff -u -r0 -r1.1 src/tests/usr.sbin/cpuctl/Makefile \
src/tests/usr.sbin/cpuctl/t_cpuctl.sh

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.845 src/distrib/sets/lists/tests/mi:1.846
--- src/distrib/sets/lists/tests/mi:1.845	Wed Jun 24 09:21:43 2020
+++ src/distrib/sets/lists/tests/mi	Wed Jun 24 09:32:41 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.845 2020/06/24 09:21:43 jruoho Exp $
+# $NetBSD: mi,v 1.846 2020/06/24 09:32:41 jruoho Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -4753,6 +4753,10 @@
 ./usr/tests/usr.sbintests-usr.sbin-tests	compattestfile,atf
 ./usr/tests/usr.sbin/Atffile			tests-usr.sbin-tests	compattestfile,atf
 ./usr/tests/usr.sbin/Kyuafile			tests-usr.sbin-tests	compattestfile,atf,kyua
+./usr/tests/usr.sbin/cpuctl			tests-usr.sbin-tests	compattestfile,atf
+./usr/tests/usr.sbin/cpuctl/Atffile		tests-usr.sbin-tests	compattestfile,atf
+./usr/tests/usr.sbin/cpuctl/Kyuafile		tests-usr.sbin-tests	compattestfile,atf,kyua
+./usr/tests/usr.sbin/cpuctl/t_cpuctl		tests-usr.sbin-tests	compattestfile,atf
 ./usr/tests/usr.sbin/mtree			tests-usr.sbin-tests	compattestfile,atf
 ./usr/tests/usr.sbin/mtree/Atffile		tests-usr.sbin-tests	compattestfile,atf
 ./usr/tests/usr.sbin/mtree/Kyuafile		tests-usr.sbin-tests	compattestfile,atf,kyua

Index: src/etc/mtree/NetBSD.dist.tests
diff -u src/etc/mtree/NetBSD.dist.tests:1.163 src/etc/mtree/NetBSD.dist.tests:1.164
--- src/etc/mtree/NetBSD.dist.tests:1.163	Wed Jun 24 09:21:43 2020
+++ src/etc/mtree/NetBSD.dist.tests	Wed Jun 24 09:32:41 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: NetBSD.dist.tests,v 1.163 2020/06/24 09:21:43 jruoho Exp $
+#	$NetBSD: NetBSD.dist.tests,v 1.164 2020/06/24 09:32:41 jruoho Exp $
 
 ./usr/libdata/debug/usr/tests
 ./usr/libdata/debug/usr/tests/atf
@@ -441,6 +441,7 @@
 ./usr/tests/usr.bin/xlint
 ./usr/tests/usr.bin/xlint/lint1
 ./usr/tests/usr.sbin
+./usr/tests/usr.sbin/cpuctl
 ./usr/tests/usr.sbin/mtree
 ./usr/tests/usr.sbin/tcpdump
 ./usr/tests/usr.sbin/traceroute

Added files:

Index: src/tests/usr.sbin/cpuctl/Makefile
diff -u /dev/null src/tests/usr.sbin/cpuctl/Makefile:1.1
--- /dev/null	Wed Jun 24 09:32:41 2020
+++ src/tests/usr.sbin/cpuctl/Makefile	Wed Jun 24 09:32:41 2020
@@ -0,0 +1,8 @@
+# $NetBSD: Makefile,v 1.1 2020/06/24 09:32:41 jruoho Exp $
+
+.include 
+
+TESTSDIR=	${TESTSBASE}/usr.sbin/cpuctl
+TESTS_SH=	t_cpuctl
+
+.include 
Index: src/tests/usr.sbin/cpuctl/t_cpuctl.sh
diff -u /dev/null src/tests/usr.sbin/cpuctl/t_cpuctl.sh:1.1
--- /dev/null	Wed Jun 24 09:32:41 2020
+++ src/tests/usr.sbin/cpuctl/t_cpuctl.sh	Wed Jun 24 09:32:41 2020
@@ -0,0 +1,240 @@
+# $NetBSD: t_cpuctl.sh,v 1.1 2020/06/24 09:32:41 jruoho Exp $
+#
+# Copyright (c) 2020 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# This code is derived from software contributed to The NetBSD Foundation
+# by Jukka Ruohonen.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#notice, this list of conditions and the following disclaimer in the
+#documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+tmp="/tmp/cpuctl.txt"
+
+setcpu() {
+
+	ncpu=$(sysctl -n hw.ncpu)
+
+	if [ $ncpu -eq 1 

CVS commit: src

2020-06-24 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Wed Jun 24 09:21:43 UTC 2020

Modified Files:
src/distrib/sets/lists/tests: mi
src/etc/mtree: NetBSD.dist.tests
Added Files:
src/tests/usr.bin/patch: Makefile t_patch.sh

Log Message:
Add a test case for bin/54620.


To generate a diff of this commit:
cvs rdiff -u -r1.844 -r1.845 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.162 -r1.163 src/etc/mtree/NetBSD.dist.tests
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/patch/Makefile \
src/tests/usr.bin/patch/t_patch.sh

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.844 src/distrib/sets/lists/tests/mi:1.845
--- src/distrib/sets/lists/tests/mi:1.844	Wed Jun 24 09:11:26 2020
+++ src/distrib/sets/lists/tests/mi	Wed Jun 24 09:21:43 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.844 2020/06/24 09:11:26 jruoho Exp $
+# $NetBSD: mi,v 1.845 2020/06/24 09:21:43 jruoho Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -4562,6 +4562,10 @@
 ./usr/tests/usr.bin/netpgpverify/Atffile		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/netpgpverify/Kyuafile		tests-usr.bin-tests	compattestfile,atf,kyua
 ./usr/tests/usr.bin/netpgpverify/t_netpgpverify		tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/patch			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/patch/Atffile		tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/patch/Kyuafile		tests-usr.bin-tests	compattestfile,atf,kyua
+./usr/tests/usr.bin/patch/t_patch		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/pkill			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/pkill/Atffile		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/pkill/Kyuafile		tests-usr.bin-tests	compattestfile,atf,kyua

Index: src/etc/mtree/NetBSD.dist.tests
diff -u src/etc/mtree/NetBSD.dist.tests:1.162 src/etc/mtree/NetBSD.dist.tests:1.163
--- src/etc/mtree/NetBSD.dist.tests:1.162	Sun Apr 19 13:22:58 2020
+++ src/etc/mtree/NetBSD.dist.tests	Wed Jun 24 09:21:43 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: NetBSD.dist.tests,v 1.162 2020/04/19 13:22:58 maxv Exp $
+#	$NetBSD: NetBSD.dist.tests,v 1.163 2020/06/24 09:21:43 jruoho Exp $
 
 ./usr/libdata/debug/usr/tests
 ./usr/libdata/debug/usr/tests/atf
@@ -422,6 +422,7 @@
 ./usr/tests/usr.bin/mkdep
 ./usr/tests/usr.bin/nbperf
 ./usr/tests/usr.bin/netpgpverify
+./usr/tests/usr.bin/patch
 ./usr/tests/usr.bin/pkill
 ./usr/tests/usr.bin/pr
 ./usr/tests/usr.bin/printf

Added files:

Index: src/tests/usr.bin/patch/Makefile
diff -u /dev/null src/tests/usr.bin/patch/Makefile:1.1
--- /dev/null	Wed Jun 24 09:21:43 2020
+++ src/tests/usr.bin/patch/Makefile	Wed Jun 24 09:21:43 2020
@@ -0,0 +1,8 @@
+# $NetBSD: Makefile,v 1.1 2020/06/24 09:21:43 jruoho Exp $
+
+.include 
+
+TESTSDIR=	${TESTSBASE}/usr.bin/patch
+TESTS_SH=	t_patch
+
+.include 
Index: src/tests/usr.bin/patch/t_patch.sh
diff -u /dev/null src/tests/usr.bin/patch/t_patch.sh:1.1
--- /dev/null	Wed Jun 24 09:21:43 2020
+++ src/tests/usr.bin/patch/t_patch.sh	Wed Jun 24 09:21:43 2020
@@ -0,0 +1,78 @@
+# $NetBSD: t_patch.sh,v 1.1 2020/06/24 09:21:43 jruoho Exp $
+#
+# Copyright (c) 2020 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#notice, this list of conditions and the following disclaimer in the
+#documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+patch_lines() {
+
+	printf "%$1s" | tr " " "a" > longlines 2>/dev/null
+
+	cat << EOF > longlines.patch
+--- ./longlines.orig 2019-10-16 09:25:30.667656644 +
 ./longlines
+@@ -1 +1 @@
+EOF
+	printf -- "-%$1s\n" | tr " " "a" >> longlines.patch 2>/dev/null
+	printf -- "+%$1s" | tr " " "b" >> longlines.patch 

CVS commit: src

2020-06-24 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Wed Jun 24 09:11:26 UTC 2020

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/sbin/ifconfig: Makefile
Added Files:
src/tests/sbin/ifconfig: t_repeated_scan.sh

Log Message:
Add a test case for PR bin/55389.


To generate a diff of this commit:
cvs rdiff -u -r1.843 -r1.844 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.1 -r1.2 src/tests/sbin/ifconfig/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/sbin/ifconfig/t_repeated_scan.sh

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.843 src/distrib/sets/lists/tests/mi:1.844
--- src/distrib/sets/lists/tests/mi:1.843	Fri Jun 12 11:04:44 2020
+++ src/distrib/sets/lists/tests/mi	Wed Jun 24 09:11:26 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.843 2020/06/12 11:04:44 roy Exp $
+# $NetBSD: mi,v 1.844 2020/06/24 09:11:26 jruoho Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -3990,6 +3990,7 @@
 ./usr/tests/sbin/ifconfig/Atffile		tests-sbin-tests	compattestfile,atf
 ./usr/tests/sbin/ifconfig/Kyuafile		tests-sbin-tests	compattestfile,atf,kyua
 ./usr/tests/sbin/ifconfig/t_nonexistent		tests-sbin-tests	compattestfile,atf
+./usr/tests/sbin/ifconfig/t_repeated_scan	tests-sbin-tests	compattestfile,atf
 ./usr/tests/sbin/newfstests-sbin-tests	compattestfile,atf
 ./usr/tests/sbin/newfs/Atffile			tests-sbin-tests	compattestfile,atf
 ./usr/tests/sbin/newfs/Kyuafile			tests-sbin-tests	compattestfile,atf,kyua

Index: src/tests/sbin/ifconfig/Makefile
diff -u src/tests/sbin/ifconfig/Makefile:1.1 src/tests/sbin/ifconfig/Makefile:1.2
--- src/tests/sbin/ifconfig/Makefile:1.1	Tue May  3 06:13:06 2011
+++ src/tests/sbin/ifconfig/Makefile	Wed Jun 24 09:11:26 2020
@@ -1,9 +1,9 @@
-# $NetBSD: Makefile,v 1.1 2011/05/03 06:13:06 jruoho Exp $
+# $NetBSD: Makefile,v 1.2 2020/06/24 09:11:26 jruoho Exp $
 
 .include 
 
 TESTSDIR=	${TESTSBASE}/sbin/ifconfig
 
-TESTS_SH=	t_nonexistent
+TESTS_SH=	t_nonexistent t_repeated_scan
 
 .include 

Added files:

Index: src/tests/sbin/ifconfig/t_repeated_scan.sh
diff -u /dev/null src/tests/sbin/ifconfig/t_repeated_scan.sh:1.1
--- /dev/null	Wed Jun 24 09:11:26 2020
+++ src/tests/sbin/ifconfig/t_repeated_scan.sh	Wed Jun 24 09:11:26 2020
@@ -0,0 +1,87 @@
+# $NetBSD: t_repeated_scan.sh,v 1.1 2020/06/24 09:11:26 jruoho Exp $
+#
+# Copyright (c) 2020 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# This code is derived from software contributed to The NetBSD Foundation
+# by Jukka Ruohonen.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#notice, this list of conditions and the following disclaimer in the
+#documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+atf_test_case repeated_scan
+repeated_scan_head() {
+	atf_set "descr" "Test with ifconfig(8) that repeated 802.11 " \
+		"scanning does not cause a panic (PR bin/55389)"
+}
+
+repeated_scan_body() {
+
+	# Even though this should amount to a "few minutes",
+	# try to still avoid stalling any automated test runs.
+	#
+	n=15
+
+	pkill -9 hostapd
+	pkill -9 wpa_supplicant
+
+	for i in $(ifconfig -l); do
+
+		state="up"
+		ifconfig -s $i
+
+		if [ $? -eq 1 ]; then
+
+			state="down"
+			ifconfig $i up
+
+			if [ ! $? -eq 0 ]; then
+echo "Failed to set $i up"
+continue
+			fi
+		fi
+
+		sleep 1
+		ifconfig $i list scan >/dev/null 2>&1
+
+		if [ ! $? -eq 0 ]; then
+			echo "Skipping $i; scan not supported"
+			continue
+		fi
+
+		while [ $n -gt 0 ]; do
+			echo "Test $n for $i"
+			ifconfig $i list scan >/dev/null 2>&1
+			n=$(expr $n - 1)
+		done
+
+		ifconfig $i $state
+		echo "Restored state of $i to $state"
+		sleep 1
+	done
+
+	/bin/sh /etc/rc.d/hostapd restart >/dev/null 2>&1
+	/bin/sh 

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

2020-06-24 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Wed Jun 24 08:27:47 UTC 2020

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

Log Message:
Fix bug with incorrect range calculation when doing icache sync.
This is called by sysarch(ARM_SYNC_ICACHE) from aarch32 (compat_netbsd32) emul 
process.

pointed out by rin@, thanks.

XXX pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/sys/arch/aarch64/aarch64/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/aarch64/aarch64/pmap.c
diff -u src/sys/arch/aarch64/aarch64/pmap.c:1.78 src/sys/arch/aarch64/aarch64/pmap.c:1.79
--- src/sys/arch/aarch64/aarch64/pmap.c:1.78	Sun Jun 14 21:47:14 2020
+++ src/sys/arch/aarch64/aarch64/pmap.c	Wed Jun 24 08:27:47 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.78 2020/06/14 21:47:14 ad Exp $	*/
+/*	$NetBSD: pmap.c,v 1.79 2020/06/24 08:27:47 ryo Exp $	*/
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.78 2020/06/14 21:47:14 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.79 2020/06/24 08:27:47 ryo Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_ddb.h"
@@ -913,7 +913,7 @@ pmap_icache_sync_range(pmap_t pm, vaddr_
 		pte = *ptep;
 		if (lxpde_valid(pte)) {
 			vaddr_t eob = (va + blocksize) & ~(blocksize - 1);
-			vsize_t len = ulmin(eva, eob - va);
+			vsize_t len = ulmin(eva, eob) - va;
 
 			if (l3pte_writable(pte)) {
 cpu_icache_sync_range(va, len);



CVS commit: src/share/man/man7

2020-06-24 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Jun 24 08:20:13 UTC 2020

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

Log Message:
New sentence, new line. Fix macro arguments. Improve Nd.
Remove superfluous Pp. Other minor cleanups.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/share/man/man7/kernel_sanitizers.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/kernel_sanitizers.7
diff -u src/share/man/man7/kernel_sanitizers.7:1.1 src/share/man/man7/kernel_sanitizers.7:1.2
--- src/share/man/man7/kernel_sanitizers.7:1.1	Tue Jun 23 16:08:46 2020
+++ src/share/man/man7/kernel_sanitizers.7	Wed Jun 24 08:20:13 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: kernel_sanitizers.7,v 1.1 2020/06/23 16:08:46 maxv Exp $
+.\"	$NetBSD: kernel_sanitizers.7,v 1.2 2020/06/24 08:20:13 wiz Exp $
 .\"
 .\" Copyright (c) 2020 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -28,13 +28,11 @@
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
 .Dd June 22, 2020
-.Dt kernel_sanitizers 7
+.Dt KERNEL_SANITIZERS 7
 .Os
 .Sh NAME
 .Nm kernel_sanitizers
-.Nd
-.Nx
-Kernel Sanitizers
+.Nd NetBSD Kernel Sanitizers
 .Sh DESCRIPTION
 Kernel Sanitizers are powerful kernel bug detection features that can
 automatically discover several classes of bugs at run time while the kernel
@@ -55,15 +53,14 @@ Compiler instrumentation and an entirely
 aarch64 (gcc), amd64 (gcc).
 [Theoretically supported on all other architectures with no MD change required]
 .Ss Files
-.Pp
 .Bl -tag -width  -compact
 .It Pa src/common/lib/libc/misc/
-Core KUBSAN code. MI.
+Core KUBSAN code.
+MI.
 .El
 .Sh KASAN
 Kernel Address Sanitizer, specializes in finding memory corruptions such as
 buffer overflows and use-after-frees.
-.Pp
 .Ss Runtime cost
 Heavy runtime checks, and ~12.5% increase in memory consumption.
 .Ss Used components
@@ -89,11 +86,14 @@ An architecture is allowed to have only 
 .Ss Files
 .Bl -tag -width  -compact
 .It Pa src/sys/kern/subr_asan.c
-Core KASAN code. MI.
+Core KASAN code.
+MI.
 .It Pa src/sys/sys/asan.h
-Main KASAN header. MI.
+Main KASAN header.
+MI.
 .It Pa src/sys/arch/{port}/include/asan.h
-Port-specific KASAN code. MD.
+Port-specific KASAN code.
+MD.
 .El
 .Pp
 Each new port of KASAN should respect the existing naming conventions, and
@@ -109,11 +109,14 @@ amd64 (gcc).
 .Ss Files
 .Bl -tag -width  -compact
 .It Pa src/sys/kern/subr_csan.c
-Core KCSAN code. MI.
+Core KCSAN code.
+MI.
 .It Pa src/sys/sys/csan.h
-Main KCSAN header. MI.
+Main KCSAN header.
+MI.
 .It Pa src/sys/arch/{port}/include/csan.h
-Port-specific KCSAN code. MD.
+Port-specific KCSAN code.
+MD.
 .El
 .Pp
 Each new port of KCSAN should respect the existing naming conventions, and
@@ -130,16 +133,20 @@ amd64 (llvm).
 .Ss Files
 .Bl -tag -width  -compact
 .It Pa src/sys/kern/subr_msan.c
-Core KMSAN code. MI.
+Core KMSAN code.
+MI.
 .It Pa src/sys/sys/msan.h
-Main KMSAN header. MI.
+Main KMSAN header.
+MI.
 .It Pa src/sys/arch/{port}/include/msan.h
-Port-specific KMSAN code. MD.
+Port-specific KMSAN code.
+MD.
 .El
 .Pp
 Each new port of KMSAN should respect the existing naming conventions, and
 should introduce only one MD header file.
 .Sh AUTHORS
+.An -nosplit
 Support for KUBSAN was developed by
 .An Kamil Rytarowski .
 Support for KASAN, KCSAN and KMSAN was developed by



CVS commit: src/tests/kernel

2020-06-24 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jun 24 07:02:57 UTC 2020

Modified Files:
src/tests/kernel: t_pty.c

Log Message:
errno is irrelevant here.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/kernel/t_pty.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/kernel/t_pty.c
diff -u src/tests/kernel/t_pty.c:1.4 src/tests/kernel/t_pty.c:1.5
--- src/tests/kernel/t_pty.c:1.4	Wed Jun 24 06:15:40 2020
+++ src/tests/kernel/t_pty.c	Wed Jun 24 07:02:57 2020
@@ -1,4 +1,4 @@
-/* $Id: t_pty.c,v 1.4 2020/06/24 06:15:40 rin Exp $ */
+/* $Id: t_pty.c,v 1.5 2020/06/24 07:02:57 rin Exp $ */
 
 /*
  * Allocates a pty(4) device, and sends the specified number of packets of the
@@ -9,7 +9,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_pty.c,v 1.4 2020/06/24 06:15:40 rin Exp $");
+__RCSID("$NetBSD: t_pty.c,v 1.5 2020/06/24 07:02:57 rin Exp $");
 
 #include 
 #include 
@@ -119,7 +119,7 @@ condition(int fd)
 		if (ioctl(fd, TIOCGQSIZE, ) == -1)
 			atf_tc_fail_errno("Couldn't get tty(4) buffer size");
 		if (opt != qsize)
-			atf_tc_fail_errno("Wrong qsize %d != %d\n", qsize, opt);
+			atf_tc_fail("Wrong qsize %d != %d\n", qsize, opt);
 	}
 	if (tcgetattr(fd, ) == -1)
 		atf_tc_fail_errno("tcgetattr()");



CVS commit: src/tests/kernel

2020-06-24 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jun 24 06:15:40 UTC 2020

Modified Files:
src/tests/kernel: t_pty.c

Log Message:
Fix random failures for pty_queue test.

Setting queue size by TIOCSQSIZE ioctl does not guarantee that data of
that size can be read by single shot of read(2).

Remove assertion based on this assertion, while total amount of data
read from child process is still checked appropriately.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/kernel/t_pty.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/kernel/t_pty.c
diff -u src/tests/kernel/t_pty.c:1.3 src/tests/kernel/t_pty.c:1.4
--- src/tests/kernel/t_pty.c:1.3	Wed Jun 24 05:59:18 2020
+++ src/tests/kernel/t_pty.c	Wed Jun 24 06:15:40 2020
@@ -1,4 +1,4 @@
-/* $Id: t_pty.c,v 1.3 2020/06/24 05:59:18 rin Exp $ */
+/* $Id: t_pty.c,v 1.4 2020/06/24 06:15:40 rin Exp $ */
 
 /*
  * Allocates a pty(4) device, and sends the specified number of packets of the
@@ -9,7 +9,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_pty.c,v 1.3 2020/06/24 05:59:18 rin Exp $");
+__RCSID("$NetBSD: t_pty.c,v 1.4 2020/06/24 06:15:40 rin Exp $");
 
 #include 
 #include 
@@ -231,11 +231,6 @@ child_spawn(const char *ttydev)
 		break;
 	err(EXIT_FAILURE, "child: read()");
 }
-if (qsize && size < qsize &&
-(size_t)size < buffer_size)
-	errx(EXIT_FAILURE, "read returned %zd "
-	"less than the queue size %d",
-	size, qsize);
 if (verbose)
 	(void)printf(
 	"child: read %zd bytes from TTY\n",