CVS commit: src

2016-11-10 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Fri Nov 11 07:39:58 UTC 2016

Modified Files:
src/distrib/sets/lists/debug: mi
src/distrib/sets/lists/tests: mi
src/tests/dev/cgd: Makefile
Added Files:
src/tests/dev/cgd: t_cgd_3des.c

Log Message:
Add 3des-cbc tests with 192 bits key.


To generate a diff of this commit:
cvs rdiff -u -r1.174 -r1.175 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.697 -r1.698 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.6 -r1.7 src/tests/dev/cgd/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/dev/cgd/t_cgd_3des.c

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/debug/mi
diff -u src/distrib/sets/lists/debug/mi:1.174 src/distrib/sets/lists/debug/mi:1.175
--- src/distrib/sets/lists/debug/mi:1.174	Thu Nov 10 23:44:36 2016
+++ src/distrib/sets/lists/debug/mi	Fri Nov 11 07:39:58 2016
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.174 2016/11/10 23:44:36 alnsn Exp $
+# $NetBSD: mi,v 1.175 2016/11/11 07:39:58 alnsn Exp $
 ./etc/mtree/set.debug   comp-sys-root
 ./usr/lib	comp-sys-usr		compatdir
 ./usr/lib/i18n/libBIG5_g.a			comp-c-debuglib		debuglib,compatfile
@@ -1591,6 +1591,7 @@
 ./usr/libdata/debug/usr/tests/crypto/opencrypto/h_xcbcmac.debug		tests-crypto-debug	debug,atf,crypto,compattestfile
 ./usr/libdata/debug/usr/tests/dev/audio/h_pad.debug			tests-fs-debug		debug,atf,rump
 ./usr/libdata/debug/usr/tests/dev/cgd/h_img2cgd/h_img2cgd.debug			tests-obsolete	obsolete,compattestfile
+./usr/libdata/debug/usr/tests/dev/cgd/t_cgd_3des.debug			tests-fs-debug		atf,compattestfile,crypto,debug,rump
 ./usr/libdata/debug/usr/tests/dev/cgd/t_cgd_aes.debug			tests-fs-debug		atf,compattestfile,crypto,debug,rump
 ./usr/libdata/debug/usr/tests/dev/cgd/t_cgd_blowfish.debug		tests-fs-debug		atf,compattestfile,crypto,debug,rump
 ./usr/libdata/debug/usr/tests/dev/clock_subr/t_clock_subr.debug		tests-fs-debug		debug,atf,rump

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.697 src/distrib/sets/lists/tests/mi:1.698
--- src/distrib/sets/lists/tests/mi:1.697	Thu Nov 10 23:47:23 2016
+++ src/distrib/sets/lists/tests/mi	Fri Nov 11 07:39:58 2016
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.697 2016/11/10 23:47:23 alnsn Exp $
+# $NetBSD: mi,v 1.698 2016/11/11 07:39:58 alnsn Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -1366,6 +1366,7 @@
 ./usr/tests/dev/cgd/h_img2cgd/h_img2cgd		tests-obsolete		obsolete
 ./usr/tests/dev/cgd/paramsfile			tests-fs-tests		compattestfile,atf
 ./usr/tests/dev/cgd/t_cgd			tests-fs-tests		compattestfile,atf
+./usr/tests/dev/cgd/t_cgd_3des			tests-fs-tests		atf,compattestfile,crypto,rump
 ./usr/tests/dev/cgd/t_cgd_aes			tests-fs-tests		atf,compattestfile,crypto,rump
 ./usr/tests/dev/cgd/t_cgd_blowfish		tests-fs-tests		atf,compattestfile,crypto,rump
 ./usr/tests/dev/clock_subr			tests-fs-tests		compattestfile,atf

Index: src/tests/dev/cgd/Makefile
diff -u src/tests/dev/cgd/Makefile:1.6 src/tests/dev/cgd/Makefile:1.7
--- src/tests/dev/cgd/Makefile:1.6	Thu Nov 10 23:44:36 2016
+++ src/tests/dev/cgd/Makefile	Fri Nov 11 07:39:58 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.6 2016/11/10 23:44:36 alnsn Exp $
+#	$NetBSD: Makefile,v 1.7 2016/11/11 07:39:58 alnsn Exp $
 #
 
 .include 
@@ -10,7 +10,7 @@ FILESDIR=	${TESTSDIR}
 TESTS_SH=	t_cgd
 
 .if ${MKCRYPTO} != "no" && ${MKRUMP} != "no"
-TESTS_C=	t_cgd_aes t_cgd_blowfish
+TESTS_C=	t_cgd_3des t_cgd_aes t_cgd_blowfish
 
 WARNS=	4
 CPPFLAGS+=	-D_KERNTYPES

Added files:

Index: src/tests/dev/cgd/t_cgd_3des.c
diff -u /dev/null src/tests/dev/cgd/t_cgd_3des.c:1.1
--- /dev/null	Fri Nov 11 07:39:58 2016
+++ src/tests/dev/cgd/t_cgd_3des.c	Fri Nov 11 07:39:58 2016
@@ -0,0 +1,913 @@
+/*	$NetBSD: t_cgd_3des.c,v 1.1 2016/11/11 07:39:58 alnsn Exp $	*/
+/*-
+ * Copyright (c) 2016 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Alexander Nasonov.
+ *
+ * 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 COPYRIGHT HOLDERS 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
+ * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * 

CVS commit: src

2016-11-10 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Fri Nov 11 07:39:58 UTC 2016

Modified Files:
src/distrib/sets/lists/debug: mi
src/distrib/sets/lists/tests: mi
src/tests/dev/cgd: Makefile
Added Files:
src/tests/dev/cgd: t_cgd_3des.c

Log Message:
Add 3des-cbc tests with 192 bits key.


To generate a diff of this commit:
cvs rdiff -u -r1.174 -r1.175 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.697 -r1.698 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.6 -r1.7 src/tests/dev/cgd/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/dev/cgd/t_cgd_3des.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

2016-11-10 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Nov 11 07:31:03 UTC 2016

Modified Files:
src/sys/dev/pci: if_wmreg.h

Log Message:
The MEHE bit in the CTRL register is not bit 17 but 19.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/sys/dev/pci/if_wmreg.h

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

Modified files:

Index: src/sys/dev/pci/if_wmreg.h
diff -u src/sys/dev/pci/if_wmreg.h:1.89 src/sys/dev/pci/if_wmreg.h:1.90
--- src/sys/dev/pci/if_wmreg.h:1.89	Fri May  6 08:56:20 2016
+++ src/sys/dev/pci/if_wmreg.h	Fri Nov 11 07:31:03 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wmreg.h,v 1.89 2016/05/06 08:56:20 msaitoh Exp $	*/
+/*	$NetBSD: if_wmreg.h,v 1.90 2016/11/11 07:31:03 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -237,7 +237,7 @@ struct livengood_tcpip_ctxdesc {
 #define	CTRL_SWDPIO_SHIFT	22
 #define	CTRL_SWDPIO_MASK	0x0f
 #define	CTRL_SWDPIO(x)		(1U << (CTRL_SWDPIO_SHIFT + (x)))
-#define CTRL_MEHE	(1U << 17)	/* Memory Error Handling Enable(I217)*/
+#define CTRL_MEHE	(1U << 19)	/* Memory Error Handling Enable(I217)*/
 #define	CTRL_RST	(1U << 26)	/* device reset */
 #define	CTRL_RFCE	(1U << 27)	/* Rx flow control enable */
 #define	CTRL_TFCE	(1U << 28)	/* Tx flow control enable */



CVS commit: src/sys/dev/pci

2016-11-10 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Nov 11 07:31:03 UTC 2016

Modified Files:
src/sys/dev/pci: if_wmreg.h

Log Message:
The MEHE bit in the CTRL register is not bit 17 but 19.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/sys/dev/pci/if_wmreg.h

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



CVS commit: [netbsd-6] src/doc

2016-11-10 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Nov 11 07:08:37 UTC 2016

Modified Files:
src/doc [netbsd-6]: CHANGES-6.2

Log Message:
tickets 1413, 1415


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.265 -r1.1.2.266 src/doc/CHANGES-6.2

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

Modified files:

Index: src/doc/CHANGES-6.2
diff -u src/doc/CHANGES-6.2:1.1.2.265 src/doc/CHANGES-6.2:1.1.2.266
--- src/doc/CHANGES-6.2:1.1.2.265	Wed Oct  5 10:51:19 2016
+++ src/doc/CHANGES-6.2	Fri Nov 11 07:08:37 2016
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.2,v 1.1.2.265 2016/10/05 10:51:19 bouyer Exp $
+# $NetBSD: CHANGES-6.2,v 1.1.2.266 2016/11/11 07:08:37 snj Exp $
 
 A complete list of changes from the 6.1 release until the 6.2 release:
 
@@ -15383,3 +15383,13 @@ xsrc/xfree/xc/programs/Xserver/include/d
 		Affected versions: libXvMC <= 1.0.9
 	[mrg, ticket #1411]
 
+etc/namedb/root.cache1.21, 1.22
+
+	Update root.cache to 2016102001 (October 20, 2016).
+	[taca, ticket #1413]
+
+sys/kern/uipc_usrreq.c1.181
+
+	Fix a memory leak.
+	[maxv, ticket #1415]
+



CVS commit: [netbsd-6] src/sys/kern

2016-11-10 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Nov 11 07:08:05 UTC 2016

Modified Files:
src/sys/kern [netbsd-6]: uipc_usrreq.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1415):
sys/kern/uipc_usrreq.c: revision 1.181
Memory leak, found by Mootja. It is easily triggerable from userland.


To generate a diff of this commit:
cvs rdiff -u -r1.136.8.3 -r1.136.8.4 src/sys/kern/uipc_usrreq.c

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



CVS commit: [netbsd-6-1] src/sys/kern

2016-11-10 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Nov 11 07:07:08 UTC 2016

Modified Files:
src/sys/kern [netbsd-6-1]: uipc_usrreq.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1415):
sys/kern/uipc_usrreq.c: revision 1.181
Memory leak, found by Mootja. It is easily triggerable from userland.


To generate a diff of this commit:
cvs rdiff -u -r1.136.8.3 -r1.136.8.3.2.1 src/sys/kern/uipc_usrreq.c

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



CVS commit: [netbsd-6-1] src/sys/kern

2016-11-10 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Nov 11 07:07:08 UTC 2016

Modified Files:
src/sys/kern [netbsd-6-1]: uipc_usrreq.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1415):
sys/kern/uipc_usrreq.c: revision 1.181
Memory leak, found by Mootja. It is easily triggerable from userland.


To generate a diff of this commit:
cvs rdiff -u -r1.136.8.3 -r1.136.8.3.2.1 src/sys/kern/uipc_usrreq.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/uipc_usrreq.c
diff -u src/sys/kern/uipc_usrreq.c:1.136.8.3 src/sys/kern/uipc_usrreq.c:1.136.8.3.2.1
--- src/sys/kern/uipc_usrreq.c:1.136.8.3	Mon Feb 18 22:00:49 2013
+++ src/sys/kern/uipc_usrreq.c	Fri Nov 11 07:07:08 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_usrreq.c,v 1.136.8.3 2013/02/18 22:00:49 riz Exp $	*/
+/*	$NetBSD: uipc_usrreq.c,v 1.136.8.3.2.1 2016/11/11 07:07:08 snj Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2004, 2008, 2009 The NetBSD Foundation, Inc.
@@ -96,7 +96,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.136.8.3 2013/02/18 22:00:49 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.136.8.3.2.1 2016/11/11 07:07:08 snj Exp $");
 
 #include 
 #include 
@@ -1014,11 +1014,11 @@ unp_connect(struct socket *so, struct mb
 		goto bad2;
 	}
 	vp = nd.ni_vp;
+	pathbuf_destroy(pb);
 	if (vp->v_type != VSOCK) {
 		error = ENOTSOCK;
 		goto bad;
 	}
-	pathbuf_destroy(pb);
 	if ((error = VOP_ACCESS(vp, VWRITE, l->l_cred)) != 0)
 		goto bad;
 	/* Acquire v_interlock to protect against unp_detach(). */



CVS commit: [netbsd-6] src/doc

2016-11-10 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Nov 11 07:08:37 UTC 2016

Modified Files:
src/doc [netbsd-6]: CHANGES-6.2

Log Message:
tickets 1413, 1415


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.265 -r1.1.2.266 src/doc/CHANGES-6.2

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



CVS commit: [netbsd-6-1] src/doc

2016-11-10 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Nov 11 07:07:34 UTC 2016

Modified Files:
src/doc [netbsd-6-1]: CHANGES-6.1.6

Log Message:
1413, 1415


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.76 -r1.1.2.77 src/doc/CHANGES-6.1.6

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

Modified files:

Index: src/doc/CHANGES-6.1.6
diff -u src/doc/CHANGES-6.1.6:1.1.2.76 src/doc/CHANGES-6.1.6:1.1.2.77
--- src/doc/CHANGES-6.1.6:1.1.2.76	Wed Oct  5 10:51:27 2016
+++ src/doc/CHANGES-6.1.6	Fri Nov 11 07:07:34 2016
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.1.6,v 1.1.2.76 2016/10/05 10:51:27 bouyer Exp $
+# $NetBSD: CHANGES-6.1.6,v 1.1.2.77 2016/11/11 07:07:34 snj Exp $
 
 A complete list of changes from the NetBSD 6.1.5 release to the NetBSD 6.1.6
 release:
@@ -9057,3 +9057,13 @@ xsrc/xfree/xc/programs/Xserver/include/d
 		Affected versions: libXvMC <= 1.0.9
 	[mrg, ticket #1411]
 
+etc/namedb/root.cache1.21, 1.22
+
+	Update root.cache to 2016102001 (October 20, 2016).
+	[taca, ticket #1413]
+
+sys/kern/uipc_usrreq.c1.181
+
+	Fix a memory leak.
+	[maxv, ticket #1415]
+



CVS commit: [netbsd-6-1] src/doc

2016-11-10 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Nov 11 07:07:34 UTC 2016

Modified Files:
src/doc [netbsd-6-1]: CHANGES-6.1.6

Log Message:
1413, 1415


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.76 -r1.1.2.77 src/doc/CHANGES-6.1.6

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



CVS commit: [netbsd-6] src/sys/kern

2016-11-10 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Nov 11 07:08:05 UTC 2016

Modified Files:
src/sys/kern [netbsd-6]: uipc_usrreq.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1415):
sys/kern/uipc_usrreq.c: revision 1.181
Memory leak, found by Mootja. It is easily triggerable from userland.


To generate a diff of this commit:
cvs rdiff -u -r1.136.8.3 -r1.136.8.4 src/sys/kern/uipc_usrreq.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/uipc_usrreq.c
diff -u src/sys/kern/uipc_usrreq.c:1.136.8.3 src/sys/kern/uipc_usrreq.c:1.136.8.4
--- src/sys/kern/uipc_usrreq.c:1.136.8.3	Mon Feb 18 22:00:49 2013
+++ src/sys/kern/uipc_usrreq.c	Fri Nov 11 07:08:05 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_usrreq.c,v 1.136.8.3 2013/02/18 22:00:49 riz Exp $	*/
+/*	$NetBSD: uipc_usrreq.c,v 1.136.8.4 2016/11/11 07:08:05 snj Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2004, 2008, 2009 The NetBSD Foundation, Inc.
@@ -96,7 +96,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.136.8.3 2013/02/18 22:00:49 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.136.8.4 2016/11/11 07:08:05 snj Exp $");
 
 #include 
 #include 
@@ -1014,11 +1014,11 @@ unp_connect(struct socket *so, struct mb
 		goto bad2;
 	}
 	vp = nd.ni_vp;
+	pathbuf_destroy(pb);
 	if (vp->v_type != VSOCK) {
 		error = ENOTSOCK;
 		goto bad;
 	}
-	pathbuf_destroy(pb);
 	if ((error = VOP_ACCESS(vp, VWRITE, l->l_cred)) != 0)
 		goto bad;
 	/* Acquire v_interlock to protect against unp_detach(). */



CVS commit: [netbsd-6-0] src/doc

2016-11-10 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Nov 11 07:06:39 UTC 2016

Modified Files:
src/doc [netbsd-6-0]: CHANGES-6.0.7

Log Message:
1413, 1415


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.78 -r1.1.2.79 src/doc/CHANGES-6.0.7

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

Modified files:

Index: src/doc/CHANGES-6.0.7
diff -u src/doc/CHANGES-6.0.7:1.1.2.78 src/doc/CHANGES-6.0.7:1.1.2.79
--- src/doc/CHANGES-6.0.7:1.1.2.78	Wed Oct  5 10:51:31 2016
+++ src/doc/CHANGES-6.0.7	Fri Nov 11 07:06:39 2016
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.0.7,v 1.1.2.78 2016/10/05 10:51:31 bouyer Exp $
+# $NetBSD: CHANGES-6.0.7,v 1.1.2.79 2016/11/11 07:06:39 snj Exp $
 
 A complete list of changes from the NetBSD 6.0.6 release to the NetBSD 6.0.7
 release:
@@ -9337,3 +9337,13 @@ xsrc/xfree/xc/programs/Xserver/include/d
 		Affected versions: libXvMC <= 1.0.9
 	[mrg, ticket #1411]
 
+etc/namedb/root.cache1.21, 1.22
+
+	Update root.cache to 2016102001 (October 20, 2016).
+	[taca, ticket #1413]
+
+sys/kern/uipc_usrreq.c1.181
+
+	Fix a memory leak.
+	[maxv, ticket #1415]
+



CVS commit: [netbsd-6-0] src/doc

2016-11-10 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Nov 11 07:06:39 UTC 2016

Modified Files:
src/doc [netbsd-6-0]: CHANGES-6.0.7

Log Message:
1413, 1415


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.78 -r1.1.2.79 src/doc/CHANGES-6.0.7

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



CVS commit: [netbsd-6-0] src/sys/kern

2016-11-10 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Nov 11 07:05:47 UTC 2016

Modified Files:
src/sys/kern [netbsd-6-0]: uipc_usrreq.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1415):
sys/kern/uipc_usrreq.c: revision 1.181
Memory leak, found by Mootja. It is easily triggerable from userland.


To generate a diff of this commit:
cvs rdiff -u -r1.136.8.2 -r1.136.8.2.2.1 src/sys/kern/uipc_usrreq.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/uipc_usrreq.c
diff -u src/sys/kern/uipc_usrreq.c:1.136.8.2 src/sys/kern/uipc_usrreq.c:1.136.8.2.2.1
--- src/sys/kern/uipc_usrreq.c:1.136.8.2	Tue Oct  9 23:45:21 2012
+++ src/sys/kern/uipc_usrreq.c	Fri Nov 11 07:05:47 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_usrreq.c,v 1.136.8.2 2012/10/09 23:45:21 riz Exp $	*/
+/*	$NetBSD: uipc_usrreq.c,v 1.136.8.2.2.1 2016/11/11 07:05:47 snj Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2004, 2008, 2009 The NetBSD Foundation, Inc.
@@ -96,7 +96,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.136.8.2 2012/10/09 23:45:21 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.136.8.2.2.1 2016/11/11 07:05:47 snj Exp $");
 
 #include 
 #include 
@@ -1014,11 +1014,11 @@ unp_connect(struct socket *so, struct mb
 		goto bad2;
 	}
 	vp = nd.ni_vp;
+	pathbuf_destroy(pb);
 	if (vp->v_type != VSOCK) {
 		error = ENOTSOCK;
 		goto bad;
 	}
-	pathbuf_destroy(pb);
 	if ((error = VOP_ACCESS(vp, VWRITE, l->l_cred)) != 0)
 		goto bad;
 	/* Acquire v_interlock to protect against unp_detach(). */



CVS commit: [netbsd-6-0] src/sys/kern

2016-11-10 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Nov 11 07:05:47 UTC 2016

Modified Files:
src/sys/kern [netbsd-6-0]: uipc_usrreq.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1415):
sys/kern/uipc_usrreq.c: revision 1.181
Memory leak, found by Mootja. It is easily triggerable from userland.


To generate a diff of this commit:
cvs rdiff -u -r1.136.8.2 -r1.136.8.2.2.1 src/sys/kern/uipc_usrreq.c

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



CVS commit: [netbsd-6] src/etc/namedb

2016-11-10 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Nov 11 06:59:50 UTC 2016

Modified Files:
src/etc/namedb [netbsd-6]: root.cache

Log Message:
Pull up following revision(s) (requested by taca in ticket #1413):
etc/namedb/root.cache: revision 1.21, 1.22
Update root.cache to 2016/3/23 version, l.root-servers.net's  record
has changed.
--
Update root.cache to 2016102001 (October 20, 2016).


To generate a diff of this commit:
cvs rdiff -u -r1.16.4.6 -r1.16.4.7 src/etc/namedb/root.cache

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

Modified files:

Index: src/etc/namedb/root.cache
diff -u src/etc/namedb/root.cache:1.16.4.6 src/etc/namedb/root.cache:1.16.4.7
--- src/etc/namedb/root.cache:1.16.4.6	Sat Sep 24 13:01:42 2016
+++ src/etc/namedb/root.cache	Fri Nov 11 06:59:50 2016
@@ -1,4 +1,4 @@
-;	$NetBSD: root.cache,v 1.16.4.6 2016/09/24 13:01:42 bouyer Exp $
+;	$NetBSD: root.cache,v 1.16.4.7 2016/11/11 06:59:50 snj Exp $
 ;   This file holds the information on root name servers needed to
 ;   initialize cache of Internet domain name servers
 ;   (e.g. reference this file in the "cache  .  "
@@ -10,8 +10,8 @@
 ;   on server   FTP.INTERNIC.NET
 ;   -OR-RS.INTERNIC.NET
 ;
-;   last update:December 01, 2015
-;   related version of root zone:   2015120100
+;   last update:October 20, 2016
+;   related version of root zone:   2016102001
 ;
 ; formerly NS.INTERNIC.NET
 ;
@@ -53,6 +53,7 @@ F.ROOT-SERVERS.NET.  360  AA
 ;
 .360  NSG.ROOT-SERVERS.NET.
 G.ROOT-SERVERS.NET.  360  A 192.112.36.4
+G.ROOT-SERVERS.NET.  360    2001:500:12::d0d
 ;
 ; FORMERLY AOS.ARL.ARMY.MIL
 ;
@@ -82,7 +83,7 @@ K.ROOT-SERVERS.NET.  360  AA
 ;
 .360  NSL.ROOT-SERVERS.NET.
 L.ROOT-SERVERS.NET.  360  A 199.7.83.42
-L.ROOT-SERVERS.NET.  360    2001:500:3::42
+L.ROOT-SERVERS.NET.  360    2001:500:9f::42
 ;
 ; OPERATED BY WIDE
 ;



CVS commit: [netbsd-6] src/etc/namedb

2016-11-10 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Nov 11 06:59:50 UTC 2016

Modified Files:
src/etc/namedb [netbsd-6]: root.cache

Log Message:
Pull up following revision(s) (requested by taca in ticket #1413):
etc/namedb/root.cache: revision 1.21, 1.22
Update root.cache to 2016/3/23 version, l.root-servers.net's  record
has changed.
--
Update root.cache to 2016102001 (October 20, 2016).


To generate a diff of this commit:
cvs rdiff -u -r1.16.4.6 -r1.16.4.7 src/etc/namedb/root.cache

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



CVS commit: [netbsd-6-1] src/etc/namedb

2016-11-10 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Nov 11 06:59:20 UTC 2016

Modified Files:
src/etc/namedb [netbsd-6-1]: root.cache

Log Message:
Pull up following revision(s) (requested by taca in ticket #1413):
etc/namedb/root.cache: revision 1.21, 1.22
Update root.cache to 2016/3/23 version, l.root-servers.net's  record
has changed.
--
Update root.cache to 2016102001 (October 20, 2016).


To generate a diff of this commit:
cvs rdiff -u -r1.16.4.1.2.3 -r1.16.4.1.2.4 src/etc/namedb/root.cache

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



CVS commit: [netbsd-6-1] src/etc/namedb

2016-11-10 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Nov 11 06:59:20 UTC 2016

Modified Files:
src/etc/namedb [netbsd-6-1]: root.cache

Log Message:
Pull up following revision(s) (requested by taca in ticket #1413):
etc/namedb/root.cache: revision 1.21, 1.22
Update root.cache to 2016/3/23 version, l.root-servers.net's  record
has changed.
--
Update root.cache to 2016102001 (October 20, 2016).


To generate a diff of this commit:
cvs rdiff -u -r1.16.4.1.2.3 -r1.16.4.1.2.4 src/etc/namedb/root.cache

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

Modified files:

Index: src/etc/namedb/root.cache
diff -u src/etc/namedb/root.cache:1.16.4.1.2.3 src/etc/namedb/root.cache:1.16.4.1.2.4
--- src/etc/namedb/root.cache:1.16.4.1.2.3	Sat Sep 24 13:01:33 2016
+++ src/etc/namedb/root.cache	Fri Nov 11 06:59:20 2016
@@ -1,4 +1,4 @@
-;	$NetBSD: root.cache,v 1.16.4.1.2.3 2016/09/24 13:01:33 bouyer Exp $
+;	$NetBSD: root.cache,v 1.16.4.1.2.4 2016/11/11 06:59:20 snj Exp $
 ;   This file holds the information on root name servers needed to
 ;   initialize cache of Internet domain name servers
 ;   (e.g. reference this file in the "cache  .  "
@@ -10,8 +10,8 @@
 ;   on server   FTP.INTERNIC.NET
 ;   -OR-RS.INTERNIC.NET
 ;
-;   last update:December 01, 2015
-;   related version of root zone:   2015120100
+;   last update:October 20, 2016
+;   related version of root zone:   2016102001
 ;
 ; formerly NS.INTERNIC.NET
 ;
@@ -53,6 +53,7 @@ F.ROOT-SERVERS.NET.  360  AA
 ;
 .360  NSG.ROOT-SERVERS.NET.
 G.ROOT-SERVERS.NET.  360  A 192.112.36.4
+G.ROOT-SERVERS.NET.  360    2001:500:12::d0d
 ;
 ; FORMERLY AOS.ARL.ARMY.MIL
 ;
@@ -82,7 +83,7 @@ K.ROOT-SERVERS.NET.  360  AA
 ;
 .360  NSL.ROOT-SERVERS.NET.
 L.ROOT-SERVERS.NET.  360  A 199.7.83.42
-L.ROOT-SERVERS.NET.  360    2001:500:3::42
+L.ROOT-SERVERS.NET.  360    2001:500:9f::42
 ;
 ; OPERATED BY WIDE
 ;



CVS commit: [netbsd-6-0] src/etc/namedb

2016-11-10 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Nov 11 06:58:42 UTC 2016

Modified Files:
src/etc/namedb [netbsd-6-0]: root.cache

Log Message:
Pull up following revision(s) (requested by taca in ticket #1413):
etc/namedb/root.cache: revision 1.21, 1.22
Update root.cache to 2016/3/23 version, l.root-servers.net's  record
has changed.
--
Update root.cache to 2016102001 (October 20, 2016).


To generate a diff of this commit:
cvs rdiff -u -r1.16.10.4 -r1.16.10.5 src/etc/namedb/root.cache

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

Modified files:

Index: src/etc/namedb/root.cache
diff -u src/etc/namedb/root.cache:1.16.10.4 src/etc/namedb/root.cache:1.16.10.5
--- src/etc/namedb/root.cache:1.16.10.4	Sat Sep 24 13:01:38 2016
+++ src/etc/namedb/root.cache	Fri Nov 11 06:58:42 2016
@@ -1,4 +1,4 @@
-;	$NetBSD: root.cache,v 1.16.10.4 2016/09/24 13:01:38 bouyer Exp $
+;	$NetBSD: root.cache,v 1.16.10.5 2016/11/11 06:58:42 snj Exp $
 ;   This file holds the information on root name servers needed to
 ;   initialize cache of Internet domain name servers
 ;   (e.g. reference this file in the "cache  .  "
@@ -10,8 +10,8 @@
 ;   on server   FTP.INTERNIC.NET
 ;   -OR-RS.INTERNIC.NET
 ;
-;   last update:December 01, 2015
-;   related version of root zone:   2015120100
+;   last update:October 20, 2016
+;   related version of root zone:   2016102001
 ;
 ; formerly NS.INTERNIC.NET
 ;
@@ -53,6 +53,7 @@ F.ROOT-SERVERS.NET.  360  AA
 ;
 .360  NSG.ROOT-SERVERS.NET.
 G.ROOT-SERVERS.NET.  360  A 192.112.36.4
+G.ROOT-SERVERS.NET.  360    2001:500:12::d0d
 ;
 ; FORMERLY AOS.ARL.ARMY.MIL
 ;
@@ -82,7 +83,7 @@ K.ROOT-SERVERS.NET.  360  AA
 ;
 .360  NSL.ROOT-SERVERS.NET.
 L.ROOT-SERVERS.NET.  360  A 199.7.83.42
-L.ROOT-SERVERS.NET.  360    2001:500:3::42
+L.ROOT-SERVERS.NET.  360    2001:500:9f::42
 ;
 ; OPERATED BY WIDE
 ;



CVS commit: [netbsd-6-0] src/etc/namedb

2016-11-10 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Nov 11 06:58:42 UTC 2016

Modified Files:
src/etc/namedb [netbsd-6-0]: root.cache

Log Message:
Pull up following revision(s) (requested by taca in ticket #1413):
etc/namedb/root.cache: revision 1.21, 1.22
Update root.cache to 2016/3/23 version, l.root-servers.net's  record
has changed.
--
Update root.cache to 2016102001 (October 20, 2016).


To generate a diff of this commit:
cvs rdiff -u -r1.16.10.4 -r1.16.10.5 src/etc/namedb/root.cache

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



re: CVS commit: src/sys/sys

2016-11-10 Thread matthew green
"Christos Zoulas" writes:
> Module Name:  src
> Committed By: christos
> Date: Thu Nov 10 18:35:17 UTC 2016
> 
> Modified Files:
>   src/sys/sys: wait.h
> 
> Log Message:
> - Move WUNTRACED outside the _NETBSD_SOURCE ifdef because waitpid()
>   needs it (kre)
> - Reformat the comments

shouldn't the _NETBSD_SOURCE ifdef also check _KERNEL, like
the older versions of this did as well as the other checks
in this file.


.mrg.


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

2016-11-10 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Thu Nov 10 23:47:24 UTC 2016

Modified Files:
src/distrib/sets/lists/tests: mi

Log Message:
Add t_cgd_blowfish.


To generate a diff of this commit:
cvs rdiff -u -r1.696 -r1.697 src/distrib/sets/lists/tests/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/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.696 src/distrib/sets/lists/tests/mi:1.697
--- src/distrib/sets/lists/tests/mi:1.696	Mon Nov  7 21:09:03 2016
+++ src/distrib/sets/lists/tests/mi	Thu Nov 10 23:47:23 2016
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.696 2016/11/07 21:09:03 kamil Exp $
+# $NetBSD: mi,v 1.697 2016/11/10 23:47:23 alnsn Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -1367,6 +1367,7 @@
 ./usr/tests/dev/cgd/paramsfile			tests-fs-tests		compattestfile,atf
 ./usr/tests/dev/cgd/t_cgd			tests-fs-tests		compattestfile,atf
 ./usr/tests/dev/cgd/t_cgd_aes			tests-fs-tests		atf,compattestfile,crypto,rump
+./usr/tests/dev/cgd/t_cgd_blowfish		tests-fs-tests		atf,compattestfile,crypto,rump
 ./usr/tests/dev/clock_subr			tests-fs-tests		compattestfile,atf
 ./usr/tests/dev/clock_subr/Atffile		tests-fs-tests		compattestfile,atf
 ./usr/tests/dev/clock_subr/Kyuafile		tests-fs-tests		compattestfile,atf,kyua



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

2016-11-10 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Thu Nov 10 23:47:24 UTC 2016

Modified Files:
src/distrib/sets/lists/tests: mi

Log Message:
Add t_cgd_blowfish.


To generate a diff of this commit:
cvs rdiff -u -r1.696 -r1.697 src/distrib/sets/lists/tests/mi

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



CVS commit: src

2016-11-10 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Thu Nov 10 23:44:36 UTC 2016

Modified Files:
src/distrib/sets/lists/debug: mi
src/tests/dev/cgd: Makefile
Added Files:
src/tests/dev/cgd: t_cgd_blowfish.c

Log Message:
Add blowfish-cbc tests for 128, 256 and 448 bits keys.


To generate a diff of this commit:
cvs rdiff -u -r1.173 -r1.174 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.5 -r1.6 src/tests/dev/cgd/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/dev/cgd/t_cgd_blowfish.c

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/debug/mi
diff -u src/distrib/sets/lists/debug/mi:1.173 src/distrib/sets/lists/debug/mi:1.174
--- src/distrib/sets/lists/debug/mi:1.173	Mon Nov  7 21:09:03 2016
+++ src/distrib/sets/lists/debug/mi	Thu Nov 10 23:44:36 2016
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.173 2016/11/07 21:09:03 kamil Exp $
+# $NetBSD: mi,v 1.174 2016/11/10 23:44:36 alnsn Exp $
 ./etc/mtree/set.debug   comp-sys-root
 ./usr/lib	comp-sys-usr		compatdir
 ./usr/lib/i18n/libBIG5_g.a			comp-c-debuglib		debuglib,compatfile
@@ -1592,6 +1592,7 @@
 ./usr/libdata/debug/usr/tests/dev/audio/h_pad.debug			tests-fs-debug		debug,atf,rump
 ./usr/libdata/debug/usr/tests/dev/cgd/h_img2cgd/h_img2cgd.debug			tests-obsolete	obsolete,compattestfile
 ./usr/libdata/debug/usr/tests/dev/cgd/t_cgd_aes.debug			tests-fs-debug		atf,compattestfile,crypto,debug,rump
+./usr/libdata/debug/usr/tests/dev/cgd/t_cgd_blowfish.debug		tests-fs-debug		atf,compattestfile,crypto,debug,rump
 ./usr/libdata/debug/usr/tests/dev/clock_subr/t_clock_subr.debug		tests-fs-debug		debug,atf,rump
 ./usr/libdata/debug/usr/tests/dev/md/h_mdserv.debug	tests-fs-debug	debug,atf,rump
 ./usr/libdata/debug/usr/tests/dev/scsipi/t_cd.debug			tests-fs-debug		debug,atf,rump

Index: src/tests/dev/cgd/Makefile
diff -u src/tests/dev/cgd/Makefile:1.5 src/tests/dev/cgd/Makefile:1.6
--- src/tests/dev/cgd/Makefile:1.5	Mon Nov  7 16:33:37 2016
+++ src/tests/dev/cgd/Makefile	Thu Nov 10 23:44:36 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.5 2016/11/07 16:33:37 scole Exp $
+#	$NetBSD: Makefile,v 1.6 2016/11/10 23:44:36 alnsn Exp $
 #
 
 .include 
@@ -9,8 +9,8 @@ FILESDIR=	${TESTSDIR}
 
 TESTS_SH=	t_cgd
 
-.if ${MKCRYPTO} == "yes" && ${MKRUMP} == "yes"
-TESTS_C=	t_cgd_aes
+.if ${MKCRYPTO} != "no" && ${MKRUMP} != "no"
+TESTS_C=	t_cgd_aes t_cgd_blowfish
 
 WARNS=	4
 CPPFLAGS+=	-D_KERNTYPES

Added files:

Index: src/tests/dev/cgd/t_cgd_blowfish.c
diff -u /dev/null src/tests/dev/cgd/t_cgd_blowfish.c:1.1
--- /dev/null	Thu Nov 10 23:44:36 2016
+++ src/tests/dev/cgd/t_cgd_blowfish.c	Thu Nov 10 23:44:36 2016
@@ -0,0 +1,2341 @@
+/*	$NetBSD: t_cgd_blowfish.c,v 1.1 2016/11/10 23:44:36 alnsn Exp $	*/
+/*-
+ * Copyright (c) 2016 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Alexander Nasonov.
+ *
+ * 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 COPYRIGHT HOLDERS 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
+ * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+
+#include "../../h_macros.h"
+
+#define SECSIZE 512
+
+struct testvec {
+	unsigned int blkno;
+	const uint8_t *ptxt;	/* PlainText  */
+	const uint8_t *ctxt;	/* CipherText */
+};
+
+/*
+ * 128 bits Blowfish key, NUL terminated.
+ */
+static const char bf_cbc_128_key[17] = {
+	0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
+	0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, /* 89ABCDEF */
+	0
+};
+
+/*
+ * 256 bits Blowfish key, NUL terminated.
+ */
+static const char 

CVS commit: src

2016-11-10 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Thu Nov 10 23:44:36 UTC 2016

Modified Files:
src/distrib/sets/lists/debug: mi
src/tests/dev/cgd: Makefile
Added Files:
src/tests/dev/cgd: t_cgd_blowfish.c

Log Message:
Add blowfish-cbc tests for 128, 256 and 448 bits keys.


To generate a diff of this commit:
cvs rdiff -u -r1.173 -r1.174 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.5 -r1.6 src/tests/dev/cgd/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/dev/cgd/t_cgd_blowfish.c

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



CVS commit: src/usr.bin/make

2016-11-10 Thread Simon J. Gerraty
Module Name:src
Committed By:   sjg
Date:   Thu Nov 10 23:41:58 UTC 2016

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

Log Message:
Report node name rather than (null) when modified before src


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 src/usr.bin/make/make.c

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



CVS commit: src/usr.bin/make

2016-11-10 Thread Simon J. Gerraty
Module Name:src
Committed By:   sjg
Date:   Thu Nov 10 23:41:58 UTC 2016

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

Log Message:
Report node name rather than (null) when modified before src


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 src/usr.bin/make/make.c

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

Modified files:

Index: src/usr.bin/make/make.c
diff -u src/usr.bin/make/make.c:1.95 src/usr.bin/make/make.c:1.96
--- src/usr.bin/make/make.c:1.95	Thu Feb 18 18:29:14 2016
+++ src/usr.bin/make/make.c	Thu Nov 10 23:41:58 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.c,v 1.95 2016/02/18 18:29:14 christos Exp $	*/
+/*	$NetBSD: make.c,v 1.96 2016/11/10 23:41:58 sjg Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: make.c,v 1.95 2016/02/18 18:29:14 christos Exp $";
+static char rcsid[] = "$NetBSD: make.c,v 1.96 2016/11/10 23:41:58 sjg Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)make.c	8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: make.c,v 1.95 2016/02/18 18:29:14 christos Exp $");
+__RCSID("$NetBSD: make.c,v 1.96 2016/11/10 23:41:58 sjg Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -308,7 +308,7 @@ Make_OODate(GNode *gn)
 	if (DEBUG(MAKE)) {
 	if (gn->cmgn != NULL && gn->mtime < gn->cmgn->mtime) {
 		fprintf(debug_file, "modified before source %s...",
-		gn->cmgn->path);
+		gn->cmgn->path ? gn->cmgn->path : gn->cmgn->name);
 	} else if (gn->mtime == 0) {
 		fprintf(debug_file, "non-existent and no sources...");
 	} else {



CVS commit: src/sbin/mount

2016-11-10 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Thu Nov 10 22:28:00 UTC 2016

Modified Files:
src/sbin/mount: mount.8

Log Message:
stress more that discard is experimental, and explain why; also note that
it's not compatible with log


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/sbin/mount/mount.8

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

Modified files:

Index: src/sbin/mount/mount.8
diff -u src/sbin/mount/mount.8:1.81 src/sbin/mount/mount.8:1.82
--- src/sbin/mount/mount.8:1.81	Mon Sep 12 00:25:23 2016
+++ src/sbin/mount/mount.8	Thu Nov 10 22:28:00 2016
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mount.8,v 1.81 2016/09/12 00:25:23 sevan Exp $
+.\"	$NetBSD: mount.8,v 1.82 2016/11/10 22:28:00 jdolecek Exp $
 .\"
 .\" Copyright (c) 1980, 1989, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" @(#)mount.8	8.8 (Berkeley) 6/16/94
 .\"
-.Dd September 12, 2016
+.Dd November 10, 2016
 .Dt MOUNT 8
 .Os
 .Sh NAME
@@ -196,7 +196,12 @@ Clear
 mode.
 .It Cm discard
 Use DISCARD/TRIM commands if disk and driver support it.
-EXPERIMENTAL!
+.Pp
+.Em EXPERIMENTAL
+- negatively influences filesystem performance,
+causes free block map inconsistency on unclean shutdown,
+and is incompatible with
+.Cm log .
 .It Cm extattr
 Enable extended attributes, if the filesystem supports them and
 does not enable them by default.



CVS commit: src/sbin/mount

2016-11-10 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Thu Nov 10 22:28:00 UTC 2016

Modified Files:
src/sbin/mount: mount.8

Log Message:
stress more that discard is experimental, and explain why; also note that
it's not compatible with log


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/sbin/mount/mount.8

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



CVS commit: src/sys/ufs/ffs

2016-11-10 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Thu Nov 10 22:19:23 UTC 2016

Modified Files:
src/sys/ufs/ffs: ffs_wapbl.c

Log Message:
disable discard when log is enabled to preserve log consistency promise

PR kern/50725


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/ufs/ffs/ffs_wapbl.c

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



CVS commit: src/sys/ufs/ffs

2016-11-10 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Thu Nov 10 22:19:23 UTC 2016

Modified Files:
src/sys/ufs/ffs: ffs_wapbl.c

Log Message:
disable discard when log is enabled to preserve log consistency promise

PR kern/50725


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/ufs/ffs/ffs_wapbl.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/ufs/ffs/ffs_wapbl.c
diff -u src/sys/ufs/ffs/ffs_wapbl.c:1.36 src/sys/ufs/ffs/ffs_wapbl.c:1.37
--- src/sys/ufs/ffs/ffs_wapbl.c:1.36	Thu Nov 10 20:56:32 2016
+++ src/sys/ufs/ffs/ffs_wapbl.c	Thu Nov 10 22:19:23 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_wapbl.c,v 1.36 2016/11/10 20:56:32 jdolecek Exp $	*/
+/*	$NetBSD: ffs_wapbl.c,v 1.37 2016/11/10 22:19:23 jdolecek Exp $	*/
 
 /*-
  * Copyright (c) 2003,2006,2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ffs_wapbl.c,v 1.36 2016/11/10 20:56:32 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_wapbl.c,v 1.37 2016/11/10 22:19:23 jdolecek Exp $");
 
 #define WAPBL_INTERNAL
 
@@ -371,6 +371,23 @@ ffs_wapbl_start(struct mount *mp)
 if (error)
 	goto out;
 			}
+
+			/*
+			 * XXX discard interferes with block deallocation
+			 * registration and hence log consistency
+			 */
+			if (mp->mnt_flag & MNT_DISCARD) {
+CLR(mp->mnt_flag, MNT_DISCARD);
+printf("%s: %s: disabling discard to preserve log consistency\n", __func__,
+fs->fs_fsmnt);
+
+if (ump->um_discarddata != NULL) {
+			ffs_discard_finish(ump->um_discarddata,
+	0);
+			ump->um_discarddata = NULL;
+}
+			}
+
 		} else if (fs->fs_flags & FS_DOWAPBL) {
 			fs->fs_fmod = 1;
 			fs->fs_flags &= ~FS_DOWAPBL;



CVS commit: src/doc/roadmaps

2016-11-10 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Thu Nov 10 21:28:15 UTC 2016

Modified Files:
src/doc/roadmaps: storage

Log Message:
update the wapbl entry - kern/47146 and kern/49175 are fixed


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/doc/roadmaps/storage

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

Modified files:

Index: src/doc/roadmaps/storage
diff -u src/doc/roadmaps/storage:1.19 src/doc/roadmaps/storage:1.20
--- src/doc/roadmaps/storage:1.19	Fri Oct 28 20:30:37 2016
+++ src/doc/roadmaps/storage	Thu Nov 10 21:28:15 2016
@@ -1,4 +1,4 @@
-$NetBSD: storage,v 1.19 2016/10/28 20:30:37 jdolecek Exp $
+$NetBSD: storage,v 1.20 2016/11/10 21:28:15 jdolecek Exp $
 
 NetBSD Storage Roadmap
 ==
@@ -92,9 +92,8 @@ best option at this point is:
 + Fixing WAPBL (e.g. to flush newly allocated/newly written blocks to
 disk early) has been examined by several people who know the code base
 and judged difficult. Also, some other problems have come to light
-more recently; e.g. PR 50725, PR 47146, and a problem where truncating
-large sparse files takes ~forever in PR 49175. Also see PR 45676. Still,
-it might be the best way forward.
+more recently; e.g. PR 50725, and 45676. Still, it might be the best
+way forward.
 
 + There is another journaling FFS; the Harvard one done by Margo
 Seltzer's group some years back. We have a copy of this, but as it was



CVS commit: src/doc/roadmaps

2016-11-10 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Thu Nov 10 21:28:15 UTC 2016

Modified Files:
src/doc/roadmaps: storage

Log Message:
update the wapbl entry - kern/47146 and kern/49175 are fixed


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/doc/roadmaps/storage

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



CVS commit: src/sys

2016-11-10 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Thu Nov 10 20:56:32 UTC 2016

Modified Files:
src/sys/kern: vfs_wapbl.c
src/sys/sys: wapbl.h
src/sys/ufs/ffs: ffs_inode.c ffs_wapbl.c
src/sys/ufs/ufs: ufs_wapbl.h

Log Message:
during truncate with wapbl, register deallocation for upper indirect block
before recursing into lower blocks, to make sure that it will be removed after
all its referenced blocks are removed

fixes 'ffs_blkfree_common: freeing free block' panic triggered by
ufs_truncate_retry() when just the upper indirect block registration failed,
code tried to free the lower blocks again after wapbl flush

problem found by hannken@, thank you


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/sys/kern/vfs_wapbl.c
cvs rdiff -u -r1.19 -r1.20 src/sys/sys/wapbl.h
cvs rdiff -u -r1.121 -r1.122 src/sys/ufs/ffs/ffs_inode.c
cvs rdiff -u -r1.35 -r1.36 src/sys/ufs/ffs/ffs_wapbl.c
cvs rdiff -u -r1.12 -r1.13 src/sys/ufs/ufs/ufs_wapbl.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/vfs_wapbl.c
diff -u src/sys/kern/vfs_wapbl.c:1.85 src/sys/kern/vfs_wapbl.c:1.86
--- src/sys/kern/vfs_wapbl.c:1.85	Fri Oct 28 20:38:12 2016
+++ src/sys/kern/vfs_wapbl.c	Thu Nov 10 20:56:32 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_wapbl.c,v 1.85 2016/10/28 20:38:12 jdolecek Exp $	*/
+/*	$NetBSD: vfs_wapbl.c,v 1.86 2016/11/10 20:56:32 jdolecek Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2008, 2009 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #define WAPBL_INTERNAL
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_wapbl.c,v 1.85 2016/10/28 20:38:12 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_wapbl.c,v 1.86 2016/11/10 20:56:32 jdolecek Exp $");
 
 #include 
 #include 
@@ -206,7 +206,7 @@ struct wapbl {
 	int wl_brperjblock;	/* r Block records per journal block */
 #endif
 
-	SIMPLEQ_HEAD(, wapbl_dealloc) wl_dealloclist;	/* lm:	list head */
+	TAILQ_HEAD(, wapbl_dealloc) wl_dealloclist;	/* lm:	list head */
 	int wl_dealloccnt;/* lm:	total count */
 	int wl_dealloclim;/* r:	max count */
 
@@ -267,6 +267,9 @@ static struct wapbl_ino *wapbl_inodetrk_
 static size_t wapbl_transaction_len(struct wapbl *wl);
 static inline size_t wapbl_transaction_inodes_len(struct wapbl *wl);
 
+static void wapbl_deallocation_free(struct wapbl *, struct wapbl_dealloc *,
+	bool);
+
 #if 0
 int wapbl_replay_verify(struct wapbl_replay *, struct vnode *);
 #endif
@@ -512,7 +515,7 @@ wapbl_start(struct wapbl ** wlp, struct 
 
 	/* XXX tie this into resource estimation */
 	wl->wl_dealloclim = wl->wl_bufbytes_max / mp->mnt_stat.f_bsize / 2;
-	SIMPLEQ_INIT(>wl_dealloclist);
+	TAILQ_INIT(>wl_dealloclist);
 	
 	wl->wl_buffer = wapbl_alloc(MAXPHYS);
 	wl->wl_buffer_used = 0;
@@ -586,7 +589,7 @@ wapbl_discard(struct wapbl *wl)
 	 * if we want to call flush from inside a transaction
 	 */
 	rw_enter(>wl_rwlock, RW_WRITER);
-	wl->wl_flush(wl->wl_mount, SIMPLEQ_FIRST(>wl_dealloclist));
+	wl->wl_flush(wl->wl_mount, TAILQ_FIRST(>wl_dealloclist));
 
 #ifdef WAPBL_DEBUG_PRINT
 	{
@@ -688,11 +691,8 @@ wapbl_discard(struct wapbl *wl)
 	}
 
 	/* Discard list of deallocs */
-	while ((wd = SIMPLEQ_FIRST(>wl_dealloclist)) != NULL) {
-		SIMPLEQ_REMOVE_HEAD(>wl_dealloclist, wd_entries);
-		pool_put(_dealloc_pool, wd);
-		wl->wl_dealloccnt--;
-	}
+	while ((wd = TAILQ_FIRST(>wl_dealloclist)) != NULL)
+		wapbl_deallocation_free(wl, wd, true);
 
 	/* XXX should we clear wl_reserved_bytes? */
 
@@ -702,7 +702,7 @@ wapbl_discard(struct wapbl *wl)
 	KASSERT(LIST_EMPTY(>wl_bufs));
 	KASSERT(SIMPLEQ_EMPTY(>wl_entries));
 	KASSERT(wl->wl_inohashcnt == 0);
-	KASSERT(SIMPLEQ_EMPTY(>wl_dealloclist));
+	KASSERT(TAILQ_EMPTY(>wl_dealloclist));
 	KASSERT(wl->wl_dealloccnt == 0);
 
 	rw_exit(>wl_rwlock);
@@ -738,7 +738,7 @@ wapbl_stop(struct wapbl *wl, int force)
 	KASSERT(wl->wl_dealloccnt == 0);
 	KASSERT(SIMPLEQ_EMPTY(>wl_entries));
 	KASSERT(wl->wl_inohashcnt == 0);
-	KASSERT(SIMPLEQ_EMPTY(>wl_dealloclist));
+	KASSERT(TAILQ_EMPTY(>wl_dealloclist));
 	KASSERT(wl->wl_dealloccnt == 0);
 
 	wapbl_free(wl->wl_wc_scratch, wl->wl_wc_header->wc_len);
@@ -1561,7 +1561,7 @@ wapbl_flush(struct wapbl *wl, int waitfo
 	 * if we want to call flush from inside a transaction
 	 */
 	rw_enter(>wl_rwlock, RW_WRITER);
-	wl->wl_flush(wl->wl_mount, SIMPLEQ_FIRST(>wl_dealloclist));
+	wl->wl_flush(wl->wl_mount, TAILQ_FIRST(>wl_dealloclist));
 
 	/*
 	 * Now that we are exclusively locked and the file system has
@@ -1739,7 +1739,7 @@ wapbl_flush(struct wapbl *wl, int waitfo
  out:
 	if (error) {
 		wl->wl_flush_abort(wl->wl_mount,
-		SIMPLEQ_FIRST(>wl_dealloclist));
+		TAILQ_FIRST(>wl_dealloclist));
 	}
 
 #ifdef WAPBL_DEBUG_PRINT
@@ -1878,7 +1878,7 @@ wapbl_print(struct wapbl *wl,
 		{
 			struct wapbl_dealloc *wd;
 			cnt = 0;
-			SIMPLEQ_FOREACH(wd, >wl_dealloclist, wd_entries) {
+			TAILQ_FOREACH(wd, >wl_dealloclist, wd_entries) {
 (*pr)(" 

CVS commit: src/sys

2016-11-10 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Thu Nov 10 20:56:32 UTC 2016

Modified Files:
src/sys/kern: vfs_wapbl.c
src/sys/sys: wapbl.h
src/sys/ufs/ffs: ffs_inode.c ffs_wapbl.c
src/sys/ufs/ufs: ufs_wapbl.h

Log Message:
during truncate with wapbl, register deallocation for upper indirect block
before recursing into lower blocks, to make sure that it will be removed after
all its referenced blocks are removed

fixes 'ffs_blkfree_common: freeing free block' panic triggered by
ufs_truncate_retry() when just the upper indirect block registration failed,
code tried to free the lower blocks again after wapbl flush

problem found by hannken@, thank you


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/sys/kern/vfs_wapbl.c
cvs rdiff -u -r1.19 -r1.20 src/sys/sys/wapbl.h
cvs rdiff -u -r1.121 -r1.122 src/sys/ufs/ffs/ffs_inode.c
cvs rdiff -u -r1.35 -r1.36 src/sys/ufs/ffs/ffs_wapbl.c
cvs rdiff -u -r1.12 -r1.13 src/sys/ufs/ufs/ufs_wapbl.h

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



CVS commit: src/sys/ufs/ffs

2016-11-10 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Thu Nov 10 19:10:05 UTC 2016

Modified Files:
src/sys/ufs/ffs: ffs_inode.c

Log Message:
ffs_indirtrunc(): for !wapbl, restore rev 1.117 behavior of writing the zeroed
(indirect) block before freeing the referenced blocks; it's necessary for
fsck to recover the filesystem, if system goes down during truncate

patch courtesy of hannken@ with only sligh tweaks


To generate a diff of this commit:
cvs rdiff -u -r1.120 -r1.121 src/sys/ufs/ffs/ffs_inode.c

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



CVS commit: src/sys/ufs/ffs

2016-11-10 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Thu Nov 10 19:10:05 UTC 2016

Modified Files:
src/sys/ufs/ffs: ffs_inode.c

Log Message:
ffs_indirtrunc(): for !wapbl, restore rev 1.117 behavior of writing the zeroed
(indirect) block before freeing the referenced blocks; it's necessary for
fsck to recover the filesystem, if system goes down during truncate

patch courtesy of hannken@ with only sligh tweaks


To generate a diff of this commit:
cvs rdiff -u -r1.120 -r1.121 src/sys/ufs/ffs/ffs_inode.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/ufs/ffs/ffs_inode.c
diff -u src/sys/ufs/ffs/ffs_inode.c:1.120 src/sys/ufs/ffs/ffs_inode.c:1.121
--- src/sys/ufs/ffs/ffs_inode.c:1.120	Mon Nov  7 21:14:23 2016
+++ src/sys/ufs/ffs/ffs_inode.c	Thu Nov 10 19:10:05 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_inode.c,v 1.120 2016/11/07 21:14:23 jdolecek Exp $	*/
+/*	$NetBSD: ffs_inode.c,v 1.121 2016/11/10 19:10:05 jdolecek Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ffs_inode.c,v 1.120 2016/11/07 21:14:23 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_inode.c,v 1.121 2016/11/10 19:10:05 jdolecek Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -533,6 +533,8 @@ out:
 	 * blocks were deallocated creating a hole, but that is okay.
 	 */
 	if (error == EAGAIN) {
+		if (!allerror)
+			allerror = error;
 		length = osize;
 		uvm_vnp_setsize(ovp, length);
 	}
@@ -573,10 +575,12 @@ ffs_indirtrunc(struct inode *ip, daddr_t
 	int64_t *bap2 = NULL;
 	struct vnode *vp;
 	daddr_t nb, nlbn, last;
+	char *copy = NULL;
 	int64_t factor;
 	int64_t nblocks;
-	int error = 0;
+	int error = 0, allerror = 0;
 	const int needswap = UFS_FSNEEDSWAP(fs);
+	const int wapbl = (ip->i_ump->um_mountp->mnt_wapbl != NULL);
 
 #define RBAP(ip, i) (((ip)->i_ump->um_fstype == UFS1) ? \
 	ufs_rw32(bap1[i], needswap) : ufs_rw64(bap2[i], needswap))
@@ -602,7 +606,7 @@ ffs_indirtrunc(struct inode *ip, daddr_t
 	nblocks = btodb(fs->fs_bsize);
 	/*
 	 * Get buffer of block pointers, zero those entries corresponding
-	 * to blocks to be free'd, and update on disk copy.  Since
+	 * to blocks to be free'd, and update on disk copy first.  Since
 	 * double(triple) indirect before single(double) indirect, calls
 	 * to bmap on these blocks will fail.  However, we already have
 	 * the on disk address, so we have to set the b_blkno field
@@ -635,13 +639,35 @@ ffs_indirtrunc(struct inode *ip, daddr_t
 		return error;
 	}
 
-	if (ip->i_ump->um_fstype == UFS1)
-		bap1 = (int32_t *)bp->b_data;
-	else
-		bap2 = (int64_t *)bp->b_data;
+	/*
+	 * Clear reference to blocks to be removed on disk, before actually
+	 * reclaiming them, so that fsck is more likely to be able to recover
+	 * the filesystem if system goes down during the truncate process.
+	 * This assumes the truncate process would not fail, contrary
+	 * to the wapbl case.
+	 */
+	if (lastbn >= 0 && !wapbl) {
+		copy = kmem_alloc(fs->fs_bsize, KM_SLEEP);
+		memcpy((void *)copy, bp->b_data, (u_int)fs->fs_bsize);
+		for (i = last + 1; i < FFS_NINDIR(fs); i++)
+			BAP_ASSIGN(ip, i, 0);
+		error = bwrite(bp);
+		if (error)
+			allerror = error;
+
+		if (ip->i_ump->um_fstype == UFS1)
+			bap1 = (int32_t *)copy;
+		else
+			bap2 = (int64_t *)copy;
+	} else {
+		if (ip->i_ump->um_fstype == UFS1)
+			bap1 = (int32_t *)bp->b_data;
+		else
+			bap2 = (int64_t *)bp->b_data;
+	}
 
 	/*
-	 * Recursively free totally unused blocks, starting from first.
+	 * Recursively free totally unused blocks.
 	 */
 	for (i = FFS_NINDIR(fs) - 1, nlbn = lbn + 1 - i * factor; i > last;
 	i--, nlbn += factor) {
@@ -686,15 +712,22 @@ ffs_indirtrunc(struct inode *ip, daddr_t
 	}
 
 out:
-	if (lastbn < 0 && error == 0) {
+ 	if (error && !allerror)
+ 		allerror = error;
+
+ 	if (copy != NULL) {
+ 		kmem_free(copy, fs->fs_bsize);
+ 	} else if (lastbn < 0 && error == 0) {
 		/* all freed, release without writing back */
 		brelse(bp, BC_INVAL);
-	} else {
-		/* only partially freed, write the updated block */
-		(void) bwrite(bp);
+	} else if (wapbl) {
+ 		/* only partially freed, write the updated block */
+ 		error = bwrite(bp);
+ 		if (!allerror)
+ 			allerror = error;
 	}
 
-	return (error);
+	return (allerror);
 }
 
 void



CVS commit: src/sys/sys

2016-11-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov 10 18:35:17 UTC 2016

Modified Files:
src/sys/sys: wait.h

Log Message:
- Move WUNTRACED outside the _NETBSD_SOURCE ifdef because waitpid()
  needs it (kre)
- Reformat the comments


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/sys/wait.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/sys/wait.h
diff -u src/sys/sys/wait.h:1.34 src/sys/sys/wait.h:1.35
--- src/sys/sys/wait.h:1.34	Thu Nov 10 12:32:50 2016
+++ src/sys/sys/wait.h	Thu Nov 10 13:35:17 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: wait.h,v 1.34 2016/11/10 17:32:50 christos Exp $	*/
+/*	$NetBSD: wait.h,v 1.35 2016/11/10 18:35:17 christos Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993, 1994
@@ -75,27 +75,39 @@
 #endif
 
 /*
- * Option bits for the third argument of wait4/waitpid/waitid/wait6.
- * WNOHANG causes the wait to not hang if there are no stopped or
- * terminated processes, rather returning an error indication in this case
- * (pid==0). WSTOPPED indicates that the caller should receive status about
- * untraced children which stop due to signals. If children are stopped and
- * a wait without this option is done, it is as though they were still running,
- * nothing about them is returned. WCONTINUED returns information for children
- * that were continued from job control. WEXITED is the default for
- * wait/wait3/wait4/waitpid (to report children that have exited), but needs
- * to be explicitly specified for waitid/wait6. WNOWAIT returns information
- * about the children without reaping them (changing their status to have
- * been already waited for.
+ * POSIX option bits for the "options" argument of wait{3,4,6} wait{,p}id:
+ *
+ * WNOHANG
+ *	Causes the wait to not hang if there are no stopped or terminated
+ *	processes, rather returning an error indication in this case (pid==0).
+ *
+ * WSTOPPED/WUNTRACED
+ *	Indicates that the caller should receive status about untraced
+ *	children which stop due to signals. If children are stopped
+ *	and a wait without this option is done, it is as though they
+ *	were still running, nothing about them is returned.
+ *
+ * WCONTINUED
+ *	Returns information for children that were continued from job
+ *	control.
+ *
+ * WEXITED
+ *	Is the default for wait/wait3/wait4/waitpid (to report children
+ *	that have exited), but needs to be explicitly specified for
+ *	waitid/wait6.
+ *
+ * WNOWAIT
+ *	Returns information about the children without reaping them
+ *	(changing their status to have been already waited for).
  */
 #define	WNOHANG		0x0001	/* don't hang in wait */
 #define	WSTOPPED	0x0002	/* include stopped/untraceed children */
+#define	WUNTRACED	WSTOPPED	/* the original name for WSTOPPED */
 #define	WCONTINUED	0x0010	/* include continued processes */
 #define	WEXITED		0x0020	/* Wait for exited processes. */
 #define	WNOWAIT		0x0001	/* Don't mark child 'P_WAITED' */
 
 #if defined(_NETBSD_SOURCE)
-#define	WUNTRACED	WSTOPPED	/* BSD compatibility */
 #define	WALTSIG		0x0004	/* wait for processes that exit
 	   with an alternate signal (i.e.
 	   not SIGCHLD) */



CVS commit: src/sys/sys

2016-11-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov 10 18:35:17 UTC 2016

Modified Files:
src/sys/sys: wait.h

Log Message:
- Move WUNTRACED outside the _NETBSD_SOURCE ifdef because waitpid()
  needs it (kre)
- Reformat the comments


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/sys/wait.h

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



CVS commit: src/tests/kernel

2016-11-10 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Nov 10 18:33:52 UTC 2016

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

Log Message:
Add new test attach2 in t_ptrace_wait{4,6,id,pid}

This test asserts that any tracer sees process termination before its
parent.

This test is not applicable for wait(2) and wait(3) as these interfaces
cannot get specified process id argument (PID).

Sponsored by .


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/kernel/t_ptrace_wait.c

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

Modified files:

Index: src/tests/kernel/t_ptrace_wait.c
diff -u src/tests/kernel/t_ptrace_wait.c:1.1 src/tests/kernel/t_ptrace_wait.c:1.2
--- src/tests/kernel/t_ptrace_wait.c:1.1	Mon Nov  7 21:09:03 2016
+++ src/tests/kernel/t_ptrace_wait.c	Thu Nov 10 18:33:52 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.c,v 1.1 2016/11/07 21:09:03 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_wait.c,v 1.2 2016/11/10 18:33:52 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.1 2016/11/07 21:09:03 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.2 2016/11/10 18:33:52 kamil Exp $");
 
 #include 
 #include 
@@ -671,6 +671,143 @@ ATF_TC_BODY(attach1, tc)
 }
 #endif
 
+#if defined(TWAIT_HAVE_PID)
+ATF_TC(attach2);
+ATF_TC_HEAD(attach2, tc)
+{
+	atf_tc_set_md_var(tc, "descr",
+	"Assert that any tracer sees process termination before its "
+	"parent");
+}
+
+ATF_TC_BODY(attach2, tc)
+{
+	int fds_totracee[2], fds_totracer[2], fds_fromtracer[2];
+	int rv;
+	const int exitval_tracee = 5;
+	const int exitval_tracer1 = 10, exitval_tracer2 = 20;
+	pid_t tracee, tracer, wpid;
+	uint8_t msg = 0xde; /* dummy message for IPC based on pipe(2) */
+#if defined(TWAIT_HAVE_STATUS)
+	int status;
+#endif
+
+	printf("Spawn tracee\n");
+	ATF_REQUIRE(pipe(fds_totracee) == 0);
+	tracee = atf_utils_fork();
+	if (tracee == 0) {
+		FORKEE_ASSERT(close(fds_totracee[1]) == 0);
+
+		/* Wait for message from the parent */
+		rv = read(fds_totracee[0], , sizeof(msg));
+		FORKEE_ASSERT(rv == sizeof(msg));
+
+		_exit(exitval_tracee);
+	}
+	ATF_REQUIRE(close(fds_totracee[0]) == 0);
+
+	printf("Spawn debugger\n");
+	ATF_REQUIRE(pipe(fds_totracer) == 0);
+	ATF_REQUIRE(pipe(fds_fromtracer) == 0);
+	tracer = atf_utils_fork();
+	if (tracer == 0) {
+		/* No IPC to communicate with the child */
+		FORKEE_ASSERT(close(fds_totracee[1]) == 0);
+
+		FORKEE_ASSERT(close(fds_totracer[1]) == 0);
+		FORKEE_ASSERT(close(fds_fromtracer[0]) == 0);
+
+		/* Fork again and drop parent to reattach to PID 1 */
+		tracer = atf_utils_fork();
+		if (tracer != 0)
+			_exit(exitval_tracer1);
+
+		printf("Before calling PT_ATTACH from tracee %d\n", getpid());
+		FORKEE_ASSERT(ptrace(PT_ATTACH, tracee, NULL, 0) != -1);
+
+		/* Wait for tracee and assert that it was stopped w/ SIGSTOP */
+		FORKEE_REQUIRE_SUCCESS(
+		wpid = TWAIT_GENERIC(tracee, , 0), tracee);
+
+		forkee_status_stopped(status, SIGSTOP);
+
+		/* Resume tracee with PT_CONTINUE */
+		FORKEE_ASSERT(ptrace(PT_CONTINUE, tracee, (void *)1, 0) != -1);
+
+		/* Inform parent that tracer has attached to tracee */
+		rv = write(fds_fromtracer[1], , sizeof(msg));
+		FORKEE_ASSERT(rv == sizeof(msg));
+
+		/* Wait for parent */
+		rv = read(fds_totracer[0], , sizeof(msg));
+		FORKEE_ASSERT(rv == sizeof(msg));
+
+		/* Wait for tracee and assert that it exited */
+		FORKEE_REQUIRE_SUCCESS(
+		wpid = TWAIT_GENERIC(tracee, , 0), tracee);
+
+		forkee_status_exited(status, exitval_tracee);
+
+		printf("Before exiting of the tracer process\n");
+		_exit(exitval_tracer2);
+	}
+	ATF_REQUIRE(close(fds_totracer[0]) == 0);
+	ATF_REQUIRE(close(fds_fromtracer[1]) == 0);
+
+	printf("Wait for the tracer process (direct child) to exit calling "
+	"%s()\n", TWAIT_FNAME);
+	TWAIT_REQUIRE_SUCCESS(
+	wpid = TWAIT_GENERIC(tracer, , 0), tracer);
+
+	validate_status_exited(status, exitval_tracer1);
+
+	printf("Wait for the non-exited tracee process with %s()\n",
+	TWAIT_FNAME);
+	TWAIT_REQUIRE_SUCCESS(
+	wpid = TWAIT_GENERIC(tracee, NULL, WNOHANG), 0);
+
+	printf("Wait for the tracer to attach to the tracee\n");
+	rv = read(fds_fromtracer[0], , sizeof(msg));
+	ATF_REQUIRE(rv == sizeof(msg));
+
+	printf("Resume the tracee and let it exit\n");
+	rv = write(fds_totracee[1], , sizeof(msg));
+	ATF_REQUIRE(rv == sizeof(msg));
+
+	printf("fds_totracee is no longer needed - close it\n");
+	ATF_REQUIRE(close(fds_totracee[1]) == 0);
+
+	printf("Detect that tracee is zombie\n");
+	await_zombie(tracee);
+
+	printf("Assert that there is no status about tracee - "
+	"Tracer must detect zombie first - calling %s()\n", TWAIT_FNAME);
+	TWAIT_REQUIRE_SUCCESS(
+	wpid = TWAIT_GENERIC(tracee, , WNOHANG), 0);
+
+	printf("Resume the tracer and let it detect exited tracee\n");
+	rv = write(fds_totracer[1], , sizeof(msg));
+	

CVS commit: src/tests/kernel

2016-11-10 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Nov 10 18:33:52 UTC 2016

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

Log Message:
Add new test attach2 in t_ptrace_wait{4,6,id,pid}

This test asserts that any tracer sees process termination before its
parent.

This test is not applicable for wait(2) and wait(3) as these interfaces
cannot get specified process id argument (PID).

Sponsored by .


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/kernel/t_ptrace_wait.c

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



CVS commit: src/sys/sys

2016-11-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov 10 17:32:50 UTC 2016

Modified Files:
src/sys/sys: wait.h

Log Message:
Reflect current reality about the wait options and standards.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/sys/wait.h

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



CVS commit: src/sys/sys

2016-11-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov 10 17:32:50 UTC 2016

Modified Files:
src/sys/sys: wait.h

Log Message:
Reflect current reality about the wait options and standards.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/sys/wait.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/sys/wait.h
diff -u src/sys/sys/wait.h:1.33 src/sys/sys/wait.h:1.34
--- src/sys/sys/wait.h:1.33	Thu Nov 10 12:07:14 2016
+++ src/sys/sys/wait.h	Thu Nov 10 12:32:50 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: wait.h,v 1.33 2016/11/10 17:07:14 christos Exp $	*/
+/*	$NetBSD: wait.h,v 1.34 2016/11/10 17:32:50 christos Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993, 1994
@@ -75,35 +75,37 @@
 #endif
 
 /*
- * Option bits for the third argument of wait4.  WNOHANG causes the
- * wait to not hang if there are no stopped or terminated processes, rather
- * returning an error indication in this case (pid==0).  WUNTRACED
- * indicates that the caller should receive status about untraced children
- * which stop due to signals.  If children are stopped and a wait without
- * this option is done, it is as though they were still running... nothing
- * about them is returned.
- */
-#define WNOHANG		0x0001	/* don't hang in wait */
-#define WUNTRACED	0x0002	/* tell about stopped,
-	   untraced children */
-#define	WSTOPPED	WUNTRACED	/* SUS compatibility */
-#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+ * Option bits for the third argument of wait4/waitpid/waitid/wait6.
+ * WNOHANG causes the wait to not hang if there are no stopped or
+ * terminated processes, rather returning an error indication in this case
+ * (pid==0). WSTOPPED indicates that the caller should receive status about
+ * untraced children which stop due to signals. If children are stopped and
+ * a wait without this option is done, it is as though they were still running,
+ * nothing about them is returned. WCONTINUED returns information for children
+ * that were continued from job control. WEXITED is the default for
+ * wait/wait3/wait4/waitpid (to report children that have exited), but needs
+ * to be explicitly specified for waitid/wait6. WNOWAIT returns information
+ * about the children without reaping them (changing their status to have
+ * been already waited for.
+ */
+#define	WNOHANG		0x0001	/* don't hang in wait */
+#define	WSTOPPED	0x0002	/* include stopped/untraceed children */
+#define	WCONTINUED	0x0010	/* include continued processes */
+#define	WEXITED		0x0020	/* Wait for exited processes. */
+#define	WNOWAIT		0x0001	/* Don't mark child 'P_WAITED' */
+
+#if defined(_NETBSD_SOURCE)
+#define	WUNTRACED	WSTOPPED	/* BSD compatibility */
 #define	WALTSIG		0x0004	/* wait for processes that exit
 	   with an alternate signal (i.e.
 	   not SIGCHLD) */
 #define	WALLSIG		0x0008	/* wait for processes that exit
 	   with any signal, i.e. SIGCHLD
 	   and alternates */
-#define	WCONTINUED	0x0010	/* Report a job control continued
-	   process. */
-#define	WEXITED		0x0020	/* Wait for exited processes. */
 #define	WTRAPPED	0x0040	/* Wait for a process to hit a trap or
  	   a breakpoint. */
-
-#define	WNOWAIT		0x0001	/* Don't mark child 'P_WAITED' */
 #define	WNOZOMBIE	0x0002	/* Ignore zombies */
 
-#ifdef _NETBSD_SOURCE
 /*
  * These are the Linux names of some of the above flags, for compatibility
  * with Linux's clone(2) API.
@@ -113,10 +115,11 @@
 #endif /* _NETBSD_SOURCE */
 
 #ifdef _KERNEL
-#define WSELECTOPTS	(WEXITED|WUNTRACED|WCONTINUED|WTRAPPED)
-#define WALLOPTS	(WNOHANG|WALTSIG|WALLSIG|WNOWAIT|WNOZOMBIE|WSELECTOPTS)
+#define	WSELECTOPTS	(WEXITED|WUNTRACED|WCONTINUED|WTRAPPED)
+#define	WALLOPTS	(WNOHANG|WALTSIG|WALLSIG|WNOWAIT|WNOZOMBIE|WSELECTOPTS)
 #endif /* _KERNEL */
 
+#if defined(_NETBSD_SOURCE) || defined(_XOPEN_SOURCE)
 /* POSIX extensions and 4.2/4.3 compatibility: */
 
 /*



CVS commit: src/lib/libc/sys

2016-11-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov 10 17:08:31 UTC 2016

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

Log Message:
Document WNOZOMBIE


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/lib/libc/sys/wait.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/wait.2
diff -u src/lib/libc/sys/wait.2:1.36 src/lib/libc/sys/wait.2:1.37
--- src/lib/libc/sys/wait.2:1.36	Thu Jun 30 13:00:55 2016
+++ src/lib/libc/sys/wait.2	Thu Nov 10 12:08:31 2016
@@ -1,4 +1,4 @@
-.\"	$NetBSD: wait.2,v 1.36 2016/06/30 17:00:55 abhinav Exp $
+.\"	$NetBSD: wait.2,v 1.37 2016/11/10 17:08:31 christos Exp $
 .\"
 .\" Copyright (c) 1980, 1991, 1993, 1994
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" @(#)wait.2	8.2 (Berkeley) 4/19/94
 .\"
-.Dd June 27, 2016
+.Dd November 10, 2016
 .Dt WAIT 2
 .Os
 .Sh NAME
@@ -313,6 +313,8 @@ there are no processes wishing to report
 .It Dv WNOWAIT
 Keep the process whose status is returned in a waitable state.
 The process may be waited for again after this call completes.
+.It Dv WNOZOMBIE
+Exclude zombie processes from the child selection criteria.
 .It Dv WSTOPPED
 An alias for
 .Dv WUNTRACED .



CVS commit: src/lib/libc/sys

2016-11-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov 10 17:08:31 UTC 2016

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

Log Message:
Document WNOZOMBIE


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/lib/libc/sys/wait.2

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



CVS commit: src/sys

2016-11-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov 10 17:07:14 UTC 2016

Modified Files:
src/sys/kern: kern_exit.c
src/sys/sys: wait.h

Log Message:
GC WOPTSCHECKED, define macros for the select opts and all the valid opts.
The linux compat flags are not part of X/Open.


To generate a diff of this commit:
cvs rdiff -u -r1.265 -r1.266 src/sys/kern/kern_exit.c
cvs rdiff -u -r1.32 -r1.33 src/sys/sys/wait.h

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



CVS commit: src/sys

2016-11-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov 10 17:07:14 UTC 2016

Modified Files:
src/sys/kern: kern_exit.c
src/sys/sys: wait.h

Log Message:
GC WOPTSCHECKED, define macros for the select opts and all the valid opts.
The linux compat flags are not part of X/Open.


To generate a diff of this commit:
cvs rdiff -u -r1.265 -r1.266 src/sys/kern/kern_exit.c
cvs rdiff -u -r1.32 -r1.33 src/sys/sys/wait.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_exit.c
diff -u src/sys/kern/kern_exit.c:1.265 src/sys/kern/kern_exit.c:1.266
--- src/sys/kern/kern_exit.c:1.265	Tue Nov  8 19:30:17 2016
+++ src/sys/kern/kern_exit.c	Thu Nov 10 12:07:14 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_exit.c,v 1.265 2016/11/09 00:30:17 kre Exp $	*/
+/*	$NetBSD: kern_exit.c,v 1.266 2016/11/10 17:07:14 christos Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_exit.c,v 1.265 2016/11/09 00:30:17 kre Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exit.c,v 1.266 2016/11/10 17:07:14 christos Exp $");
 
 #include "opt_ktrace.h"
 #include "opt_dtrace.h"
@@ -1004,14 +1004,12 @@ find_stopped_child(struct proc *parent, 
 
 	KASSERT(mutex_owned(proc_lock));
 
-	if (options & ~(WUNTRACED|WNOHANG|WALTSIG|WALLSIG|WTRAPPED|WEXITED|
-	WNOWAIT|WCONTINUED)
-	&& !(options & WOPTSCHECKED)) {
+	if (options & ~WALLOPTS) {
 		*child_p = NULL;
 		return EINVAL;
 	}
 
-	if ((options & (WEXITED|WUNTRACED|WCONTINUED|WTRAPPED)) == 0) {
+	if ((options & WSELECTOPTS) == 0) {
 		/*
 		 * We will be unable to find any matching processes,
 		 * because there are no known events to look for.

Index: src/sys/sys/wait.h
diff -u src/sys/sys/wait.h:1.32 src/sys/sys/wait.h:1.33
--- src/sys/sys/wait.h:1.32	Sat Nov  5 19:49:59 2016
+++ src/sys/sys/wait.h	Thu Nov 10 12:07:14 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: wait.h,v 1.32 2016/11/05 23:49:59 christos Exp $	*/
+/*	$NetBSD: wait.h,v 1.33 2016/11/10 17:07:14 christos Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993, 1994
@@ -100,23 +100,23 @@
 #define	WTRAPPED	0x0040	/* Wait for a process to hit a trap or
  	   a breakpoint. */
 
+#define	WNOWAIT		0x0001	/* Don't mark child 'P_WAITED' */
+#define	WNOZOMBIE	0x0002	/* Ignore zombies */
+
+#ifdef _NETBSD_SOURCE
 /*
  * These are the Linux names of some of the above flags, for compatibility
  * with Linux's clone(2) API.
  */
 #define	__WCLONE	WALTSIG
 #define	__WALL		WALLSIG
+#endif /* _NETBSD_SOURCE */
 
-/*
- * These bits are used in order to support SVR4 (etc) functionality
- * without replicating sys_wait4 5 times.
- */
-#define	WNOWAIT		0x0001	/* Don't mark child 'P_WAITED' */
-#define	WNOZOMBIE	0x0002	/* Ignore zombies */
-#define	WOPTSCHECKED	0x0004	/* Compat call, options verified */
-#endif /* _XOPEN_SOURCE || _NETBSD_SOURCE */
+#ifdef _KERNEL
+#define WSELECTOPTS	(WEXITED|WUNTRACED|WCONTINUED|WTRAPPED)
+#define WALLOPTS	(WNOHANG|WALTSIG|WALLSIG|WNOWAIT|WNOZOMBIE|WSELECTOPTS)
+#endif /* _KERNEL */
 
-#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
 /* POSIX extensions and 4.2/4.3 compatibility: */
 
 /*



CVS commit: src/sys/compat

2016-11-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov 10 17:00:51 UTC 2016

Modified Files:
src/sys/compat/linux/common: linux_misc.c
src/sys/compat/linux32/common: linux32_wait.c
src/sys/compat/osf1: osf1_misc.c
src/sys/compat/svr4: svr4_misc.c
src/sys/compat/svr4_32: svr4_32_misc.c

Log Message:
GC WOPTSCHECKED


To generate a diff of this commit:
cvs rdiff -u -r1.232 -r1.233 src/sys/compat/linux/common/linux_misc.c
cvs rdiff -u -r1.11 -r1.12 src/sys/compat/linux32/common/linux32_wait.c
cvs rdiff -u -r1.86 -r1.87 src/sys/compat/osf1/osf1_misc.c
cvs rdiff -u -r1.156 -r1.157 src/sys/compat/svr4/svr4_misc.c
cvs rdiff -u -r1.76 -r1.77 src/sys/compat/svr4_32/svr4_32_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/linux/common/linux_misc.c
diff -u src/sys/compat/linux/common/linux_misc.c:1.232 src/sys/compat/linux/common/linux_misc.c:1.233
--- src/sys/compat/linux/common/linux_misc.c:1.232	Wed Aug 31 04:12:44 2016
+++ src/sys/compat/linux/common/linux_misc.c	Thu Nov 10 12:00:51 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_misc.c,v 1.232 2016/08/31 08:12:44 njoly Exp $	*/
+/*	$NetBSD: linux_misc.c,v 1.233 2016/11/10 17:00:51 christos Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1998, 1999, 2008 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.232 2016/08/31 08:12:44 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.233 2016/11/10 17:00:51 christos Exp $");
 
 #include 
 #include 
@@ -223,10 +223,10 @@ linux_sys_wait4(struct lwp *l, const str
 	proc_t *p;
 
 	linux_options = SCARG(uap, options);
-	options = WOPTSCHECKED;
 	if (linux_options & ~(LINUX_WAIT4_KNOWNFLAGS))
 		return (EINVAL);
 
+	options = 0;
 	if (linux_options & LINUX_WAIT4_WNOHANG)
 		options |= WNOHANG;
 	if (linux_options & LINUX_WAIT4_WUNTRACED)

Index: src/sys/compat/linux32/common/linux32_wait.c
diff -u src/sys/compat/linux32/common/linux32_wait.c:1.11 src/sys/compat/linux32/common/linux32_wait.c:1.12
--- src/sys/compat/linux32/common/linux32_wait.c:1.11	Wed Nov  4 16:23:03 2009
+++ src/sys/compat/linux32/common/linux32_wait.c	Thu Nov 10 12:00:51 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux32_wait.c,v 1.11 2009/11/04 21:23:03 rmind Exp $ */
+/*	$NetBSD: linux32_wait.c,v 1.12 2016/11/10 17:00:51 christos Exp $ */
 
 /*-
  * Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved.
@@ -33,7 +33,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: linux32_wait.c,v 1.11 2009/11/04 21:23:03 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux32_wait.c,v 1.12 2016/11/10 17:00:51 christos Exp $");
 
 #include 
 #include 
@@ -105,10 +105,10 @@ linux32_sys_wait4(struct lwp *l, const s
 	proc_t *p;
 
 	linux_options = SCARG(uap, options);
-	options = WOPTSCHECKED;
 	if (linux_options & ~(LINUX_WAIT4_KNOWNFLAGS))
 		return EINVAL;
 
+	options = 0;
 	if (linux_options & LINUX_WAIT4_WNOHANG)
 		options |= WNOHANG;
 	if (linux_options & LINUX_WAIT4_WUNTRACED)

Index: src/sys/compat/osf1/osf1_misc.c
diff -u src/sys/compat/osf1/osf1_misc.c:1.86 src/sys/compat/osf1/osf1_misc.c:1.87
--- src/sys/compat/osf1/osf1_misc.c:1.86	Fri Jul 22 06:02:08 2011
+++ src/sys/compat/osf1/osf1_misc.c	Thu Nov 10 12:00:51 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: osf1_misc.c,v 1.86 2011/07/22 10:02:08 njoly Exp $ */
+/* $NetBSD: osf1_misc.c,v 1.87 2016/11/10 17:00:51 christos Exp $ */
 
 /*
  * Copyright (c) 1999 Christopher G. Demetriou.  All rights reserved.
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: osf1_misc.c,v 1.86 2011/07/22 10:02:08 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: osf1_misc.c,v 1.87 2016/11/10 17:00:51 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_syscall_debug.h"
@@ -406,7 +406,7 @@ osf1_sys_wait4(struct lwp *l, const stru
 	if (leftovers != 0)
 		return (EINVAL);
 
-	error = do_sys_wait(, , options | WOPTSCHECKED,
+	error = do_sys_wait(, , options,
 	SCARG(uap, rusage) != NULL ? _rusage : NULL);
 
 	retval[0] = pid;

Index: src/sys/compat/svr4/svr4_misc.c
diff -u src/sys/compat/svr4/svr4_misc.c:1.156 src/sys/compat/svr4/svr4_misc.c:1.157
--- src/sys/compat/svr4/svr4_misc.c:1.156	Fri Sep  5 05:21:55 2014
+++ src/sys/compat/svr4/svr4_misc.c	Thu Nov 10 12:00:51 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: svr4_misc.c,v 1.156 2014/09/05 09:21:55 matt Exp $	 */
+/*	$NetBSD: svr4_misc.c,v 1.157 2016/11/10 17:00:51 christos Exp $	 */
 
 /*-
  * Copyright (c) 1994, 2008 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: svr4_misc.c,v 1.156 2014/09/05 09:21:55 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: svr4_misc.c,v 1.157 2016/11/10 17:00:51 christos Exp $");
 
 #include 
 #include 
@@ -1030,7 +1030,7 @@ svr4_sys_waitsys(struct lwp *l, const st
 	}
 
 	/* Translate options */
-	options = WOPTSCHECKED;
+	options = 0;
 	if (SCARG(uap, options) & SVR4_WNOWAIT)
 		options |= WNOWAIT;
 	if 

CVS commit: src/sys/compat

2016-11-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov 10 17:00:51 UTC 2016

Modified Files:
src/sys/compat/linux/common: linux_misc.c
src/sys/compat/linux32/common: linux32_wait.c
src/sys/compat/osf1: osf1_misc.c
src/sys/compat/svr4: svr4_misc.c
src/sys/compat/svr4_32: svr4_32_misc.c

Log Message:
GC WOPTSCHECKED


To generate a diff of this commit:
cvs rdiff -u -r1.232 -r1.233 src/sys/compat/linux/common/linux_misc.c
cvs rdiff -u -r1.11 -r1.12 src/sys/compat/linux32/common/linux32_wait.c
cvs rdiff -u -r1.86 -r1.87 src/sys/compat/osf1/osf1_misc.c
cvs rdiff -u -r1.156 -r1.157 src/sys/compat/svr4/svr4_misc.c
cvs rdiff -u -r1.76 -r1.77 src/sys/compat/svr4_32/svr4_32_misc.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/usb

2016-11-10 Thread Hauke Fath
Module Name:src
Committed By:   hauke
Date:   Thu Nov 10 15:42:13 UTC 2016

Modified Files:
src/sys/dev/usb: usbdevs.h usbdevs_data.h

Log Message:
Add entry for Intel Centrino Advanced-N 6235 bluetooth piggy-back
Add entry for Validity Sensors, Inc. VFS491


To generate a diff of this commit:
cvs rdiff -u -r1.715 -r1.716 src/sys/dev/usb/usbdevs.h
cvs rdiff -u -r1.716 -r1.717 src/sys/dev/usb/usbdevs_data.h

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



CVS commit: src/sys/dev/usb

2016-11-10 Thread Hauke Fath
Module Name:src
Committed By:   hauke
Date:   Thu Nov 10 15:38:51 UTC 2016

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

Log Message:
Add entry for Intel Centrino Advanced-N 6235 bluetooth piggy-back
Add entry for Validity Sensors, Inc. VFS491


To generate a diff of this commit:
cvs rdiff -u -r1.723 -r1.724 src/sys/dev/usb/usbdevs

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/usbdevs
diff -u src/sys/dev/usb/usbdevs:1.723 src/sys/dev/usb/usbdevs:1.724
--- src/sys/dev/usb/usbdevs:1.723	Fri Nov  4 20:39:33 2016
+++ src/sys/dev/usb/usbdevs	Thu Nov 10 15:38:51 2016
@@ -1,4 +1,4 @@
-$NetBSD: usbdevs,v 1.723 2016/11/04 20:39:33 mlelstv Exp $
+$NetBSD: usbdevs,v 1.724 2016/11/10 15:38:51 hauke Exp $
 
 /*
  * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
@@ -1856,6 +1856,7 @@ product INTEL TESTBOARD		0x9890	82930 te
 
 product INTEL2 RMH		0x0020	Rate Matching Hub
 product INTEL2 RMH2		0x0024	Rate Matching Hub
+product INTEL2 N_6235_BT	0x07da	Advanced-N 6235 Combo Bluetooth
 
 /* Intersil products */
 product INTERSIL PRISM_GT	0x1000	PrismGT USB 2.0 WLAN
@@ -3331,6 +3332,7 @@ product VALIDITY VFS451		0x0007	VFS451 F
 product VALIDITY VFS300		0x0008	VFS300 Fingerprint Reader
 product VALIDITY VFS5011	0x0011	VFS5011 Fingerprint Reader
 product VALIDITY VFS471		0x003c	VFS471 Fingerprint Reader
+product VALIDITY VFS491		0x003d	VFS491 Fingerprint Reader
 
 /* VidzMedia products */
 product VIDZMEDIA MONSTERTV	0x4fb1	MonsterTV P2H



CVS commit: src/sys/dev/usb

2016-11-10 Thread Hauke Fath
Module Name:src
Committed By:   hauke
Date:   Thu Nov 10 15:38:51 UTC 2016

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

Log Message:
Add entry for Intel Centrino Advanced-N 6235 bluetooth piggy-back
Add entry for Validity Sensors, Inc. VFS491


To generate a diff of this commit:
cvs rdiff -u -r1.723 -r1.724 src/sys/dev/usb/usbdevs

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



CVS commit: src/tests/net/if_pppoe

2016-11-10 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Thu Nov 10 10:32:59 UTC 2016

Modified Files:
src/tests/net/if_pppoe: t_pppoe.sh

Log Message:
fix: extend waittime to avoid unintended fail at high cpu load.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/tests/net/if_pppoe/t_pppoe.sh

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



CVS commit: src/tests/net/if_pppoe

2016-11-10 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Thu Nov 10 10:32:59 UTC 2016

Modified Files:
src/tests/net/if_pppoe: t_pppoe.sh

Log Message:
fix: extend waittime to avoid unintended fail at high cpu load.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/tests/net/if_pppoe/t_pppoe.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/net/if_pppoe/t_pppoe.sh
diff -u src/tests/net/if_pppoe/t_pppoe.sh:1.10 src/tests/net/if_pppoe/t_pppoe.sh:1.11
--- src/tests/net/if_pppoe/t_pppoe.sh:1.10	Mon Nov  7 05:25:36 2016
+++ src/tests/net/if_pppoe/t_pppoe.sh	Thu Nov 10 10:32:59 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: t_pppoe.sh,v 1.10 2016/11/07 05:25:36 ozaki-r Exp $
+#	$NetBSD: t_pppoe.sh,v 1.11 2016/11/10 10:32:59 knakahara Exp $
 #
 # Copyright (c) 2016 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -41,7 +41,7 @@ AUTHNAME=foo...@baz.com
 SECRET=oink
 BUS=bus0
 TIMEOUT=3
-WAITTIME=5
+WAITTIME=10
 DEBUG=${DEBUG:-false}
 
 setup()



CVS commit: src/sys/dev/pci

2016-11-10 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Nov 10 08:35:24 UTC 2016

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

Log Message:
- Move I219 DMA workaround into wm_flush_desc_rings() and call it before
  wm_reset().
- Rewite I219 TX DMA workaround based on OpenBSD's one.
- Add I219 RX DMA workaroud from OpenBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.442 -r1.443 src/sys/dev/pci/if_wm.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_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.442 src/sys/dev/pci/if_wm.c:1.443
--- src/sys/dev/pci/if_wm.c:1.442	Thu Nov 10 06:57:15 2016
+++ src/sys/dev/pci/if_wm.c	Thu Nov 10 08:35:24 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.442 2016/11/10 06:57:15 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.443 2016/11/10 08:35:24 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -84,7 +84,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.442 2016/11/10 06:57:15 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.443 2016/11/10 08:35:24 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -637,6 +637,7 @@ static void	wm_lan_init_done(struct wm_s
 static void	wm_get_cfg_done(struct wm_softc *);
 static void	wm_initialize_hardware_bits(struct wm_softc *);
 static uint32_t	wm_rxpbs_adjust_82580(uint32_t);
+static void	wm_flush_desc_rings(struct wm_softc *);
 static void	wm_reset(struct wm_softc *);
 static int	wm_add_rxbuf(struct wm_rxqueue *, int);
 static void	wm_rxdrain(struct wm_rxqueue *);
@@ -3742,6 +3743,82 @@ wm_rxpbs_adjust_82580(uint32_t val)
 	return rv;
 }
 
+static void
+wm_flush_desc_rings(struct wm_softc *sc)
+{
+	pcireg_t preg;
+	uint32_t reg;
+	int nexttx;
+
+	/* First, disable MULR fix in FEXTNVM11 */
+	reg = CSR_READ(sc, WMREG_FEXTNVM11);
+	reg |= FEXTNVM11_DIS_MULRFIX;
+	CSR_WRITE(sc, WMREG_FEXTNVM11, reg);
+
+	preg = pci_conf_read(sc->sc_pc, sc->sc_pcitag, WM_PCI_DESCRING_STATUS);
+	reg = CSR_READ(sc, WMREG_TDLEN(0));
+	if (((preg & DESCRING_STATUS_FLUSH_REQ) != 0) && (reg != 0)) {
+		struct wm_txqueue *txq;
+		wiseman_txdesc_t *txd;
+
+		/* TX */
+		printf("%s: Need TX flush (reg = %08x, len = %u)\n",
+		device_xname(sc->sc_dev), preg, reg);
+		reg = CSR_READ(sc, WMREG_TCTL);
+		CSR_WRITE(sc, WMREG_TCTL, reg | TCTL_EN);
+
+		txq = >sc_queue[0].wmq_txq;
+		nexttx = txq->txq_next;
+		txd = >txq_descs[nexttx];
+		wm_set_dma_addr(>wtx_addr, WM_CDTXADDR(txq, nexttx));
+		txd->wtx_cmdlen = htole32(WTX_CMD_IFCS| 512);
+		txd->wtx_fields.wtxu_status = 0;
+		txd->wtx_fields.wtxu_options = 0;
+		txd->wtx_fields.wtxu_vlan = 0;
+
+		bus_space_barrier(sc->sc_st, sc->sc_sh, 0, 0,
+			BUS_SPACE_BARRIER_WRITE);
+		
+		txq->txq_next = WM_NEXTTX(txq, txq->txq_next);
+		CSR_WRITE(sc, WMREG_TDT(0), txq->txq_next);
+		bus_space_barrier(sc->sc_st, sc->sc_sh, 0, 0,
+			BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
+		delay(250);
+	}
+	preg = pci_conf_read(sc->sc_pc, sc->sc_pcitag, WM_PCI_DESCRING_STATUS);
+	if (preg & DESCRING_STATUS_FLUSH_REQ) {
+		uint32_t rctl;
+
+		/* RX */
+		printf("%s: Need RX flush (reg = %08x)\n",
+		device_xname(sc->sc_dev), preg);
+		rctl = CSR_READ(sc, WMREG_RCTL);
+		CSR_WRITE(sc, WMREG_RCTL, rctl & ~RCTL_EN);
+		CSR_WRITE_FLUSH(sc);
+		delay(150);
+
+		reg = CSR_READ(sc, WMREG_RXDCTL(0));
+		/* zero the lower 14 bits (prefetch and host thresholds) */
+		reg &= 0xc000;
+		/*
+		 * update thresholds: prefetch threshold to 31, host threshold
+		 * to 1 and make sure the granularity is "descriptors" and not
+		 * "cache lines"
+		 */
+		reg |= (0x1f | (1 << 8) | RXDCTL_GRAN);
+		CSR_WRITE(sc, WMREG_RXDCTL(0), reg);
+
+		/*
+		 * momentarily enable the RX ring for the changes to take
+		 * effect
+		 */
+		CSR_WRITE(sc, WMREG_RCTL, rctl | RCTL_EN);
+		CSR_WRITE_FLUSH(sc);
+		delay(150);
+		CSR_WRITE(sc, WMREG_RCTL, rctl & ~RCTL_EN);
+	}
+}
+
 /*
  * wm_reset:
  *
@@ -4663,6 +4740,10 @@ wm_init_locked(struct ifnet *ifp)
 	ifp->if_collisions += CSR_READ(sc, WMREG_COLC);
 	ifp->if_ierrors += CSR_READ(sc, WMREG_RXERRC);
 
+	/* PCH_SPT hardware workaround */
+	if (sc->sc_type == WM_T_PCH_SPT)
+		wm_flush_desc_rings(sc);
+
 	/* Reset the chip to a known state. */
 	wm_reset(sc);
 
@@ -5237,49 +5318,6 @@ wm_stop_locked(struct ifnet *ifp, int di
 txs->txs_mbuf = NULL;
 			}
 		}
-		if (sc->sc_type == WM_T_PCH_SPT) {
-			pcireg_t preg;
-			uint32_t reg;
-			int nexttx;
-
-			/* First, disable MULR fix in FEXTNVM11 */
-			reg = CSR_READ(sc, WMREG_FEXTNVM11);
-			reg |= FEXTNVM11_DIS_MULRFIX;
-			CSR_WRITE(sc, WMREG_FEXTNVM11, reg);
-
-			preg = pci_conf_read(sc->sc_pc, sc->sc_pcitag,
-			WM_PCI_DESCRING_STATUS);
-			reg = CSR_READ(sc, WMREG_TDLEN(0));
-			printf("XXX RST: FLUSH = %08x, len = %u\n",
-			(uint32_t)(preg & DESCRING_STATUS_FLUSH_REQ), reg);
-			if (((preg & DESCRING_STATUS_FLUSH_REQ) != 0)
-			&& (reg != 0)) {
-/* 

CVS commit: src/sys/dev/pci

2016-11-10 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Nov 10 08:35:24 UTC 2016

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

Log Message:
- Move I219 DMA workaround into wm_flush_desc_rings() and call it before
  wm_reset().
- Rewite I219 TX DMA workaround based on OpenBSD's one.
- Add I219 RX DMA workaroud from OpenBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.442 -r1.443 src/sys/dev/pci/if_wm.c

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