CVS commit: [netbsd-6] src/doc

2014-06-25 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Jun 26 04:02:10 UTC 2014

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

Log Message:
Ticket 1084 and 1086.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.119 -r1.1.2.120 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.119 src/doc/CHANGES-6.2:1.1.2.120
--- src/doc/CHANGES-6.2:1.1.2.119	Wed Jun 18 02:03:46 2014
+++ src/doc/CHANGES-6.2	Thu Jun 26 04:02:10 2014
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.2,v 1.1.2.119 2014/06/18 02:03:46 msaitoh Exp $
+# $NetBSD: CHANGES-6.2,v 1.1.2.120 2014/06/26 04:02:10 msaitoh Exp $
 
 A complete list of changes from the 6.1 release until the 6.2 release:
 
@@ -2902,7 +2902,7 @@ external/mit/xorg/lib/fontconfig/etc/fon
 	Noted by tsutsui.
 	[wiz, ticket #1077]
 
-src/external/bsd/openpam/dist/lib/openpam_configure.c 1.8 via patch
+external/bsd/openpam/dist/lib/openpam_configure.c 1.8 via patch
 
 	CVE-2014-3879: Incorrect error handling in PAM policy parser:
 	Missing module files were treated as soft failures leading to
@@ -2910,3 +2910,14 @@ src/external/bsd/openpam/dist/lib/openpa
 	differently installed modules or in the short period during upgrades
 	when module files were being replaced.
 	[christos, ticket #1076]
+
+sys/compat/netbsd32/netbsd32_netbsd.c		1.187
+
+	Fix cases where count <= 0 in netbsd32_swapctl_stats().
+	[maxv, ticket #1084]
+
+sys/compat/freebsd/freebsd_sched.c		1.20-1.21
+
+	Avoid NULL dereference and fix sched param conversion.
+	Pointed out by Maxime Villard.
+	[maxv, ticket #1086]



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

2014-06-25 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Jun 26 04:01:32 UTC 2014

Modified Files:
src/sys/compat/freebsd [netbsd-6-0]: freebsd_sched.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1086):
sys/compat/freebsd/freebsd_sched.c  1.20-1.21

Avoid NULL dereference and fix sched param conversion (at least make it
do something). Pointed out by Maxime Villard.

Simplify and clarify.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.19.46.1 src/sys/compat/freebsd/freebsd_sched.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/freebsd/freebsd_sched.c
diff -u src/sys/compat/freebsd/freebsd_sched.c:1.19 src/sys/compat/freebsd/freebsd_sched.c:1.19.46.1
--- src/sys/compat/freebsd/freebsd_sched.c:1.19	Mon Apr 28 20:23:41 2008
+++ src/sys/compat/freebsd/freebsd_sched.c	Thu Jun 26 04:01:32 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: freebsd_sched.c,v 1.19 2008/04/28 20:23:41 martin Exp $	*/
+/*	$NetBSD: freebsd_sched.c,v 1.19.46.1 2014/06/26 04:01:32 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: freebsd_sched.c,v 1.19 2008/04/28 20:23:41 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: freebsd_sched.c,v 1.19.46.1 2014/06/26 04:01:32 msaitoh Exp $");
 
 #include 
 #include 
@@ -62,72 +62,72 @@ freebsd_sys_yield(struct lwp *l, const v
  */
 static int
 sched_freebsd2native(int freebsd_policy,
-struct freebsd_sched_param *freebsd_params, int *native_policy,
+const struct freebsd_sched_param *freebsd_params, int *native_policy,
 struct sched_param *native_params)
 {
-	int error;
-
-	error = 0;
+	int p;
 
 	switch (freebsd_policy) {
 	case FREEBSD_SCHED_OTHER:
-		*native_policy = SCHED_OTHER;
+		p = SCHED_OTHER;
 		break;
 
 	case FREEBSD_SCHED_FIFO:
-		*native_policy = SCHED_FIFO;
+		p = SCHED_FIFO;
 		break;
 
 	case FREEBSD_SCHED_RR:
-		*native_policy = SCHED_RR;
+		p = SCHED_RR;
 		break;
 
 	default:
-		error = EINVAL;
-		break;
+		return EINVAL;
 	}
  
-	if (freebsd_params != NULL && native_params != NULL && !error) {
-		native_params = (struct sched_param *)freebsd_params;
+	if (native_policy != NULL)
+		*native_policy = p;
+
+	if (freebsd_params != NULL && native_params != NULL) {
+		/* XXX: Needs adjustment to do a proper conversion. */
+		native_params->sched_priority = freebsd_params->sched_priority;
 	}
-
-	return (error);
+	return 0;
 }
 
 /*
- * XXX: Needs adjustment to do a proper conversion.
  */
 static int
-sched_native2freebsd(int native_policy, struct sched_param *native_params,
+sched_native2freebsd(int native_policy, const struct sched_param *native_params,
 int *freebsd_policy, struct freebsd_sched_param *freebsd_params)
 {
-	int error;
-
-	error = 0;
+	int p;
 
 	switch (native_policy) {
 	case SCHED_OTHER:
-		*freebsd_policy = FREEBSD_SCHED_OTHER;
+		p = FREEBSD_SCHED_OTHER;
 		break;
 
 	case SCHED_FIFO:
-		*freebsd_policy = FREEBSD_SCHED_FIFO;
+		p = FREEBSD_SCHED_FIFO;
 		break;
 
 	case SCHED_RR:
-		*freebsd_policy = FREEBSD_SCHED_RR;
+		p = FREEBSD_SCHED_RR;
 		break;
 
 	default:
-		error = EINVAL;
-		break;
+		return EINVAL;
 	}
  
-	if (native_params != NULL && freebsd_params != NULL && !error) {
-		freebsd_params = (struct freebsd_sched_param *)native_params;
+	if (freebsd_policy != NULL)
+		*freebsd_policy = p;
+
+	if (native_params != NULL && freebsd_params != NULL) {
+		/* XXX: Needs adjustment to do a proper conversion. */
+		freebsd_params->sched_priority = native_params->sched_priority;
 	}
-
-	return (error);
+
+	return 0;
 }
 
 int
@@ -199,7 +199,7 @@ freebsd_sys_sched_getparam(struct lwp *l
 		goto out;
 
  out:
-	return (error);
+	return error;
 }
 
 int



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

2014-06-25 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Jun 26 04:01:07 UTC 2014

Modified Files:
src/sys/compat/freebsd [netbsd-6-1]: freebsd_sched.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1086):
sys/compat/freebsd/freebsd_sched.c  1.20-1.21

Avoid NULL dereference and fix sched param conversion (at least make it
do something). Pointed out by Maxime Villard.

Simplify and clarify.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.19.56.1 src/sys/compat/freebsd/freebsd_sched.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/freebsd/freebsd_sched.c
diff -u src/sys/compat/freebsd/freebsd_sched.c:1.19 src/sys/compat/freebsd/freebsd_sched.c:1.19.56.1
--- src/sys/compat/freebsd/freebsd_sched.c:1.19	Mon Apr 28 20:23:41 2008
+++ src/sys/compat/freebsd/freebsd_sched.c	Thu Jun 26 04:01:07 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: freebsd_sched.c,v 1.19 2008/04/28 20:23:41 martin Exp $	*/
+/*	$NetBSD: freebsd_sched.c,v 1.19.56.1 2014/06/26 04:01:07 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: freebsd_sched.c,v 1.19 2008/04/28 20:23:41 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: freebsd_sched.c,v 1.19.56.1 2014/06/26 04:01:07 msaitoh Exp $");
 
 #include 
 #include 
@@ -62,72 +62,72 @@ freebsd_sys_yield(struct lwp *l, const v
  */
 static int
 sched_freebsd2native(int freebsd_policy,
-struct freebsd_sched_param *freebsd_params, int *native_policy,
+const struct freebsd_sched_param *freebsd_params, int *native_policy,
 struct sched_param *native_params)
 {
-	int error;
-
-	error = 0;
+	int p;
 
 	switch (freebsd_policy) {
 	case FREEBSD_SCHED_OTHER:
-		*native_policy = SCHED_OTHER;
+		p = SCHED_OTHER;
 		break;
 
 	case FREEBSD_SCHED_FIFO:
-		*native_policy = SCHED_FIFO;
+		p = SCHED_FIFO;
 		break;
 
 	case FREEBSD_SCHED_RR:
-		*native_policy = SCHED_RR;
+		p = SCHED_RR;
 		break;
 
 	default:
-		error = EINVAL;
-		break;
+		return EINVAL;
 	}
  
-	if (freebsd_params != NULL && native_params != NULL && !error) {
-		native_params = (struct sched_param *)freebsd_params;
+	if (native_policy != NULL)
+		*native_policy = p;
+
+	if (freebsd_params != NULL && native_params != NULL) {
+		/* XXX: Needs adjustment to do a proper conversion. */
+		native_params->sched_priority = freebsd_params->sched_priority;
 	}
-
-	return (error);
+	return 0;
 }
 
 /*
- * XXX: Needs adjustment to do a proper conversion.
  */
 static int
-sched_native2freebsd(int native_policy, struct sched_param *native_params,
+sched_native2freebsd(int native_policy, const struct sched_param *native_params,
 int *freebsd_policy, struct freebsd_sched_param *freebsd_params)
 {
-	int error;
-
-	error = 0;
+	int p;
 
 	switch (native_policy) {
 	case SCHED_OTHER:
-		*freebsd_policy = FREEBSD_SCHED_OTHER;
+		p = FREEBSD_SCHED_OTHER;
 		break;
 
 	case SCHED_FIFO:
-		*freebsd_policy = FREEBSD_SCHED_FIFO;
+		p = FREEBSD_SCHED_FIFO;
 		break;
 
 	case SCHED_RR:
-		*freebsd_policy = FREEBSD_SCHED_RR;
+		p = FREEBSD_SCHED_RR;
 		break;
 
 	default:
-		error = EINVAL;
-		break;
+		return EINVAL;
 	}
  
-	if (native_params != NULL && freebsd_params != NULL && !error) {
-		freebsd_params = (struct freebsd_sched_param *)native_params;
+	if (freebsd_policy != NULL)
+		*freebsd_policy = p;
+
+	if (native_params != NULL && freebsd_params != NULL) {
+		/* XXX: Needs adjustment to do a proper conversion. */
+		freebsd_params->sched_priority = native_params->sched_priority;
 	}
-
-	return (error);
+
+	return 0;
 }
 
 int
@@ -199,7 +199,7 @@ freebsd_sys_sched_getparam(struct lwp *l
 		goto out;
 
  out:
-	return (error);
+	return error;
 }
 
 int



CVS commit: [netbsd-6] src/sys/compat/freebsd

2014-06-25 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Jun 26 04:00:30 UTC 2014

Modified Files:
src/sys/compat/freebsd [netbsd-6]: freebsd_sched.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1086):
sys/compat/freebsd/freebsd_sched.c  1.20-1.21

Avoid NULL dereference and fix sched param conversion (at least make it
do something). Pointed out by Maxime Villard.

Simplify and clarify.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.19.40.1 src/sys/compat/freebsd/freebsd_sched.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/freebsd/freebsd_sched.c
diff -u src/sys/compat/freebsd/freebsd_sched.c:1.19 src/sys/compat/freebsd/freebsd_sched.c:1.19.40.1
--- src/sys/compat/freebsd/freebsd_sched.c:1.19	Mon Apr 28 20:23:41 2008
+++ src/sys/compat/freebsd/freebsd_sched.c	Thu Jun 26 04:00:30 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: freebsd_sched.c,v 1.19 2008/04/28 20:23:41 martin Exp $	*/
+/*	$NetBSD: freebsd_sched.c,v 1.19.40.1 2014/06/26 04:00:30 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: freebsd_sched.c,v 1.19 2008/04/28 20:23:41 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: freebsd_sched.c,v 1.19.40.1 2014/06/26 04:00:30 msaitoh Exp $");
 
 #include 
 #include 
@@ -62,72 +62,72 @@ freebsd_sys_yield(struct lwp *l, const v
  */
 static int
 sched_freebsd2native(int freebsd_policy,
-struct freebsd_sched_param *freebsd_params, int *native_policy,
+const struct freebsd_sched_param *freebsd_params, int *native_policy,
 struct sched_param *native_params)
 {
-	int error;
-
-	error = 0;
+	int p;
 
 	switch (freebsd_policy) {
 	case FREEBSD_SCHED_OTHER:
-		*native_policy = SCHED_OTHER;
+		p = SCHED_OTHER;
 		break;
 
 	case FREEBSD_SCHED_FIFO:
-		*native_policy = SCHED_FIFO;
+		p = SCHED_FIFO;
 		break;
 
 	case FREEBSD_SCHED_RR:
-		*native_policy = SCHED_RR;
+		p = SCHED_RR;
 		break;
 
 	default:
-		error = EINVAL;
-		break;
+		return EINVAL;
 	}
  
-	if (freebsd_params != NULL && native_params != NULL && !error) {
-		native_params = (struct sched_param *)freebsd_params;
+	if (native_policy != NULL)
+		*native_policy = p;
+
+	if (freebsd_params != NULL && native_params != NULL) {
+		/* XXX: Needs adjustment to do a proper conversion. */
+		native_params->sched_priority = freebsd_params->sched_priority;
 	}
-
-	return (error);
+	return 0;
 }
 
 /*
- * XXX: Needs adjustment to do a proper conversion.
  */
 static int
-sched_native2freebsd(int native_policy, struct sched_param *native_params,
+sched_native2freebsd(int native_policy, const struct sched_param *native_params,
 int *freebsd_policy, struct freebsd_sched_param *freebsd_params)
 {
-	int error;
-
-	error = 0;
+	int p;
 
 	switch (native_policy) {
 	case SCHED_OTHER:
-		*freebsd_policy = FREEBSD_SCHED_OTHER;
+		p = FREEBSD_SCHED_OTHER;
 		break;
 
 	case SCHED_FIFO:
-		*freebsd_policy = FREEBSD_SCHED_FIFO;
+		p = FREEBSD_SCHED_FIFO;
 		break;
 
 	case SCHED_RR:
-		*freebsd_policy = FREEBSD_SCHED_RR;
+		p = FREEBSD_SCHED_RR;
 		break;
 
 	default:
-		error = EINVAL;
-		break;
+		return EINVAL;
 	}
  
-	if (native_params != NULL && freebsd_params != NULL && !error) {
-		freebsd_params = (struct freebsd_sched_param *)native_params;
+	if (freebsd_policy != NULL)
+		*freebsd_policy = p;
+
+	if (native_params != NULL && freebsd_params != NULL) {
+		/* XXX: Needs adjustment to do a proper conversion. */
+		freebsd_params->sched_priority = native_params->sched_priority;
 	}
-
-	return (error);
+
+	return 0;
 }
 
 int
@@ -199,7 +199,7 @@ freebsd_sys_sched_getparam(struct lwp *l
 		goto out;
 
  out:
-	return (error);
+	return error;
 }
 
 int



CVS commit: [netbsd-6] src/sys/compat/netbsd32

2014-06-25 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Jun 26 03:28:47 UTC 2014

Modified Files:
src/sys/compat/netbsd32 [netbsd-6]: netbsd32_netbsd.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1084):
sys/compat/netbsd32/netbsd32_netbsd.c   rev. 1.187

Fix cases where count <= 0 (thanks to Maxime Villard for raising this).


To generate a diff of this commit:
cvs rdiff -u -r1.179.2.1 -r1.179.2.2 \
src/sys/compat/netbsd32/netbsd32_netbsd.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/netbsd32/netbsd32_netbsd.c
diff -u src/sys/compat/netbsd32/netbsd32_netbsd.c:1.179.2.1 src/sys/compat/netbsd32/netbsd32_netbsd.c:1.179.2.2
--- src/sys/compat/netbsd32/netbsd32_netbsd.c:1.179.2.1	Tue Mar 18 08:09:46 2014
+++ src/sys/compat/netbsd32/netbsd32_netbsd.c	Thu Jun 26 03:28:47 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_netbsd.c,v 1.179.2.1 2014/03/18 08:09:46 msaitoh Exp $	*/
+/*	$NetBSD: netbsd32_netbsd.c,v 1.179.2.2 2014/06/26 03:28:47 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001, 2008 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_netbsd.c,v 1.179.2.1 2014/03/18 08:09:46 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_netbsd.c,v 1.179.2.2 2014/06/26 03:28:47 msaitoh Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ddb.h"
@@ -1740,6 +1740,12 @@ netbsd32_swapctl_stats(struct lwp *l, st
 	int i, error = 0;
 	size_t ksep_len;
 
+	if (count < 0)
+		return EINVAL;
+
+	if (count == 0 || uvmexp.nswapdev == 0)
+		return 0;
+
 	/* Make sure userland cannot exhaust kernel memory */
 	if ((size_t)count > (size_t)uvmexp.nswapdev)
 		count = uvmexp.nswapdev;
@@ -1751,9 +1757,6 @@ netbsd32_swapctl_stats(struct lwp *l, st
 	uvm_swap_stats(SWAP_STATS, ksep, count, retval);
 	count = *retval;
 
-	if (count < 1)
-		goto out;
-
 	for (i = 0; i < count; i++) {
 		se32.se_dev = ksep[i].se_dev;
 		se32.se_flags = ksep[i].se_flags;
@@ -1768,8 +1771,6 @@ netbsd32_swapctl_stats(struct lwp *l, st
 			break;
 	}
 
-	
-out:
 	kmem_free(ksep, ksep_len);
 
 	return error;



CVS commit: src/libexec/rpc.rstatd

2014-06-25 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Thu Jun 26 03:24:51 UTC 2014

Modified Files:
src/libexec/rpc.rstatd: rstat_proc.c

Log Message:
put the sccsids back here too


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/libexec/rpc.rstatd/rstat_proc.c

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

Modified files:

Index: src/libexec/rpc.rstatd/rstat_proc.c
diff -u src/libexec/rpc.rstatd/rstat_proc.c:1.51 src/libexec/rpc.rstatd/rstat_proc.c:1.52
--- src/libexec/rpc.rstatd/rstat_proc.c:1.51	Fri Jun  6 15:33:14 2014
+++ src/libexec/rpc.rstatd/rstat_proc.c	Thu Jun 26 03:24:51 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: rstat_proc.c,v 1.51 2014/06/06 15:33:14 christos Exp $	*/
+/*	$NetBSD: rstat_proc.c,v 1.52 2014/06/26 03:24:51 dholland Exp $	*/
 
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -30,7 +30,13 @@
  */
 
 #include 
-__RCSID("$NetBSD: rstat_proc.c,v 1.51 2014/06/06 15:33:14 christos Exp $");
+#if 0
+static char sccsid[] =
+	"from: @(#)rpc.rstatd.c 1.1 86/09/25 Copyr 1984 Sun Micro";
+static char sccsid[] =
+	"from: @(#)rstat_proc.c	2.2 88/08/01 4.0 RPCSRC";
+#endif
+__RCSID("$NetBSD: rstat_proc.c,v 1.52 2014/06/26 03:24:51 dholland Exp $");
 
 /*
  * rstat service:  built with rstat.x and derived from rpc.rstatd.c



CVS commit: src/usr.bin/sed

2014-06-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jun 26 02:14:32 UTC 2014

Modified Files:
src/usr.bin/sed: compile.c main.c misc.c process.c

Log Message:
restore sccsid[]'s per core@'s decision


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/usr.bin/sed/compile.c
cvs rdiff -u -r1.29 -r1.30 src/usr.bin/sed/main.c
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/sed/misc.c
cvs rdiff -u -r1.44 -r1.45 src/usr.bin/sed/process.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/sed/compile.c
diff -u src/usr.bin/sed/compile.c:1.42 src/usr.bin/sed/compile.c:1.43
--- src/usr.bin/sed/compile.c:1.42	Fri Jun  6 08:46:54 2014
+++ src/usr.bin/sed/compile.c	Wed Jun 25 22:14:32 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: compile.c,v 1.42 2014/06/06 12:46:54 joerg Exp $	*/
+/*	$NetBSD: compile.c,v 1.43 2014/06/26 02:14:32 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992 Diomidis Spinellis.
@@ -38,11 +38,15 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: compile.c,v 1.42 2014/06/06 12:46:54 joerg Exp $");
+__RCSID("$NetBSD: compile.c,v 1.43 2014/06/26 02:14:32 christos Exp $");
 #ifdef __FBSDID
 __FBSDID("$FreeBSD: head/usr.bin/sed/compile.c 259132 2013-12-09 18:57:20Z eadler $");
 #endif
 
+#if 0
+static const char sccsid[] = "@(#)compile.c	8.1 (Berkeley) 6/6/93";
+#endif
+
 #include 
 #include 
 

Index: src/usr.bin/sed/main.c
diff -u src/usr.bin/sed/main.c:1.29 src/usr.bin/sed/main.c:1.30
--- src/usr.bin/sed/main.c:1.29	Sat Jun 21 17:05:54 2014
+++ src/usr.bin/sed/main.c	Wed Jun 25 22:14:32 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.29 2014/06/21 21:05:54 christos Exp $	*/
+/*	$NetBSD: main.c,v 1.30 2014/06/26 02:14:32 christos Exp $	*/
 
 /*-
  * Copyright (c) 2013 Johann 'Myrkraverk' Oskarsson.
@@ -39,7 +39,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: main.c,v 1.29 2014/06/21 21:05:54 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.30 2014/06/26 02:14:32 christos Exp $");
 #ifdef __FBSDID
 __FBSDID("$FreeBSD: head/usr.bin/sed/main.c 252231 2013-06-26 04:14:19Z pfg $");
 #endif
@@ -49,6 +49,10 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 19
 	The Regents of the University of California.  All rights reserved.");
 #endif
 
+#if 0
+static const char sccsid[] = "@(#)main.c	8.2 (Berkeley) 1/3/94";
+#endif
+
 #include 
 #include 
 #include 

Index: src/usr.bin/sed/misc.c
diff -u src/usr.bin/sed/misc.c:1.14 src/usr.bin/sed/misc.c:1.15
--- src/usr.bin/sed/misc.c:1.14	Fri Jun  6 17:56:39 2014
+++ src/usr.bin/sed/misc.c	Wed Jun 25 22:14:32 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: misc.c,v 1.14 2014/06/06 21:56:39 wiz Exp $	*/
+/*	$NetBSD: misc.c,v 1.15 2014/06/26 02:14:32 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992 Diomidis Spinellis.
@@ -38,11 +38,15 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: misc.c,v 1.14 2014/06/06 21:56:39 wiz Exp $");
+__RCSID("$NetBSD: misc.c,v 1.15 2014/06/26 02:14:32 christos Exp $");
 #ifdef __FBSDID
 __FBSDID("$FreeBSD: head/usr.bin/sed/misc.c 200462 2009-12-13 03:14:06Z delphij $");
 #endif
 
+#if 0
+static const char sccsid[] = "@(#)misc.c	8.1 (Berkeley) 6/6/93";
+#endif
+
 #include 
 
 #include 

Index: src/usr.bin/sed/process.c
diff -u src/usr.bin/sed/process.c:1.44 src/usr.bin/sed/process.c:1.45
--- src/usr.bin/sed/process.c:1.44	Mon Jun  9 08:48:58 2014
+++ src/usr.bin/sed/process.c	Wed Jun 25 22:14:32 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: process.c,v 1.44 2014/06/09 12:48:58 christos Exp $	*/
+/*	$NetBSD: process.c,v 1.45 2014/06/26 02:14:32 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992 Diomidis Spinellis.
@@ -38,11 +38,15 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: process.c,v 1.44 2014/06/09 12:48:58 christos Exp $");
+__RCSID("$NetBSD: process.c,v 1.45 2014/06/26 02:14:32 christos Exp $");
 #ifdef __FBSDID
 __FBSDID("$FreeBSD: head/usr.bin/sed/process.c 192732 2009-05-25 06:45:33Z brian $");
 #endif
 
+#if 0
+static const char sccsid[] = "@(#)process.c	8.6 (Berkeley) 4/20/94";
+#endif
+
 #include 
 #include 
 #include 



CVS commit: src/sys/kern

2014-06-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jun 26 01:46:03 UTC 2014

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

Log Message:
Don't initialize the fh pointer to NULL when the allocation functions fail
and allow NULL in the free functions. It just leads to writing sloppy code
for no good reason.


To generate a diff of this commit:
cvs rdiff -u -r1.484 -r1.485 src/sys/kern/vfs_syscalls.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/vfs_syscalls.c
diff -u src/sys/kern/vfs_syscalls.c:1.484 src/sys/kern/vfs_syscalls.c:1.485
--- src/sys/kern/vfs_syscalls.c:1.484	Sat Jun 14 07:37:35 2014
+++ src/sys/kern/vfs_syscalls.c	Wed Jun 25 21:46:03 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls.c,v 1.484 2014/06/14 11:37:35 njoly Exp $	*/
+/*	$NetBSD: vfs_syscalls.c,v 1.485 2014/06/26 01:46:03 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.484 2014/06/14 11:37:35 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.485 2014/06/26 01:46:03 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_fileassoc.h"
@@ -1706,9 +1706,6 @@ vfs__fhfree(fhandle_t *fhp)
 {
 	size_t fhsize;
 
-	if (fhp == NULL) {
-		return;
-	}
 	fhsize = FHANDLE_SIZE(fhp);
 	kmem_free(fhp, fhsize);
 }
@@ -1756,7 +1753,6 @@ vfs_composefh_alloc(struct vnode *vp, fh
 	size_t fidsize;
 	int error;
 
-	*fhpp = NULL;
 	mp = vp->v_mount;
 	fidsize = 0;
 	error = VFS_VPTOFH(vp, NULL, &fidsize);
@@ -1826,7 +1822,6 @@ vfs_copyinfh_alloc(const void *ufhp, siz
 	fhandle_t *fhp;
 	int error;
 
-	*fhpp = NULL;
 	if (fhsize > FHANDLE_SIZE_MAX) {
 		return EINVAL;
 	}
@@ -1915,7 +1910,7 @@ sys___getfh30(struct lwp *l, const struc
 	error = vfs_composefh_alloc(vp, &fh);
 	vput(vp);
 	if (error != 0) {
-		goto out;
+		return error;
 	}
 	error = copyin(SCARG(uap, fh_size), &usz, sizeof(size_t));
 	if (error != 0) {



CVS commit: src/usr.sbin/puffs/mount_psshfs

2014-06-25 Thread Ryosuke Moro
Module Name:src
Committed By:   szptvlfn
Date:   Wed Jun 25 23:22:18 UTC 2014

Modified Files:
src/usr.sbin/puffs/mount_psshfs: mount_psshfs.8

Log Message:
s/stavfs/statvfs/


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8

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/puffs/mount_psshfs/mount_psshfs.8
diff -u src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8:1.26 src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8:1.27
--- src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8:1.26	Tue Dec 25 20:31:03 2012
+++ src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8	Wed Jun 25 23:22:18 2014
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mount_psshfs.8,v 1.26 2012/12/25 20:31:03 reed Exp $
+.\"	$NetBSD: mount_psshfs.8,v 1.27 2014/06/25 23:22:18 szptvlfn Exp $
 .\"
 .\" Copyright (c) 2007-2009 Antti Kantee.  All rights reserved.
 .\"
@@ -198,7 +198,7 @@ Do not expect the file system to behave 
 .Pp
 Depending on if the server supports the
 .Xr sftp 1
-stavfs protocol extension,
+statvfs protocol extension,
 free disk space may be displayed for the mount by
 .Xr df 1 .
 This information reflects the status at the server's mountpoint



CVS commit: src/sys/dev/usb

2014-06-25 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Jun 25 21:23:03 UTC 2014

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

Log Message:
Remove a couple of items


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/dev/usb/TODO

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/TODO
diff -u src/sys/dev/usb/TODO:1.44 src/sys/dev/usb/TODO:1.45
--- src/sys/dev/usb/TODO:1.44	Sat Dec  7 08:01:51 2013
+++ src/sys/dev/usb/TODO	Wed Jun 25 21:23:03 2014
@@ -4,8 +4,6 @@ Some things that need to be done:
 High priority:
 --
 
-On a short control transfer the status phase needs to be executed anyway.
-
 Fix flow control in ucom (copy from com driver).
 
 Use some encapsulation in the upl driver to allow multiple protocols.
@@ -61,8 +59,6 @@ Stylistic changes:
 	use usb_ and usbd_ consistently
 	rearrange the contents and names of some files (Nick)
 
-Use splsoftusb() or a thread to deliver callbacks.
-
 Add threads to the Ethernet drivers.
 
 Change what's done at watchdog timeout inb if_{a,c,k}ue.c; what we have



CVS commit: src/sys/net

2014-06-25 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Wed Jun 25 19:32:37 UTC 2014

Modified Files:
src/sys/net: bpfjit.h

Log Message:
Fix copyright years.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/net/bpfjit.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/net/bpfjit.h
diff -u src/sys/net/bpfjit.h:1.3 src/sys/net/bpfjit.h:1.4
--- src/sys/net/bpfjit.h:1.3	Tue Jun 24 10:53:30 2014
+++ src/sys/net/bpfjit.h	Wed Jun 25 19:32:37 2014
@@ -1,7 +1,7 @@
-/*	$NetBSD: bpfjit.h,v 1.3 2014/06/24 10:53:30 alnsn Exp $	*/
+/*	$NetBSD: bpfjit.h,v 1.4 2014/06/25 19:32:37 alnsn Exp $	*/
 
 /*-
- * Copyright (c) 2011-2012,2014 Alexander Nasonov.
+ * Copyright (c) 2011-2014 Alexander Nasonov.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without



CVS commit: src/distrib/sets/lists

2014-06-25 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Wed Jun 25 19:20:47 UTC 2014

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

Log Message:
Add new libbpfjit tests.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.573 -r1.574 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/debug/mi
diff -u src/distrib/sets/lists/debug/mi:1.62 src/distrib/sets/lists/debug/mi:1.63
--- src/distrib/sets/lists/debug/mi:1.62	Mon Jun 23 10:53:20 2014
+++ src/distrib/sets/lists/debug/mi	Wed Jun 25 19:20:46 2014
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.62 2014/06/23 10:53:20 shm Exp $
+# $NetBSD: mi,v 1.63 2014/06/25 19:20:46 alnsn Exp $
 
 ./etc/mtree/set.debug   comp-sys-root
 ./usr/lib/i18n/libBIG5_g.a			comp-c-debuglib		debuglib
@@ -1775,6 +1775,8 @@
 ./usr/libdata/debug/usr/tests/lib/libbluetooth/t_sdp_put.debug		tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libbluetooth/t_sdp_set.debug		tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libbpfjit/t_bpfjit.debug		tests-lib-debug		debug,atf,sljit
+./usr/libdata/debug/usr/tests/lib/libbpfjit/t_extmem.debug		tests-lib-debug		debug,atf,sljit
+./usr/libdata/debug/usr/tests/lib/libbpfjit/t_cop.debug			tests-lib-debug		debug,atf,sljit
 ./usr/libdata/debug/usr/tests/lib/libc/c063/t_faccessat.debug		tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/c063/t_fchmodat.debug		tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/c063/t_fchownat.debug		tests-lib-debug		debug,atf

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.573 src/distrib/sets/lists/tests/mi:1.574
--- src/distrib/sets/lists/tests/mi:1.573	Mon Jun 23 10:53:20 2014
+++ src/distrib/sets/lists/tests/mi	Wed Jun 25 19:20:46 2014
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.573 2014/06/23 10:53:20 shm Exp $
+# $NetBSD: mi,v 1.574 2014/06/25 19:20:46 alnsn Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -2297,6 +2297,8 @@
 ./usr/tests/lib/libbpfjit/Atffile		tests-lib-tests		atf,sljit
 ./usr/tests/lib/libbpfjit/Kyuafile		tests-lib-tests		atf,sljit,kyua
 ./usr/tests/lib/libbpfjit/t_bpfjit		tests-lib-tests		atf,sljit
+./usr/tests/lib/libbpfjit/t_extmem		tests-lib-tests		atf,sljit
+./usr/tests/lib/libbpfjit/t_cop			tests-lib-tests		atf,sljit
 ./usr/tests/lib/libctests-lib-tests
 ./usr/tests/lib/libc/Atffile			tests-lib-tests		atf
 ./usr/tests/lib/libc/Kyuafile			tests-lib-tests		atf,kyua



CVS commit: src/tests/lib/libbpfjit

2014-06-25 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Wed Jun 25 19:13:27 UTC 2014

Modified Files:
src/tests/lib/libbpfjit: Makefile

Log Message:
Add t_extmem test.


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

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

Modified files:

Index: src/tests/lib/libbpfjit/Makefile
diff -u src/tests/lib/libbpfjit/Makefile:1.4 src/tests/lib/libbpfjit/Makefile:1.5
--- src/tests/lib/libbpfjit/Makefile:1.4	Wed Jun 25 18:04:44 2014
+++ src/tests/lib/libbpfjit/Makefile	Wed Jun 25 19:13:27 2014
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.4 2014/06/25 18:04:44 alnsn Exp $
+# $NetBSD: Makefile,v 1.5 2014/06/25 19:13:27 alnsn Exp $
 
 .include 
 .include <../../../external/bsd/sljit/Makefile.inc>
@@ -6,6 +6,7 @@
 TESTSDIR=	${TESTSBASE}/lib/libbpfjit
 
 TESTS_C+=	t_bpfjit
+TESTS_C+=	t_extmem
 TESTS_C+=	t_cop
 
 # XXX this variable doesn't belong to here



CVS commit: src/tests/lib/libbpfjit

2014-06-25 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Wed Jun 25 19:13:03 UTC 2014

Added Files:
src/tests/lib/libbpfjit: t_extmem.c

Log Message:
Add external memory tests.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/tests/lib/libbpfjit/t_extmem.c

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

Added files:

Index: src/tests/lib/libbpfjit/t_extmem.c
diff -u /dev/null src/tests/lib/libbpfjit/t_extmem.c:1.1
--- /dev/null	Wed Jun 25 19:13:03 2014
+++ src/tests/lib/libbpfjit/t_extmem.c	Wed Jun 25 19:13:03 2014
@@ -0,0 +1,479 @@
+/*	$NetBSD: t_extmem.c,v 1.1 2014/06/25 19:13:03 alnsn Exp $ */
+
+/*-
+ * Copyright (c) 2014 Alexander Nasonov.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in
+ *the documentation and/or other materials provided with the
+ *distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE 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 
+__RCSID("$NetBSD: t_extmem.c,v 1.1 2014/06/25 19:13:03 alnsn Exp $");
+
+#include 
+#include 
+#include 
+
+#define __BPF_PRIVATE
+#include 
+#include 
+
+static uint32_t retM(const bpf_ctx_t *bc, bpf_args_t *args, uint32_t A);
+
+static const bpf_copfunc_t copfuncs[] = {
+	&retM
+};
+
+static const bpf_ctx_t ctx = {
+	.copfuncs = copfuncs,
+	.nfuncs = sizeof(copfuncs) / sizeof(copfuncs[0]),
+	.extwords = 4,
+	.preinited = BPF_MEMWORD_INIT(0) | BPF_MEMWORD_INIT(3),
+};
+
+static uint32_t
+retM(const bpf_ctx_t *bc, bpf_args_t *args, uint32_t A)
+{
+
+	return args->mem[(uintptr_t)args->arg];
+}
+
+
+ATF_TC(bpfjit_extmem_load_default);
+ATF_TC_HEAD(bpfjit_extmem_load_default, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test that external memory "
+	"is zero initialized by default");
+}
+
+ATF_TC_BODY(bpfjit_extmem_load_default, tc)
+{
+	static struct bpf_insn insns[] = {
+		BPF_STMT(BPF_LD+BPF_MEM, 1),
+		BPF_STMT(BPF_RET+BPF_A, 0)
+	};
+
+	bpfjit_func_t code;
+	uint8_t pkt[1] = { 0 };
+	uint32_t mem[ctx.extwords];
+
+	/* Pre-inited words. */
+	mem[0] = 0;
+	mem[3] = 3;
+
+	bpf_args_t args = {
+		.pkt = pkt,
+		.buflen = sizeof(pkt),
+		.wirelen = sizeof(pkt),
+		.mem = mem,
+	};
+
+	size_t insn_count = sizeof(insns) / sizeof(insns[0]);
+
+	code = bpfjit_generate_code(&ctx, insns, insn_count);
+	ATF_REQUIRE(code != NULL);
+
+	ATF_CHECK(code(&ctx, &args) == 0);
+
+	bpfjit_free_code(code);
+}
+
+ATF_TC(bpfjit_extmem_load_preinited);
+ATF_TC_HEAD(bpfjit_extmem_load_preinited, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test a load of external "
+	"pre-initialized memory");
+}
+
+ATF_TC_BODY(bpfjit_extmem_load_preinited, tc)
+{
+	static struct bpf_insn insns[] = {
+		BPF_STMT(BPF_LD+BPF_MEM, 3),
+		BPF_STMT(BPF_RET+BPF_A, 0)
+	};
+
+	bpfjit_func_t code;
+	uint8_t pkt[1] = { 0 };
+	uint32_t mem[ctx.extwords];
+
+	/* Pre-inited words. */
+	mem[0] = 0;
+	mem[3] = 3;
+
+	bpf_args_t args = {
+		.pkt = pkt,
+		.buflen = sizeof(pkt),
+		.wirelen = sizeof(pkt),
+		.mem = mem,
+	};
+
+	size_t insn_count = sizeof(insns) / sizeof(insns[0]);
+
+	code = bpfjit_generate_code(&ctx, insns, insn_count);
+	ATF_REQUIRE(code != NULL);
+
+	ATF_CHECK(code(&ctx, &args) == 3);
+
+	bpfjit_free_code(code);
+}
+
+ATF_TC(bpfjit_extmem_invalid_load);
+ATF_TC_HEAD(bpfjit_extmem_invalid_load, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test that out-of-range load "
+	"fails validation");
+}
+
+ATF_TC_BODY(bpfjit_extmem_invalid_load, tc)
+{
+	static struct bpf_insn insns[] = {
+		BPF_STMT(BPF_LD+BPF_MEM, 4),
+		BPF_STMT(BPF_RET+BPF_A, 0)
+	};
+
+	size_t insn_count = sizeof(insns) / sizeof(insns[0]);
+
+	ATF_CHECK(bpfjit_generate_code(&ctx, insns, insn_count) == NULL);
+}
+
+ATF_TC(bpfjit_extmem_store);
+ATF_TC_HEAD(bpfjit_extmem_store, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test stores to external memory");
+}
+
+ATF_TC_BODY(bpfjit_extmem_store, tc)
+

CVS commit: src/tests/lib/libbpfjit

2014-06-25 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Wed Jun 25 18:16:40 UTC 2014

Modified Files:
src/tests/lib/libbpfjit: t_cop.c

Log Message:
Fix copyright. These tests are based on tests created in 2013 on github.com.

https://github.com/alnsn/bpfjit , files test/test_cop{,x}.c.


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

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

Modified files:

Index: src/tests/lib/libbpfjit/t_cop.c
diff -u src/tests/lib/libbpfjit/t_cop.c:1.1 src/tests/lib/libbpfjit/t_cop.c:1.2
--- src/tests/lib/libbpfjit/t_cop.c:1.1	Wed Jun 25 18:04:05 2014
+++ src/tests/lib/libbpfjit/t_cop.c	Wed Jun 25 18:16:40 2014
@@ -1,7 +1,7 @@
-/*	$NetBSD: t_cop.c,v 1.1 2014/06/25 18:04:05 alnsn Exp $ */
+/*	$NetBSD: t_cop.c,v 1.2 2014/06/25 18:16:40 alnsn Exp $ */
 
 /*-
- * Copyright (c) 2014 Alexander Nasonov.
+ * Copyright (c) 2013-2014 Alexander Nasonov.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_cop.c,v 1.1 2014/06/25 18:04:05 alnsn Exp $");
+__RCSID("$NetBSD: t_cop.c,v 1.2 2014/06/25 18:16:40 alnsn Exp $");
 
 #include 
 #include 



CVS commit: src/tests/lib/libbpfjit

2014-06-25 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Wed Jun 25 18:04:44 UTC 2014

Modified Files:
src/tests/lib/libbpfjit: Makefile

Log Message:
Add t_cop test.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libbpfjit/Makefile

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

Modified files:

Index: src/tests/lib/libbpfjit/Makefile
diff -u src/tests/lib/libbpfjit/Makefile:1.3 src/tests/lib/libbpfjit/Makefile:1.4
--- src/tests/lib/libbpfjit/Makefile:1.3	Tue Jun 17 19:26:18 2014
+++ src/tests/lib/libbpfjit/Makefile	Wed Jun 25 18:04:44 2014
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.3 2014/06/17 19:26:18 alnsn Exp $
+# $NetBSD: Makefile,v 1.4 2014/06/25 18:04:44 alnsn Exp $
 
 .include 
 .include <../../../external/bsd/sljit/Makefile.inc>
@@ -6,6 +6,7 @@
 TESTSDIR=	${TESTSBASE}/lib/libbpfjit
 
 TESTS_C+=	t_bpfjit
+TESTS_C+=	t_cop
 
 # XXX this variable doesn't belong to here
 LIBBPFJITDIR!=	cd ${NETBSDSRCDIR}/lib/libbpfjit && ${PRINTOBJDIR}



CVS commit: src/tests/lib/libbpfjit

2014-06-25 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Wed Jun 25 18:04:05 UTC 2014

Added Files:
src/tests/lib/libbpfjit: t_cop.c

Log Message:
Add BPF_COP and BPF_COPX tests.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/tests/lib/libbpfjit/t_cop.c

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

Added files:

Index: src/tests/lib/libbpfjit/t_cop.c
diff -u /dev/null src/tests/lib/libbpfjit/t_cop.c:1.1
--- /dev/null	Wed Jun 25 18:04:05 2014
+++ src/tests/lib/libbpfjit/t_cop.c	Wed Jun 25 18:04:05 2014
@@ -0,0 +1,572 @@
+/*	$NetBSD: t_cop.c,v 1.1 2014/06/25 18:04:05 alnsn Exp $ */
+
+/*-
+ * Copyright (c) 2014 Alexander Nasonov.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in
+ *the documentation and/or other materials provided with the
+ *distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE 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 
+__RCSID("$NetBSD: t_cop.c,v 1.1 2014/06/25 18:04:05 alnsn Exp $");
+
+#include 
+#include 
+#include 
+
+#define __BPF_PRIVATE
+#include 
+#include 
+
+static uint32_t retA(const bpf_ctx_t *bc, bpf_args_t *args, uint32_t A);
+static uint32_t retBL(const bpf_ctx_t *bc, bpf_args_t *args, uint32_t A);
+static uint32_t retWL(const bpf_ctx_t *bc, bpf_args_t *args, uint32_t A);
+static uint32_t retNF(const bpf_ctx_t *bc, bpf_args_t *args, uint32_t A);
+static uint32_t setARG(const bpf_ctx_t *bc, bpf_args_t *args, uint32_t A);
+
+static const bpf_copfunc_t copfuncs[] = {
+	&retA,
+	&retBL,
+	&retWL,
+	&retNF,
+	&setARG
+};
+
+static const bpf_ctx_t ctx = {
+	.copfuncs = copfuncs,
+	.nfuncs = sizeof(copfuncs) / sizeof(copfuncs[0]),
+	.extwords = 0
+};
+
+static uint32_t
+retA(const bpf_ctx_t *bc, bpf_args_t *args, uint32_t A)
+{
+
+	return A;
+}
+
+static uint32_t
+retBL(const bpf_ctx_t *bc, bpf_args_t *args, uint32_t A)
+{
+
+	return args->buflen;
+}
+
+static uint32_t
+retWL(const bpf_ctx_t *bc, bpf_args_t *args, uint32_t A)
+{
+
+	return args->wirelen;
+}
+
+static uint32_t
+retNF(const bpf_ctx_t *bc, bpf_args_t *args, uint32_t A)
+{
+
+	return bc->nfuncs;
+}
+
+/*
+ * COP function with a side effect.
+ */
+static uint32_t
+setARG(const bpf_ctx_t *bc, bpf_args_t *args, uint32_t A)
+{
+	bool *arg = (bool *)args->arg;
+	bool old = *arg;
+
+	*arg = true;
+	return old;
+}
+
+ATF_TC(bpfjit_cop_no_ctx);
+ATF_TC_HEAD(bpfjit_cop_no_ctx, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test that bpf program with BPF_COP "
+	"instruction isn't valid without a context");
+}
+
+ATF_TC_BODY(bpfjit_cop_no_ctx, tc)
+{
+	static struct bpf_insn insns[] = {
+		BPF_STMT(BPF_MISC+BPF_COP, 0),
+		BPF_STMT(BPF_RET+BPF_K, 7)
+	};
+
+	bpfjit_func_t code;
+
+	size_t insn_count = sizeof(insns) / sizeof(insns[0]);
+
+	ATF_CHECK(!bpf_validate(insns, insn_count));
+
+	code = bpfjit_generate_code(NULL, insns, insn_count);
+	ATF_CHECK(code == NULL);
+}
+
+ATF_TC(bpfjit_cop_ret_A);
+ATF_TC_HEAD(bpfjit_cop_ret_A, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test coprocessor function "
+	"that returns a content of the A register");
+}
+
+ATF_TC_BODY(bpfjit_cop_ret_A, tc)
+{
+	static struct bpf_insn insns[] = {
+		BPF_STMT(BPF_LD+BPF_IMM, 13),
+		BPF_STMT(BPF_MISC+BPF_COP, 0), // retA
+		BPF_STMT(BPF_RET+BPF_A, 0)
+	};
+
+	bpfjit_func_t code;
+	uint8_t pkt[1] = { 0 };
+	bpf_args_t args = {
+		.pkt = pkt,
+		.buflen = sizeof(pkt),
+		.wirelen = sizeof(pkt),
+	};
+
+	size_t insn_count = sizeof(insns) / sizeof(insns[0]);
+
+	code = bpfjit_generate_code(&ctx, insns, insn_count);
+	ATF_REQUIRE(code != NULL);
+
+	ATF_CHECK(code(&ctx, &args) == 13);
+
+	bpfjit_free_code(code);
+}
+
+ATF_TC(bpfjit_cop_ret_buflen);
+ATF_TC_HEAD(bpfjit_cop_ret_buflen, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test coprocessor function "
+	"that returns the buflen argument");
+}
+
+ATF_TC_BODY(bpfj

CVS commit: src/sys/kern

2014-06-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jun 25 17:10:39 UTC 2014

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

Log Message:
Provide a compatibility define for binaries generated before NetBSD 1.5.
These binaries contain multiple notes per section and their NetBSD version
value is 199905. This is enabled via COMPAT_OLDNOTE (default off).


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/kern/exec_elf.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/exec_elf.c
diff -u src/sys/kern/exec_elf.c:1.66 src/sys/kern/exec_elf.c:1.67
--- src/sys/kern/exec_elf.c:1.66	Thu May 15 15:37:22 2014
+++ src/sys/kern/exec_elf.c	Wed Jun 25 13:10:39 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec_elf.c,v 1.66 2014/05/15 19:37:22 christos Exp $	*/
+/*	$NetBSD: exec_elf.c,v 1.67 2014/06/25 17:10:39 christos Exp $	*/
 
 /*-
  * Copyright (c) 1994, 2000, 2005 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: exec_elf.c,v 1.66 2014/05/15 19:37:22 christos Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exec_elf.c,v 1.67 2014/06/25 17:10:39 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pax.h"
@@ -870,6 +870,10 @@ netbsd_elf_signature(struct lwp *l, stru
 	int error;
 	int isnetbsd = 0;
 	char *ndata, *ndesc;
+#ifdef COMPAT_OLDNOTE
+	int compat_oldnote = -1;
+#endif
+	
 #ifdef DIAGNOSTIC
 	const char *badnote;
 #define BADNOTE(n) badnote = (n)
@@ -919,6 +923,9 @@ netbsd_elf_signature(struct lwp *l, stru
 		roundup(np->n_descsz, 4);
 		if (nsize != shp->sh_size) {
 			BADNOTE("note size");
+#ifdef COMPAT_OLDNOTE
+			if (nsize > shp->sh_size || compat_oldnote == 0)
+#endif
 			goto bad;
 		}
 		ndesc = ndata + roundup(np->n_namesz, 4);
@@ -933,6 +940,9 @@ netbsd_elf_signature(struct lwp *l, stru
 memcpy(&epp->ep_osversion, ndesc,
 ELF_NOTE_NETBSD_DESCSZ);
 isnetbsd = 1;
+#ifdef COMPAT_OLDNOTE
+compat_oldnote = epp->ep_osversion == 199905;
+#endif
 break;
 			}
 
@@ -944,6 +954,10 @@ netbsd_elf_signature(struct lwp *l, stru
 			memcmp(ndata, ELF_NOTE_SUSE_NAME,
 			ELF_NOTE_SUSE_NAMESZ) == 0)
 break;
+#ifdef COMPAT_OLDNOTE
+			if (compat_oldnote == 1)
+break;
+#endif
 			BADNOTE("NetBSD tag");
 			goto bad;
 



CVS commit: src/sys/compat/linux/common

2014-06-25 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Wed Jun 25 16:38:53 UTC 2014

Modified Files:
src/sys/compat/linux/common: linux_file.c

Log Message:
Add support for more open flags that have a native equivalent
(O_NONBLOCK, O_DIRECT and O_NOFOLLOW).
Translate native EFTYPE error (missing on Linux) to expected ELOOP;
when opening symlinks with flag O_NOFOLLOW.


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/sys/compat/linux/common/linux_file.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_file.c
diff -u src/sys/compat/linux/common/linux_file.c:1.112 src/sys/compat/linux/common/linux_file.c:1.113
--- src/sys/compat/linux/common/linux_file.c:1.112	Sun Jun  1 13:42:12 2014
+++ src/sys/compat/linux/common/linux_file.c	Wed Jun 25 16:38:53 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_file.c,v 1.112 2014/06/01 13:42:12 njoly Exp $	*/
+/*	$NetBSD: linux_file.c,v 1.113 2014/06/25 16:38:53 njoly Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1998, 2008 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_file.c,v 1.112 2014/06/01 13:42:12 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_file.c,v 1.113 2014/06/25 16:38:53 njoly Exp $");
 
 #include 
 #include 
@@ -93,15 +93,19 @@ linux_to_bsd_ioflags(int lflags)
 	res |= cvtto_bsd_mask(lflags, LINUX_O_WRONLY, O_WRONLY);
 	res |= cvtto_bsd_mask(lflags, LINUX_O_RDONLY, O_RDONLY);
 	res |= cvtto_bsd_mask(lflags, LINUX_O_RDWR, O_RDWR);
+
 	res |= cvtto_bsd_mask(lflags, LINUX_O_CREAT, O_CREAT);
 	res |= cvtto_bsd_mask(lflags, LINUX_O_EXCL, O_EXCL);
 	res |= cvtto_bsd_mask(lflags, LINUX_O_NOCTTY, O_NOCTTY);
 	res |= cvtto_bsd_mask(lflags, LINUX_O_TRUNC, O_TRUNC);
+	res |= cvtto_bsd_mask(lflags, LINUX_O_APPEND, O_APPEND);
+	res |= cvtto_bsd_mask(lflags, LINUX_O_NONBLOCK, O_NONBLOCK);
 	res |= cvtto_bsd_mask(lflags, LINUX_O_NDELAY, O_NDELAY);
 	res |= cvtto_bsd_mask(lflags, LINUX_O_SYNC, O_FSYNC);
 	res |= cvtto_bsd_mask(lflags, LINUX_FASYNC, O_ASYNC);
-	res |= cvtto_bsd_mask(lflags, LINUX_O_APPEND, O_APPEND);
+	res |= cvtto_bsd_mask(lflags, LINUX_O_DIRECT, O_DIRECT);
 	res |= cvtto_bsd_mask(lflags, LINUX_O_DIRECTORY, O_DIRECTORY);
+	res |= cvtto_bsd_mask(lflags, LINUX_O_NOFOLLOW, O_NOFOLLOW);
 	res |= cvtto_bsd_mask(lflags, LINUX_O_CLOEXEC, O_CLOEXEC);
 
 	return res;
@@ -115,15 +119,19 @@ bsd_to_linux_ioflags(int bflags)
 	res |= cvtto_linux_mask(bflags, O_WRONLY, LINUX_O_WRONLY);
 	res |= cvtto_linux_mask(bflags, O_RDONLY, LINUX_O_RDONLY);
 	res |= cvtto_linux_mask(bflags, O_RDWR, LINUX_O_RDWR);
+
 	res |= cvtto_linux_mask(bflags, O_CREAT, LINUX_O_CREAT);
 	res |= cvtto_linux_mask(bflags, O_EXCL, LINUX_O_EXCL);
 	res |= cvtto_linux_mask(bflags, O_NOCTTY, LINUX_O_NOCTTY);
 	res |= cvtto_linux_mask(bflags, O_TRUNC, LINUX_O_TRUNC);
+	res |= cvtto_linux_mask(bflags, O_APPEND, LINUX_O_APPEND);
+	res |= cvtto_linux_mask(bflags, O_NONBLOCK, LINUX_O_NONBLOCK);
 	res |= cvtto_linux_mask(bflags, O_NDELAY, LINUX_O_NDELAY);
 	res |= cvtto_linux_mask(bflags, O_FSYNC, LINUX_O_SYNC);
 	res |= cvtto_linux_mask(bflags, O_ASYNC, LINUX_FASYNC);
-	res |= cvtto_linux_mask(bflags, O_APPEND, LINUX_O_APPEND);
+	res |= cvtto_linux_mask(bflags, O_DIRECT, LINUX_O_DIRECT);
 	res |= cvtto_linux_mask(bflags, O_DIRECTORY, LINUX_O_DIRECTORY);
+	res |= cvtto_linux_mask(bflags, O_NOFOLLOW, LINUX_O_NOFOLLOW);
 	res |= cvtto_linux_mask(bflags, O_CLOEXEC, LINUX_O_CLOEXEC);
 
 	return res;
@@ -204,7 +212,7 @@ linux_sys_open(struct lwp *l, const stru
 	SCARG(&boa, mode) = SCARG(uap, mode);
 
 	if ((error = sys_open(l, &boa, retval)))
-		return error;
+		return (error == EFTYPE) ? ELOOP : error;
 
 	linux_open_ctty(l, fl, *retval);
 	return 0;
@@ -230,7 +238,7 @@ linux_sys_openat(struct lwp *l, const st
 	SCARG(&boa, mode) = SCARG(uap, mode);
 
 	if ((error = sys_openat(l, &boa, retval)))
-		return error;
+		return (error == EFTYPE) ? ELOOP : error;
 
 	linux_open_ctty(l, fl, *retval);
 	return 0;



CVS commit: src/sys/kern

2014-06-25 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Jun 25 16:35:13 UTC 2014

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

Log Message:
1) Make clear that we want the space allocated for the KMEM_SIZE header to be
   aligned, by using kmem_roundup_size(). There's no functional difference with
   the current MAX().

2) If there isn't enough space in the page padding for the red zone, allocate
   one more page, not just 2 bytes. We only poison 1 or 2 bytes in this page,
   depending on the space left in the previous page. That way 'allocsz' is
   properly aligned. Again, there's no functional difference since the shift
   already handles it correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/kern/subr_kmem.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/subr_kmem.c
diff -u src/sys/kern/subr_kmem.c:1.55 src/sys/kern/subr_kmem.c:1.56
--- src/sys/kern/subr_kmem.c:1.55	Wed Jun 25 16:05:22 2014
+++ src/sys/kern/subr_kmem.c	Wed Jun 25 16:35:12 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_kmem.c,v 1.55 2014/06/25 16:05:22 maxv Exp $	*/
+/*	$NetBSD: subr_kmem.c,v 1.56 2014/06/25 16:35:12 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -69,7 +69,7 @@
 
 /*
  * KMEM_REDZONE: detect overrun bugs.
- *	Add a 2-byte pattern (allocate some more bytes if needed) at the end
+ *	Add a 2-byte pattern (allocate one more page if needed) at the end
  *	of each allocated buffer. Check this pattern on kmem_free.
  *
  * KMEM_POISON: detect modify-after-free bugs.
@@ -90,7 +90,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_kmem.c,v 1.55 2014/06/25 16:05:22 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_kmem.c,v 1.56 2014/06/25 16:35:12 maxv Exp $");
 
 #include 
 #include 
@@ -196,7 +196,7 @@ static void kmem_redzone_check(void *p, 
 #endif /* defined(KMEM_REDZONE) */
 
 #if defined(KMEM_SIZE)
-#define	SIZE_SIZE	(MAX(KMEM_ALIGN, sizeof(size_t)))
+#define	SIZE_SIZE	kmem_roundup_size(sizeof(size_t))
 static void kmem_size_set(void *, size_t);
 static void kmem_size_check(void *, size_t);
 #else
@@ -244,8 +244,8 @@ kmem_intr_alloc(size_t requested_size, k
 #ifdef KMEM_REDZONE
 	if (size - requested_size < REDZONE_SIZE) {
 		/* If there isn't enough space in the page padding,
-		 * allocate two more bytes for the red zone. */
-		allocsz += REDZONE_SIZE;
+		 * allocate one more page for the red zone. */
+		allocsz += kmem_roundup_size(REDZONE_SIZE);
 	}
 #endif
 
@@ -322,7 +322,7 @@ kmem_intr_free(void *p, size_t requested
 
 #ifdef KMEM_REDZONE
 	if (size - requested_size < REDZONE_SIZE) {
-		allocsz += REDZONE_SIZE;
+		allocsz += kmem_roundup_size(REDZONE_SIZE);
 	}
 #endif
 



CVS commit: src/sys/compat/linux/arch

2014-06-25 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Wed Jun 25 16:30:42 UTC 2014

Modified Files:
src/sys/compat/linux/arch/alpha: linux_fcntl.h
src/sys/compat/linux/arch/amd64: linux_fcntl.h
src/sys/compat/linux/arch/arm: linux_fcntl.h
src/sys/compat/linux/arch/i386: linux_fcntl.h
src/sys/compat/linux/arch/m68k: linux_fcntl.h
src/sys/compat/linux/arch/mips: linux_fcntl.h
src/sys/compat/linux/arch/powerpc: linux_fcntl.h

Log Message:
Add a few missing open(2) flags (LINUX_O_*). Fix alpha wrong values.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/compat/linux/arch/alpha/linux_fcntl.h
cvs rdiff -u -r1.4 -r1.5 src/sys/compat/linux/arch/amd64/linux_fcntl.h
cvs rdiff -u -r1.4 -r1.5 src/sys/compat/linux/arch/arm/linux_fcntl.h
cvs rdiff -u -r1.7 -r1.8 src/sys/compat/linux/arch/i386/linux_fcntl.h
cvs rdiff -u -r1.4 -r1.5 src/sys/compat/linux/arch/m68k/linux_fcntl.h
cvs rdiff -u -r1.7 -r1.8 src/sys/compat/linux/arch/mips/linux_fcntl.h
cvs rdiff -u -r1.9 -r1.10 src/sys/compat/linux/arch/powerpc/linux_fcntl.h

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

Modified files:

Index: src/sys/compat/linux/arch/alpha/linux_fcntl.h
diff -u src/sys/compat/linux/arch/alpha/linux_fcntl.h:1.4 src/sys/compat/linux/arch/alpha/linux_fcntl.h:1.5
--- src/sys/compat/linux/arch/alpha/linux_fcntl.h:1.4	Tue Nov  2 18:01:25 2010
+++ src/sys/compat/linux/arch/alpha/linux_fcntl.h	Wed Jun 25 16:30:42 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_fcntl.h,v 1.4 2010/11/02 18:01:25 chs Exp $	*/
+/*	$NetBSD: linux_fcntl.h,v 1.5 2014/06/25 16:30:42 njoly Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -45,10 +45,14 @@
 #define LINUX_O_TRUNC		0x000400
 #define LINUX_O_EXCL		0x000800
 #define LINUX_O_NDELAY		LINUX_O_NONBLOCK
+#define LINUX_O_NOCTTY		0x001000
 #define LINUX_FASYNC		0x002000
 #define LINUX_O_SYNC		0x004000
-#define LINUX_O_NOCTTY		0x008000
-#define LINUX_O_DIRECTORY	0x04
+#define LINUX_O_DIRECTORY	0x008000
+#define LINUX_O_NOFOLLOW	0x01
+#define LINUX_O_LARGEFILE	0x02
+#define LINUX_O_DIRECT		0x08
+#define LINUX_O_NOATIME		0x10
 #define LINUX_O_CLOEXEC		0x20
 
 /* fcntl(2) operations */

Index: src/sys/compat/linux/arch/amd64/linux_fcntl.h
diff -u src/sys/compat/linux/arch/amd64/linux_fcntl.h:1.4 src/sys/compat/linux/arch/amd64/linux_fcntl.h:1.5
--- src/sys/compat/linux/arch/amd64/linux_fcntl.h:1.4	Tue Nov  2 18:01:25 2010
+++ src/sys/compat/linux/arch/amd64/linux_fcntl.h	Wed Jun 25 16:30:42 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_fcntl.h,v 1.4 2010/11/02 18:01:25 chs Exp $ */
+/*	$NetBSD: linux_fcntl.h,v 1.5 2014/06/25 16:30:42 njoly Exp $ */
 
 /*-
  * Copyright (c) 2005 Emmanuel Dreyfus, all rights reserved.
@@ -50,7 +50,11 @@
 #define LINUX_O_NDELAY		LINUX_O_NONBLOCK
 #define LINUX_O_SYNC		0x01000
 #define LINUX_FASYNC		0x02000
+#define LINUX_O_DIRECT		0x04000
+#define LINUX_O_LARGEFILE	0x08000
 #define LINUX_O_DIRECTORY	0x1
+#define LINUX_O_NOFOLLOW	0x2
+#define LINUX_O_NOATIME		0x4
 #define LINUX_O_CLOEXEC		0x8
 
 /* fcntl(2) operations */

Index: src/sys/compat/linux/arch/arm/linux_fcntl.h
diff -u src/sys/compat/linux/arch/arm/linux_fcntl.h:1.4 src/sys/compat/linux/arch/arm/linux_fcntl.h:1.5
--- src/sys/compat/linux/arch/arm/linux_fcntl.h:1.4	Tue Nov  2 18:01:25 2010
+++ src/sys/compat/linux/arch/arm/linux_fcntl.h	Wed Jun 25 16:30:42 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_fcntl.h,v 1.4 2010/11/02 18:01:25 chs Exp $	*/
+/*	$NetBSD: linux_fcntl.h,v 1.5 2014/06/25 16:30:42 njoly Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -49,6 +49,10 @@
 #define LINUX_O_SYNC		0x01000
 #define LINUX_FASYNC		0x02000
 #define LINUX_O_DIRECTORY	0x04000
+#define LINUX_O_NOFOLLOW	0x08000
+#define LINUX_O_DIRECT		0x1
+#define LINUX_O_LARGEFILE	0x2
+#define LINUX_O_NOATIME		0x4
 #define LINUX_O_CLOEXEC		0x8
 
 /* fcntl(2) operations */

Index: src/sys/compat/linux/arch/i386/linux_fcntl.h
diff -u src/sys/compat/linux/arch/i386/linux_fcntl.h:1.7 src/sys/compat/linux/arch/i386/linux_fcntl.h:1.8
--- src/sys/compat/linux/arch/i386/linux_fcntl.h:1.7	Tue Nov  2 18:01:26 2010
+++ src/sys/compat/linux/arch/i386/linux_fcntl.h	Wed Jun 25 16:30:42 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_fcntl.h,v 1.7 2010/11/02 18:01:26 chs Exp $	*/
+/*	$NetBSD: linux_fcntl.h,v 1.8 2014/06/25 16:30:42 njoly Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -48,7 +48,11 @@
 #define LINUX_O_NDELAY		LINUX_O_NONBLOCK
 #define LINUX_O_SYNC		0x01000
 #define LINUX_FASYNC		0x02000
+#define LINUX_O_DIRECT		0x04000
+#define LINUX_O_LARGEFILE	0x08000
 #define LINUX_O_DIRECTORY	0x1
+#define LINUX_O_NOFOLLOW	0x2
+#define LINUX_O_NOATIME		0x4
 #define LINUX_O_CLOEXEC		0x8
 
 /* fcntl(2) operations */

Index: src/sys/compat/linux/arch/m68k/linux_fcntl.h
diff -u src/sys/compat/linux/arch/m68k/linux_fcn

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

2014-06-25 Thread David Brownlee
Module Name:src
Committed By:   abs
Date:   Wed Jun 25 16:14:43 UTC 2014

Modified Files:
src/sys/arch/sun3/conf: DISKLESS

Log Message:
Enable ie0 in DISKLESS for sun3/110


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/sun3/conf/DISKLESS

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/sun3/conf/DISKLESS
diff -u src/sys/arch/sun3/conf/DISKLESS:1.68 src/sys/arch/sun3/conf/DISKLESS:1.69
--- src/sys/arch/sun3/conf/DISKLESS:1.68	Wed Jun  4 20:21:24 2014
+++ src/sys/arch/sun3/conf/DISKLESS	Wed Jun 25 16:14:43 2014
@@ -1,4 +1,4 @@
-# $NetBSD: DISKLESS,v 1.68 2014/06/04 20:21:24 abs Exp $
+# $NetBSD: DISKLESS,v 1.69 2014/06/25 16:14:43 abs Exp $
 
 # DISKLESS - Root and swap on NFS
 # Desktop machines only (3/50, 3/60, 3/110)
@@ -127,7 +127,7 @@ ms0	at zsc0 channel 1	# mouse
 #
 
 # Intel Ethernet (onboard, or VME)
-#ie0 at obio0 addr 0x0C ipl 3
+ie0 at obio0 addr 0x0C ipl 3
 #ie1 at vme2 addr 0xe88000 ipl 3 vect 0x75
 
 # Lance Ethernet (only onboard)



CVS commit: src/sys/kern

2014-06-25 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Jun 25 16:05:22 UTC 2014

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

Log Message:
Rephrase some comments and remove whitespaces. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/kern/subr_kmem.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/subr_kmem.c
diff -u src/sys/kern/subr_kmem.c:1.54 src/sys/kern/subr_kmem.c:1.55
--- src/sys/kern/subr_kmem.c:1.54	Tue Jun 24 07:28:23 2014
+++ src/sys/kern/subr_kmem.c	Wed Jun 25 16:05:22 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_kmem.c,v 1.54 2014/06/24 07:28:23 maxv Exp $	*/
+/*	$NetBSD: subr_kmem.c,v 1.55 2014/06/25 16:05:22 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -56,54 +56,41 @@
  */
 
 /*
- * Allocator of kernel wired memory.
+ * Allocator of kernel wired memory. This allocator has some debug features
+ * enabled with "option DIAGNOSTIC" and "option DEBUG".
  */
 
 /*
- * This allocator has some debug features enabled with "option DEBUG" and
- * "option DIAGNOSTIC".
- *
- * KMEM_POISON
- *	Try to detect modify-after-free bugs.
- *
- *	Fill freed (in the sense of kmem_free) memory with a garbage pattern.
- *	Check the pattern on allocation.
- *
- * KMEM_REDZONE
- *	Try to detect overrun bugs.
- *
- *	Add a 2-byte pattern (allocate some more bytes if needed) at the end
- *	of each allocated buffer. Check this pattern on kmem_free.
- *
- * KMEM_SIZE
- *	Try to detect alloc/free size mismatch bugs.
- *
- *	Prefix each allocations with a fixed-sized header and record
- *	the exact user-requested allocation size in it.
- *	When freeing, compare it with kmem_free's "size" argument.
- *
- * KMEM_GUARD
- *	See the below "kmguard" section.
+ * KMEM_SIZE: detect alloc/free size mismatch bugs.
+ *	Prefix each allocations with a fixed-sized header and record the exact
+ *	user-requested allocation size in it. When freeing, compare it with
+ *	kmem_free's "size" argument.
  */
 
 /*
- * kmguard
+ * KMEM_REDZONE: detect overrun bugs.
+ *	Add a 2-byte pattern (allocate some more bytes if needed) at the end
+ *	of each allocated buffer. Check this pattern on kmem_free.
  *
- * A kernel with "option DEBUG" has "kmguard" debugging feature compiled in.
- * See the comment in uvm/uvm_kmguard.c for what kind of bugs it tries to
- * detect.  Even if compiled in, it's disabled by default because it's very
- * expensive.  You can enable it on boot by:
+ * KMEM_POISON: detect modify-after-free bugs.
+ *	Fill freed (in the sense of kmem_free) memory with a garbage pattern.
+ *	Check the pattern on allocation.
  *
- * 	boot -d
- * 	db> w kmem_guard_depth 0t3
- * 	db> c
+ * KMEM_GUARD
+ *	A kernel with "option DEBUG" has "kmguard" debugging feature compiled
+ *	in. See the comment in uvm/uvm_kmguard.c for what kind of bugs it tries
+ *	to detect.  Even if compiled in, it's disabled by default because it's
+ *	very expensive.  You can enable it on boot by:
+ *		boot -d
+ *		db> w kmem_guard_depth 0t3
+ *		db> c
  *
- * The default value of kmem_guard_depth is 0, which means disabled.
- * It can be changed by KMEM_GUARD_DEPTH kernel config option.
+ *	The default value of kmem_guard_depth is 0, which means disabled.
+ *	It can be changed by KMEM_GUARD_DEPTH kernel config option.
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_kmem.c,v 1.54 2014/06/24 07:28:23 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_kmem.c,v 1.55 2014/06/25 16:05:22 maxv Exp $");
 
 #include 
 #include 
@@ -266,7 +253,7 @@ kmem_intr_alloc(size_t requested_size, k
 	< kmem_cache_maxidx) {
 		pc = kmem_cache[index];
 	} else if ((index = ((allocsz - 1) >> KMEM_BIG_SHIFT))
-< kmem_cache_big_maxidx) {
+	< kmem_cache_big_maxidx) {
 		pc = kmem_cache_big[index];
 	} else {
 		int ret = uvm_km_kmem_alloc(kmem_va_arena,
@@ -343,7 +330,7 @@ kmem_intr_free(void *p, size_t requested
 	< kmem_cache_maxidx) {
 		pc = kmem_cache[index];
 	} else if ((index = ((allocsz - 1) >> KMEM_BIG_SHIFT))
-< kmem_cache_big_maxidx) {
+	< kmem_cache_big_maxidx) {
 		pc = kmem_cache_big[index];
 	} else {
 		FREECHECK_IN(&kmem_freecheck, p);
@@ -473,7 +460,7 @@ kmem_init(void)
 #endif
 	kmem_cache_maxidx = kmem_create_caches(kmem_cache_sizes,
 	kmem_cache, KMEM_MAXSIZE, KMEM_SHIFT, IPL_VM);
-   	kmem_cache_big_maxidx = kmem_create_caches(kmem_cache_big_sizes,
+	kmem_cache_big_maxidx = kmem_create_caches(kmem_cache_big_sizes,
 	kmem_cache_big, PAGE_SIZE, KMEM_BIG_SHIFT, IPL_VM);
 }
 



CVS commit: src/sys/dev/pci

2014-06-25 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jun 25 15:04:53 UTC 2014

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

Log Message:
No, that should be unsigned.


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 src/sys/dev/pci/agp_i810.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/agp_i810.c
diff -u src/sys/dev/pci/agp_i810.c:1.104 src/sys/dev/pci/agp_i810.c:1.105
--- src/sys/dev/pci/agp_i810.c:1.104	Wed Jun 25 13:10:27 2014
+++ src/sys/dev/pci/agp_i810.c	Wed Jun 25 15:04:53 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: agp_i810.c,v 1.104 2014/06/25 13:10:27 riastradh Exp $	*/
+/*	$NetBSD: agp_i810.c,v 1.105 2014/06/25 15:04:53 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2000 Doug Rabson
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: agp_i810.c,v 1.104 2014/06/25 13:10:27 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: agp_i810.c,v 1.105 2014/06/25 15:04:53 riastradh Exp $");
 
 #include 
 #include 
@@ -1094,7 +1094,7 @@ agp_i810_bind_page(struct agp_softc *sc,
 	if (offset < 0 || offset >= ((isc->gtt_size/4) << AGP_PAGE_SHIFT)) {
 #ifdef AGP_DEBUG
 		printf("%s: failed"
-		": offset 0x%08x, shift %d, entries %"PRIdMAX"\n",
+		": offset 0x%08x, shift %d, entries %"PRIuMAX"\n",
 		device_xname(sc->as_dev), (int)offset, AGP_PAGE_SHIFT,
 		(uintmax_t)isc->gtt_size/4);
 #endif



CVS commit: src/sys/net

2014-06-25 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Wed Jun 25 13:53:40 UTC 2014

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

Log Message:
Default initialize external memwords.

This change doesn't affect performance of valid bpf kernel programs
because bpf_filter_ext() checks that all memwords are initialized
explicitly.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/net/bpfjit.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/bpfjit.c
diff -u src/sys/net/bpfjit.c:1.17 src/sys/net/bpfjit.c:1.18
--- src/sys/net/bpfjit.c:1.17	Wed Jun 25 11:58:15 2014
+++ src/sys/net/bpfjit.c	Wed Jun 25 13:53:40 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: bpfjit.c,v 1.17 2014/06/25 11:58:15 alnsn Exp $	*/
+/*	$NetBSD: bpfjit.c,v 1.18 2014/06/25 13:53:40 alnsn Exp $	*/
 
 /*-
  * Copyright (c) 2011-2014 Alexander Nasonov.
@@ -31,9 +31,9 @@
 
 #include 
 #ifdef _KERNEL
-__KERNEL_RCSID(0, "$NetBSD: bpfjit.c,v 1.17 2014/06/25 11:58:15 alnsn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bpfjit.c,v 1.18 2014/06/25 13:53:40 alnsn Exp $");
 #else
-__RCSID("$NetBSD: bpfjit.c,v 1.17 2014/06/25 11:58:15 alnsn Exp $");
+__RCSID("$NetBSD: bpfjit.c,v 1.18 2014/06/25 13:53:40 alnsn Exp $");
 #endif
 
 #include 
@@ -1594,6 +1594,10 @@ bpfjit_generate_code(const bpf_ctx_t *bc
 	bpf_memword_init_t initmask;
 	int nscratches, ncopfuncs;
 
+	/* memory store location for initial zero initialization */
+	sljit_si mem_reg;
+	sljit_sw mem_off;
+
 	/* a list of jumps to out-of-bound return from a generated function */
 	struct sljit_jump **ret0;
 	size_t ret0_size, ret0_maxsize;
@@ -1665,7 +1669,10 @@ bpfjit_generate_code(const bpf_ctx_t *bc
 			goto fail;
 	}
 
-	if (extwords != 0) {
+	if (extwords == 0) {
+		mem_reg = SLJIT_MEM1(SLJIT_LOCALS_REG);
+		mem_off = offsetof(struct bpfjit_stack, mem);
+	} else {
 		/* copy "mem" argument from bpf_args to bpfjit_stack */
 		status = sljit_emit_op1(compiler,
 		SLJIT_MOV_P,
@@ -1681,11 +1688,10 @@ bpfjit_generate_code(const bpf_ctx_t *bc
 		BJ_TMP1REG, 0);
 		if (status != SLJIT_SUCCESS)
 			goto fail;
-	}
 
-	status = load_buf_buflen(compiler);
-	if (status != SLJIT_SUCCESS)
-		goto fail;
+		mem_reg = SLJIT_MEM1(BJ_TMP1REG);
+		mem_off = 0;
+	}
 
 	/*
 	 * Exclude pre-initialised external memory words but keep
@@ -1703,9 +1709,7 @@ bpfjit_generate_code(const bpf_ctx_t *bc
 			/* M[i] = 0; */
 			status = sljit_emit_op1(compiler,
 			SLJIT_MOV_UI,
-			SLJIT_MEM1(SLJIT_LOCALS_REG),
-			offsetof(struct bpfjit_stack, mem) +
-			i * sizeof(uint32_t),
+			mem_reg, mem_off + i * sizeof(uint32_t),
 			SLJIT_IMM, 0);
 			if (status != SLJIT_SUCCESS)
 goto fail;
@@ -1732,6 +1736,10 @@ bpfjit_generate_code(const bpf_ctx_t *bc
 			goto fail;
 	}
 
+	status = load_buf_buflen(compiler);
+	if (status != SLJIT_SUCCESS)
+		goto fail;
+
 	for (i = 0; i < insn_count; i++) {
 		if (insn_dat[i].unreachable)
 			continue;



CVS commit: src/sys/dev/pci

2014-06-25 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jun 25 13:10:27 UTC 2014

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

Log Message:
Fix integer type mismatch in debug printf.


To generate a diff of this commit:
cvs rdiff -u -r1.103 -r1.104 src/sys/dev/pci/agp_i810.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/agp_i810.c
diff -u src/sys/dev/pci/agp_i810.c:1.103 src/sys/dev/pci/agp_i810.c:1.104
--- src/sys/dev/pci/agp_i810.c:1.103	Thu Jun 12 18:46:32 2014
+++ src/sys/dev/pci/agp_i810.c	Wed Jun 25 13:10:27 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: agp_i810.c,v 1.103 2014/06/12 18:46:32 riastradh Exp $	*/
+/*	$NetBSD: agp_i810.c,v 1.104 2014/06/25 13:10:27 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2000 Doug Rabson
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: agp_i810.c,v 1.103 2014/06/12 18:46:32 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: agp_i810.c,v 1.104 2014/06/25 13:10:27 riastradh Exp $");
 
 #include 
 #include 
@@ -1093,9 +1093,10 @@ agp_i810_bind_page(struct agp_softc *sc,
 
 	if (offset < 0 || offset >= ((isc->gtt_size/4) << AGP_PAGE_SHIFT)) {
 #ifdef AGP_DEBUG
-		printf("%s: failed: offset 0x%08x, shift %d, entries %d\n",
+		printf("%s: failed"
+		": offset 0x%08x, shift %d, entries %"PRIdMAX"\n",
 		device_xname(sc->as_dev), (int)offset, AGP_PAGE_SHIFT,
-		isc->gtt_size/4);
+		(uintmax_t)isc->gtt_size/4);
 #endif
 		return EINVAL;
 	}



CVS commit: src/sys/net

2014-06-25 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Wed Jun 25 11:58:15 UTC 2014

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

Log Message:
New jitcode takes two arguments.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/net/bpfjit.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/bpfjit.c
diff -u src/sys/net/bpfjit.c:1.16 src/sys/net/bpfjit.c:1.17
--- src/sys/net/bpfjit.c:1.16	Wed Jun 25 11:13:28 2014
+++ src/sys/net/bpfjit.c	Wed Jun 25 11:58:15 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: bpfjit.c,v 1.16 2014/06/25 11:13:28 alnsn Exp $	*/
+/*	$NetBSD: bpfjit.c,v 1.17 2014/06/25 11:58:15 alnsn Exp $	*/
 
 /*-
  * Copyright (c) 2011-2014 Alexander Nasonov.
@@ -31,9 +31,9 @@
 
 #include 
 #ifdef _KERNEL
-__KERNEL_RCSID(0, "$NetBSD: bpfjit.c,v 1.16 2014/06/25 11:13:28 alnsn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bpfjit.c,v 1.17 2014/06/25 11:58:15 alnsn Exp $");
 #else
-__RCSID("$NetBSD: bpfjit.c,v 1.16 2014/06/25 11:13:28 alnsn Exp $");
+__RCSID("$NetBSD: bpfjit.c,v 1.17 2014/06/25 11:58:15 alnsn Exp $");
 #endif
 
 #include 
@@ -1650,7 +1650,7 @@ bpfjit_generate_code(const bpf_ctx_t *bc
 #endif
 
 	status = sljit_emit_enter(compiler,
-	3, nscratches, 3, sizeof(struct bpfjit_stack));
+	2, nscratches, 3, sizeof(struct bpfjit_stack));
 	if (status != SLJIT_SUCCESS)
 		goto fail;
 



CVS commit: src/sys/net

2014-06-25 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Wed Jun 25 11:13:28 UTC 2014

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

Log Message:
Use SLJIT_MOV_P to copy extmem pointer.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/net/bpfjit.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/bpfjit.c
diff -u src/sys/net/bpfjit.c:1.15 src/sys/net/bpfjit.c:1.16
--- src/sys/net/bpfjit.c:1.15	Wed Jun 25 01:21:36 2014
+++ src/sys/net/bpfjit.c	Wed Jun 25 11:13:28 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: bpfjit.c,v 1.15 2014/06/25 01:21:36 rmind Exp $	*/
+/*	$NetBSD: bpfjit.c,v 1.16 2014/06/25 11:13:28 alnsn Exp $	*/
 
 /*-
  * Copyright (c) 2011-2014 Alexander Nasonov.
@@ -31,9 +31,9 @@
 
 #include 
 #ifdef _KERNEL
-__KERNEL_RCSID(0, "$NetBSD: bpfjit.c,v 1.15 2014/06/25 01:21:36 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bpfjit.c,v 1.16 2014/06/25 11:13:28 alnsn Exp $");
 #else
-__RCSID("$NetBSD: bpfjit.c,v 1.15 2014/06/25 01:21:36 rmind Exp $");
+__RCSID("$NetBSD: bpfjit.c,v 1.16 2014/06/25 11:13:28 alnsn Exp $");
 #endif
 
 #include 
@@ -847,7 +847,7 @@ emit_memload(struct sljit_compiler* comp
 	} else {
 		/* copy extmem pointer to the tmp1 register */
 		status = sljit_emit_op1(compiler,
-		SLJIT_MOV_UI,
+		SLJIT_MOV_P,
 		BJ_TMP1REG, 0,
 		SLJIT_MEM1(SLJIT_LOCALS_REG),
 		offsetof(struct bpfjit_stack, extmem));
@@ -875,7 +875,7 @@ emit_memstore(struct sljit_compiler* com
 	} else {
 		/* copy extmem pointer to the tmp1 register */
 		status = sljit_emit_op1(compiler,
-		SLJIT_MOV_UI,
+		SLJIT_MOV_P,
 		BJ_TMP1REG, 0,
 		SLJIT_MEM1(SLJIT_LOCALS_REG),
 		offsetof(struct bpfjit_stack, extmem));



CVS commit: src/sys/net

2014-06-25 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Wed Jun 25 09:51:34 UTC 2014

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

Log Message:
Check "preinited" argument of bpf_set_extmem().


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/net/bpf_filter.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/bpf_filter.c
diff -u src/sys/net/bpf_filter.c:1.64 src/sys/net/bpf_filter.c:1.65
--- src/sys/net/bpf_filter.c:1.64	Tue Jun 24 22:27:40 2014
+++ src/sys/net/bpf_filter.c	Wed Jun 25 09:51:34 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: bpf_filter.c,v 1.64 2014/06/24 22:27:40 rmind Exp $	*/
+/*	$NetBSD: bpf_filter.c,v 1.65 2014/06/25 09:51:34 alnsn Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bpf_filter.c,v 1.64 2014/06/24 22:27:40 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bpf_filter.c,v 1.65 2014/06/25 09:51:34 alnsn Exp $");
 
 #if 0
 #if !(defined(lint) || defined(KERNEL))
@@ -79,7 +79,7 @@ bpf_set_cop(bpf_ctx_t *bc, const bpf_cop
 int
 bpf_set_extmem(bpf_ctx_t *bc, size_t nwords, bpf_memword_init_t preinited)
 {
-	if (nwords > BPF_MAX_MEMWORDS) {
+	if (nwords > BPF_MAX_MEMWORDS || (preinited >> nwords) != 0) {
 		return EINVAL;
 	}
 	bc->extwords = nwords;