CVS commit: src/sys/kern

2019-06-20 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 21 04:28:12 UTC 2019

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

Log Message:
Revert previous

There is fallout in gdb that will be investigated before relanding this.


To generate a diff of this commit:
cvs rdiff -u -r1.363 -r1.364 src/sys/kern/kern_sig.c

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

Modified files:

Index: src/sys/kern/kern_sig.c
diff -u src/sys/kern/kern_sig.c:1.363 src/sys/kern/kern_sig.c:1.364
--- src/sys/kern/kern_sig.c:1.363	Fri Jun 21 04:02:57 2019
+++ src/sys/kern/kern_sig.c	Fri Jun 21 04:28:12 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_sig.c,v 1.363 2019/06/21 04:02:57 kamil Exp $	*/
+/*	$NetBSD: kern_sig.c,v 1.364 2019/06/21 04:28:12 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.363 2019/06/21 04:02:57 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.364 2019/06/21 04:28:12 kamil Exp $");
 
 #include "opt_ptrace.h"
 #include "opt_dtrace.h"
@@ -913,7 +913,6 @@ trapsignal(struct lwp *l, ksiginfo_t *ks
 	mutex_enter(proc_lock);
 	mutex_enter(p->p_lock);
 
-repeat:
 	/*
 	 * If we are exiting, demise now.
 	 *
@@ -927,16 +926,6 @@ repeat:
 		/* NOTREACHED */
 	}
 
-	/*
-	 * The process is already stopping.
-	 */
-	if ((p->p_sflag & PS_STOPPING) != 0) {
-		sigswitch(0, p->p_xsig, false);
-		mutex_enter(proc_lock);
-		mutex_enter(p->p_lock);
-		goto repeat; /* XXX */
-	}
-
 	mask = &l->l_sigmask;
 	ps = p->p_sigacts;
 	action = SIGACTION_PS(ps, signo).sa_handler;
@@ -1591,7 +1580,6 @@ eventswitch(int code)
 	KASSERT((code == TRAP_CHLD) || (code == TRAP_LWP) ||
 	(code == TRAP_EXEC));
 
-repeat:
 	/*
 	 * If we are exiting, demise now.
 	 *
@@ -1615,16 +1603,6 @@ repeat:
 		return;
 	}
 
-	/*
-	 * The process is already stopping.
-	 */
-	if ((p->p_sflag & PS_STOPPING) != 0) {
-		sigswitch(0, p->p_xsig, false);
-		mutex_enter(proc_lock);
-		mutex_enter(p->p_lock);
-		goto repeat; /* XXX */
-	}
-
 	KSI_INIT_TRAP(&ksi);
 	ksi.ksi_lid = l->l_lid;
 	ksi.ksi_info._signo = signo;
@@ -2456,7 +2434,6 @@ proc_stoptrace(int trapno, int sysnum, c
 
 	mutex_enter(p->p_lock);
 
-repeat:
 	/*
 	 * If we are exiting, demise now.
 	 *
@@ -2478,15 +2455,6 @@ repeat:
 		return;
 	}
 
-	/*
-	 * The process is already stopping.
-	 */
-	if ((p->p_sflag & PS_STOPPING) != 0) {
-		sigswitch(0, p->p_xsig, true);
-		mutex_enter(p->p_lock);
-		goto repeat; /* XXX */
-	}
-
 	/* Needed for ktrace */
 	ps = p->p_sigacts;
 	action = SIGACTION_PS(ps, signo).sa_handler;



CVS commit: src/sys/kern

2019-06-20 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 21 04:28:12 UTC 2019

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

Log Message:
Revert previous

There is fallout in gdb that will be investigated before relanding this.


To generate a diff of this commit:
cvs rdiff -u -r1.363 -r1.364 src/sys/kern/kern_sig.c

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



CVS commit: src/sys/kern

2019-06-20 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 21 04:02:58 UTC 2019

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

Log Message:
Enhance reliability of ptrace(2) in a debuggee with multiple LWPs

Stop competing between threads which one emits event signal quicker and
overwriting the signal from another thread.

This fixes missed in action signals.

NetBSD truss can now report reliably all TRAP_SCE/SCX/etc events without
reports of missed ones.

This was one of the reasons why debuggee with multiple threads misbehaved
under a debugger.


To generate a diff of this commit:
cvs rdiff -u -r1.362 -r1.363 src/sys/kern/kern_sig.c

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



CVS commit: src/sys/kern

2019-06-20 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 21 04:02:58 UTC 2019

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

Log Message:
Enhance reliability of ptrace(2) in a debuggee with multiple LWPs

Stop competing between threads which one emits event signal quicker and
overwriting the signal from another thread.

This fixes missed in action signals.

NetBSD truss can now report reliably all TRAP_SCE/SCX/etc events without
reports of missed ones.

This was one of the reasons why debuggee with multiple threads misbehaved
under a debugger.


To generate a diff of this commit:
cvs rdiff -u -r1.362 -r1.363 src/sys/kern/kern_sig.c

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

Modified files:

Index: src/sys/kern/kern_sig.c
diff -u src/sys/kern/kern_sig.c:1.362 src/sys/kern/kern_sig.c:1.363
--- src/sys/kern/kern_sig.c:1.362	Fri Jun 21 01:03:51 2019
+++ src/sys/kern/kern_sig.c	Fri Jun 21 04:02:57 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_sig.c,v 1.362 2019/06/21 01:03:51 kamil Exp $	*/
+/*	$NetBSD: kern_sig.c,v 1.363 2019/06/21 04:02:57 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.362 2019/06/21 01:03:51 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.363 2019/06/21 04:02:57 kamil Exp $");
 
 #include "opt_ptrace.h"
 #include "opt_dtrace.h"
@@ -913,6 +913,7 @@ trapsignal(struct lwp *l, ksiginfo_t *ks
 	mutex_enter(proc_lock);
 	mutex_enter(p->p_lock);
 
+repeat:
 	/*
 	 * If we are exiting, demise now.
 	 *
@@ -926,6 +927,16 @@ trapsignal(struct lwp *l, ksiginfo_t *ks
 		/* NOTREACHED */
 	}
 
+	/*
+	 * The process is already stopping.
+	 */
+	if ((p->p_sflag & PS_STOPPING) != 0) {
+		sigswitch(0, p->p_xsig, false);
+		mutex_enter(proc_lock);
+		mutex_enter(p->p_lock);
+		goto repeat; /* XXX */
+	}
+
 	mask = &l->l_sigmask;
 	ps = p->p_sigacts;
 	action = SIGACTION_PS(ps, signo).sa_handler;
@@ -1580,6 +1591,7 @@ eventswitch(int code)
 	KASSERT((code == TRAP_CHLD) || (code == TRAP_LWP) ||
 	(code == TRAP_EXEC));
 
+repeat:
 	/*
 	 * If we are exiting, demise now.
 	 *
@@ -1603,6 +1615,16 @@ eventswitch(int code)
 		return;
 	}
 
+	/*
+	 * The process is already stopping.
+	 */
+	if ((p->p_sflag & PS_STOPPING) != 0) {
+		sigswitch(0, p->p_xsig, false);
+		mutex_enter(proc_lock);
+		mutex_enter(p->p_lock);
+		goto repeat; /* XXX */
+	}
+
 	KSI_INIT_TRAP(&ksi);
 	ksi.ksi_lid = l->l_lid;
 	ksi.ksi_info._signo = signo;
@@ -2434,6 +2456,7 @@ proc_stoptrace(int trapno, int sysnum, c
 
 	mutex_enter(p->p_lock);
 
+repeat:
 	/*
 	 * If we are exiting, demise now.
 	 *
@@ -2455,6 +2478,15 @@ proc_stoptrace(int trapno, int sysnum, c
 		return;
 	}
 
+	/*
+	 * The process is already stopping.
+	 */
+	if ((p->p_sflag & PS_STOPPING) != 0) {
+		sigswitch(0, p->p_xsig, true);
+		mutex_enter(p->p_lock);
+		goto repeat; /* XXX */
+	}
+
 	/* Needed for ktrace */
 	ps = p->p_sigacts;
 	action = SIGACTION_PS(ps, signo).sa_handler;



CVS commit: src/sbin/gpt

2019-06-20 Thread John Nemeth
Module Name:src
Committed By:   jnemeth
Date:   Fri Jun 21 02:14:59 UTC 2019

Modified Files:
src/sbin/gpt: gpt.c gpt.h label.c remove.c type.c

Log Message:
Add a third argument to the "cfn" function that is an argument to
gpt_change_ent().  The purpose of the third argument is to specify
whether the entry to be changed is a primary GPT entry or a secondary
GPT entry.  It is assumed that a secondary GPT entry will always
follow a corresponding primary entry.

This is in preparation for an upcoming change that will require it.


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/sbin/gpt/gpt.c
cvs rdiff -u -r1.38 -r1.39 src/sbin/gpt/gpt.h
cvs rdiff -u -r1.29 -r1.30 src/sbin/gpt/label.c
cvs rdiff -u -r1.22 -r1.23 src/sbin/gpt/remove.c
cvs rdiff -u -r1.15 -r1.16 src/sbin/gpt/type.c

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

Modified files:

Index: src/sbin/gpt/gpt.c
diff -u src/sbin/gpt/gpt.c:1.78 src/sbin/gpt/gpt.c:1.79
--- src/sbin/gpt/gpt.c:1.78	Thu Jun 20 10:41:58 2019
+++ src/sbin/gpt/gpt.c	Fri Jun 21 02:14:59 2019
@@ -35,7 +35,7 @@
 __FBSDID("$FreeBSD: src/sbin/gpt/gpt.c,v 1.16 2006/07/07 02:44:23 marcel Exp $");
 #endif
 #ifdef __RCSID
-__RCSID("$NetBSD: gpt.c,v 1.78 2019/06/20 10:41:58 martin Exp $");
+__RCSID("$NetBSD: gpt.c,v 1.79 2019/06/21 02:14:59 jnemeth Exp $");
 #endif
 
 #include 
@@ -1015,7 +1015,7 @@ gpt_add_find(gpt_t gpt, struct gpt_find 
 
 int
 gpt_change_ent(gpt_t gpt, const struct gpt_find *find,
-void (*cfn)(struct gpt_ent *, void *), void *v)
+void (*cfn)(struct gpt_ent *, void *, int), void *v)
 {
 	map_t m;
 	struct gpt_hdr *hdr;
@@ -1058,14 +1058,14 @@ gpt_change_ent(gpt_t gpt, const struct g
 			continue;
 
 		/* Change the primary entry. */
-		(*cfn)(ent, v);
+		(*cfn)(ent, v, 0);
 
 		if (gpt_write_primary(gpt) == -1)
 			return -1;
 
 		ent = gpt_ent_backup(gpt, i);
 		/* Change the secondary entry. */
-		(*cfn)(ent, v);
+		(*cfn)(ent, v, 1);
 
 		if (gpt_write_backup(gpt) == -1)
 			return -1;

Index: src/sbin/gpt/gpt.h
diff -u src/sbin/gpt/gpt.h:1.38 src/sbin/gpt/gpt.h:1.39
--- src/sbin/gpt/gpt.h:1.38	Tue Jul  3 03:41:23 2018
+++ src/sbin/gpt/gpt.h	Fri Jun 21 02:14:59 2019
@@ -115,7 +115,7 @@ struct gpt_find {
 	const char *msg;
 };
 int	gpt_change_ent(gpt_t, const struct gpt_find *,
-void (*)(struct gpt_ent *, void *), void *);
+void (*)(struct gpt_ent *, void *, int), void *);
 int	gpt_add_find(gpt_t, struct gpt_find *, int);
 
 #define GPT_AIS "a:i:s:"

Index: src/sbin/gpt/label.c
diff -u src/sbin/gpt/label.c:1.29 src/sbin/gpt/label.c:1.30
--- src/sbin/gpt/label.c:1.29	Tue Jul  3 03:41:24 2018
+++ src/sbin/gpt/label.c	Fri Jun 21 02:14:59 2019
@@ -33,7 +33,7 @@
 __FBSDID("$FreeBSD: src/sbin/gpt/label.c,v 1.3 2006/10/04 18:20:25 marcel Exp $");
 #endif
 #ifdef __RCSID
-__RCSID("$NetBSD: label.c,v 1.29 2018/07/03 03:41:24 jnemeth Exp $");
+__RCSID("$NetBSD: label.c,v 1.30 2019/06/21 02:14:59 jnemeth Exp $");
 #endif
 
 #include 
@@ -68,7 +68,7 @@ struct gpt_cmd c_label = {
 #define usage() gpt_usage(NULL, &c_label)
 
 static void
-change(struct gpt_ent *ent, void *v)
+change(struct gpt_ent *ent, void *v, int backup)
 {
 	uint8_t *name = v;
 	utf8_to_utf16(name, ent->ent_name, __arraycount(ent->ent_name));

Index: src/sbin/gpt/remove.c
diff -u src/sbin/gpt/remove.c:1.22 src/sbin/gpt/remove.c:1.23
--- src/sbin/gpt/remove.c:1.22	Tue Jul  3 03:41:24 2018
+++ src/sbin/gpt/remove.c	Fri Jun 21 02:14:59 2019
@@ -33,7 +33,7 @@
 __FBSDID("$FreeBSD: src/sbin/gpt/remove.c,v 1.10 2006/10/04 18:20:25 marcel Exp $");
 #endif
 #ifdef __RCSID
-__RCSID("$NetBSD: remove.c,v 1.22 2018/07/03 03:41:24 jnemeth Exp $");
+__RCSID("$NetBSD: remove.c,v 1.23 2019/06/21 02:14:59 jnemeth Exp $");
 #endif
 
 #include 
@@ -66,7 +66,7 @@ struct gpt_cmd c_remove = {
 #define usage() gpt_usage(NULL, &c_remove)
 
 static void
-change(struct gpt_ent *ent, void *v)
+change(struct gpt_ent *ent, void *v, int backup)
 {
 	/* Remove the primary entry by clearing the partition type. */
 	gpt_uuid_copy(ent->ent_type, gpt_uuid_nil);

Index: src/sbin/gpt/type.c
diff -u src/sbin/gpt/type.c:1.15 src/sbin/gpt/type.c:1.16
--- src/sbin/gpt/type.c:1.15	Tue Jul  3 03:41:24 2018
+++ src/sbin/gpt/type.c	Fri Jun 21 02:14:59 2019
@@ -33,7 +33,7 @@
 __FBSDID("$FreeBSD: src/sbin/gpt/remove.c,v 1.10 2006/10/04 18:20:25 marcel Exp $");
 #endif
 #ifdef __RCSID
-__RCSID("$NetBSD: type.c,v 1.15 2018/07/03 03:41:24 jnemeth Exp $");
+__RCSID("$NetBSD: type.c,v 1.16 2019/06/21 02:14:59 jnemeth Exp $");
 #endif
 
 #include 
@@ -67,7 +67,7 @@ struct gpt_cmd c_type = {
 #define usage() gpt_usage(NULL, &c_type)
 
 static void
-change(struct gpt_ent *ent, void *v)
+change(struct gpt_ent *ent, void *v, int backup)
 {
 	gpt_uuid_t *newtype = v;
 	gpt_uuid_copy(ent->ent_type, *newtype);



CVS commit: src/sbin/gpt

2019-06-20 Thread John Nemeth
Module Name:src
Committed By:   jnemeth
Date:   Fri Jun 21 02:14:59 UTC 2019

Modified Files:
src/sbin/gpt: gpt.c gpt.h label.c remove.c type.c

Log Message:
Add a third argument to the "cfn" function that is an argument to
gpt_change_ent().  The purpose of the third argument is to specify
whether the entry to be changed is a primary GPT entry or a secondary
GPT entry.  It is assumed that a secondary GPT entry will always
follow a corresponding primary entry.

This is in preparation for an upcoming change that will require it.


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/sbin/gpt/gpt.c
cvs rdiff -u -r1.38 -r1.39 src/sbin/gpt/gpt.h
cvs rdiff -u -r1.29 -r1.30 src/sbin/gpt/label.c
cvs rdiff -u -r1.22 -r1.23 src/sbin/gpt/remove.c
cvs rdiff -u -r1.15 -r1.16 src/sbin/gpt/type.c

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



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

2019-06-20 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Jun 21 02:08:55 UTC 2019

Modified Files:
src/sys/arch/x86/include: bootinfo.h

Log Message:
PR/54147: Increase BOOTINFO_MAXSIZE to 16Kib.

Some systems require a larger bootinfo size for memory descriptors.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/x86/include/bootinfo.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/x86/include/bootinfo.h
diff -u src/sys/arch/x86/include/bootinfo.h:1.29 src/sys/arch/x86/include/bootinfo.h:1.30
--- src/sys/arch/x86/include/bootinfo.h:1.29	Fri Apr 13 11:24:34 2018
+++ src/sys/arch/x86/include/bootinfo.h	Fri Jun 21 02:08:55 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: bootinfo.h,v 1.29 2018/04/13 11:24:34 nonaka Exp $	*/
+/*	$NetBSD: bootinfo.h,v 1.30 2019/06/21 02:08:55 nonaka Exp $	*/
 
 /*
  * Copyright (c) 1997
@@ -251,7 +251,7 @@ struct btinfo_efimemmap {
 
 #ifdef _KERNEL
 
-#define BOOTINFO_MAXSIZE 8192
+#define BOOTINFO_MAXSIZE 16384
 
 #ifndef _LOCORE
 /*



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

2019-06-20 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Jun 21 02:08:55 UTC 2019

Modified Files:
src/sys/arch/x86/include: bootinfo.h

Log Message:
PR/54147: Increase BOOTINFO_MAXSIZE to 16Kib.

Some systems require a larger bootinfo size for memory descriptors.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/x86/include/bootinfo.h

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



CVS commit: src/sys

2019-06-20 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 21 01:03:51 UTC 2019

Modified Files:
src/sys/kern: kern_sig.c
src/sys/sys: proc.h

Log Message:
Eliminate PS_NOTIFYSTOP remnants from the kernel

This flag used to be useful in /proc (BSD4.4-style) debugging semantics.
Traced child events were notified without signaling the parent.

This property was removed in NetBSD-8.0 and had no users.

This change simplifies the signal code, removing dead branches.

NFCI


To generate a diff of this commit:
cvs rdiff -u -r1.361 -r1.362 src/sys/kern/kern_sig.c
cvs rdiff -u -r1.353 -r1.354 src/sys/sys/proc.h

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

Modified files:

Index: src/sys/kern/kern_sig.c
diff -u src/sys/kern/kern_sig.c:1.361 src/sys/kern/kern_sig.c:1.362
--- src/sys/kern/kern_sig.c:1.361	Tue Jun 18 23:53:55 2019
+++ src/sys/kern/kern_sig.c	Fri Jun 21 01:03:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_sig.c,v 1.361 2019/06/18 23:53:55 kamil Exp $	*/
+/*	$NetBSD: kern_sig.c,v 1.362 2019/06/21 01:03:51 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.361 2019/06/18 23:53:55 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.362 2019/06/21 01:03:51 kamil Exp $");
 
 #include "opt_ptrace.h"
 #include "opt_dtrace.h"
@@ -1534,7 +1534,7 @@ proc_stop_lwps(struct proc *p)
 /*
  * Finish stopping of a process.  Mark it stopped and notify the parent.
  *
- * Drop p_lock briefly if PS_NOTIFYSTOP is set and ppsig is true.
+ * Drop p_lock briefly if ppsig is true.
  */
 static void
 proc_stop_done(struct proc *p, int ppmask)
@@ -1549,11 +1549,10 @@ proc_stop_done(struct proc *p, int ppmas
 	p->p_stat = SSTOP;
 	p->p_waited = 0;
 	p->p_pptr->p_nstopchild++;
-	if ((p->p_sflag & PS_NOTIFYSTOP) != 0) {
-		/* child_psignal drops p_lock briefly. */
-		child_psignal(p, ppmask);
-		cv_broadcast(&p->p_pptr->p_waitcv);
-	}
+
+	/* child_psignal drops p_lock briefly. */
+	child_psignal(p, ppmask);
+	cv_broadcast(&p->p_pptr->p_waitcv);
 }
 
 /*
@@ -2251,7 +2250,7 @@ proc_stop(struct proc *p, int signo)
 	 * LWPs to a halt so they are included in p->p_nrlwps.  We musn't
 	 * unlock between here and the p->p_nrlwps check below.
 	 */
-	p->p_sflag |= PS_STOPPING | PS_NOTIFYSTOP;
+	p->p_sflag |= PS_STOPPING;
 	membar_producer();
 
 	proc_stop_lwps(p);
@@ -2325,16 +2324,13 @@ proc_stop_callout(void *cookie)
  * We brought the process to a halt.
  * Mark it as stopped and notify the
  * parent.
+ *
+ * Note that proc_stop_done() will
+ * drop p->p_lock briefly.
+ * Arrange to restart and check
+ * all processes again.
  */
-if ((p->p_sflag & PS_NOTIFYSTOP) != 0) {
-	/*
-	 * Note that proc_stop_done() will
-	 * drop p->p_lock briefly.
-	 * Arrange to restart and check
-	 * all processes again.
-	 */
-	restart = true;
-}
+restart = true;
 proc_stop_done(p, PS_NOCLDSTOP);
 			} else
 more = true;

Index: src/sys/sys/proc.h
diff -u src/sys/sys/proc.h:1.353 src/sys/sys/proc.h:1.354
--- src/sys/sys/proc.h:1.353	Tue Jun 11 23:18:55 2019
+++ src/sys/sys/proc.h	Fri Jun 21 01:03:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: proc.h,v 1.353 2019/06/11 23:18:55 kamil Exp $	*/
+/*	$NetBSD: proc.h,v 1.354 2019/06/21 01:03:51 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -395,7 +395,6 @@ struct proc {
 #define	PS_STOPFORK	0x0080 /* Child will be stopped on fork(2) */
 #define	PS_STOPEXEC	0x0100 /* Will be stopped on exec(2) */
 #define	PS_STOPEXIT	0x0200 /* Will be stopped at process exit */
-#define	PS_NOTIFYSTOP	0x1000 /* Notify parent of successful STOP */
 #define	PS_COREDUMP	0x2000 /* Process core-dumped */
 #define	PS_CONTINUED	0x4000 /* Process is continued */
 #define	PS_STOPPING	0x8000 /* Transitioning SACTIVE -> SSTOP */



CVS commit: src/sys

2019-06-20 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 21 01:03:51 UTC 2019

Modified Files:
src/sys/kern: kern_sig.c
src/sys/sys: proc.h

Log Message:
Eliminate PS_NOTIFYSTOP remnants from the kernel

This flag used to be useful in /proc (BSD4.4-style) debugging semantics.
Traced child events were notified without signaling the parent.

This property was removed in NetBSD-8.0 and had no users.

This change simplifies the signal code, removing dead branches.

NFCI


To generate a diff of this commit:
cvs rdiff -u -r1.361 -r1.362 src/sys/kern/kern_sig.c
cvs rdiff -u -r1.353 -r1.354 src/sys/sys/proc.h

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



CVS commit: src/usr.sbin/sysinst

2019-06-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jun 20 19:26:41 UTC 2019

Modified Files:
src/usr.sbin/sysinst: bsddisklabel.c

Log Message:
Avoid creating a (tiny) swap partition by default on overall too small
disks.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/usr.sbin/sysinst/bsddisklabel.c

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



CVS commit: src/usr.sbin/sysinst

2019-06-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jun 20 19:26:41 UTC 2019

Modified Files:
src/usr.sbin/sysinst: bsddisklabel.c

Log Message:
Avoid creating a (tiny) swap partition by default on overall too small
disks.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/usr.sbin/sysinst/bsddisklabel.c

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

Modified files:

Index: src/usr.sbin/sysinst/bsddisklabel.c
diff -u src/usr.sbin/sysinst/bsddisklabel.c:1.14 src/usr.sbin/sysinst/bsddisklabel.c:1.15
--- src/usr.sbin/sysinst/bsddisklabel.c:1.14	Thu Jun 20 15:52:07 2019
+++ src/usr.sbin/sysinst/bsddisklabel.c	Thu Jun 20 19:26:41 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: bsddisklabel.c,v 1.14 2019/06/20 15:52:07 christos Exp $	*/
+/*	$NetBSD: bsddisklabel.c,v 1.15 2019/06/20 19:26:41 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -987,8 +987,8 @@ static void
 fill_defaults(struct partition_usage_set *wanted, struct disk_partitions *parts,
 daddr_t ptstart, daddr_t ptsize)
 {
-	size_t i, root = ~0U, usr = ~0U, swap = ~0U;
-	daddr_t free_space, dump_space;
+	size_t i, root = ~0U, usr = ~0U, swap = ~0U, def_usr = ~0U;
+	daddr_t free_space, dump_space, required;
 #if defined(DEFAULT_UFS2) && !defined(HAVE_UFS2_BOOT)
 	size_t boot = ~0U;
 #endif
@@ -1017,12 +1017,16 @@ fill_defaults(struct partition_usage_set
 		if (wanted->infos[i].instflags & PUIINST_BOOT)
 			boot = i;
 #endif
-		if (wanted->infos[i].type == PT_root
-		&& wanted->infos[i].size > 0) {
-			if (strcmp(wanted->infos[i].mount, "/") == 0)
+		if (wanted->infos[i].type == PT_root) {
+			if (strcmp(wanted->infos[i].mount, "/") == 0) {
 root = i;
-			else if (strcmp(wanted->infos[i].mount, "/usr") == 0)
-usr = i;
+			} else if (
+			strcmp(wanted->infos[i].mount, "/usr") == 0) {
+if (wanted->infos[i].size > 0)
+	usr = i;
+else
+	def_usr = i;
+			}
 			wanted->infos[i].fs_type = FS_BSDFFS;
 #ifdef DEFAULT_UFS2
 #ifndef HAVE_UFS2_BOOT
@@ -1130,9 +1134,21 @@ fill_defaults(struct partition_usage_set
 	 * impossible defaults.
 	 */
 	free_space = parts->free_space;
+	required = 0;
+	if (root < wanted->num)
+		required += wanted->infos[root].size;
+	if (usr < wanted->num)
+		required += wanted->infos[usr].size;
+	else if (def_usr < wanted->num)
+			required += wanted->infos[def_usr].def_size;
+	free_space -= required;
 	for (i = 0; i < wanted->num; i++) {
+		if (i == root || i == usr)
+			continue;	/* already accounted above */
 		if (wanted->infos[i].cur_part_id != NO_PART)
 			continue;
+		if (wanted->infos[i].size == 0)
+			continue;
 		if (wanted->infos[i].flags
 		& (PUIFLG_IS_OUTER|PUIFLG_JUST_MOUNTPOINT))
 			continue;
@@ -1147,7 +1163,6 @@ fill_defaults(struct partition_usage_set
 		free_space += inc;
 		wanted->infos[swap].size -= inc;
 	}
-
 	if (root < wanted->num) {
 		/* Add space for 2 system dumps to / (traditional) */
 		dump_space = get_ramsize() * (MEG/512);



CVS commit: src/usr.sbin/sysinst

2019-06-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jun 20 18:32:33 UTC 2019

Modified Files:
src/usr.sbin/sysinst: disklabel.c
src/usr.sbin/sysinst/arch/dummy: md.h
src/usr.sbin/sysinst/arch/sparc: md.h
src/usr.sbin/sysinst/arch/sparc64: md.h

Log Message:
Avoid architecture specific ifdefs in main code, move to MD macros.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/sysinst/disklabel.c
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/sysinst/arch/dummy/md.h
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/sysinst/arch/sparc/md.h
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/sysinst/arch/sparc64/md.h

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



CVS commit: src/usr.sbin/sysinst

2019-06-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jun 20 18:32:33 UTC 2019

Modified Files:
src/usr.sbin/sysinst: disklabel.c
src/usr.sbin/sysinst/arch/dummy: md.h
src/usr.sbin/sysinst/arch/sparc: md.h
src/usr.sbin/sysinst/arch/sparc64: md.h

Log Message:
Avoid architecture specific ifdefs in main code, move to MD macros.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/sysinst/disklabel.c
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/sysinst/arch/dummy/md.h
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/sysinst/arch/sparc/md.h
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/sysinst/arch/sparc64/md.h

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

Modified files:

Index: src/usr.sbin/sysinst/disklabel.c
diff -u src/usr.sbin/sysinst/disklabel.c:1.3 src/usr.sbin/sysinst/disklabel.c:1.4
--- src/usr.sbin/sysinst/disklabel.c:1.3	Thu Jun 20 16:57:25 2019
+++ src/usr.sbin/sysinst/disklabel.c	Thu Jun 20 18:32:32 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: disklabel.c,v 1.3 2019/06/20 16:57:25 martin Exp $	*/
+/*	$NetBSD: disklabel.c,v 1.4 2019/06/20 18:32:32 martin Exp $	*/
 
 /*
  * Copyright 2018 The NetBSD Foundation, Inc.
@@ -75,10 +75,10 @@ disklabel_init_default_alignment(struct 
 	if (dl_maxpart == 0)
 		dl_maxpart = getmaxpartitions();
 
-#if defined(__sun__) || defined(__sparc__)
-	/* sun labels are always cylinder aligned */
-	parts->ptn_alignment = track;
-#else
+#ifdef MD_DISKLABEL_SET_ALIGN_PRE
+	if (MD_DISKLABEL_SET_ALIGN_PRE(parts->ptn_alignment, track))
+		return;
+#endif
 	/* Use 1MB alignemnt for large (>128GB) disks */
 	if (parts->dp.disk_size > HUGE_DISK_SIZE) {
 		parts->ptn_alignment = 2048;
@@ -87,6 +87,8 @@ disklabel_init_default_alignment(struct 
 	} else {
 		parts->ptn_alignment = 1;
 	}
+#ifdef MD_DISKLABEL_SET_ALIGN_POST
+	MD_DISKLABEL_SET_ALIGN_POST(parts->ptn_alignment, track);
 #endif
 }
 

Index: src/usr.sbin/sysinst/arch/dummy/md.h
diff -u src/usr.sbin/sysinst/arch/dummy/md.h:1.1 src/usr.sbin/sysinst/arch/dummy/md.h:1.2
--- src/usr.sbin/sysinst/arch/dummy/md.h:1.1	Sat Jul 26 19:56:30 2014
+++ src/usr.sbin/sysinst/arch/dummy/md.h	Thu Jun 20 18:32:33 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.h,v 1.1 2014/07/26 19:56:30 dholland Exp $	*/
+/*	$NetBSD: md.h,v 1.2 2019/06/20 18:32:33 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -33,3 +33,9 @@
  */
 
 #define XNEEDMB		100
+
+#ifdef __sun__
+/* sunlabels force track alignment (true = no further processing) */
+#define	MD_DISKLABEL_SET_ALIGN_PRE(align, track)	\
+	(align) = (track), true
+#endif

Index: src/usr.sbin/sysinst/arch/sparc/md.h
diff -u src/usr.sbin/sysinst/arch/sparc/md.h:1.3 src/usr.sbin/sysinst/arch/sparc/md.h:1.4
--- src/usr.sbin/sysinst/arch/sparc/md.h:1.3	Fri Nov 16 19:54:05 2018
+++ src/usr.sbin/sysinst/arch/sparc/md.h	Thu Jun 20 18:32:33 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.h,v 1.3 2018/11/16 19:54:05 martin Exp $	*/
+/*	$NetBSD: md.h,v 1.4 2019/06/20 18:32:33 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -56,6 +56,10 @@
 /* have support for booting from UFS2 */
 #define	HAVE_UFS2_BOOT
 
+/* sunlabels force track alignment (true = no further processing) */
+#define	MD_DISKLABEL_SET_ALIGN_PRE(align, track)	\
+	(align) = (track), true
+
 /*
  * Default filesets to fetch and install during installation
  * or upgrade.

Index: src/usr.sbin/sysinst/arch/sparc64/md.h
diff -u src/usr.sbin/sysinst/arch/sparc64/md.h:1.4 src/usr.sbin/sysinst/arch/sparc64/md.h:1.5
--- src/usr.sbin/sysinst/arch/sparc64/md.h:1.4	Thu Jun 13 06:25:03 2019
+++ src/usr.sbin/sysinst/arch/sparc64/md.h	Thu Jun 20 18:32:33 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.h,v 1.4 2019/06/13 06:25:03 martin Exp $	*/
+/*	$NetBSD: md.h,v 1.5 2019/06/20 18:32:33 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -54,6 +54,10 @@
 #define XNEEDMB		300	/* Extra megs for full X installation */
 #define DEBNEEDMB	1200	/* Extra megs for debug sets */
 
+/* sunlabels force track alignment (true = no further processing) */
+#define	MD_DISKLABEL_SET_ALIGN_PRE(align, track)	\
+	(align) = (track), true
+
 /* use UFS2 by default for ffs */
 #define	DEFAULT_UFS2
 



CVS commit: src

2019-06-20 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Jun 20 17:33:31 UTC 2019

Modified Files:
src/doc: TODO.kaslr
src/sys/arch/i386/stand/efiboot: boot.c
src/sys/arch/i386/stand/lib: exec.c
src/sys/lib/libsa: loadfile_elf32.c

Log Message:
Add KASLR support in UEFI.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/doc/TODO.kaslr
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/i386/stand/efiboot/boot.c
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/i386/stand/lib/exec.c
cvs rdiff -u -r1.53 -r1.54 src/sys/lib/libsa/loadfile_elf32.c

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

Modified files:

Index: src/doc/TODO.kaslr
diff -u src/doc/TODO.kaslr:1.9 src/doc/TODO.kaslr:1.10
--- src/doc/TODO.kaslr:1.9	Sat Nov 24 17:54:18 2018
+++ src/doc/TODO.kaslr	Thu Jun 20 17:33:30 2019
@@ -46,4 +46,4 @@
 -- Sort the kernel sections by size, from largest to smallest, to save
memory.
 
--- Add the "pkboot" command in the EFI bootloader.
+[DONE] -- Add the "pkboot" command in the EFI bootloader.

Index: src/sys/arch/i386/stand/efiboot/boot.c
diff -u src/sys/arch/i386/stand/efiboot/boot.c:1.10 src/sys/arch/i386/stand/efiboot/boot.c:1.11
--- src/sys/arch/i386/stand/efiboot/boot.c:1.10	Wed Apr 11 10:32:09 2018
+++ src/sys/arch/i386/stand/efiboot/boot.c	Thu Jun 20 17:33:31 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.c,v 1.10 2018/04/11 10:32:09 nonaka Exp $	*/
+/*	$NetBSD: boot.c,v 1.11 2019/06/20 17:33:31 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -62,6 +62,7 @@ static const char * const names[][2] = {
 void	command_help(char *);
 void	command_quit(char *);
 void	command_boot(char *);
+void	command_pkboot(char *);
 void	command_consdev(char *);
 void	command_dev(char *);
 void	command_devpath(char *);
@@ -84,6 +85,7 @@ const struct bootblk_command commands[] 
 	{ "?",		command_help },
 	{ "quit",	command_quit },
 	{ "boot",	command_boot },
+	{ "pkboot",	command_pkboot },
 	{ "consdev",	command_consdev },
 	{ "dev",	command_dev },
 	{ "devpath",	command_devpath },
@@ -362,7 +364,8 @@ command_help(char *arg)
 
 	printf("commands are:\n"
 	   "boot [xdNx:][filename] [-12acdqsvxz]\n"
-	   " (ex. \"hd0a:netbsd.old -s\"\n"
+	   " (ex. \"hd0a:netbsd.old -s\")\n"
+	   "pkboot [xdNx:][filename] [-12acdqsvxz]\n"
 	   "dev [xd[N[x]]:]\n"
 	   "consdev {pc|com[0123][,{speed}]|com,{ioport}[,{speed}]}\n"
 	   "devpath\n"
@@ -435,6 +438,15 @@ command_boot(char *arg)
 }
 
 void
+command_pkboot(char *arg)
+{
+	extern int has_prekern;
+	has_prekern = 1;
+	command_boot(arg);
+	has_prekern = 0;
+}
+
+void
 command_dev(char *arg)
 {
 	static char savedevname[MAXDEVNAME + 1];

Index: src/sys/arch/i386/stand/lib/exec.c
diff -u src/sys/arch/i386/stand/lib/exec.c:1.69 src/sys/arch/i386/stand/lib/exec.c:1.70
--- src/sys/arch/i386/stand/lib/exec.c:1.69	Sat Oct  7 10:26:38 2017
+++ src/sys/arch/i386/stand/lib/exec.c	Thu Jun 20 17:33:31 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec.c,v 1.69 2017/10/07 10:26:38 maxv Exp $	 */
+/*	$NetBSD: exec.c,v 1.70 2019/06/20 17:33:31 maxv Exp $	 */
 
 /*
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -275,6 +275,7 @@ common_load_prekern(const char *file, u_
 {
 	paddr_t kernpa_start, kernpa_end;
 	char prekernpath[] = "/prekern";
+	u_long prekern_start;
 	int fd, flags;
 
 	*extmem = getextmem();
@@ -283,13 +284,17 @@ common_load_prekern(const char *file, u_
 	marks[MARK_START] = loadaddr;
 
 	/* Load the prekern (static) */
-	flags = LOAD_KERNEL & ~(LOAD_HDR|COUNT_HDR|LOAD_SYM|COUNT_SYM);
+	flags = LOAD_KERNEL & ~(LOAD_HDR|LOAD_SYM);
 	if ((fd = loadfile(prekernpath, marks, flags)) == -1)
 		return EIO;
 	close(fd);
 
-	marks[MARK_END] = (1UL << 21); /* the kernel starts at 2MB XXX */
-	kernpa_start = marks[MARK_END];
+	prekern_start = marks[MARK_START];
+
+	/* The kernel starts at 2MB. */
+	marks[MARK_START] = loadaddr;
+	marks[MARK_END] = loadaddr + (1UL << 21);
+	kernpa_start = (1UL << 21);
 
 	/* Load the kernel (dynamic) */
 	flags = (LOAD_KERNEL | LOAD_DYN) & ~(floppy ? LOAD_BACKWARDS : 0);
@@ -297,7 +302,7 @@ common_load_prekern(const char *file, u_
 		return EIO;
 	close(fd);
 
-	kernpa_end = marks[MARK_END];
+	kernpa_end = marks[MARK_END] - loadaddr;
 
 	/* If the root fs type is unusual, load its module. */
 	if (fsmod != NULL)
@@ -319,6 +324,7 @@ common_load_prekern(const char *file, u_
 	bi_getmemmap();
 #endif
 
+	marks[MARK_START] = prekern_start;
 	marks[MARK_END] = (((u_long)marks[MARK_END] + sizeof(int) - 1)) &
 	(-sizeof(int));
 	image_end = marks[MARK_END];
@@ -518,7 +524,7 @@ exec_netbsd(const char *file, physaddr_t
 	}
 
 	efi_kernel_start = marks[MARK_START];
-	efi_kernel_size = image_end - efi_loadaddr - efi_kernel_start;
+	efi_kernel_size = image_end - (efi_loadaddr + efi_kernel_start);
 #endif
 	startprog(marks[MARK_ENTRY], BOOT_NARGS, boot_argv,
 	x86_trunc_page(basemem * 1024));
@@ -541,6 +547,15 @@ count_netbsd(co

CVS commit: src

2019-06-20 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Jun 20 17:33:31 UTC 2019

Modified Files:
src/doc: TODO.kaslr
src/sys/arch/i386/stand/efiboot: boot.c
src/sys/arch/i386/stand/lib: exec.c
src/sys/lib/libsa: loadfile_elf32.c

Log Message:
Add KASLR support in UEFI.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/doc/TODO.kaslr
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/i386/stand/efiboot/boot.c
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/i386/stand/lib/exec.c
cvs rdiff -u -r1.53 -r1.54 src/sys/lib/libsa/loadfile_elf32.c

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



CVS commit: src/sys/net/npf

2019-06-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jun 20 17:12:37 UTC 2019

Modified Files:
src/sys/net/npf: npf_tableset.c

Log Message:
Add error checking for previous memory allocation failure.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/net/npf/npf_tableset.c

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



CVS commit: src/sys/net/npf

2019-06-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jun 20 17:12:37 UTC 2019

Modified Files:
src/sys/net/npf: npf_tableset.c

Log Message:
Add error checking for previous memory allocation failure.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/net/npf/npf_tableset.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/npf/npf_tableset.c
diff -u src/sys/net/npf/npf_tableset.c:1.31 src/sys/net/npf/npf_tableset.c:1.32
--- src/sys/net/npf/npf_tableset.c:1.31	Thu Jun 20 13:08:52 2019
+++ src/sys/net/npf/npf_tableset.c	Thu Jun 20 13:12:37 2019
@@ -39,7 +39,7 @@
 
 #ifdef _KERNEL
 #include 
-__KERNEL_RCSID(0, "$NetBSD: npf_tableset.c,v 1.31 2019/06/20 17:08:52 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_tableset.c,v 1.32 2019/06/20 17:12:37 christos Exp $");
 
 #include 
 #include 
@@ -495,7 +495,7 @@ table_cidr_check(int alen, const npf_add
 	return 0;
 }
 
-static void
+static int
 table_ifaddr_insert(npf_table_t *t, const int alen, npf_tblent_t *ent)
 {
 	const unsigned aidx = NPF_ADDRLEN2IDX(alen);
@@ -514,6 +514,9 @@ table_ifaddr_insert(npf_table_t *t, cons
 		newsize = toalloc * sizeof(npf_tblent_t *);
 
 		elements = kmem_zalloc(newsize, KM_NOSLEEP);
+		if (elements == NULL) {
+			return ENOMEM;
+		}
 		for (unsigned i = 0; i < used; i++) {
 			elements[i] = old_elements[i];
 		}
@@ -527,6 +530,7 @@ table_ifaddr_insert(npf_table_t *t, cons
 	}
 	t->t_elements[aidx][used] = ent;
 	t->t_used[aidx]++;
+	return 0;
 }
 
 /*
@@ -590,7 +594,9 @@ npf_table_insert(npf_table_t *t, const i
 		error = EINVAL;
 		break;
 	case NPF_TABLE_IFADDR:
-		table_ifaddr_insert(t, alen, ent);
+		if ((error = table_ifaddr_insert(t, alen, ent)) != 0) {
+			break;
+		}
 		LIST_INSERT_HEAD(&t->t_list, ent, te_listent);
 		t->t_nitems++;
 		break;



CVS commit: src/sys/net/npf

2019-06-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jun 20 17:08:52 UTC 2019

Modified Files:
src/sys/net/npf: npf_tableset.c

Log Message:
PR/54314: Frank Kardel: LOCKDEBUG: Mutex error: assert_sleepable,70:
spin lock held when loading NPF


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/net/npf/npf_tableset.c

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



CVS commit: src/sys/net/npf

2019-06-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jun 20 17:08:52 UTC 2019

Modified Files:
src/sys/net/npf: npf_tableset.c

Log Message:
PR/54314: Frank Kardel: LOCKDEBUG: Mutex error: assert_sleepable,70:
spin lock held when loading NPF


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/net/npf/npf_tableset.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/npf/npf_tableset.c
diff -u src/sys/net/npf/npf_tableset.c:1.30 src/sys/net/npf/npf_tableset.c:1.31
--- src/sys/net/npf/npf_tableset.c:1.30	Wed Jun 12 10:36:32 2019
+++ src/sys/net/npf/npf_tableset.c	Thu Jun 20 13:08:52 2019
@@ -39,7 +39,7 @@
 
 #ifdef _KERNEL
 #include 
-__KERNEL_RCSID(0, "$NetBSD: npf_tableset.c,v 1.30 2019/06/12 14:36:32 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_tableset.c,v 1.31 2019/06/20 17:08:52 christos Exp $");
 
 #include 
 #include 
@@ -513,7 +513,7 @@ table_ifaddr_insert(npf_table_t *t, cons
 		toalloc = roundup2(allocated + 1, NPF_IFADDR_STEP);
 		newsize = toalloc * sizeof(npf_tblent_t *);
 
-		elements = kmem_zalloc(newsize, KM_SLEEP);
+		elements = kmem_zalloc(newsize, KM_NOSLEEP);
 		for (unsigned i = 0; i < used; i++) {
 			elements[i] = old_elements[i];
 		}



CVS commit: src/usr.sbin/sysinst

2019-06-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jun 20 16:57:25 UTC 2019

Modified Files:
src/usr.sbin/sysinst: disklabel.c

Log Message:
Disklabel partitions may start at the beginning of the disk (or the
NetBSD partition).


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/sysinst/disklabel.c

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

Modified files:

Index: src/usr.sbin/sysinst/disklabel.c
diff -u src/usr.sbin/sysinst/disklabel.c:1.2 src/usr.sbin/sysinst/disklabel.c:1.3
--- src/usr.sbin/sysinst/disklabel.c:1.2	Thu Jun 13 06:20:34 2019
+++ src/usr.sbin/sysinst/disklabel.c	Thu Jun 20 16:57:25 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: disklabel.c,v 1.2 2019/06/13 06:20:34 martin Exp $	*/
+/*	$NetBSD: disklabel.c,v 1.3 2019/06/20 16:57:25 martin Exp $	*/
 
 /*
  * Copyright 2018 The NetBSD Foundation, Inc.
@@ -687,13 +687,11 @@ disklabel_get_free_spaces_internal(const
 	size_t cnt = 0, i;
 	daddr_t s, e, from, size, end_of_disk;
 
-	if (start <= LABELSECTOR)
-		start = LABELSECTOR+1;
-	if (parts->dp.disk_start != 0 && parts->dp.disk_start > start)
+	if (start < parts->dp.disk_start)
 		start = parts->dp.disk_start;
 	if (min_space_size < 1)
 		min_space_size = 1;
-	if (align > 1)
+	if (align > 1 && (start % align) != 0)
 		start = max(roundup(start, align), align);
 	end_of_disk = parts->dp.disk_start + parts->dp.disk_size;
 	from = start;



CVS commit: src/usr.sbin/sysinst

2019-06-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jun 20 16:57:25 UTC 2019

Modified Files:
src/usr.sbin/sysinst: disklabel.c

Log Message:
Disklabel partitions may start at the beginning of the disk (or the
NetBSD partition).


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/sysinst/disklabel.c

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



CVS commit: src/usr.sbin/sysinst

2019-06-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jun 20 15:59:40 UTC 2019

Modified Files:
src/usr.sbin/sysinst: Makefile.inc

Log Message:
remove format warning.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/usr.sbin/sysinst/Makefile.inc

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



CVS commit: src/usr.sbin/sysinst

2019-06-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jun 20 15:59:40 UTC 2019

Modified Files:
src/usr.sbin/sysinst: Makefile.inc

Log Message:
remove format warning.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/usr.sbin/sysinst/Makefile.inc

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

Modified files:

Index: src/usr.sbin/sysinst/Makefile.inc
diff -u src/usr.sbin/sysinst/Makefile.inc:1.21 src/usr.sbin/sysinst/Makefile.inc:1.22
--- src/usr.sbin/sysinst/Makefile.inc:1.21	Mon Jun 17 14:36:39 2019
+++ src/usr.sbin/sysinst/Makefile.inc	Thu Jun 20 11:59:40 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.21 2019/06/17 18:36:39 martin Exp $
+#	$NetBSD: Makefile.inc,v 1.22 2019/06/20 15:59:40 christos Exp $
 #
 # Makefile for sysinst
 
@@ -118,8 +118,6 @@ DBG +=-g -O0 ${O0TRACKING}
 COPTS += -Os
 .endif
 
-COPTS.msg_defs.c+=	-Wno-format-nonliteral
-
 .if (!defined(SMALLPROG) || defined(SMALLPROG_INET6)) && (${USE_INET6} != "no")
 CPPFLAGS+=-DINET6
 .endif



CVS commit: src/usr.sbin/sysinst

2019-06-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jun 20 15:58:59 UTC 2019

Modified Files:
src/usr.sbin/sysinst: configmenu.c

Log Message:
use proper format strings in replace().


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/sysinst/configmenu.c

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



CVS commit: src/usr.sbin/sysinst

2019-06-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jun 20 15:58:59 UTC 2019

Modified Files:
src/usr.sbin/sysinst: configmenu.c

Log Message:
use proper format strings in replace().


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/sysinst/configmenu.c

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

Modified files:

Index: src/usr.sbin/sysinst/configmenu.c
diff -u src/usr.sbin/sysinst/configmenu.c:1.7 src/usr.sbin/sysinst/configmenu.c:1.8
--- src/usr.sbin/sysinst/configmenu.c:1.7	Wed Jun 19 20:43:55 2019
+++ src/usr.sbin/sysinst/configmenu.c	Thu Jun 20 11:58:59 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: configmenu.c,v 1.7 2019/06/20 00:43:55 christos Exp $ */
+/* $NetBSD: configmenu.c,v 1.8 2019/06/20 15:58:59 christos Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -295,7 +295,6 @@ set_binpkg(struct menudesc *menu, void *
 {
 	configinfo **confp = arg;
 	char additional_pkgs[STRSIZE] = {0};
-	char pattern[STRSIZE];
 	int allok = 0;
 	arg_rv parm;
 
@@ -316,8 +315,8 @@ set_binpkg(struct menudesc *menu, void *
 	} while (allok == 0);
 
 	/* configure pkgin to use $pkgpath as a repository */
-	snprintf(pattern, STRSIZE, "s,^[^#].*$,%s,", pkgpath);
-	replace("/usr/pkg/etc/pkgin/repositories.conf", pattern);
+	replace("/usr/pkg/etc/pkgin/repositories.conf", "s,^[^#].*$,%s,",
+	pkgpath);
 
 	run_program(RUN_DISPLAY | RUN_PROGRESS | RUN_CHROOT,
 		"/usr/pkg/bin/pkgin -y update");
@@ -425,7 +424,7 @@ toggle_rcvar(struct menudesc *menu, void
 			fprintf(logfp, "replacement pattern is %s\n", pattern);
 			fflush(logfp);
 		}
-		replace("/etc/rc.conf", pattern);
+		replace("/etc/rc.conf", "%s", pattern);
 	}
 
 	return 0;



CVS commit: src/usr.sbin/sysinst

2019-06-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jun 20 15:56:41 UTC 2019

Modified Files:
src/usr.sbin/sysinst: defs.h

Log Message:
add more printflikes() (rin) and remove unused function.
cVS: --


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/usr.sbin/sysinst/defs.h

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

Modified files:

Index: src/usr.sbin/sysinst/defs.h
diff -u src/usr.sbin/sysinst/defs.h:1.34 src/usr.sbin/sysinst/defs.h:1.35
--- src/usr.sbin/sysinst/defs.h:1.34	Wed Jun 12 02:20:17 2019
+++ src/usr.sbin/sysinst/defs.h	Thu Jun 20 11:56:41 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: defs.h,v 1.34 2019/06/12 06:20:17 martin Exp $	*/
+/*	$NetBSD: defs.h,v 1.35 2019/06/20 15:56:41 christos Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -735,7 +735,7 @@ int	sanity_check(void);
 int	set_timezone(void);
 void	scripting_fprintf(FILE *, const char *, ...) __printflike(2, 3);
 void	scripting_vfprintf(FILE *, const char *, va_list) __printflike(2, 0);
-void	add_rc_conf(const char *, ...);
+void	add_rc_conf(const char *, ...) __printflike(1, 2);
 int	del_rc_conf(const char *);
 void	add_sysctl_conf(const char *, ...) __printflike(1, 2);
 void	enable_rc_conf(void);
@@ -748,7 +748,7 @@ void	umount_mnt2(void);
 int 	set_is_source(const char *);
 const char *set_dir_for_set(const char *);
 const char *ext_dir_for_set(const char *);
-void	replace(const char *, const char *, ...);
+void	replace(const char *, const char *, ...) __printflike(2, 3);
 void	get_tz_default(void);
 int	extract_file(distinfo *, int);
 void	do_coloring (unsigned int, unsigned int);
@@ -773,8 +773,6 @@ bool	needs_expanding(const char *, size_
 void	make_target_dir(const char *);
 void	append_to_target_file(const char *, const char *);
 void	echo_to_target_file(const char *, const char *);
-void	sprintf_to_target_file(const char *, const char *, ...)
-__printflike(2, 3);
 void	trunc_target_file(const char *);
 const	char *target_prefix(void);
 int	target_chdir(const char *);



CVS commit: src/usr.sbin/sysinst

2019-06-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jun 20 15:56:41 UTC 2019

Modified Files:
src/usr.sbin/sysinst: defs.h

Log Message:
add more printflikes() (rin) and remove unused function.
cVS: --


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/usr.sbin/sysinst/defs.h

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



CVS commit: src/usr.sbin/sysinst

2019-06-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jun 20 15:52:08 UTC 2019

Modified Files:
src/usr.sbin/sysinst: bsddisklabel.c

Log Message:
mount is an array and can't be NULL (rin)


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/usr.sbin/sysinst/bsddisklabel.c

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



CVS commit: src/usr.sbin/sysinst

2019-06-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jun 20 15:52:08 UTC 2019

Modified Files:
src/usr.sbin/sysinst: bsddisklabel.c

Log Message:
mount is an array and can't be NULL (rin)


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/usr.sbin/sysinst/bsddisklabel.c

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

Modified files:

Index: src/usr.sbin/sysinst/bsddisklabel.c
diff -u src/usr.sbin/sysinst/bsddisklabel.c:1.13 src/usr.sbin/sysinst/bsddisklabel.c:1.14
--- src/usr.sbin/sysinst/bsddisklabel.c:1.13	Wed Jun 19 20:43:55 2019
+++ src/usr.sbin/sysinst/bsddisklabel.c	Thu Jun 20 11:52:07 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: bsddisklabel.c,v 1.13 2019/06/20 00:43:55 christos Exp $	*/
+/*	$NetBSD: bsddisklabel.c,v 1.14 2019/06/20 15:52:07 christos Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -316,7 +316,7 @@ draw_size_menu_line(menudesc *m, int opt
 		getfslabelname(pset->infos[opt].fs_type,
 		pset->infos[opt].fs_version));
 		mount = swap;
-	} else if (pset->infos[opt].mount && pset->infos[opt].mount[0]) {
+	} else if (pset->infos[opt].mount[0]) {
 		mount = pset->infos[opt].mount;
 	} else {
 		mount = getfslabelname(pset->infos[opt].fs_type,



CVS commit: src/usr.sbin/sysinst

2019-06-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jun 20 15:49:21 UTC 2019

Modified Files:
src/usr.sbin/sysinst: disks.c

Log Message:
devdev is an array, remove NULL check (rin)


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/usr.sbin/sysinst/disks.c

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



CVS commit: src/usr.sbin/sysinst

2019-06-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jun 20 15:49:21 UTC 2019

Modified Files:
src/usr.sbin/sysinst: disks.c

Log Message:
devdev is an array, remove NULL check (rin)


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/usr.sbin/sysinst/disks.c

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

Modified files:

Index: src/usr.sbin/sysinst/disks.c
diff -u src/usr.sbin/sysinst/disks.c:1.33 src/usr.sbin/sysinst/disks.c:1.34
--- src/usr.sbin/sysinst/disks.c:1.33	Wed Jun 19 20:43:55 2019
+++ src/usr.sbin/sysinst/disks.c	Thu Jun 20 11:49:20 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: disks.c,v 1.33 2019/06/20 00:43:55 christos Exp $ */
+/*	$NetBSD: disks.c,v 1.34 2019/06/20 15:49:20 christos Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1101,8 +1101,6 @@ make_filesystems(struct install_partitio
 		make_target_dir("/");
 
 		snprintf(devdev, sizeof devdev, _PATH_DEV "%s", pm->diskdev);
-		if (devdev == NULL)
-			return (ENOMEM);
 		error = target_mount_do("-o async", devdev, "/");
 		if (error) {
 			msg_display_subst(MSG_mountfail, 2, devdev, "/");



CVS commit: src/sys/dev/pci

2019-06-20 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Jun 20 15:25:28 UTC 2019

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

Log Message:
 Fix panic on attach. This bug was added in rev. 1.56. I think it's not
required to call txp_set_filter() in the attach function.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/dev/pci/if_txp.c

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



CVS commit: src/sys/dev/pci

2019-06-20 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Jun 20 15:25:28 UTC 2019

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

Log Message:
 Fix panic on attach. This bug was added in rev. 1.56. I think it's not
required to call txp_set_filter() in the attach function.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/dev/pci/if_txp.c

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

Modified files:

Index: src/sys/dev/pci/if_txp.c
diff -u src/sys/dev/pci/if_txp.c:1.57 src/sys/dev/pci/if_txp.c:1.58
--- src/sys/dev/pci/if_txp.c:1.57	Wed May 29 10:07:29 2019
+++ src/sys/dev/pci/if_txp.c	Thu Jun 20 15:25:28 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: if_txp.c,v 1.57 2019/05/29 10:07:29 msaitoh Exp $ */
+/* $NetBSD: if_txp.c,v 1.58 2019/06/20 15:25:28 msaitoh Exp $ */
 
 /*
  * Copyright (c) 2001
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_txp.c,v 1.57 2019/05/29 10:07:29 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_txp.c,v 1.58 2019/06/20 15:25:28 msaitoh Exp $");
 
 #include "opt_inet.h"
 
@@ -276,8 +276,6 @@ txp_attach(device_t parent, device_t sel
 	&p1, &p2, NULL, 1))
 		goto cleanupintr;
 
-	txp_set_filter(sc);
-
 	p1 = htole16(p1);
 	enaddr[0] = ((uint8_t *)&p1)[1];
 	enaddr[1] = ((uint8_t *)&p1)[0];



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2019-06-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Jun 20 14:33:05 UTC 2019

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: alist.c barrier.c fifo.c
hash.c stack.c strtab.c

Log Message:
Toolify


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/cddl/osnet/dist/tools/ctf/cvt/alist.c
cvs rdiff -u -r1.4 -r1.5 src/external/cddl/osnet/dist/tools/ctf/cvt/barrier.c \
src/external/cddl/osnet/dist/tools/ctf/cvt/strtab.c
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/external/cddl/osnet/dist/tools/ctf/cvt/fifo.c \
src/external/cddl/osnet/dist/tools/ctf/cvt/stack.c
cvs rdiff -u -r1.2 -r1.3 src/external/cddl/osnet/dist/tools/ctf/cvt/hash.c

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



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2019-06-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Jun 20 14:33:05 UTC 2019

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: alist.c barrier.c fifo.c
hash.c stack.c strtab.c

Log Message:
Toolify


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/cddl/osnet/dist/tools/ctf/cvt/alist.c
cvs rdiff -u -r1.4 -r1.5 src/external/cddl/osnet/dist/tools/ctf/cvt/barrier.c \
src/external/cddl/osnet/dist/tools/ctf/cvt/strtab.c
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/external/cddl/osnet/dist/tools/ctf/cvt/fifo.c \
src/external/cddl/osnet/dist/tools/ctf/cvt/stack.c
cvs rdiff -u -r1.2 -r1.3 src/external/cddl/osnet/dist/tools/ctf/cvt/hash.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/tools/ctf/cvt/alist.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/alist.c:1.3 src/external/cddl/osnet/dist/tools/ctf/cvt/alist.c:1.4
--- src/external/cddl/osnet/dist/tools/ctf/cvt/alist.c:1.3	Sun Feb 21 01:46:34 2010
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/alist.c	Thu Jun 20 14:33:04 2019
@@ -19,6 +19,11 @@
  *
  * CDDL HEADER END
  */
+
+#ifdef HAVE_NBTOOL_CONFIG_H
+#include "nbtool_config.h"
+#endif
+
 /*
  * Copyright 2001-2003 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/barrier.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/barrier.c:1.4 src/external/cddl/osnet/dist/tools/ctf/cvt/barrier.c:1.5
--- src/external/cddl/osnet/dist/tools/ctf/cvt/barrier.c:1.4	Mon May 28 21:05:06 2018
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/barrier.c	Thu Jun 20 14:33:04 2019
@@ -19,6 +19,11 @@
  *
  * CDDL HEADER END
  */
+
+#ifdef HAVE_NBTOOL_CONFIG_H
+#include "nbtool_config.h"
+#endif
+
 /*
  * Copyright 2002 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
Index: src/external/cddl/osnet/dist/tools/ctf/cvt/strtab.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/strtab.c:1.4 src/external/cddl/osnet/dist/tools/ctf/cvt/strtab.c:1.5
--- src/external/cddl/osnet/dist/tools/ctf/cvt/strtab.c:1.4	Mon May 28 21:05:06 2018
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/strtab.c	Thu Jun 20 14:33:05 2019
@@ -19,6 +19,10 @@
  *
  * CDDL HEADER END
  */
+#ifdef HAVE_NBTOOL_CONFIG_H
+#include "nbtool_config.h"
+#endif
+
 /*
  * Copyright (c) 2001 by Sun Microsystems, Inc.
  * All rights reserved.

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/fifo.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/fifo.c:1.1.1.1 src/external/cddl/osnet/dist/tools/ctf/cvt/fifo.c:1.2
--- src/external/cddl/osnet/dist/tools/ctf/cvt/fifo.c:1.1.1.1	Sat Feb 20 04:34:43 2010
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/fifo.c	Thu Jun 20 14:33:04 2019
@@ -19,6 +19,11 @@
  *
  * CDDL HEADER END
  */
+
+#ifdef HAVE_NBTOOL_CONFIG_H
+#include "nbtool_config.h"
+#endif
+
 /*
  * Copyright 2002 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
Index: src/external/cddl/osnet/dist/tools/ctf/cvt/stack.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/stack.c:1.1.1.1 src/external/cddl/osnet/dist/tools/ctf/cvt/stack.c:1.2
--- src/external/cddl/osnet/dist/tools/ctf/cvt/stack.c:1.1.1.1	Sat Feb 20 04:34:44 2010
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/stack.c	Thu Jun 20 14:33:04 2019
@@ -19,6 +19,10 @@
  *
  * CDDL HEADER END
  */
+#ifdef HAVE_NBTOOL_CONFIG_H
+#include "nbtool_config.h"
+#endif
+
 /*
  * Copyright (c) 2001 by Sun Microsystems, Inc.
  * All rights reserved.

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/hash.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/hash.c:1.2 src/external/cddl/osnet/dist/tools/ctf/cvt/hash.c:1.3
--- src/external/cddl/osnet/dist/tools/ctf/cvt/hash.c:1.2	Sun Feb 21 00:49:56 2010
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/hash.c	Thu Jun 20 14:33:04 2019
@@ -19,6 +19,11 @@
  *
  * CDDL HEADER END
  */
+
+#ifdef HAVE_NBTOOL_CONFIG_H
+#include "nbtool_config.h"
+#endif
+
 /*
  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.



CVS commit: src

2019-06-20 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Thu Jun 20 12:14:46 UTC 2019

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/dev/audio: Makefile h_pad.c t_pad.sh
Removed Files:
src/tests/dev/audio: t_pad_output.bz2.uue

Log Message:
Rewrite t_pad test.
Previous version compared the pad's output binary passed mulaw-slinear
conversion and frequency conversion with the prepared "good result".
In such case, a test may fail when the implemantation changes.  In fact,
the frequency conversion algorithm was changed in isaki-audio2, so
output waveforms is not completely the same (but that's no problem with
the audio waveforms).
New version uses slinear_le/2ch/44100Hz input data and compares the
output binary with the input data.  pad with no conversions should
output the same binary.
Fix PR kern/54187.


To generate a diff of this commit:
cvs rdiff -u -r1.816 -r1.817 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.5 -r1.6 src/tests/dev/audio/Makefile
cvs rdiff -u -r1.2 -r1.3 src/tests/dev/audio/h_pad.c
cvs rdiff -u -r1.3 -r1.4 src/tests/dev/audio/t_pad.sh
cvs rdiff -u -r1.4 -r0 src/tests/dev/audio/t_pad_output.bz2.uue

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.816 src/distrib/sets/lists/tests/mi:1.817
--- src/distrib/sets/lists/tests/mi:1.816	Fri Jun  7 21:32:34 2019
+++ src/distrib/sets/lists/tests/mi	Thu Jun 20 12:14:46 2019
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.816 2019/06/07 21:32:34 christos Exp $
+# $NetBSD: mi,v 1.817 2019/06/20 12:14:46 isaki Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -1389,7 +1389,7 @@
 ./usr/tests/dev/audio/Kyuafile			tests-fs-tests		atf,rump,kyua
 ./usr/tests/dev/audio/h_pad			tests-fs-tests		atf,rump
 ./usr/tests/dev/audio/t_pad			tests-fs-tests		atf,rump
-./usr/tests/dev/audio/t_pad_output.bz2.uue	tests-fs-tests		atf,rump
+./usr/tests/dev/audio/t_pad_output.bz2.uue	tests-obsolete		obsolete
 ./usr/tests/dev/cgdtests-fs-tests		compattestfile,atf
 ./usr/tests/dev/cgd/Atffile			tests-fs-tests		compattestfile,atf
 ./usr/tests/dev/cgd/Kyuafile			tests-fs-tests		compattestfile,atf,kyua

Index: src/tests/dev/audio/Makefile
diff -u src/tests/dev/audio/Makefile:1.5 src/tests/dev/audio/Makefile:1.6
--- src/tests/dev/audio/Makefile:1.5	Sat Jan 23 21:22:48 2016
+++ src/tests/dev/audio/Makefile	Thu Jun 20 12:14:46 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.5 2016/01/23 21:22:48 christos Exp $
+#	$NetBSD: Makefile,v 1.6 2019/06/20 12:14:46 isaki Exp $
 #
 
 .include 
@@ -20,8 +20,6 @@ LDADD+=	-lrumpuser
 LDADD+=	-lrump
 LDADD+=	-lpthread
 
-FILES=		t_pad_output.bz2.uue
-
 WARNS=	4
 NOMAN=
 

Index: src/tests/dev/audio/h_pad.c
diff -u src/tests/dev/audio/h_pad.c:1.2 src/tests/dev/audio/h_pad.c:1.3
--- src/tests/dev/audio/h_pad.c:1.2	Sat Oct 15 07:08:06 2016
+++ src/tests/dev/audio/h_pad.c	Thu Jun 20 12:14:46 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: h_pad.c,v 1.2 2016/10/15 07:08:06 nat Exp $	*/
+/*	$NetBSD: h_pad.c,v 1.3 2019/06/20 12:14:46 isaki Exp $	*/
 
 /*
  * Copyright (c) 2010 Antti Kantee.  All Rights Reserved.
@@ -32,29 +32,114 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 #include "h_pad_musa.c"
 
 /*
- * Stuff some audio into /dev/audio, read it from /dev/pad.  Use in
- * conjunction with t_pad, which tests that we got sensible output
- * by comparing against a previous audibly good result.
+ * Stuff some audio into /dev/audio, read it from /dev/pad.
  */
 
 #define BUFSIZE 1024
 
+static const int16_t mulaw_to_slinear16[256] = {
+	0x8284, 0x8684, 0x8a84, 0x8e84, 0x9284, 0x9684, 0x9a84, 0x9e84,
+	0xa284, 0xa684, 0xaa84, 0xae84, 0xb284, 0xb684, 0xba84, 0xbe84,
+	0xc184, 0xc384, 0xc584, 0xc784, 0xc984, 0xcb84, 0xcd84, 0xcf84,
+	0xd184, 0xd384, 0xd584, 0xd784, 0xd984, 0xdb84, 0xdd84, 0xdf84,
+	0xe104, 0xe204, 0xe304, 0xe404, 0xe504, 0xe604, 0xe704, 0xe804,
+	0xe904, 0xea04, 0xeb04, 0xec04, 0xed04, 0xee04, 0xef04, 0xf004,
+	0xf0c4, 0xf144, 0xf1c4, 0xf244, 0xf2c4, 0xf344, 0xf3c4, 0xf444,
+	0xf4c4, 0xf544, 0xf5c4, 0xf644, 0xf6c4, 0xf744, 0xf7c4, 0xf844,
+	0xf8a4, 0xf8e4, 0xf924, 0xf964, 0xf9a4, 0xf9e4, 0xfa24, 0xfa64,
+	0xfaa4, 0xfae4, 0xfb24, 0xfb64, 0xfba4, 0xfbe4, 0xfc24, 0xfc64,
+	0xfc94, 0xfcb4, 0xfcd4, 0xfcf4, 0xfd14, 0xfd34, 0xfd54, 0xfd74,
+	0xfd94, 0xfdb4, 0xfdd4, 0xfdf4, 0xfe14, 0xfe34, 0xfe54, 0xfe74,
+	0xfe8c, 0xfe9c, 0xfeac, 0xfebc, 0xfecc, 0xfedc, 0xfeec, 0xfefc,
+	0xff0c, 0xff1c, 0xff2c, 0xff3c, 0xff4c, 0xff5c, 0xff6c, 0xff7c,
+	0xff88, 0xff90, 0xff98, 0xffa0, 0xffa8, 0xffb0, 0xffb8, 0xffc0,
+	0xffc8, 0xffd0, 0xffd8, 0xffe0, 0xffe8, 0xfff0, 0xfff8, 0xfffc,
+	0x7d7c, 0x797c, 0x757c, 0x717c, 0x6d7c, 0x697c, 0x657c, 0x617c,
+	0x5d7c, 0x597c, 0x557c, 0x517c, 0x4d7c, 0x497c, 0x457c, 0x417c,
+	0x3e7c, 0x3c7c, 0x3a7c, 0x387c, 0x367c, 0x347c, 0x327c, 0x307c,
+	0x2e7c, 0x2c7c, 0x2a7c, 0x

CVS commit: src

2019-06-20 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Thu Jun 20 12:14:46 UTC 2019

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/dev/audio: Makefile h_pad.c t_pad.sh
Removed Files:
src/tests/dev/audio: t_pad_output.bz2.uue

Log Message:
Rewrite t_pad test.
Previous version compared the pad's output binary passed mulaw-slinear
conversion and frequency conversion with the prepared "good result".
In such case, a test may fail when the implemantation changes.  In fact,
the frequency conversion algorithm was changed in isaki-audio2, so
output waveforms is not completely the same (but that's no problem with
the audio waveforms).
New version uses slinear_le/2ch/44100Hz input data and compares the
output binary with the input data.  pad with no conversions should
output the same binary.
Fix PR kern/54187.


To generate a diff of this commit:
cvs rdiff -u -r1.816 -r1.817 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.5 -r1.6 src/tests/dev/audio/Makefile
cvs rdiff -u -r1.2 -r1.3 src/tests/dev/audio/h_pad.c
cvs rdiff -u -r1.3 -r1.4 src/tests/dev/audio/t_pad.sh
cvs rdiff -u -r1.4 -r0 src/tests/dev/audio/t_pad_output.bz2.uue

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



CVS commit: src/distrib/sets/lists/xbase

2019-06-20 Thread Yuuki Enomoto
Module Name:src
Committed By:   uki
Date:   Thu Jun 20 12:09:28 UTC 2019

Modified Files:
src/distrib/sets/lists/xbase: mi shl.mi

Log Message:
Mark "xbase-obsolete" to obsolete files


To generate a diff of this commit:
cvs rdiff -u -r1.151 -r1.152 src/distrib/sets/lists/xbase/mi
cvs rdiff -u -r1.84 -r1.85 src/distrib/sets/lists/xbase/shl.mi

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



CVS commit: src/distrib/sets/lists/xbase

2019-06-20 Thread Yuuki Enomoto
Module Name:src
Committed By:   uki
Date:   Thu Jun 20 12:09:28 UTC 2019

Modified Files:
src/distrib/sets/lists/xbase: mi shl.mi

Log Message:
Mark "xbase-obsolete" to obsolete files


To generate a diff of this commit:
cvs rdiff -u -r1.151 -r1.152 src/distrib/sets/lists/xbase/mi
cvs rdiff -u -r1.84 -r1.85 src/distrib/sets/lists/xbase/shl.mi

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/xbase/mi
diff -u src/distrib/sets/lists/xbase/mi:1.151 src/distrib/sets/lists/xbase/mi:1.152
--- src/distrib/sets/lists/xbase/mi:1.151	Tue Apr 16 21:20:51 2019
+++ src/distrib/sets/lists/xbase/mi	Thu Jun 20 12:09:28 2019
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.151 2019/04/16 21:20:51 mrg Exp $
+# $NetBSD: mi,v 1.152 2019/06/20 12:09:28 uki Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -37,7 +37,7 @@
 ./usr/X11R7/bin/iceauth	-unknown-	xorg
 ./usr/X11R7/bin/ico	-unknown-	xorg
 ./usr/X11R7/bin/imake	-unknown-	xorg
-./usr/X11R7/bin/lbxproxy-unknown-	obsolete
+./usr/X11R7/bin/lbxproxyxbase-obsolete	obsolete
 ./usr/X11R7/bin/listres	-unknown-	xorg
 ./usr/X11R7/bin/lndir	-unknown-	xorg
 ./usr/X11R7/bin/luit	-unknown-	xorg
@@ -115,12 +115,12 @@
 ./usr/X11R7/bin/xmlwf	-unknown-	xorg
 ./usr/X11R7/bin/xmodmap	-unknown-	xorg
 ./usr/X11R7/bin/xmore	-unknown-	xorg
-./usr/X11R7/bin/xphelloworld-unknown-	obsolete
-./usr/X11R7/bin/xplsprinters-unknown-	obsolete
-./usr/X11R7/bin/xprehashprinterlist			-unknown-	obsolete
+./usr/X11R7/bin/xphelloworldxbase-obsolete	obsolete
+./usr/X11R7/bin/xplsprintersxbase-obsolete	obsolete
+./usr/X11R7/bin/xprehashprinterlist			xbase-obsolete	obsolete
 ./usr/X11R7/bin/xprop	-unknown-	xorg
-./usr/X11R7/bin/xpsimplehelloworld			-unknown-	obsolete
-./usr/X11R7/bin/xpxthelloworld-unknown-	obsolete
+./usr/X11R7/bin/xpsimplehelloworld			xbase-obsolete	obsolete
+./usr/X11R7/bin/xpxthelloworldxbase-obsolete	obsolete
 ./usr/X11R7/bin/xrandr	-unknown-	xorg
 ./usr/X11R7/bin/xrdb	-unknown-	xorg
 ./usr/X11R7/bin/xrefresh-unknown-	xorg
@@ -158,12 +158,12 @@
 ./usr/X11R7/include/X11/Xcursorbase-x11-root	xorg
 ./usr/X11R7/include/X11/Xftbase-x11-root	xorg
 ./usr/X11R7/include/X11/Xmubase-x11-root	xorg
-./usr/X11R7/include/X11/XprintAppUtil			base-obsolete	obsolete
-./usr/X11R7/include/X11/XprintUtil			base-obsolete	obsolete
+./usr/X11R7/include/X11/XprintAppUtil			xbase-obsolete	obsolete
+./usr/X11R7/include/X11/XprintUtil			xbase-obsolete	obsolete
 ./usr/X11R7/include/X11/Xtransbase-x11-root	xorg
 ./usr/X11R7/include/X11/bitmapsbase-x11-root	xorg
 ./usr/X11R7/include/X11/dribase-x11-root	xorg
-./usr/X11R7/include/X11/drmbase-obsolete	obsolete
+./usr/X11R7/include/X11/drmxbase-obsolete	obsolete
 ./usr/X11R7/include/X11/extensions			base-x11-root	xorg
 ./usr/X11R7/include/X11/fontsbase-x11-root	xorg
 ./usr/X11R7/include/X11/pixmapsbase-x11-root	xorg
@@ -257,19 +257,19 @@
 ./usr/X11R7/include/X11/pixmaps/ctwm/xterm.xpm		-unknown-	xorg
 ./usr/X11R7/include/X11/pixmaps/xorg-bw.xpm		-unknown-	xorg
 ./usr/X11R7/include/X11/pixmaps/xorg.xpm		-unknown-	xorg
-./usr/X11R7/include/drm	base-obsolete	obsolete
+./usr/X11R7/include/drm	xbase-obsolete	obsolete
 ./usr/X11R7/include/epoxybase-x11-root	xorg
 ./usr/X11R7/include/fontconfigbase-x11-root	xorg
 ./usr/X11R7/include/freetype2base-x11-root	xorg
-./usr/X11R7/include/freetype2/cache			base-obsolete	obsolete
-./usr/X11R7/include/freetype2/config			base-obsolete	obsolete
+./usr/X11R7/include/freetype2/cache			xbase-obsolete	obsolete
+./usr/X11R7/include/freetype2/config			xbase-obsolete	obsolete
 ./usr/X11R7/include/freetype2/freetype			base-x11-root	xorg
 ./usr/X11R7/include/freetype2/freetype/cache		base-x11-root	xorg
 ./usr/X11R7/include/freetype2/freetype/config		base-x11-root	xorg
-./usr/X11R7/include/freetype2/freetype/internal		base-obsolete	obsolete
-./usr/X11R7/include/freetype2/freetype/internal/services base-obsolete	obsolete
-./usr/X11R7/include/freetype2/internal			base-obsolete	obsolete
-./usr/X11R7/include/freetype2/internal/services		base-obsolete	obsolete
+./usr/X11R7/include/freetype2/freetype/internal		xbase-obsolete	obsolete
+./usr/X11R7/include/freetype2/freetype/internal/services xbase-obsolete	obsolete
+./usr/X11R7/include/freetype2/internal			xbase-obsolete	obsolete
+./usr/X11R7/include/freetype2/internal/services		xbase-obsolete	obsolete
 ./usr/X11R7/include/libdrmbase-x11-root	xorg
 ./usr/X11R7/include/libdrm/nouveau			base-x11-root	xorg
 ./usr/X11R7/include/libdrm/nouveau/nvif			base-x11-root	xorg
@@ -445,18 +445,18 @@
 ./usr/X11R7/lib/X11/locale/ja.JIS/Compose		-unknown-	xorg
 ./usr/X11R7/lib/X11/locale/ja.JIS/XI18N_OBJS		-unknown-	xorg
 ./usr/X11R7/lib/X11/locale/ja.JIS/XLC_LOCALE		-unknown-	xorg
-./usr/X11R7/lib/X11/locale/ja.S90			base-obso

CVS commit: src/usr.bin/msgc

2019-06-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jun 20 11:31:13 UTC 2019

Modified Files:
src/usr.bin/msgc: msg_sys.def

Log Message:
Re-add msg_clear() accidently dropped in previous.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/usr.bin/msgc/msg_sys.def

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



CVS commit: src/usr.bin/msgc

2019-06-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jun 20 11:31:13 UTC 2019

Modified Files:
src/usr.bin/msgc: msg_sys.def

Log Message:
Re-add msg_clear() accidently dropped in previous.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/usr.bin/msgc/msg_sys.def

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/msgc/msg_sys.def
diff -u src/usr.bin/msgc/msg_sys.def:1.45 src/usr.bin/msgc/msg_sys.def:1.46
--- src/usr.bin/msgc/msg_sys.def:1.45	Thu Jun 20 00:45:18 2019
+++ src/usr.bin/msgc/msg_sys.def	Thu Jun 20 11:31:12 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_sys.def,v 1.45 2019/06/20 00:45:18 christos Exp $	*/
+/*	$NetBSD: msg_sys.def,v 1.46 2019/06/20 11:31:12 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -288,6 +288,7 @@ void
 msg_display(msg msg_no)
 {
 
+	msg_clear();
 	msg_printf("%s", msg_string(msg_no));
 }
 



CVS commit: src/sbin/gpt

2019-06-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jun 20 10:56:38 UTC 2019

Modified Files:
src/sbin/gpt: biosboot.c

Log Message:
When biosboot is used on an existing wedge and we are switching to
the gpt of the parent device, do not pass the size of the wedge to
gpt_open, it certainly is smaller than the whole device.
Fixes bin/54312.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sbin/gpt/biosboot.c

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



CVS commit: src/sbin/gpt

2019-06-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jun 20 10:56:38 UTC 2019

Modified Files:
src/sbin/gpt: biosboot.c

Log Message:
When biosboot is used on an existing wedge and we are switching to
the gpt of the parent device, do not pass the size of the wedge to
gpt_open, it certainly is smaller than the whole device.
Fixes bin/54312.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sbin/gpt/biosboot.c

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

Modified files:

Index: src/sbin/gpt/biosboot.c
diff -u src/sbin/gpt/biosboot.c:1.31 src/sbin/gpt/biosboot.c:1.32
--- src/sbin/gpt/biosboot.c:1.31	Thu Apr  4 13:55:40 2019
+++ src/sbin/gpt/biosboot.c	Thu Jun 20 10:56:38 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: biosboot.c,v 1.31 2019/04/04 13:55:40 martin Exp $ */
+/*	$NetBSD: biosboot.c,v 1.32 2019/06/20 10:56:38 martin Exp $ */
 
 /*
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 #include 
 #ifdef __RCSID
-__RCSID("$NetBSD: biosboot.c,v 1.31 2019/04/04 13:55:40 martin Exp $");
+__RCSID("$NetBSD: biosboot.c,v 1.32 2019/06/20 10:56:38 martin Exp $");
 #endif
 
 #include 
@@ -312,7 +312,7 @@ cmd_biosboot(gpt_t gpt, int argc, char *
 		start = dkw.dkw_offset;
 		size = dkw.dkw_size;
 		ngpt = gpt_open(dkw.dkw_parent, gpt->flags, gpt->verbose,
-		gpt->mediasz, gpt->secsz, gpt->timestamp);
+		0, 0, 0);
 		if (ngpt == NULL)
 			goto cleanup;
 	}



CVS commit: src/sbin/gpt

2019-06-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jun 20 10:41:58 UTC 2019

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

Log Message:
Do not try to close a NULL gpt. Fixes the core dump part of PR bin/54312


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/sbin/gpt/gpt.c

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



CVS commit: src/sbin/gpt

2019-06-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jun 20 10:41:58 UTC 2019

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

Log Message:
Do not try to close a NULL gpt. Fixes the core dump part of PR bin/54312


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/sbin/gpt/gpt.c

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

Modified files:

Index: src/sbin/gpt/gpt.c
diff -u src/sbin/gpt/gpt.c:1.77 src/sbin/gpt/gpt.c:1.78
--- src/sbin/gpt/gpt.c:1.77	Sun Jan 27 13:16:05 2019
+++ src/sbin/gpt/gpt.c	Thu Jun 20 10:41:58 2019
@@ -35,7 +35,7 @@
 __FBSDID("$FreeBSD: src/sbin/gpt/gpt.c,v 1.16 2006/07/07 02:44:23 marcel Exp $");
 #endif
 #ifdef __RCSID
-__RCSID("$NetBSD: gpt.c,v 1.77 2019/01/27 13:16:05 martin Exp $");
+__RCSID("$NetBSD: gpt.c,v 1.78 2019/06/20 10:41:58 martin Exp $");
 #endif
 
 #include 
@@ -590,6 +590,9 @@ void
 gpt_close(gpt_t gpt)
 {
 
+	if (gpt == NULL)
+		return;
+
 	if (!(gpt->flags & GPT_MODIFIED) || !(gpt->flags & GPT_SYNC))
 		goto out;
 



CVS commit: src/sys/dev/usb

2019-06-20 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Jun 20 10:46:24 UTC 2019

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

Log Message:
minor clean up, almost NFCI:
- use const, __func__, more
- axen_mii_lock is a normal mutex not rwlock, and make sure it's
  properly cleaned up for failed attach
- check axen_dying in axen_miibus_statchg()
- rename axen_ax88179_eeprom() to axen_get_eaddr() and move the code
  here into the support the current method.
- adjust some comments


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/usb/if_axen.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_axen.c
diff -u src/sys/dev/usb/if_axen.c:1.42 src/sys/dev/usb/if_axen.c:1.43
--- src/sys/dev/usb/if_axen.c:1.42	Tue Jun 18 09:34:57 2019
+++ src/sys/dev/usb/if_axen.c	Thu Jun 20 10:46:24 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_axen.c,v 1.42 2019/06/18 09:34:57 mrg Exp $	*/
+/*	$NetBSD: if_axen.c,v 1.43 2019/06/20 10:46:24 mrg Exp $	*/
 /*	$OpenBSD: if_axen.c,v 1.3 2013/10/21 10:10:22 yuo Exp $	*/
 
 /*
@@ -23,7 +23,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_axen.c,v 1.42 2019/06/18 09:34:57 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_axen.c,v 1.43 2019/06/20 10:46:24 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -112,7 +112,7 @@ struct axen_softc {
 
 	struct usb_task		axen_tick_task;
 
-	krwlock_t		axen_mii_lock;
+	kmutex_t		axen_mii_lock;
 
 	int			axen_link;
 
@@ -178,14 +178,8 @@ static int	axen_cmd(struct axen_softc *,
 static int	axen_ifmedia_upd(struct ifnet *);
 static void	axen_ifmedia_sts(struct ifnet *, struct ifmediareq *);
 static void	axen_reset(struct axen_softc *);
-#if 0
-static int	axen_ax88179_eeprom(struct axen_softc *, void *);
-#endif
-
+static int	axen_get_eaddr(struct axen_softc *, void *);
 static void	axen_iff(struct axen_softc *);
-static void	axen_lock_mii(struct axen_softc *);
-static void	axen_unlock_mii(struct axen_softc *);
-
 static void	axen_ax88179_init(struct axen_softc *);
 static void	axen_setcoe(struct axen_softc *);
 
@@ -195,14 +189,14 @@ axen_lock_mii(struct axen_softc *sc)
 {
 
 	sc->axen_refcnt++;
-	rw_enter(&sc->axen_mii_lock, RW_WRITER);
+	mutex_enter(&sc->axen_mii_lock);
 }
 
 static void
 axen_unlock_mii(struct axen_softc *sc)
 {
 
-	rw_exit(&sc->axen_mii_lock);
+	mutex_exit(&sc->axen_mii_lock);
 	if (--sc->axen_refcnt < 0)
 		usb_detach_wakeupold(sc->axen_dev);
 }
@@ -213,7 +207,7 @@ axen_cmd(struct axen_softc *sc, int cmd,
 	usb_device_request_t req;
 	usbd_status err;
 
-	KASSERT(rw_lock_held(&sc->axen_mii_lock));
+	KASSERT(mutex_owned(&sc->axen_mii_lock));
 
 	if (sc->axen_dying)
 		return 0;
@@ -232,7 +226,7 @@ axen_cmd(struct axen_softc *sc, int cmd,
 	cmd, val, AXEN_CMD_LEN(cmd)));
 
 	if (err) {
-		DPRINTF(("axen_cmd err: cmd: %d, error: %d\n", cmd, err));
+		DPRINTF(("%s: cmd: %d, error: %d\n", __func__, cmd, err));
 		return -1;
 	}
 
@@ -242,7 +236,7 @@ axen_cmd(struct axen_softc *sc, int cmd,
 static int
 axen_miibus_readreg(device_t dev, int phy, int reg, uint16_t *val)
 {
-	struct axen_softc *sc = device_private(dev);
+	struct axen_softc * const sc = device_private(dev);
 	usbd_status err;
 	uint16_t data;
 
@@ -259,7 +253,7 @@ axen_miibus_readreg(device_t dev, int ph
 	axen_unlock_mii(sc);
 
 	if (err) {
-		aprint_error_dev(sc->axen_dev, "read PHY failed\n");
+		aprint_error_dev(sc->axen_dev, "read PHY failed: %d\n", err);
 		return err;
 	}
 
@@ -277,7 +271,7 @@ axen_miibus_readreg(device_t dev, int ph
 static int
 axen_miibus_writereg(device_t dev, int phy, int reg, uint16_t val)
 {
-	struct axen_softc *sc = device_private(dev);
+	struct axen_softc * const sc = device_private(dev);
 	usbd_status err;
 	uint16_t uval;
 
@@ -291,11 +285,12 @@ axen_miibus_writereg(device_t dev, int p
 	axen_lock_mii(sc);
 	err = axen_cmd(sc, AXEN_CMD_MII_WRITE_REG, reg, phy, &uval);
 	axen_unlock_mii(sc);
+
 	DPRINTFN(2, ("axen_miibus_writereg: phy 0x%x reg 0x%x val 0x%04hx\n",
 	phy, reg, val));
 
 	if (err) {
-		aprint_error_dev(sc->axen_dev, "write PHY failed\n");
+		aprint_error_dev(sc->axen_dev, "write PHY failed: %d\n", err);
 		return err;
 	}
 
@@ -305,12 +300,15 @@ axen_miibus_writereg(device_t dev, int p
 static void
 axen_miibus_statchg(struct ifnet *ifp)
 {
-	struct axen_softc *sc = ifp->if_softc;
+	struct axen_softc * const sc = ifp->if_softc;
 	struct mii_data *mii = GET_MII(sc);
 	int err;
 	uint16_t val;
 	uint16_t wval;
 
+	if (sc->axen_dying)
+		return;
+
 	sc->axen_link = 0;
 	if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) ==
 	(IFM_ACTIVE | IFM_AVALID)) {
@@ -349,7 +347,7 @@ axen_miibus_statchg(struct ifnet *ifp)
 		break;
 	}
 
-	DPRINTF(("axen_miibus_statchg: val=0x%x\n", val));
+	DPRINTF(("%s: val=0x%x\n", __func__, val));
 	wval = htole16(val);
 	axen_lock_mii(sc);
 	err = axen_cmd(sc, AXEN_CMD_MAC_WRITE2, 2, AXEN_MEDIUM_STATUS, &wval);
@@ -366,7 +364,7 @@ axen_miibus_

CVS commit: src/sys/dev/usb

2019-06-20 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Jun 20 10:46:24 UTC 2019

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

Log Message:
minor clean up, almost NFCI:
- use const, __func__, more
- axen_mii_lock is a normal mutex not rwlock, and make sure it's
  properly cleaned up for failed attach
- check axen_dying in axen_miibus_statchg()
- rename axen_ax88179_eeprom() to axen_get_eaddr() and move the code
  here into the support the current method.
- adjust some comments


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/usb/if_axen.c

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



CVS commit: src/sys/arch

2019-06-20 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Thu Jun 20 08:16:20 UTC 2019

Modified Files:
src/sys/arch/arm/imx: files.imx6 if_enet_imx6.c if_enetvar.h
imx6_ahcisata.c imx6_ccm.c imx6_ccmreg.h imx6_ccmvar.h imx6_i2c.c
imx6_pcie.c imx6_usb.c imx6_usbphy.c imx6_usdhc.c imxi2cvar.h
imxusbvar.h
src/sys/arch/evbarm/nitrogen6: nitrogen6_usb.c

Log Message:
Add support for clk subsystem in imx6 CCM driver.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/imx/files.imx6
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/imx/if_enet_imx6.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/imx/if_enetvar.h \
src/sys/arch/arm/imx/imx6_i2c.c src/sys/arch/arm/imx/imxi2cvar.h
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/imx/imx6_ahcisata.c \
src/sys/arch/arm/imx/imx6_pcie.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/imx/imx6_ccm.c \
src/sys/arch/arm/imx/imx6_ccmreg.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/imx/imx6_ccmvar.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/imx/imx6_usb.c \
src/sys/arch/arm/imx/imxusbvar.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/imx/imx6_usbphy.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/imx/imx6_usdhc.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbarm/nitrogen6/nitrogen6_usb.c

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



CVS commit: src/sys/arch

2019-06-20 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Thu Jun 20 08:16:20 UTC 2019

Modified Files:
src/sys/arch/arm/imx: files.imx6 if_enet_imx6.c if_enetvar.h
imx6_ahcisata.c imx6_ccm.c imx6_ccmreg.h imx6_ccmvar.h imx6_i2c.c
imx6_pcie.c imx6_usb.c imx6_usbphy.c imx6_usdhc.c imxi2cvar.h
imxusbvar.h
src/sys/arch/evbarm/nitrogen6: nitrogen6_usb.c

Log Message:
Add support for clk subsystem in imx6 CCM driver.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/imx/files.imx6
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/imx/if_enet_imx6.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/imx/if_enetvar.h \
src/sys/arch/arm/imx/imx6_i2c.c src/sys/arch/arm/imx/imxi2cvar.h
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/imx/imx6_ahcisata.c \
src/sys/arch/arm/imx/imx6_pcie.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/imx/imx6_ccm.c \
src/sys/arch/arm/imx/imx6_ccmreg.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/imx/imx6_ccmvar.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/imx/imx6_usb.c \
src/sys/arch/arm/imx/imxusbvar.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/imx/imx6_usbphy.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/imx/imx6_usdhc.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbarm/nitrogen6/nitrogen6_usb.c

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

Modified files:

Index: src/sys/arch/arm/imx/files.imx6
diff -u src/sys/arch/arm/imx/files.imx6:1.14 src/sys/arch/arm/imx/files.imx6:1.15
--- src/sys/arch/arm/imx/files.imx6:1.14	Wed Jun 20 07:05:37 2018
+++ src/sys/arch/arm/imx/files.imx6	Thu Jun 20 08:16:19 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: files.imx6,v 1.14 2018/06/20 07:05:37 hkenken Exp $
+#	$NetBSD: files.imx6,v 1.15 2019/06/20 08:16:19 hkenken Exp $
 #
 # Configuration info for the Freescale i.MX6
 #
@@ -32,12 +32,15 @@ attach	imxpcie at axi
 file	arch/arm/imx/imx6_pcie.c		imxpcie
 
 # iMX6 Clock Control Module
-device	imxccm
+device	imxccm : clk
 attach	imxccm at axi
 file	arch/arm/imx/imx6_ccm.c			imxccm	needs-flag
 defflag opt_imx6clk.hIMXCCMDEBUG
 defparam opt_imx6clk.hIMX6_OSC_FREQ
 defparam opt_imx6clk.hIMX6_CKIL_FREQ
+defparam opt_imx6clk.hIMX6_CKIH_FREQ
+defparam opt_imx6clk.hIMX6_ANACLK1_FREQ
+defparam opt_imx6clk.hIMX6_ANACLK2_FREQ
 
 # iMX6 Enhanced Periodic Interrupt Timer
 device	imxclock

Index: src/sys/arch/arm/imx/if_enet_imx6.c
diff -u src/sys/arch/arm/imx/if_enet_imx6.c:1.3 src/sys/arch/arm/imx/if_enet_imx6.c:1.4
--- src/sys/arch/arm/imx/if_enet_imx6.c:1.3	Fri Jun  9 18:14:59 2017
+++ src/sys/arch/arm/imx/if_enet_imx6.c	Thu Jun 20 08:16:19 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_enet_imx6.c,v 1.3 2017/06/09 18:14:59 ryo Exp $	*/
+/*	$NetBSD: if_enet_imx6.c,v 1.4 2019/06/20 08:16:19 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2014 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_enet_imx6.c,v 1.3 2017/06/09 18:14:59 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_enet_imx6.c,v 1.4 2019/06/20 08:16:19 hkenken Exp $");
 
 #include "locators.h"
 #include "imxccm.h"
@@ -47,6 +47,8 @@ __KERNEL_RCSID(0, "$NetBSD: if_enet_imx6
 #include 
 #include 
 
+static int enet_init_clocks(struct enet_softc *);
+
 int
 enet_match(device_t parent __unused, struct cfdata *match __unused, void *aux)
 {
@@ -108,28 +110,9 @@ enet_attach(device_t parent, device_t se
 	sc->sc_enaddr[5] = eaddr + sc->sc_unit;
 #endif
 
-#if NIMXCCM > 0
-	/* PLL power up */
-	if (imx6_pll_power(CCM_ANALOG_PLL_ENET, 1,
-	CCM_ANALOG_PLL_ENET_ENABLE) != 0) {
-		aprint_error_dev(sc->sc_dev,
-		"couldn't enable CCM_ANALOG_PLL_ENET\n");
-		return;
-	}
-
 	if (IMX6_CHIPID_MAJOR(imx6_chip_id()) == CHIPID_MAJOR_IMX6UL) {
 		uint32_t v;
 
-		/* iMX6UL */
-		if ((imx6_pll_power(CCM_ANALOG_PLL_ENET, 1,
-		CCM_ANALOG_PLL_ENET_ENET_25M_REF_EN) != 0) ||
-		(imx6_pll_power(CCM_ANALOG_PLL_ENET, 1,
-		CCM_ANALOG_PLL_ENET_ENET2_125M_EN) != 0)) {
-			aprint_error_dev(sc->sc_dev,
-			"couldn't enable CCM_ANALOG_PLL_ENET\n");
-			return;
-		}
-
 		v = iomux_read(IMX6UL_IOMUX_GPR1);
 		switch (sc->sc_unit) {
 		case 0:
@@ -144,11 +127,42 @@ enet_attach(device_t parent, device_t se
 		iomux_write(IMX6UL_IOMUX_GPR1, v);
 	}
 
-	sc->sc_pllclock = imx6_get_clock(IMX6CLK_PLL6);
-#else
-	sc->sc_pllclock = 5000;
-#endif
+	sc->sc_clk_enet = imx6_get_clock("enet");
+	if (sc->sc_clk_enet == NULL) {
+		aprint_error(": couldn't get clock enet\n");
+		return;
+	}
+	sc->sc_clk_enet_ref = imx6_get_clock("enet_ref");
+	if (sc->sc_clk_enet_ref == NULL) {
+		aprint_error(": couldn't get clock enet_ref\n");
+		return;
+	}
+	if (enet_init_clocks(sc) != 0) {
+		aprint_error_dev(self, "couldn't init clocks\n");
+		return;
+	}
+
+	sc->sc_pllclock = clk_get_rate(sc->sc_clk_enet_ref);
 
 	enet_attach_common(self, aa->aa_iot, aa->aa_dmat, aa->aa_addr,
 	aa->aa_size, aa->aa_irq);
 }
+
+static int
+enet_init_clocks(struct enet_softc *sc)
+{
+	int error;
+
+	err

CVS commit: src/lib/libc/sys

2019-06-20 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Jun 20 06:59:32 UTC 2019

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

Log Message:
fifo -> FIFO. Sort errors.


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

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

Modified files:

Index: src/lib/libc/sys/mknod.2
diff -u src/lib/libc/sys/mknod.2:1.30 src/lib/libc/sys/mknod.2:1.31
--- src/lib/libc/sys/mknod.2:1.30	Thu Jun 20 03:31:54 2019
+++ src/lib/libc/sys/mknod.2	Thu Jun 20 06:59:32 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mknod.2,v 1.30 2019/06/20 03:31:54 kamil Exp $
+.\"	$NetBSD: mknod.2,v 1.31 2019/06/20 06:59:32 wiz Exp $
 .\"
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -54,7 +54,7 @@ specified in
 .Fa mode
 and 0 in
 .Fa dev
-makes a fifo file.
+makes a FIFO file.
 This call is respectively a portable alias for
 .Xr mkfifo 2
 and
@@ -157,10 +157,10 @@ there are no free inodes on the file sys
 node is being created.
 .It Bq Er ENOTDIR
 A component of the path prefix is not a directory.
+.It Bq Er EOPNOTSUPP
+The kernel has not been configured to support FIFOs.
 .It Bq Er EPERM
 The process's effective user ID is not super-user.
-.It Bq Er EOPNOTSUPP
-The kernel has not been configured to support fifo's.
 .It Bq Er EROFS
 The named file resides on a read-only file system.
 .El