CVS commit: src/lib/libdm

2011-03-01 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Mar  1 08:48:41 UTC 2011

Modified Files:
src/lib/libdm: dm.3

Log Message:
Whitespace nit.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/libdm/dm.3

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

Modified files:

Index: src/lib/libdm/dm.3
diff -u src/lib/libdm/dm.3:1.4 src/lib/libdm/dm.3:1.5
--- src/lib/libdm/dm.3:1.4	Mon Feb 28 23:23:08 2011
+++ src/lib/libdm/dm.3	Tue Mar  1 08:48:41 2011
@@ -1,4 +1,4 @@
-.\" $NetBSD: dm.3,v 1.4 2011/02/28 23:23:08 haad Exp $
+.\" $NetBSD: dm.3,v 1.5 2011/03/01 08:48:41 wiz Exp $
 .\"
 .\" Copyright (c) 2004,2009 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -218,10 +218,10 @@
 Set/fetch device status flags from the task dictionary.
 .Pp
 .Fn libdm_task_get_open_num
-Fetch number of opened devices from the kernel and return them as count .
+Fetch number of opened devices from the kernel and return them as count.
 .Pp
 .Fn libdm_task_get_target_num
-Fetch number of opened devices from the kernel and return them as count .
+Fetch number of opened devices from the kernel and return them as count.
 .Pp
 .Fn libdm_task_get_cmd_version
 Get the version of the dm driver in the kernel as array



CVS commit: src/tests/lib/librumphijack

2011-03-01 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Mar  1 08:54:18 UTC 2011

Modified Files:
src/tests/lib/librumphijack: h_client.c

Log Message:
Create a pipe on which to select.  selecting on STDIN_FILENO seems
to be succesful *sometimes* on some archs (i'm suspecting this is
in some way related to lib/libc/ttyio/t_ttyio failing).


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/lib/librumphijack/h_client.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/librumphijack/h_client.c
diff -u src/tests/lib/librumphijack/h_client.c:1.3 src/tests/lib/librumphijack/h_client.c:1.4
--- src/tests/lib/librumphijack/h_client.c:1.3	Sun Feb 20 23:45:46 2011
+++ src/tests/lib/librumphijack/h_client.c	Tue Mar  1 08:54:18 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: h_client.c,v 1.3 2011/02/20 23:45:46 pooka Exp $	*/
+/*	$NetBSD: h_client.c,v 1.4 2011/03/01 08:54:18 pooka Exp $	*/
 
 /*
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -50,21 +50,24 @@
 	if (strcmp(argv[1], "select_timeout") == 0) {
 		fd_set rfds;
 		struct timeval tv;
+		int pipefd[2];
 		int rv;
 
 		tv.tv_sec = 0;
 		tv.tv_usec = 1;
 
+		if (pipe(pipefd) == -1)
+			err(1, "pipe");
 		FD_ZERO(&rfds);
-		FD_SET(STDIN_FILENO, &rfds);
+		FD_SET(pipefd[0], &rfds);
 
-		rv = select(STDIN_FILENO+1, &rfds, NULL, NULL, &tv);
+		rv = select(pipefd[0]+1, &rfds, NULL, NULL, &tv);
 		if (rv == -1)
 			err(1, "select");
 		if (rv != 0)
 			errx(1, "select succesful");
 
-		if (FD_ISSET(STDIN_FILENO, &rfds))
+		if (FD_ISSET(pipefd[0], &rfds))
 			errx(1, "stdin fileno is still set");
 		exit(0);
 	} else if (strcmp(argv[1], "select_allunset") == 0) {



CVS commit: src

2011-03-01 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Tue Mar  1 09:17:07 UTC 2011

Modified Files:
src/etc/etc.sandpoint: MAKEDEV.conf
src/sys/arch/powerpc/conf: majors.powerpc
src/sys/arch/sandpoint/conf: files.sandpoint

Log Message:
Revert the major number for satmgr(4) back to 100 and allocate it from
majors.powerpc, as suggested by matt@.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/etc/etc.sandpoint/MAKEDEV.conf
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/powerpc/conf/majors.powerpc
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/sandpoint/conf/files.sandpoint

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

Modified files:

Index: src/etc/etc.sandpoint/MAKEDEV.conf
diff -u src/etc/etc.sandpoint/MAKEDEV.conf:1.10 src/etc/etc.sandpoint/MAKEDEV.conf:1.11
--- src/etc/etc.sandpoint/MAKEDEV.conf:1.10	Sat Feb 26 09:52:16 2011
+++ src/etc/etc.sandpoint/MAKEDEV.conf	Tue Mar  1 09:17:06 2011
@@ -1,4 +1,4 @@
-# $NetBSD: MAKEDEV.conf,v 1.10 2011/02/26 09:52:16 phx Exp $
+# $NetBSD: MAKEDEV.conf,v 1.11 2011/03/01 09:17:06 phx Exp $
 
 init)
 	makedev std tty00 tty01 opty ptm pty0
@@ -25,7 +25,7 @@
 	;;
 
 satmgr)
-	mkdev satmgr	c 144 0 620
+	mkdev satmgr	c 100 0 620
 	;;
 
 power)

Index: src/sys/arch/powerpc/conf/majors.powerpc
diff -u src/sys/arch/powerpc/conf/majors.powerpc:1.6 src/sys/arch/powerpc/conf/majors.powerpc:1.7
--- src/sys/arch/powerpc/conf/majors.powerpc:1.6	Sat May 29 22:48:57 2010
+++ src/sys/arch/powerpc/conf/majors.powerpc	Tue Mar  1 09:17:06 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: majors.powerpc,v 1.6 2010/05/29 22:48:57 phx Exp $
+#	$NetBSD: majors.powerpc,v 1.7 2011/03/01 09:17:06 phx Exp $
 #
 # Device majors for shared PowerPC
 #
@@ -90,6 +90,7 @@
 
 device-major	nsmb		char 98			nsmb
 device-major	xlcom		char 99			xlcom
+device-major	satmgr		char 100		satmgr
 
 # Majors up to 143 are reserved for machine-dependant drivers.
 # New machine-independent driver majors are assigned in 

Index: src/sys/arch/sandpoint/conf/files.sandpoint
diff -u src/sys/arch/sandpoint/conf/files.sandpoint:1.28 src/sys/arch/sandpoint/conf/files.sandpoint:1.29
--- src/sys/arch/sandpoint/conf/files.sandpoint:1.28	Sat Feb 26 09:52:16 2011
+++ src/sys/arch/sandpoint/conf/files.sandpoint	Tue Mar  1 09:17:07 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: files.sandpoint,v 1.28 2011/02/26 09:52:16 phx Exp $
+#	$NetBSD: files.sandpoint,v 1.29 2011/03/01 09:17:07 phx Exp $
 #
 # Motorola's "SandPoint" evaluation board and multiplied descendents.
 #
@@ -109,5 +109,3 @@
 file	arch/sandpoint/sandpoint/satmgr.c	satmgr
 
 include "arch/powerpc/conf/majors.powerpc"
-
-device-major	satmgr		char 144	satmgr



CVS commit: src/sys/rump/librump/rumpvfs

2011-03-01 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Mar  1 10:02:11 UTC 2011

Modified Files:
src/sys/rump/librump/rumpvfs: vm_vfs.c

Log Message:
Pass accurate protection info from ubc_uiomove() to the pager.
Fixes nfs{,ro}_fileio tests on at least sparc64 (and probably macppc
and other fat endian machines).

The problem was that nfs was fooled to thinking read() caused a
write fault because of VM_PROT_WRITE being unconditionally set and
therefore set NMODIFIED on a r/o file system.  It is absolutely
beyond me why the test worked on i386/amd64.  Incidentally, I seem
to have "misplaced" a few goats.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/rump/librump/rumpvfs/vm_vfs.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/rump/librump/rumpvfs/vm_vfs.c
diff -u src/sys/rump/librump/rumpvfs/vm_vfs.c:1.26 src/sys/rump/librump/rumpvfs/vm_vfs.c:1.27
--- src/sys/rump/librump/rumpvfs/vm_vfs.c:1.26	Sun Feb 27 13:37:39 2011
+++ src/sys/rump/librump/rumpvfs/vm_vfs.c	Tue Mar  1 10:02:11 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_vfs.c,v 1.26 2011/02/27 13:37:39 pooka Exp $	*/
+/*	$NetBSD: vm_vfs.c,v 1.27 2011/03/01 10:02:11 pooka Exp $	*/
 
 /*
  * Copyright (c) 2008 Antti Kantee.  All Rights Reserved.
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm_vfs.c,v 1.26 2011/02/27 13:37:39 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_vfs.c,v 1.27 2011/03/01 10:02:11 pooka Exp $");
 
 #include 
 
@@ -173,6 +173,7 @@
 	int npages = len2npages(uio->uio_offset, todo);
 	size_t pgalloc;
 	int i, rv, pagerflags;
+	vm_prot_t prot;
 
 	pgalloc = npages * sizeof(pgs);
 	pgs = kmem_alloc(pgalloc, KM_SLEEP);
@@ -183,13 +184,16 @@
 	if (flags & UBC_FAULTBUSY)
 		pagerflags |= PGO_OVERWRITE;
 
+	prot = VM_PROT_READ;
+	if (flags & UBC_WRITE)
+		prot |= VM_PROT_WRITE;
+
 	mutex_enter(&uobj->vmobjlock);
 	do {
 		npages = len2npages(uio->uio_offset, todo);
 		memset(pgs, 0, pgalloc);
 		rv = uobj->pgops->pgo_get(uobj, trunc_page(uio->uio_offset),
-		pgs, &npages, 0, VM_PROT_READ | VM_PROT_WRITE, 0,
-		pagerflags);
+		pgs, &npages, 0, prot, 0, pagerflags);
 		if (rv)
 			goto out;
 



CVS commit: src/lib/librumphijack

2011-03-01 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Mar  1 10:47:30 UTC 2011

Modified Files:
src/lib/librumphijack: hijack.c

Log Message:
comment


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/lib/librumphijack/hijack.c

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

Modified files:

Index: src/lib/librumphijack/hijack.c
diff -u src/lib/librumphijack/hijack.c:1.72 src/lib/librumphijack/hijack.c:1.73
--- src/lib/librumphijack/hijack.c:1.72	Mon Feb 28 20:39:07 2011
+++ src/lib/librumphijack/hijack.c	Tue Mar  1 10:47:29 2011
@@ -1,4 +1,4 @@
-/*  $NetBSD: hijack.c,v 1.72 2011/02/28 20:39:07 pooka Exp $	*/
+/*  $NetBSD: hijack.c,v 1.73 2011/03/01 10:47:29 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: hijack.c,v 1.72 2011/02/28 20:39:07 pooka Exp $");
+__RCSID("$NetBSD: hijack.c,v 1.73 2011/03/01 10:47:29 pooka Exp $");
 
 #define __ssp_weak_name(fun) _hijack_ ## fun
 
@@ -1480,6 +1480,11 @@
 		/*
 		 * then, open two pipes, one for notifications
 		 * to each kernel.
+		 *
+		 * At least the rump pipe should probably be
+		 * cached, along with the helper threads.  This
+		 * should give a microbenchmark improvement (haven't
+		 * experienced a macro-level problem yet, though).
 		 */
 		if ((rv = rump_sys_pipe(rpipe)) == -1) {
 			sverrno = errno;



CVS commit: src/lib/librumphijack

2011-03-01 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Mar  1 10:54:06 UTC 2011

Modified Files:
src/lib/librumphijack: hijack.c

Log Message:
another comment


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/lib/librumphijack/hijack.c

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

Modified files:

Index: src/lib/librumphijack/hijack.c
diff -u src/lib/librumphijack/hijack.c:1.73 src/lib/librumphijack/hijack.c:1.74
--- src/lib/librumphijack/hijack.c:1.73	Tue Mar  1 10:47:29 2011
+++ src/lib/librumphijack/hijack.c	Tue Mar  1 10:54:06 2011
@@ -1,4 +1,4 @@
-/*  $NetBSD: hijack.c,v 1.73 2011/03/01 10:47:29 pooka Exp $	*/
+/*  $NetBSD: hijack.c,v 1.74 2011/03/01 10:54:06 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: hijack.c,v 1.73 2011/03/01 10:47:29 pooka Exp $");
+__RCSID("$NetBSD: hijack.c,v 1.74 2011/03/01 10:54:06 pooka Exp $");
 
 #define __ssp_weak_name(fun) _hijack_ ## fun
 
@@ -242,6 +242,8 @@
 
 /*
  * Maintain a mapping table for the usual dup2 suspects.
+ * Could use atomic ops to operate on dup2vec, but an application
+ * racing there is not well-defined, so don't bother.
  */
 /* note: you cannot change this without editing the env-passing code */
 #define DUP2HIGH 2



CVS commit: src/lib/librefuse

2011-03-01 Thread Noriyuki Soda
Module Name:src
Committed By:   soda
Date:   Tue Mar  1 11:23:42 UTC 2011

Modified Files:
src/lib/librefuse: refuse_opt.c

Log Message:
fuse_opt_parse() was using uninitialized struct fuse_opt_option::data,
this bug made fuse_opt_proc_t not work, if it used first ``data'' argument,
and might cause memory corruption even.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/lib/librefuse/refuse_opt.c

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

Modified files:

Index: src/lib/librefuse/refuse_opt.c
diff -u src/lib/librefuse/refuse_opt.c:1.14 src/lib/librefuse/refuse_opt.c:1.15
--- src/lib/librefuse/refuse_opt.c:1.14	Mon Jan 19 09:56:06 2009
+++ src/lib/librefuse/refuse_opt.c	Tue Mar  1 11:23:42 2011
@@ -1,4 +1,4 @@
-/* 	$NetBSD: refuse_opt.c,v 1.14 2009/01/19 09:56:06 lukem Exp $	*/
+/* 	$NetBSD: refuse_opt.c,v 1.15 2011/03/01 11:23:42 soda Exp $	*/
 
 /*-
  * Copyright (c) 2007 Juan Romero Pardines.
@@ -282,6 +282,7 @@
 	if (!args || !args->argv || !args->argc || !proc)
 		return 0;
 
+	foo.data = data;
 	if (args->argc == 1)
 		return proc(foo.data, *args->argv, FUSE_OPT_KEY_OPT, args);
 



CVS commit: src/tests/lib/libc

2011-03-01 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Mar  1 12:47:43 UTC 2011

Modified Files:
src/tests/lib/libc/gen: t_siginfo.c
src/tests/lib/libc/ieeefp: t_except.c

Log Message:
Attempt further qemu heuristics to avoid failures due to non-working FPU


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/lib/libc/gen/t_siginfo.c
cvs rdiff -u -r1.6 -r1.7 src/tests/lib/libc/ieeefp/t_except.c

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

Modified files:

Index: src/tests/lib/libc/gen/t_siginfo.c
diff -u src/tests/lib/libc/gen/t_siginfo.c:1.8 src/tests/lib/libc/gen/t_siginfo.c:1.9
--- src/tests/lib/libc/gen/t_siginfo.c:1.8	Mon Jan  3 20:51:26 2011
+++ src/tests/lib/libc/gen/t_siginfo.c	Tue Mar  1 12:47:43 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: t_siginfo.c,v 1.8 2011/01/03 20:51:26 pgoyette Exp $ */
+/* $NetBSD: t_siginfo.c,v 1.9 2011/03/01 12:47:43 pooka Exp $ */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -298,6 +298,10 @@
 
 	if (system("cpuctl identify 0 | grep -q QEMU") == 0)
 		atf_tc_skip("Test does not run correctly under qemu");
+	if (system("cpuctl identify 0 | grep -q "
+	"'cpu0: Intel Pentium II (Klamath) (686-class), id 0x633'") == 0)
+		atf_tc_skip("Test does not run correctly under qemu "
+		"(heuristic match)");
 	if (sigsetjmp(sigfpe_flt_env, 0) == 0) {
 		sa.sa_flags = SA_SIGINFO;
 		sa.sa_sigaction = sigfpe_flt_action;

Index: src/tests/lib/libc/ieeefp/t_except.c
diff -u src/tests/lib/libc/ieeefp/t_except.c:1.6 src/tests/lib/libc/ieeefp/t_except.c:1.7
--- src/tests/lib/libc/ieeefp/t_except.c:1.6	Tue Jan  4 22:30:41 2011
+++ src/tests/lib/libc/ieeefp/t_except.c	Tue Mar  1 12:47:43 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_except.c,v 1.6 2011/01/04 22:30:41 pgoyette Exp $	*/
+/*	$NetBSD: t_except.c,v 1.7 2011/03/01 12:47:43 pooka Exp $	*/
 
 /*-
  * Copyright (c) 1995 The NetBSD Foundation, Inc.
@@ -295,6 +295,11 @@
 	\
 		if (system("cpuctl identify 0 | grep -q QEMU") == 0)	\
 			atf_tc_skip("Test not applicable on QEMU");	\
+		if (system("cpuctl identify 0 | grep -q			\
+		  'cpu0: Intel Pentium II (Klamath) (686-class), id 0x633'")\
+		== 0)		\
+			atf_tc_skip("Test not applicable on QEMU "	\
+			"(heuristic match)");			\
 		m(t##_ops);		\
 	}
 



CVS commit: src/sys/dev/acpi

2011-03-01 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Tue Mar  1 13:38:45 UTC 2011

Modified Files:
src/sys/dev/acpi: acpi_cpu.c

Log Message:
Detach evcnt(9) before the states.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/acpi/acpi_cpu.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/acpi/acpi_cpu.c
diff -u src/sys/dev/acpi/acpi_cpu.c:1.33 src/sys/dev/acpi/acpi_cpu.c:1.34
--- src/sys/dev/acpi/acpi_cpu.c:1.33	Tue Mar  1 05:57:04 2011
+++ src/sys/dev/acpi/acpi_cpu.c	Tue Mar  1 13:38:45 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu.c,v 1.33 2011/03/01 05:57:04 jruoho Exp $ */
+/* $NetBSD: acpi_cpu.c,v 1.34 2011/03/01 13:38:45 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2010, 2011 Jukka Ruohonen 
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_cpu.c,v 1.33 2011/03/01 05:57:04 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cpu.c,v 1.34 2011/03/01 13:38:45 jruoho Exp $");
 
 #include 
 #include 
@@ -183,6 +183,8 @@
 	int rv = 0;
 
 	sc->sc_cold = true;
+
+	acpicpu_evcnt_detach(self);
 	acpi_deregister_notify(sc->sc_node);
 
 	if ((sc->sc_flags & ACPICPU_FLAG_C) != 0)
@@ -204,7 +206,6 @@
 		return rv;
 
 	mutex_destroy(&sc->sc_mtx);
-	acpicpu_evcnt_detach(self);
 
 	sc->sc_node->ad_device = NULL;
 



CVS commit: src/crypto/dist/ipsec-tools/src/racoon

2011-03-01 Thread VANHULLEBUS Yvan
Module Name:src
Committed By:   vanhu
Date:   Tue Mar  1 14:14:50 UTC 2011

Modified Files:
src/crypto/dist/ipsec-tools/src/racoon: cfparse.y

Log Message:
reset yyerrorcount before doing parse stuff. patch by M E Andersson 



To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/crypto/dist/ipsec-tools/src/racoon/cfparse.y

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

Modified files:

Index: src/crypto/dist/ipsec-tools/src/racoon/cfparse.y
diff -u src/crypto/dist/ipsec-tools/src/racoon/cfparse.y:1.38 src/crypto/dist/ipsec-tools/src/racoon/cfparse.y:1.39
--- src/crypto/dist/ipsec-tools/src/racoon/cfparse.y:1.38	Tue Jun 22 09:41:33 2010
+++ src/crypto/dist/ipsec-tools/src/racoon/cfparse.y	Tue Mar  1 14:14:50 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cfparse.y,v 1.38 2010/06/22 09:41:33 vanhu Exp $	*/
+/*	$NetBSD: cfparse.y,v 1.39 2011/03/01 14:14:50 vanhu Exp $	*/
 
 /* Id: cfparse.y,v 1.66 2006/08/22 18:17:17 manubsd Exp */
 
@@ -2617,6 +2617,7 @@
 {
 	int error;
 
+	yyerrorcount = 0;
 	yycf_init_buffer();
 
 	if (yycf_switch_buffer(lcconf->racoon_conf) != 0) {



CVS commit: src/tests/fs/vfs

2011-03-01 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Mar  1 14:21:46 UTC 2011

Modified Files:
src/tests/fs/vfs: t_vnops.c

Log Message:
augment rename test case with the failure from PR kern/44288


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/tests/fs/vfs/t_vnops.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/fs/vfs/t_vnops.c
diff -u src/tests/fs/vfs/t_vnops.c:1.15 src/tests/fs/vfs/t_vnops.c:1.16
--- src/tests/fs/vfs/t_vnops.c:1.15	Mon Feb 28 03:40:45 2011
+++ src/tests/fs/vfs/t_vnops.c	Tue Mar  1 14:21:46 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vnops.c,v 1.15 2011/02/28 03:40:45 pooka Exp $	*/
+/*	$NetBSD: t_vnops.c,v 1.16 2011/03/01 14:21:46 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -170,7 +170,7 @@
 rename_dir(const atf_tc_t *tc, const char *mp)
 {
 	char pb1[MAXPATHLEN], pb2[MAXPATHLEN], pb3[MAXPATHLEN];
-	struct stat ref;
+	struct stat ref, sb;
 
 	if (FSTYPE_MSDOS(tc))
 		atf_tc_skip("test fails in some setups, reason unknown");
@@ -247,11 +247,27 @@
 	md(pb1, mp, "dir2/../dir3");
 	checkfile(pb1, &ref);
 
-	/* finally, atomic cross-directory rename */
+	/* atomic cross-directory rename */
 	md(pb3, mp, "dir2/subdir");
 	if (rump_sys_rename(pb1, pb3) == -1)
 		atf_tc_fail_errno("rename 9");
 	checkfile(pb3, &ref);
+
+	/* rename directory over an empty directory */
+	md(pb1, mp, "parent");
+	md(pb2, mp, "parent/dir1");
+	md(pb3, mp, "parent/dir2");
+	RL(rump_sys_mkdir(pb1, 0777));
+	RL(rump_sys_mkdir(pb2, 0777));
+	RL(rump_sys_mkdir(pb3, 0777));
+	RL(rump_sys_rename(pb2, pb3));
+
+	RL(rump_sys_stat(pb1, &sb));
+	ATF_CHECK_EQ(sb.st_nlink, 3);
+	RL(rump_sys_rmdir(pb3));
+	if (FSTYPE_TMPFS(tc))
+		atf_tc_expect_signal(-1, "PR kern/44288");
+	RL(rump_sys_rmdir(pb1));
 }
 
 static void



CVS commit: src/tests/fs/vfs

2011-03-01 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Mar  1 14:27:32 UTC 2011

Modified Files:
src/tests/fs/vfs: t_vnops.c

Log Message:
Comment out msdosfs skip -- i'm not sure if it will still fail with
the "stack size" problem, but at least it fails due to yet another
refcounting snafu in the msdosfs rename method.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/tests/fs/vfs/t_vnops.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/fs/vfs/t_vnops.c
diff -u src/tests/fs/vfs/t_vnops.c:1.16 src/tests/fs/vfs/t_vnops.c:1.17
--- src/tests/fs/vfs/t_vnops.c:1.16	Tue Mar  1 14:21:46 2011
+++ src/tests/fs/vfs/t_vnops.c	Tue Mar  1 14:27:32 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vnops.c,v 1.16 2011/03/01 14:21:46 pooka Exp $	*/
+/*	$NetBSD: t_vnops.c,v 1.17 2011/03/01 14:27:32 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -172,8 +172,8 @@
 	char pb1[MAXPATHLEN], pb2[MAXPATHLEN], pb3[MAXPATHLEN];
 	struct stat ref, sb;
 
-	if (FSTYPE_MSDOS(tc))
-		atf_tc_skip("test fails in some setups, reason unknown");
+	//if (FSTYPE_MSDOS(tc))
+		//atf_tc_skip("test fails in some setups, reason unknown");
 
 	if (FSTYPE_RUMPFS(tc))
 		atf_tc_skip("rename not supported by fs");



CVS commit: src/crypto/dist/ipsec-tools/src/racoon

2011-03-01 Thread VANHULLEBUS Yvan
Module Name:src
Committed By:   vanhu
Date:   Tue Mar  1 14:33:58 UTC 2011

Modified Files:
src/crypto/dist/ipsec-tools/src/racoon: isakmp.c pfkey.c

Log Message:
plog text fixes, patch from M E Andersson 


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/crypto/dist/ipsec-tools/src/racoon/isakmp.c
cvs rdiff -u -r1.54 -r1.55 src/crypto/dist/ipsec-tools/src/racoon/pfkey.c

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

Modified files:

Index: src/crypto/dist/ipsec-tools/src/racoon/isakmp.c
diff -u src/crypto/dist/ipsec-tools/src/racoon/isakmp.c:1.67 src/crypto/dist/ipsec-tools/src/racoon/isakmp.c:1.68
--- src/crypto/dist/ipsec-tools/src/racoon/isakmp.c:1.67	Wed Feb  2 15:21:34 2011
+++ src/crypto/dist/ipsec-tools/src/racoon/isakmp.c	Tue Mar  1 14:33:58 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: isakmp.c,v 1.67 2011/02/02 15:21:34 vanhu Exp $	*/
+/*	$NetBSD: isakmp.c,v 1.68 2011/03/01 14:33:58 vanhu Exp $	*/
 
 /* Id: isakmp.c,v 1.74 2006/05/07 21:32:59 manubsd Exp */
 
@@ -3422,7 +3422,7 @@
 	dst = iph2->dst;
 
 	plog(LLV_INFO, LOCATION, NULL,
-		 "generated policy, deleting it.\n");
+		 "deleting a generated policy.\n");
 
 	memset(&spidx, 0, sizeof(spidx));
 	iph2->spidx_gen = (caddr_t )&spidx;

Index: src/crypto/dist/ipsec-tools/src/racoon/pfkey.c
diff -u src/crypto/dist/ipsec-tools/src/racoon/pfkey.c:1.54 src/crypto/dist/ipsec-tools/src/racoon/pfkey.c:1.55
--- src/crypto/dist/ipsec-tools/src/racoon/pfkey.c:1.54	Fri Nov 12 10:36:37 2010
+++ src/crypto/dist/ipsec-tools/src/racoon/pfkey.c	Tue Mar  1 14:33:58 2011
@@ -1,6 +1,6 @@
-/*	$NetBSD: pfkey.c,v 1.54 2010/11/12 10:36:37 tteras Exp $	*/
+/*	$NetBSD: pfkey.c,v 1.55 2011/03/01 14:33:58 vanhu Exp $	*/
 
-/* $Id: pfkey.c,v 1.54 2010/11/12 10:36:37 tteras Exp $ */
+/* $Id: pfkey.c,v 1.55 2011/03/01 14:33:58 vanhu Exp $ */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -231,7 +231,7 @@
 		}
 	}
 
-	plog(LLV_DEBUG, LOCATION, NULL, "get pfkey %s message\n",
+	plog(LLV_DEBUG, LOCATION, NULL, "got pfkey %s message\n",
 		s_pfkey_type(msg->sadb_msg_type));
 	plogdump(LLV_DEBUG2, msg, msg->sadb_msg_len << 3);
 
@@ -2344,8 +2344,8 @@
 
 	sp = getsp(&spidx);
 	if (sp == NULL) {
-		plog(LLV_ERROR, LOCATION, NULL,
-			"such policy does not already exist: \"%s\"\n",
+		plog(LLV_DEBUG, LOCATION, NULL,
+			"this policy did not exist for removal: \"%s\"\n",
 			spidx2str(&spidx));
 	} else {
 		/* preserve hints before deleting the SP */
@@ -3611,8 +3611,8 @@
 		break;
 	case IPSECDOI_PROTO_IPCOMP:
 		plog(LLV_DEBUG, LOCATION, NULL,
-			"compression algorithm can not be checked "
-			"because sadb message doesn't support it.\n");
+			"no check of compression algorithm; "
+			"not supported in sadb message.\n");
 		return 0;
 	default:
 		plog(LLV_ERROR, LOCATION, NULL,



CVS commit: src/tests/fs/vfs

2011-03-01 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Mar  1 15:04:48 UTC 2011

Modified Files:
src/tests/fs/vfs: t_vnops.c

Log Message:
Rmdir the dir you're in and its parent and try to cd ..
Fails on tmpfs (crash), puffs (cd .. succeeds) and rumpfs (cd .. succeeds).

another testcase derived from the bugfinding genious of Taylor R Campbell


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/tests/fs/vfs/t_vnops.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/fs/vfs/t_vnops.c
diff -u src/tests/fs/vfs/t_vnops.c:1.17 src/tests/fs/vfs/t_vnops.c:1.18
--- src/tests/fs/vfs/t_vnops.c:1.17	Tue Mar  1 14:27:32 2011
+++ src/tests/fs/vfs/t_vnops.c	Tue Mar  1 15:04:47 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vnops.c,v 1.17 2011/03/01 14:27:32 pooka Exp $	*/
+/*	$NetBSD: t_vnops.c,v 1.18 2011/03/01 15:04:47 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -152,6 +152,34 @@
 }
 
 static void
+dir_rmdirdotdot(const atf_tc_t *tc, const char *mp)
+{
+	char pb[MAXPATHLEN];
+	int xerrno;
+
+	USES_DIRS;
+
+	FSTEST_ENTER();
+	RL(rump_sys_mkdir("test", 0777));
+	RL(rump_sys_chdir("test"));
+
+	RL(rump_sys_mkdir("subtest", 0777));
+	RL(rump_sys_chdir("subtest"));
+
+	md(pb, mp, "test/subtest");
+	RL(rump_sys_rmdir(pb));
+	md(pb, mp, "test");
+	RL(rump_sys_rmdir(pb));
+
+	if (FSTYPE_NFS(tc))
+		xerrno = ESTALE;
+	else
+		xerrno = ENOENT;
+	ATF_REQUIRE_ERRNO(xerrno, rump_sys_chdir("..") == -1);
+	FSTEST_EXIT();
+}
+
+static void
 checkfile(const char *path, struct stat *refp)
 {
 	char buf[MAXPATHLEN];
@@ -749,6 +777,7 @@
 ATF_TC_FSAPPLY(lookup_complex, "lookup of non-dot entries");
 ATF_TC_FSAPPLY(dir_simple, "mkdir/rmdir");
 ATF_TC_FSAPPLY(dir_notempty, "non-empty directories cannot be removed");
+ATF_TC_FSAPPLY(dir_rmdirdotdot, "remove .. and try to cd out");
 ATF_TC_FSAPPLY(rename_dir, "exercise various directory renaming ops");
 ATF_TC_FSAPPLY(rename_dotdot, "rename dir ..");
 ATF_TC_FSAPPLY(rename_reg_nodir, "rename regular files, no subdirectories");
@@ -768,6 +797,7 @@
 	ATF_TP_FSAPPLY(lookup_complex);
 	ATF_TP_FSAPPLY(dir_simple);
 	ATF_TP_FSAPPLY(dir_notempty);
+	ATF_TP_FSAPPLY(dir_rmdirdotdot);
 	ATF_TP_FSAPPLY(rename_dir);
 	ATF_TP_FSAPPLY(rename_dotdot);
 	ATF_TP_FSAPPLY(rename_reg_nodir);



CVS commit: src/sys/rump/librump/rumpvfs

2011-03-01 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Mar  1 15:14:35 UTC 2011

Modified Files:
src/sys/rump/librump/rumpvfs: rumpfs.c

Log Message:
Reset node's parent pointer when it's removed.  Technically the
parent still exists, but allows us to avoid complicated g/c algorithms
if the parent *is* removed.


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/sys/rump/librump/rumpvfs/rumpfs.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/rump/librump/rumpvfs/rumpfs.c
diff -u src/sys/rump/librump/rumpvfs/rumpfs.c:1.91 src/sys/rump/librump/rumpvfs/rumpfs.c:1.92
--- src/sys/rump/librump/rumpvfs/rumpfs.c:1.91	Wed Feb  2 15:58:09 2011
+++ src/sys/rump/librump/rumpvfs/rumpfs.c	Tue Mar  1 15:14:35 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpfs.c,v 1.91 2011/02/02 15:58:09 pooka Exp $	*/
+/*	$NetBSD: rumpfs.c,v 1.92 2011/03/01 15:14:35 pooka Exp $	*/
 
 /*
  * Copyright (c) 2009, 2010 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.91 2011/02/02 15:58:09 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.92 2011/03/01 15:14:35 pooka Exp $");
 
 #include 
 #include 
@@ -733,8 +733,8 @@
 		goto getvnode;
 	} else {
 		if (dotdot) {
-			rn = rnd->rn_parent;
-			goto getvnode;
+			if ((rn = rnd->rn_parent) != NULL)
+goto getvnode;
 		} else {
 			LIST_FOREACH(rd, &rnd->rn_dir, rd_entries) {
 if (rd->rd_namelen == cnp->cn_namelen &&
@@ -927,6 +927,7 @@
 
 	freedir(rnd, cnp);
 	rn->rn_flags |= RUMPNODE_CANRECLAIM;
+	rn->rn_parent = NULL;
 
 out:
 	vput(dvp);



CVS commit: src/tests/fs/puffs/h_dtfs

2011-03-01 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Mar  1 15:19:49 UTC 2011

Modified Files:
src/tests/fs/puffs/h_dtfs: dtfs_subr.c dtfs_vnops.c

Log Message:
Reset node's parent pointer when it's removed.  Technically the
parent still exists, but allows us to avoid complicated g/c algorithms
if the parent *is* removed.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/fs/puffs/h_dtfs/dtfs_subr.c
cvs rdiff -u -r1.7 -r1.8 src/tests/fs/puffs/h_dtfs/dtfs_vnops.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/fs/puffs/h_dtfs/dtfs_subr.c
diff -u src/tests/fs/puffs/h_dtfs/dtfs_subr.c:1.2 src/tests/fs/puffs/h_dtfs/dtfs_subr.c:1.3
--- src/tests/fs/puffs/h_dtfs/dtfs_subr.c:1.2	Wed Jul 14 13:09:52 2010
+++ src/tests/fs/puffs/h_dtfs/dtfs_subr.c	Tue Mar  1 15:19:49 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: dtfs_subr.c,v 1.2 2010/07/14 13:09:52 pooka Exp $	*/
+/*	$NetBSD: dtfs_subr.c,v 1.3 2011/03/01 15:19:49 pooka Exp $	*/
 
 /*
  * Copyright (c) 2006  Antti Kantee.  All Rights Reserved.
@@ -314,8 +314,12 @@
 
 	assert(pn_dir->pn_va.va_type == VDIR);
 	LIST_REMOVE(dent, dfd_entries);
-	if (pn_file->pn_va.va_type == VDIR)
+	if (pn_file->pn_va.va_type == VDIR) {
+		struct dtfs_file *df = DTFS_PTOF(pn_file);
+
 		pn_dir->pn_va.va_nlink--;
+		df->df_dotdot = NULL;
+	}
 	pn_file->pn_va.va_nlink--;
 	assert(pn_dir->pn_va.va_nlink >= 2);
 

Index: src/tests/fs/puffs/h_dtfs/dtfs_vnops.c
diff -u src/tests/fs/puffs/h_dtfs/dtfs_vnops.c:1.7 src/tests/fs/puffs/h_dtfs/dtfs_vnops.c:1.8
--- src/tests/fs/puffs/h_dtfs/dtfs_vnops.c:1.7	Wed Jul 21 06:58:25 2010
+++ src/tests/fs/puffs/h_dtfs/dtfs_vnops.c	Tue Mar  1 15:19:49 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: dtfs_vnops.c,v 1.7 2010/07/21 06:58:25 pooka Exp $	*/
+/*	$NetBSD: dtfs_vnops.c,v 1.8 2011/03/01 15:19:49 pooka Exp $	*/
 
 /*
  * Copyright (c) 2006  Antti Kantee.  All Rights Reserved.
@@ -51,6 +51,9 @@
 
 	/* parent dir? */
 	if (PCNISDOTDOT(pcn)) {
+		if (df->df_dotdot == NULL)
+			return ENOENT;
+
 		assert(df->df_dotdot->pn_va.va_type == VDIR);
 		puffs_newinfo_setcookie(pni, df->df_dotdot);
 		puffs_newinfo_setvtype(pni, df->df_dotdot->pn_va.va_type);



CVS commit: src/tests/fs/vfs

2011-03-01 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Mar  1 15:33:35 UTC 2011

Modified Files:
src/tests/fs/vfs: t_vnops.c

Log Message:
xfail dir_rmdirdotdot for tmpfs (PR kern/44657)


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/tests/fs/vfs/t_vnops.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/fs/vfs/t_vnops.c
diff -u src/tests/fs/vfs/t_vnops.c:1.18 src/tests/fs/vfs/t_vnops.c:1.19
--- src/tests/fs/vfs/t_vnops.c:1.18	Tue Mar  1 15:04:47 2011
+++ src/tests/fs/vfs/t_vnops.c	Tue Mar  1 15:33:35 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vnops.c,v 1.18 2011/03/01 15:04:47 pooka Exp $	*/
+/*	$NetBSD: t_vnops.c,v 1.19 2011/03/01 15:33:35 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -175,6 +175,8 @@
 		xerrno = ESTALE;
 	else
 		xerrno = ENOENT;
+	if (FSTYPE_TMPFS(tc))
+		atf_tc_expect_signal(-1, "PR kern/44657");
 	ATF_REQUIRE_ERRNO(xerrno, rump_sys_chdir("..") == -1);
 	FSTEST_EXIT();
 }



CVS commit: src/sys/kern

2011-03-01 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Tue Mar  1 18:53:12 UTC 2011

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

Log Message:
Ensure that the LWP private area has a consistent value after exec.


To generate a diff of this commit:
cvs rdiff -u -r1.308 -r1.309 src/sys/kern/kern_exec.c

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

Modified files:

Index: src/sys/kern/kern_exec.c
diff -u src/sys/kern/kern_exec.c:1.308 src/sys/kern/kern_exec.c:1.309
--- src/sys/kern/kern_exec.c:1.308	Mon Feb 21 20:23:29 2011
+++ src/sys/kern/kern_exec.c	Tue Mar  1 18:53:10 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_exec.c,v 1.308 2011/02/21 20:23:29 pooka Exp $	*/
+/*	$NetBSD: kern_exec.c,v 1.309 2011/03/01 18:53:10 joerg Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.308 2011/02/21 20:23:29 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.309 2011/03/01 18:53:10 joerg Exp $");
 
 #include "opt_ktrace.h"
 #include "opt_modular.h"
@@ -1075,6 +1075,9 @@
 	if (pack.ep_esch->es_setregs)
 		(*pack.ep_esch->es_setregs)(l, &pack, (vaddr_t)stack);
 
+	/* Provide a consistent LWP private setting */
+	(void)lwp_setprivate(l, NULL);
+
 	/* map the process's signal trampoline code */
 	if ((error = exec_sigcode_map(p, pack.ep_esch->es_emul)) != 0) {
 		DPRINTF(("execve: map sigcode failed %d\n", error));



CVS commit: src/usr.bin/netstat

2011-03-01 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Mar  1 19:01:59 UTC 2011

Modified Files:
src/usr.bin/netstat: Makefile inet.c
Added Files:
src/usr.bin/netstat: pfsync.c

Log Message:
Pull pfsync_stats() out of inet.c and into pfsync.c so that inet.c does
not have to #include PF header files that pollute the global namespace
by #defining v4 and v6 (sheesh).


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/usr.bin/netstat/Makefile
cvs rdiff -u -r1.93 -r1.94 src/usr.bin/netstat/inet.c
cvs rdiff -u -r0 -r1.1 src/usr.bin/netstat/pfsync.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/netstat/Makefile
diff -u src/usr.bin/netstat/Makefile:1.32 src/usr.bin/netstat/Makefile:1.33
--- src/usr.bin/netstat/Makefile:1.32	Wed Dec 15 11:22:41 2010
+++ src/usr.bin/netstat/Makefile	Tue Mar  1 19:01:59 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.32 2010/12/15 11:22:41 pooka Exp $
+#	$NetBSD: Makefile,v 1.33 2011/03/01 19:01:59 dyoung Exp $
 #	from: @(#)Makefile	8.1 (Berkeley) 6/12/93
 
 .include 
@@ -7,7 +7,7 @@
 
 RUMPPRG=netstat
 SRCS=	atalk.c bpf.c fast_ipsec.c if.c inet.c inet6.c ipsec.c iso.c \
-	main.c mbuf.c mroute.c mroute6.c show.c route.c tp_astring.c \
+	main.c mbuf.c mroute.c mroute6.c pfsync.c show.c route.c tp_astring.c \
 	unix.c
 .PATH:	${NETBSDSRCDIR}/sys/netiso 
 BINGRP=	kmem

Index: src/usr.bin/netstat/inet.c
diff -u src/usr.bin/netstat/inet.c:1.93 src/usr.bin/netstat/inet.c:1.94
--- src/usr.bin/netstat/inet.c:1.93	Mon Dec 13 21:15:30 2010
+++ src/usr.bin/netstat/inet.c	Tue Mar  1 19:01:59 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: inet.c,v 1.93 2010/12/13 21:15:30 pooka Exp $	*/
+/*	$NetBSD: inet.c,v 1.94 2011/03/01 19:01:59 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1983, 1988, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "from: @(#)inet.c	8.4 (Berkeley) 4/20/94";
 #else
-__RCSID("$NetBSD: inet.c,v 1.93 2010/12/13 21:15:30 pooka Exp $");
+__RCSID("$NetBSD: inet.c,v 1.94 2011/03/01 19:01:59 dyoung Exp $");
 #endif
 #endif /* not lint */
 
@@ -76,8 +76,6 @@
 #include 
 #include 
 #include 
-#include 
-#include 
 
 #include 
 #include 
@@ -690,52 +688,6 @@
 }
 
 /*
- * Dump PFSYNC statistics structure.
- */
-void
-pfsync_stats(u_long off, const char *name)
-{
-	uint64_t pfsyncstat[PFSYNC_NSTATS];
-
-	if (use_sysctl) {
-		size_t size = sizeof(pfsyncstat);
-
-		if (sysctlbyname("net.inet.pfsync.stats", pfsyncstat, &size,
- NULL, 0) == -1)
-			return;
-	} else {
-		warnx("%s stats not available via KVM.", name);
-		return;
-	}
-
-	printf("%s:\n", name);
-
-#define p(f, m) if (pfsyncstat[f] || sflag <= 1) \
-	printf(m, pfsyncstat[f], plural(pfsyncstat[f]))
-#define p2(f, m) if (pfsyncstat[f] || sflag <= 1) \
-	printf(m, pfsyncstat[f])
-
-	p(PFSYNC_STAT_IPACKETS, "\t%" PRIu64 " packet%s received (IPv4)\n");
-	p(PFSYNC_STAT_IPACKETS6,"\t%" PRIu64 " packet%s received (IPv6)\n");
-	p(PFSYNC_STAT_BADIF, "\t\t%" PRIu64 " packet%s discarded for bad interface\n");
-	p(PFSYNC_STAT_BADTTL, "\t\t%" PRIu64 " packet%s discarded for bad ttl\n");
-	p(PFSYNC_STAT_HDROPS, "\t\t%" PRIu64 " packet%s shorter than header\n");
-	p(PFSYNC_STAT_BADVER, "\t\t%" PRIu64 " packet%s discarded for bad version\n");
-	p(PFSYNC_STAT_BADAUTH, "\t\t%" PRIu64 " packet%s discarded for bad HMAC\n");
-	p(PFSYNC_STAT_BADACT,"\t\t%" PRIu64 " packet%s discarded for bad action\n");
-	p(PFSYNC_STAT_BADLEN, "\t\t%" PRIu64 " packet%s discarded for short packet\n");
-	p(PFSYNC_STAT_BADVAL, "\t\t%" PRIu64 " state%s discarded for bad values\n");
-	p(PFSYNC_STAT_STALE, "\t\t%" PRIu64 " stale state%s\n");
-	p(PFSYNC_STAT_BADSTATE, "\t\t%" PRIu64 " failed state lookup/insert%s\n");
-	p(PFSYNC_STAT_OPACKETS, "\t%" PRIu64 " packet%s sent (IPv4)\n");
-	p(PFSYNC_STAT_OPACKETS6, "\t%" PRIu64 " packet%s sent (IPv6)\n");
-	p2(PFSYNC_STAT_ONOMEM, "\t\t%" PRIu64 " send failed due to mbuf memory error\n");
-	p2(PFSYNC_STAT_OERRORS, "\t\t%" PRIu64 " send error\n");
-#undef p
-#undef p2
-}
-
-/*
  * Dump PIM statistics structure.
  */
 void

Added files:

Index: src/usr.bin/netstat/pfsync.c
diff -u /dev/null src/usr.bin/netstat/pfsync.c:1.1
--- /dev/null	Tue Mar  1 19:01:59 2011
+++ src/usr.bin/netstat/pfsync.c	Tue Mar  1 19:01:59 2011
@@ -0,0 +1,119 @@
+/*	$NetBSD: pfsync.c,v 1.1 2011/03/01 19:01:59 dyoung Exp $	*/
+
+/*
+ * Copyright (c) 1983, 1988, 1993
+ *	The Regents of the University of California.  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 

CVS commit: src/share/man/man4

2011-03-01 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Tue Mar  1 19:41:05 UTC 2011

Modified Files:
src/share/man/man4: piixpcib.4
src/share/man/man4/man4.x86: ichlpcib.4

Log Message:
Xref est(4).


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/share/man/man4/piixpcib.4
cvs rdiff -u -r1.3 -r1.4 src/share/man/man4/man4.x86/ichlpcib.4

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

Modified files:

Index: src/share/man/man4/piixpcib.4
diff -u src/share/man/man4/piixpcib.4:1.4 src/share/man/man4/piixpcib.4:1.5
--- src/share/man/man4/piixpcib.4:1.4	Fri Nov 23 13:06:09 2007
+++ src/share/man/man4/piixpcib.4	Tue Mar  1 19:41:05 2011
@@ -1,4 +1,4 @@
-.\" $NetBSD: piixpcib.4,v 1.4 2007/11/23 13:06:09 xtraeme Exp $
+.\" $NetBSD: piixpcib.4,v 1.5 2011/03/01 19:41:05 jruoho Exp $
 .\"
 .\" Copyright (c) 2007 Stephan Meisinger
 .\"
@@ -14,7 +14,7 @@
 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 .\"
-.Dd November 23, 2007
+.Dd March 1, 2011
 .Dt PIIXPCIB 4
 .Os
 .Sh NAME
@@ -43,6 +43,7 @@
 .It machdep.speedstep_state = [0/1]
 .El
 .Sh SEE ALSO
+.Xr est 4 ,
 .Xr isa 4 ,
 .Xr pci 4 ,
 .Xr apmd 8 ,

Index: src/share/man/man4/man4.x86/ichlpcib.4
diff -u src/share/man/man4/man4.x86/ichlpcib.4:1.3 src/share/man/man4/man4.x86/ichlpcib.4:1.4
--- src/share/man/man4/man4.x86/ichlpcib.4:1.3	Thu Jan 20 08:53:24 2011
+++ src/share/man/man4/man4.x86/ichlpcib.4	Tue Mar  1 19:41:05 2011
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ichlpcib.4,v 1.3 2011/01/20 08:53:24 jruoho Exp $
+.\"	$NetBSD: ichlpcib.4,v 1.4 2011/03/01 19:41:05 jruoho Exp $
 .\"
 .\" Copyright (c) 2004 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd January 20, 2011
+.Dd March 1, 2011
 .Dt ICHLPCIB 4 x86
 .Os
 .Sh NAME
@@ -71,6 +71,7 @@
 framework.
 .El
 .Sh SEE ALSO
+.Xr est 4 ,
 .Xr fwhrng 4 ,
 .Xr gpio 4 ,
 .Xr hpet 4 ,



CVS commit: src/tests/fs/vfs

2011-03-01 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Mar  1 20:16:33 UTC 2011

Modified Files:
src/tests/fs/vfs: t_vnops.c

Log Message:
msdosfs xfail for PR kern/44661


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/tests/fs/vfs/t_vnops.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/fs/vfs/t_vnops.c
diff -u src/tests/fs/vfs/t_vnops.c:1.19 src/tests/fs/vfs/t_vnops.c:1.20
--- src/tests/fs/vfs/t_vnops.c:1.19	Tue Mar  1 15:33:35 2011
+++ src/tests/fs/vfs/t_vnops.c	Tue Mar  1 20:16:33 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vnops.c,v 1.19 2011/03/01 15:33:35 pooka Exp $	*/
+/*	$NetBSD: t_vnops.c,v 1.20 2011/03/01 20:16:33 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -298,6 +298,9 @@
 	if (FSTYPE_TMPFS(tc))
 		atf_tc_expect_signal(-1, "PR kern/44288");
 	RL(rump_sys_rmdir(pb1));
+
+	if (FSTYPE_MSDOS(tc))
+		atf_tc_expect_fail("PR kern/44661");
 }
 
 static void



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

2011-03-01 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Mar  1 21:47:13 UTC 2011

Modified Files:
src/sys/arch/sgimips/dev: crmfb.c crmfbreg.h

Log Message:
use hardware to draw characters, while there use vcons_replay_msgbuf()


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/sgimips/dev/crmfb.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/sgimips/dev/crmfbreg.h

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

Modified files:

Index: src/sys/arch/sgimips/dev/crmfb.c
diff -u src/sys/arch/sgimips/dev/crmfb.c:1.27 src/sys/arch/sgimips/dev/crmfb.c:1.28
--- src/sys/arch/sgimips/dev/crmfb.c:1.27	Sun Feb 20 07:59:50 2011
+++ src/sys/arch/sgimips/dev/crmfb.c	Tue Mar  1 21:47:13 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: crmfb.c,v 1.27 2011/02/20 07:59:50 matt Exp $ */
+/* $NetBSD: crmfb.c,v 1.28 2011/03/01 21:47:13 macallan Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill 
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: crmfb.c,v 1.27 2011/02/20 07:59:50 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: crmfb.c,v 1.28 2011/03/01 21:47:13 macallan Exp $");
 
 #include 
 #include 
@@ -138,9 +138,6 @@
 	int			sc_mte_direction;
 	uint8_t			*sc_scratch;
 	paddr_t			sc_linear;
-	struct rasops_info	sc_rasops;
-	int 			sc_cells;
-	int			sc_current_cell;
 	int			sc_wsmode;
 
 	/* cursor stuff */
@@ -313,8 +310,6 @@
 	sc->sc_dev.dv_xname,
 	sc->sc_fbsize, KERNADDR(sc->sc_dmai), KERNADDR(sc->sc_dma));
 
-	sc->sc_current_cell = 0;
-
 	crmfb_setup_video(sc, 8);
 	ri = &crmfb_console_screen.scr_ri;
 	memset(ri, 0, sizeof(struct rasops_info));
@@ -337,6 +332,7 @@
 	consdev = arcbios_GetEnvironmentVariable("ConsoleOut");
 	if (consdev != NULL && strcmp(consdev, "video()") == 0) {
 		wsdisplay_cnattach(&crmfb_defaultscreen, ri, 0, 0, defattr);
+		vcons_replay_msgbuf(&crmfb_console_screen);
 		aa.console = 1;
 	} else
 		aa.console = 0;
@@ -549,16 +545,6 @@
 	ri->ri_width / ri->ri_font->fontwidth);
 	ri->ri_hw = scr;
 
-	/* now make a fake rasops_info for drawing into the scratch tile */
-	memcpy(&sc->sc_rasops, ri, sizeof(struct rasops_info));
-	sc->sc_rasops.ri_width = 512;	/* assume we're always in 8bit here */
-	sc->sc_rasops.ri_stride = 512;
-	sc->sc_rasops.ri_height = 128;
-	sc->sc_rasops.ri_xorigin = 0;
-	sc->sc_rasops.ri_yorigin = 0;
-	sc->sc_rasops.ri_bits = sc->sc_scratch;
-	sc->sc_cells = 512 / ri->ri_font->fontwidth;
-
 	ri->ri_ops.cursor= crmfb_cursor;
 	ri->ri_ops.copyrows  = crmfb_copyrows;
 	ri->ri_ops.eraserows = crmfb_eraserows;
@@ -1375,32 +1361,76 @@
 	struct rasops_info *ri = cookie;
 	struct vcons_screen *scr = ri->ri_hw;
 	struct crmfb_softc *sc = scr->scr_cookie;
-	struct rasops_info *fri = &sc->sc_rasops;
-	int bg;
-	int x, y, wi, he, xs;
+	struct wsdisplay_font *font = PICK_FONT(ri, c);
+	uint32_t bg, fg;
+	int x, y, wi, he, i, uc;
+	uint8_t *fd8;
+	uint16_t *fd16;
+	void *fd;
 
-	wi = ri->ri_font->fontwidth;
-	he = ri->ri_font->fontheight;
+	wi = font->fontwidth;
+	he = font->fontheight;
 
 	x = ri->ri_xorigin + col * wi;
 	y = ri->ri_yorigin + row * he;
 
 	bg = ri->ri_devcmap[(attr >> 16) & 0xff];
+	fg = ri->ri_devcmap[(attr >> 24) & 0xff];
+	uc = c - font->firstchar;
+	fd = (uint8_t *)font->data + uc * ri->ri_fontscale;
 	if (c == 0x20) {
 		crmfb_fill_rect(sc, x, y, wi, he, bg);
 	} else {
-		/*
-		 * we rotate over all available character cells in the scratch
-		 * tile. The idea is to have more cells than there's room for
-		 * drawing commands in the engine's pipeline so we don't have
-		 * to wait for the engine until we're done drawing the 
-		 * character and ready to blit it into place
-		 */
-		fri->ri_ops.putchar(fri, 0, sc->sc_current_cell, c, attr);
-		xs = sc->sc_current_cell * wi;
-		sc->sc_current_cell++;
-		if (sc->sc_current_cell >= sc->sc_cells)
-			sc->sc_current_cell = 0;
-		crmfb_bitblt(sc, xs, 2048-128, x, y, wi, he, 3);
+		crmfb_wait_idle(sc);
+		/* setup */
+		bus_space_write_4(sc->sc_iot, sc->sc_reh, CRIME_DE_ROP, 3);
+		bus_space_write_4(sc->sc_iot, sc->sc_reh, CRIME_DE_FG, fg);
+		bus_space_write_4(sc->sc_iot, sc->sc_reh, CRIME_DE_BG, bg);
+		bus_space_write_4(sc->sc_iot, sc->sc_reh, CRIME_DE_DRAWMODE,
+		DE_DRAWMODE_PLANEMASK | DE_DRAWMODE_BYTEMASK |
+		DE_DRAWMODE_ROP | 
+		DE_DRAWMODE_OPAQUE_STIP | DE_DRAWMODE_POLY_STIP);
+		bus_space_write_4(sc->sc_iot, sc->sc_reh, CRIME_DE_PRIMITIVE,
+		DE_PRIM_RECTANGLE | DE_PRIM_LR | DE_PRIM_TB);
+		bus_space_write_4(sc->sc_iot, sc->sc_reh, CRIME_DE_STIPPLE_MODE,
+		0x001f);
+		/* now let's feed the engine */
+		if (font->stride == 1) {
+			/* shovel in 8 bit quantities */
+			fd8 = fd;
+			for (i = 0; i < he; i++) {
+/*
+ * the pipeline should be long enough to
+ * draw any character without having to wait
+ */
+bus_space_write_4(sc->sc_iot, sc->sc_reh, 
+CRIME_DE_STIPPLE_PAT, *fd8 << 24);
+bus_space_write_4(sc->sc_iot, sc->sc_reh,
+CRIME_DE_X_VE

CVS commit: src/sys/dev/raidframe

2011-03-01 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Tue Mar  1 22:51:14 UTC 2011

Modified Files:
src/sys/dev/raidframe: rf_paritymap.c

Log Message:
Always return at least one parity region.  Fixes PR#44239.
Fix from oster@, code (such as it is) by me.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/raidframe/rf_paritymap.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/raidframe/rf_paritymap.c
diff -u src/sys/dev/raidframe/rf_paritymap.c:1.5 src/sys/dev/raidframe/rf_paritymap.c:1.6
--- src/sys/dev/raidframe/rf_paritymap.c:1.5	Sun Mar 14 21:11:41 2010
+++ src/sys/dev/raidframe/rf_paritymap.c	Tue Mar  1 22:51:14 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_paritymap.c,v 1.5 2010/03/14 21:11:41 jld Exp $ */
+/* $NetBSD: rf_paritymap.c,v 1.6 2011/03/01 22:51:14 riz Exp $ */
 
 /*-
  * Copyright (c) 2009 Jed Davis.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rf_paritymap.c,v 1.5 2010/03/14 21:11:41 jld Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_paritymap.c,v 1.6 2011/03/01 22:51:14 riz Exp $");
 
 #include 
 #include 
@@ -409,6 +409,8 @@
 	nreg = bytes_per_disk / REGION_MINSIZE;
 	if (nreg > RF_PARITYMAP_NREG)
 		nreg = RF_PARITYMAP_NREG;
+	if (nreg < 1)
+		nreg = 1;
 
 	return (u_int)nreg;
 }



CVS commit: src/tests/dev/raidframe

2011-03-01 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Tue Mar  1 22:52:54 UTC 2011

Modified Files:
src/tests/dev/raidframe: t_raid.sh

Log Message:
PR#44239 is now fixed, remove the xfail from the test.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/dev/raidframe/t_raid.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/dev/raidframe/t_raid.sh
diff -u src/tests/dev/raidframe/t_raid.sh:1.6 src/tests/dev/raidframe/t_raid.sh:1.7
--- src/tests/dev/raidframe/t_raid.sh:1.6	Fri Feb  4 19:44:00 2011
+++ src/tests/dev/raidframe/t_raid.sh	Tue Mar  1 22:52:54 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: t_raid.sh,v 1.6 2011/02/04 19:44:00 pooka Exp $
+#	$NetBSD: t_raid.sh,v 1.7 2011/03/01 22:52:54 riz Exp $
 #
 # Copyright (c) 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -61,7 +61,6 @@
 	-d key=/disk1,hostpath=disk1.img,size=1m		\
 	${RUMP_SERVER}
 
-	atf_expect_fail "PR kern/44239" # ADJUST CLEANUP WHEN THIS IS FIXED!
 	atf_check -s exit:0 rump.raidctl -C raid.conf raid0
 }
 
@@ -69,7 +68,6 @@
 {
 	export RUMP_SERVER=unix://sock
 	rump.halt
-	: server dumps currently, so reset error.  remove this line when fixed
 }
 
 



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

2011-03-01 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Wed Mar  2 03:42:56 UTC 2011

Modified Files:
src/tests/lib/libc/gen: t_siginfo.c

Log Message:
Skip the sigfpe_flt and sigfpe_int tests on powerpc; powerpc does
not fault on divide-by-zero.  As discussed on tech-userlevel.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/tests/lib/libc/gen/t_siginfo.c

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

Modified files:

Index: src/tests/lib/libc/gen/t_siginfo.c
diff -u src/tests/lib/libc/gen/t_siginfo.c:1.9 src/tests/lib/libc/gen/t_siginfo.c:1.10
--- src/tests/lib/libc/gen/t_siginfo.c:1.9	Tue Mar  1 12:47:43 2011
+++ src/tests/lib/libc/gen/t_siginfo.c	Wed Mar  2 03:42:56 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: t_siginfo.c,v 1.9 2011/03/01 12:47:43 pooka Exp $ */
+/* $NetBSD: t_siginfo.c,v 1.10 2011/03/02 03:42:56 riz Exp $ */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -27,6 +27,7 @@
  */
 
 #include 
+#include 
 
 #include 
 #include 
@@ -38,6 +39,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -302,6 +304,8 @@
 	"'cpu0: Intel Pentium II (Klamath) (686-class), id 0x633'") == 0)
 		atf_tc_skip("Test does not run correctly under qemu "
 		"(heuristic match)");
+	if (strcmp(atf_config_get("atf_arch"),"powerpc") == 0)
+		atf_tc_skip("Test not valid on powerpc");
 	if (sigsetjmp(sigfpe_flt_env, 0) == 0) {
 		sa.sa_flags = SA_SIGINFO;
 		sa.sa_sigaction = sigfpe_flt_action;
@@ -351,6 +355,8 @@
 	struct sigaction sa;
 	long l = strtol("0", NULL, 10);
 
+	if (strcmp(atf_config_get("atf_arch"),"powerpc") == 0)
+		atf_tc_skip("Test not valid on powerpc");
 	if (sigsetjmp(sigfpe_int_env, 0) == 0) {
 		sa.sa_flags = SA_SIGINFO;
 		sa.sa_sigaction = sigfpe_int_action;



CVS commit: src/sys

2011-03-01 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Wed Mar  2 06:17:09 UTC 2011

Modified Files:
src/sys/arch/x86/acpi: acpi_cpu_md.c
src/sys/dev/acpi: acpi_cpu.c

Log Message:
Append Intel's Turbo Boost to the debug printfs if we detect it.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/x86/acpi/acpi_cpu_md.c
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/acpi/acpi_cpu.c

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

Modified files:

Index: src/sys/arch/x86/acpi/acpi_cpu_md.c
diff -u src/sys/arch/x86/acpi/acpi_cpu_md.c:1.50 src/sys/arch/x86/acpi/acpi_cpu_md.c:1.51
--- src/sys/arch/x86/acpi/acpi_cpu_md.c:1.50	Tue Mar  1 05:02:16 2011
+++ src/sys/arch/x86/acpi/acpi_cpu_md.c	Wed Mar  2 06:17:09 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu_md.c,v 1.50 2011/03/01 05:02:16 jruoho Exp $ */
+/* $NetBSD: acpi_cpu_md.c,v 1.51 2011/03/02 06:17:09 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2010, 2011 Jukka Ruohonen 
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_md.c,v 1.50 2011/03/01 05:02:16 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_md.c,v 1.51 2011/03/02 06:17:09 jruoho Exp $");
 
 #include 
 #include 
@@ -533,6 +533,7 @@
 		/*
 		 * If the so-called Turbo Boost is present,
 		 * the P0-state is always the "turbo state".
+		 * It is shown as the P1 frequency + 1 MHz.
 		 *
 		 * For discussion, see:
 		 *
@@ -540,8 +541,13 @@
 		 *	in Intel Core(tm) Microarchitectures (Nehalem)
 		 *	Based Processors. White Paper, November 2008.
 		 */
-		if ((sc->sc_flags & ACPICPU_FLAG_P_TURBO) != 0)
-			sc->sc_pstate[0].ps_flags |= ACPICPU_FLAG_P_TURBO;
+		if ((sc->sc_flags & ACPICPU_FLAG_P_TURBO) != 0) {
+
+			ps = &sc->sc_pstate[0];
+
+			if (ps->ps_freq == sc->sc_pstate[1].ps_freq + 1)
+ps->ps_flags |= ACPICPU_FLAG_P_TURBO;
+		}
 
 		msr.ps_control_addr = MSR_PERF_CTL;
 		msr.ps_control_mask = __BITS(0, 15);

Index: src/sys/dev/acpi/acpi_cpu.c
diff -u src/sys/dev/acpi/acpi_cpu.c:1.34 src/sys/dev/acpi/acpi_cpu.c:1.35
--- src/sys/dev/acpi/acpi_cpu.c:1.34	Tue Mar  1 13:38:45 2011
+++ src/sys/dev/acpi/acpi_cpu.c	Wed Mar  2 06:17:08 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu.c,v 1.34 2011/03/01 13:38:45 jruoho Exp $ */
+/* $NetBSD: acpi_cpu.c,v 1.35 2011/03/02 06:17:08 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2010, 2011 Jukka Ruohonen 
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_cpu.c,v 1.34 2011/03/01 13:38:45 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cpu.c,v 1.35 2011/03/02 06:17:08 jruoho Exp $");
 
 #include 
 #include 
@@ -800,10 +800,10 @@
 continue;
 
 			aprint_verbose_dev(sc->sc_dev, "C%d: %3s, "
-			"lat %3u us, pow %5u mW, %s\n", i,
+			"lat %3u us, pow %5u mW%s\n", i,
 			acpicpu_debug_print_method(cs->cs_method),
 			cs->cs_latency, cs->cs_power,
-			(cs->cs_flags != 0) ? "bus master check" : "");
+			(cs->cs_flags != 0) ? ", bus master check" : "");
 		}
 
 		method = sc->sc_pstate_control.reg_spaceid;
@@ -816,9 +816,11 @@
 continue;
 
 			aprint_verbose_dev(sc->sc_dev, "P%d: %3s, "
-			"lat %3u us, pow %5u mW, %4u MHz\n", i,
+			"lat %3u us, pow %5u mW, %4u MHz%s\n", i,
 			acpicpu_debug_print_method(method),
-			ps->ps_latency, ps->ps_power, ps->ps_freq);
+			ps->ps_latency, ps->ps_power, ps->ps_freq,
+			(ps->ps_flags & ACPICPU_FLAG_P_TURBO) != 0 ?
+			", turbo boost" : "");
 		}
 
 		method = sc->sc_tstate_control.reg_spaceid;



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

2011-03-01 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Wed Mar  2 06:23:17 UTC 2011

Modified Files:
src/sys/arch/x86/acpi: acpi_cpu_md.c

Log Message:
Adjust the detection of Turbo Boost to prevent a theoretical array OOB access.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/x86/acpi/acpi_cpu_md.c

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

Modified files:

Index: src/sys/arch/x86/acpi/acpi_cpu_md.c
diff -u src/sys/arch/x86/acpi/acpi_cpu_md.c:1.51 src/sys/arch/x86/acpi/acpi_cpu_md.c:1.52
--- src/sys/arch/x86/acpi/acpi_cpu_md.c:1.51	Wed Mar  2 06:17:09 2011
+++ src/sys/arch/x86/acpi/acpi_cpu_md.c	Wed Mar  2 06:23:17 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu_md.c,v 1.51 2011/03/02 06:17:09 jruoho Exp $ */
+/* $NetBSD: acpi_cpu_md.c,v 1.52 2011/03/02 06:23:17 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2010, 2011 Jukka Ruohonen 
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_md.c,v 1.51 2011/03/02 06:17:09 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_md.c,v 1.52 2011/03/02 06:23:17 jruoho Exp $");
 
 #include 
 #include 
@@ -541,7 +541,8 @@
 		 *	in Intel Core(tm) Microarchitectures (Nehalem)
 		 *	Based Processors. White Paper, November 2008.
 		 */
-		if ((sc->sc_flags & ACPICPU_FLAG_P_TURBO) != 0) {
+		if (sc->sc_pstate_count > 2 &&
+		   (sc->sc_flags & ACPICPU_FLAG_P_TURBO) != 0) {
 
 			ps = &sc->sc_pstate[0];