CVS commit: src/sys/kern

2011-04-14 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Apr 14 06:12:02 UTC 2011

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

Log Message:
rearrange some common code in lockdebug_unlocked.
When printing a lockdebug error, add a '*' to indicate whether lock or
unlock was performed.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/kern/subr_lockdebug.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_lockdebug.c
diff -u src/sys/kern/subr_lockdebug.c:1.43 src/sys/kern/subr_lockdebug.c:1.44
--- src/sys/kern/subr_lockdebug.c:1.43	Sat Sep 25 01:42:39 2010
+++ src/sys/kern/subr_lockdebug.c	Thu Apr 14 06:12:02 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_lockdebug.c,v 1.43 2010/09/25 01:42:39 matt Exp $	*/
+/*	$NetBSD: subr_lockdebug.c,v 1.44 2011/04/14 06:12:02 matt Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: subr_lockdebug.c,v 1.43 2010/09/25 01:42:39 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: subr_lockdebug.c,v 1.44 2011/04/14 06:12:02 matt Exp $);
 
 #include opt_ddb.h
 
@@ -572,9 +572,6 @@
 not held by current LWP, true);
 return;
 			}
-			ld-ld_flags = ~LD_LOCKED;
-			ld-ld_unlocked = where;
-			ld-ld_lwp = NULL;
 			TAILQ_REMOVE(l-l_ld_locks, ld, ld_chain);
 		} else {
 			if (ld-ld_cpu != (uint16_t)cpu_index(curcpu())) {
@@ -582,12 +579,12 @@
 not held by current CPU, true);
 return;
 			}
-			ld-ld_flags = ~LD_LOCKED;
-			ld-ld_unlocked = where;		
-			ld-ld_lwp = NULL;
 			TAILQ_REMOVE(curcpu()-ci_data.cpu_ld_locks, ld,
 			ld_chain);
 		}
+		ld-ld_flags = ~LD_LOCKED;
+		ld-ld_unlocked = where;		
+		ld-ld_lwp = NULL;
 	}
 	__cpu_simple_unlock(ld-ld_spinlock);
 	splx(s);
@@ -733,12 +730,15 @@
 		shares wanted: %18u exclusive: %18u\n
 		current cpu  : %18u last held: %18u\n
 		current lwp  : %#018lx last held: %#018lx\n
-		last locked  : %#018lx unlocked : %#018lx\n,
+		last locked%c : %#018lx unlocked%c: %#018lx\n,
 		(unsigned)ld-ld_shares, ((ld-ld_flags  LD_LOCKED) != 0),
 		(unsigned)ld-ld_shwant, (unsigned)ld-ld_exwant,
 		(unsigned)cpu_index(curcpu()), (unsigned)ld-ld_cpu,
 		(long)curlwp, (long)ld-ld_lwp,
-		(long)ld-ld_locked, (long)ld-ld_unlocked);
+		((ld-ld_flags  LD_LOCKED) ? '*' : ' '),
+		(long)ld-ld_locked,
+		((ld-ld_flags  LD_LOCKED) ? ' ' : '*'),
+		(long)ld-ld_unlocked);
 	}
 
 	if (ld-ld_lockops-lo_dump != NULL)



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

2011-04-14 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Thu Apr 14 06:12:21 UTC 2011

Modified Files:
src/sys/arch/mips/rmi: rmixl_cpucore.c

Log Message:
- fix comment at cpucore_rmixl_run()


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/mips/rmi/rmixl_cpucore.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/mips/rmi/rmixl_cpucore.c
diff -u src/sys/arch/mips/rmi/rmixl_cpucore.c:1.3 src/sys/arch/mips/rmi/rmixl_cpucore.c:1.4
--- src/sys/arch/mips/rmi/rmixl_cpucore.c:1.3	Thu Apr 14 05:14:23 2011
+++ src/sys/arch/mips/rmi/rmixl_cpucore.c	Thu Apr 14 06:12:21 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_cpucore.c,v 1.3 2011/04/14 05:14:23 cliff Exp $	*/
+/*	$NetBSD: rmixl_cpucore.c,v 1.4 2011/04/14 06:12:21 cliff Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -38,7 +38,7 @@
 #include locators.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rmixl_cpucore.c,v 1.3 2011/04/14 05:14:23 cliff Exp $);
+__KERNEL_RCSID(0, $NetBSD: rmixl_cpucore.c,v 1.4 2011/04/14 06:12:21 cliff Exp $);
 
 #include opt_multiprocessor.h
 
@@ -199,7 +199,8 @@
 
 /*
  * cpucore_rmixl_run
- *	called from cpu_rmixl_hatch for each cpu
+ *	called from cpucore_rmixl_attach for primary core
+ *	and called from cpu_rmixl_run for each hatched cpu
  *	the first call for each cpucore causes init of per-core features:
  *	- disable unused threads
  *	- set Fine-grained (Round Robin) thread scheduling mode



CVS commit: src/sys/dev/acpi

2011-04-14 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Thu Apr 14 06:25:25 UTC 2011

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

Log Message:
Simplify by using a static array for the reference counting.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/acpi/acpi_power.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_power.c
diff -u src/sys/dev/acpi/acpi_power.c:1.29 src/sys/dev/acpi/acpi_power.c:1.30
--- src/sys/dev/acpi/acpi_power.c:1.29	Sun Jan  9 16:22:07 2011
+++ src/sys/dev/acpi/acpi_power.c	Thu Apr 14 06:25:25 2011
@@ -1,7 +1,7 @@
-/* $NetBSD: acpi_power.c,v 1.29 2011/01/09 16:22:07 jruoho Exp $ */
+/* $NetBSD: acpi_power.c,v 1.30 2011/04/14 06:25:25 jruoho Exp $ */
 
 /*-
- * Copyright (c) 2009, 2010 The NetBSD Foundation, Inc.
+ * Copyright (c) 2009, 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -56,7 +56,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: acpi_power.c,v 1.29 2011/01/09 16:22:07 jruoho Exp $);
+__KERNEL_RCSID(0, $NetBSD: acpi_power.c,v 1.30 2011/04/14 06:25:25 jruoho Exp $);
 
 #include sys/param.h
 #include sys/kmem.h
@@ -74,27 +74,15 @@
 #define	ACPI_STA_POW_OFF		0x00
 #define	ACPI_STA_POW_ON			0x01
 
-/*
- * References.
- */
-struct acpi_power_ref {
-	ACPI_HANDLE			ref_handle;
-
-	SIMPLEQ_ENTRY(acpi_power_ref)	ref_list;
-};
-
-/*
- * Resources.
- */
 struct acpi_power_res {
 	ACPI_HANDLE			res_handle;
 	ACPI_INTEGER			res_level;
 	ACPI_INTEGER			res_order;
+	ACPI_HANDLE			res_ref[5];
 	charres_name[5];
 	kmutex_t			res_mutex;
 
 	TAILQ_ENTRY(acpi_power_res)	res_list;
-	SIMPLEQ_HEAD(, acpi_power_ref)	ref_head;
 };
 
 static TAILQ_HEAD(, acpi_power_res) res_head =
@@ -128,6 +116,7 @@
 	ACPI_OBJECT *obj;
 	ACPI_BUFFER buf;
 	ACPI_STATUS rv;
+	size_t i;
 
 	rv = acpi_eval_struct(hdl, NULL, buf);
 
@@ -155,7 +144,9 @@
 	(void)strlcpy(res-res_name,
 	acpi_xname(hdl), sizeof(res-res_name));
 
-	SIMPLEQ_INIT(res-ref_head);
+	for (i = 0; i  __arraycount(res-res_ref); i++)
+		res-res_ref[i] = NULL;
+
 	mutex_init(res-res_mutex, MUTEX_DEFAULT, IPL_NONE);
 
 	/*
@@ -481,8 +472,13 @@
 	if (res == NULL)
 		return AE_NOT_FOUND;
 
+	if (ref == NULL)
+		return AE_BAD_PARAMETER;
+
 	/*
-	 * (De)reference the resource.
+	 * Adjust the reference counting. This is
+	 * necessary since a single power resource
+	 * can be shared by multiple devices.
 	 */
 	switch (on) {
 
@@ -510,82 +506,70 @@
 }
 
 static ACPI_STATUS
-acpi_power_res_ref(struct acpi_power_res *res, ACPI_HANDLE hdl)
+acpi_power_res_ref(struct acpi_power_res *res, ACPI_HANDLE ref)
 {
-	struct acpi_power_ref *ref, *tmp;
+	size_t i, j = SIZE_MAX;
 
-	ref = kmem_zalloc(sizeof(*ref), KM_SLEEP);
+	mutex_enter(res-res_mutex);
 
-	if (ref == NULL)
-		return AE_NO_MEMORY;
+	for (i = 0; i  __arraycount(res-res_ref); i++) {
 
-	mutex_enter(res-res_mutex);
+		/*
+		 * Do not error out if the handle
+		 * has already been referenced.
+		 */
+		if (res-res_ref[i] == ref) {
+			mutex_exit(res-res_mutex);
+			return AE_OK;
+		}
 
-	SIMPLEQ_FOREACH(tmp, res-ref_head, ref_list) {
+		if (j == SIZE_MAX  res-res_ref[i] == NULL)
+			j = i;
+	}
 
-		if (tmp-ref_handle == hdl)
-			goto out;
+	if (j == SIZE_MAX) {
+		mutex_exit(res-res_mutex);
+		return AE_LIMIT;
 	}
 
-	ref-ref_handle = hdl;
-	SIMPLEQ_INSERT_TAIL(res-ref_head, ref, ref_list);
+	res-res_ref[j] = ref;
 	mutex_exit(res-res_mutex);
 
 	ACPI_DEBUG_PRINT((ACPI_DB_INFO, %s referenced 
-		by %s\n, res-res_name, acpi_xname(hdl)));
-
-	return AE_OK;
-
-out:
-	mutex_exit(res-res_mutex);
-	kmem_free(ref, sizeof(*ref));
-
-	ACPI_DEBUG_PRINT((ACPI_DB_INFO, %s already referenced 
-		by %s?\n, res-res_name, acpi_xname(hdl)));
+		by %s\n, res-res_name, acpi_xname(ref)));
 
 	return AE_OK;
 }
 
 static ACPI_STATUS
-acpi_power_res_deref(struct acpi_power_res *res, ACPI_HANDLE hdl)
+acpi_power_res_deref(struct acpi_power_res *res, ACPI_HANDLE ref)
 {
-	struct acpi_power_ref *ref;
+	size_t i;
 
 	mutex_enter(res-res_mutex);
 
-	if (SIMPLEQ_EMPTY(res-ref_head) != 0) {
+	for (i = 0; i  __arraycount(res-res_ref); i++) {
+
+		if (res-res_ref[i] != ref)
+			continue;
+
+		res-res_ref[i] = NULL;
 		mutex_exit(res-res_mutex);
-		return AE_OK;
-	}
 
-	SIMPLEQ_FOREACH(ref, res-ref_head, ref_list) {
+		ACPI_DEBUG_PRINT((ACPI_DB_INFO, %s dereferenced 
+			by %s\n, res-res_name, acpi_xname(ref)));
 
-		if (ref-ref_handle == hdl) {
-			SIMPLEQ_REMOVE(res-ref_head,
-			ref, acpi_power_ref, ref_list);
-			mutex_exit(res-res_mutex);
-			kmem_free(ref, sizeof(*ref));
-			mutex_enter(res-res_mutex);
-			break;
-		}
+		return AE_OK;
 	}
 
 	/*
-	 * If the queue remains non-empty,
+	 * If the array remains to be non-empty,
 	 * something else is using the resource
 	 * and hence it can not be turned off.
 	 */
-	if (SIMPLEQ_EMPTY(res-ref_head) == 0) {
-		

CVS commit: src/sys/dev/acpi

2011-04-14 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Thu Apr 14 06:37:13 UTC 2011

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

Log Message:
Use the common power resource code. Also add a comment explaining
what can happen if we do not power on the resource upon resume from S3.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/acpi/thinkpad_acpi.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/thinkpad_acpi.c
diff -u src/sys/dev/acpi/thinkpad_acpi.c:1.35 src/sys/dev/acpi/thinkpad_acpi.c:1.36
--- src/sys/dev/acpi/thinkpad_acpi.c:1.35	Sun Mar 27 08:52:25 2011
+++ src/sys/dev/acpi/thinkpad_acpi.c	Thu Apr 14 06:37:13 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: thinkpad_acpi.c,v 1.35 2011/03/27 08:52:25 mlelstv Exp $ */
+/* $NetBSD: thinkpad_acpi.c,v 1.36 2011/04/14 06:37:13 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: thinkpad_acpi.c,v 1.35 2011/03/27 08:52:25 mlelstv Exp $);
+__KERNEL_RCSID(0, $NetBSD: thinkpad_acpi.c,v 1.36 2011/04/14 06:37:13 jruoho Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -37,6 +37,7 @@
 #include dev/acpi/acpireg.h
 #include dev/acpi/acpivar.h
 #include dev/acpi/acpi_ecvar.h
+#include dev/acpi/acpi_power.h
 
 #include dev/isa/isareg.h
 
@@ -51,6 +52,7 @@
 	device_t		sc_dev;
 	device_t		sc_ecdev;
 	struct acpi_devnode	*sc_node;
+	ACPI_HANDLE		sc_powhdl;
 	ACPI_HANDLE		sc_cmoshdl;
 	bool			sc_cmoshdl_valid;
 
@@ -170,8 +172,9 @@
 	ACPI_INTEGER val;
 	int i;
 
-	sc-sc_node = aa-aa_node;
 	sc-sc_dev = self;
+	sc-sc_powhdl = NULL;
+	sc-sc_node = aa-aa_node;
 	sc-sc_display_state = THINKPAD_DISPLAY_LCD;
 
 	aprint_naive(\n);
@@ -218,6 +221,14 @@
 
 	(void)acpi_register_notify(sc-sc_node, thinkpad_notify_handler);
 
+	/*
+	 * Obtain a handle to the power resource available on many models.
+	 * Since pmf(9) is not yet integrated with the ACPI power resource
+	 * code, this must be turned on manually upon resume. Otherwise the
+	 * system may, for instance, resume from S3 with usb(4) powered down.
+	 */
+	(void)AcpiGetHandle(NULL, \\_SB.PCI0.LPC.EC.PUBS, sc-sc_powhdl);
+
 	/* Register power switches with sysmon */
 	psw = sc-sc_smpsw;
 	sc-sc_smpsw_valid = true;
@@ -633,17 +644,12 @@
 static bool
 thinkpad_resume(device_t dv, const pmf_qual_t *qual)
 {
-	ACPI_STATUS rv;
-	ACPI_HANDLE pubs;
+	thinkpad_softc_t *sc = device_private(dv);
 
-	rv = AcpiGetHandle(NULL, \\_SB.PCI0.LPC.EC.PUBS, pubs);
-	if (ACPI_FAILURE(rv))
-		return true;	/* not fatal */
+	if (sc-sc_powhdl == NULL)
+		return true;
 
-	rv = AcpiEvaluateObject(pubs, _ON, NULL, NULL);
-	if (ACPI_FAILURE(rv))
-		aprint_error_dev(dv, failed to execute PUBS._ON: %s\n,
-		AcpiFormatException(rv));
+	(void)acpi_power_res(sc-sc_powhdl, sc-sc_node-ad_handle, true);
 
 	return true;
 }



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

2011-04-14 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Thu Apr 14 06:54:58 UTC 2011

Modified Files:
src/sys/arch/mips/mips: cpu_subr.c

Log Message:
cpuwatch_* stuff is #if (MIPS32 + MIPS32R2 + MIPS64 + MIPS64R2)  0
now cobalt can build


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/mips/mips/cpu_subr.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/mips/mips/cpu_subr.c
diff -u src/sys/arch/mips/mips/cpu_subr.c:1.8 src/sys/arch/mips/mips/cpu_subr.c:1.9
--- src/sys/arch/mips/mips/cpu_subr.c:1.8	Thu Apr 14 05:54:24 2011
+++ src/sys/arch/mips/mips/cpu_subr.c	Thu Apr 14 06:54:57 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.8 2011/04/14 05:54:24 cliff Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.9 2011/04/14 06:54:57 cliff Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu_subr.c,v 1.8 2011/04/14 05:54:24 cliff Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu_subr.c,v 1.9 2011/04/14 06:54:57 cliff Exp $);
 
 #include opt_ddb.h
 #include opt_multiprocessor.h
@@ -1014,6 +1014,8 @@
 }
 
 
+#if (MIPS32 + MIPS32R2 + MIPS64 + MIPS64R2)  0
+
 #if (CPUWATCH_MAX != 8)
 # error CPUWATCH_MAX
 #endif
@@ -1145,3 +1147,4 @@
 	mipsNN_cp0_watchlo_write(cwnum, 0);
 }
 
+#endif	/* (MIPS32 + MIPS32R2 + MIPS64 + MIPS64R2)  0 */



CVS commit: src/share/man/man3

2011-04-14 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Apr 14 06:56:28 UTC 2011

Modified Files:
src/share/man/man3: __alignof__.3 offsetof.3

Log Message:
No need to use \*[q], use plain double quotes instead.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/share/man/man3/__alignof__.3 \
src/share/man/man3/offsetof.3

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/man3/__alignof__.3
diff -u src/share/man/man3/__alignof__.3:1.4 src/share/man/man3/__alignof__.3:1.5
--- src/share/man/man3/__alignof__.3:1.4	Mon Dec 20 19:15:26 2010
+++ src/share/man/man3/__alignof__.3	Thu Apr 14 06:56:28 2011
@@ -1,4 +1,4 @@
-.\ $NetBSD: __alignof__.3,v 1.4 2010/12/20 19:15:26 jruoho Exp $
+.\ $NetBSD: __alignof__.3,v 1.5 2011/04/14 06:56:28 wiz Exp $
 .\
 .\ Copyright (c) 2010 Jukka Ruohonen jruoho...@iki.fi
 .\ All rights reserved.
@@ -61,7 +61,7 @@
 If the architecture aligns integers along 32-bit address boundaries,
 the following should print the value 4.
 .Bd -literal -offset indent
-(void)printf(\*[q]%d\en\*[q], __alignof__(int));
+(void)printf(%d\en, __alignof__(int));
 .Ed
 .Pp
 On the other hand, the following example should print the value 1,
@@ -73,7 +73,7 @@
 	char y;
 } a;
 
-(void)printf(\*[q]%d\en\*[q], __alignof__(a.y));
+(void)printf(%d\en, __alignof__(a.y));
 .Ed
 .Sh SEE ALSO
 .Xr gcc 1 ,
Index: src/share/man/man3/offsetof.3
diff -u src/share/man/man3/offsetof.3:1.4 src/share/man/man3/offsetof.3:1.5
--- src/share/man/man3/offsetof.3:1.4	Fri Apr  1 05:24:37 2011
+++ src/share/man/man3/offsetof.3	Thu Apr 14 06:56:28 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: offsetof.3,v 1.4 2011/04/01 05:24:37 jruoho Exp $
+.\	$NetBSD: offsetof.3,v 1.5 2011/04/14 06:56:28 wiz Exp $
 .\
 .\	$OpenBSD: offsetof.3,v 1.2 2010/02/18 18:30:19 jmc Exp $
 .\
@@ -59,7 +59,7 @@
 y = offsetof(struct example, y);
 z = offsetof(struct example, z);
 
-(void)printf(\*[q]%zu %zu %zu\en\*[q], x, y, z);
+(void)printf(%zu %zu %zu\en, x, y, z);
 .Ed
 .Sh SEE ALSO
 .Xr __alignof__ 3 ,



CVS commit: src/sys/dev/acpi

2011-04-14 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Thu Apr 14 07:06:53 UTC 2011

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

Log Message:
Simplify a little. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/acpi/thinkpad_acpi.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/thinkpad_acpi.c
diff -u src/sys/dev/acpi/thinkpad_acpi.c:1.36 src/sys/dev/acpi/thinkpad_acpi.c:1.37
--- src/sys/dev/acpi/thinkpad_acpi.c:1.36	Thu Apr 14 06:37:13 2011
+++ src/sys/dev/acpi/thinkpad_acpi.c	Thu Apr 14 07:06:52 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: thinkpad_acpi.c,v 1.36 2011/04/14 06:37:13 jruoho Exp $ */
+/* $NetBSD: thinkpad_acpi.c,v 1.37 2011/04/14 07:06:52 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: thinkpad_acpi.c,v 1.36 2011/04/14 06:37:13 jruoho Exp $);
+__KERNEL_RCSID(0, $NetBSD: thinkpad_acpi.c,v 1.37 2011/04/14 07:06:52 jruoho Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -54,7 +54,6 @@
 	struct acpi_devnode	*sc_node;
 	ACPI_HANDLE		sc_powhdl;
 	ACPI_HANDLE		sc_cmoshdl;
-	bool			sc_cmoshdl_valid;
 
 #define	TP_PSW_SLEEP		0
 #define	TP_PSW_HIBERNATE	1
@@ -174,21 +173,13 @@
 
 	sc-sc_dev = self;
 	sc-sc_powhdl = NULL;
+	sc-sc_cmoshdl = NULL;
 	sc-sc_node = aa-aa_node;
 	sc-sc_display_state = THINKPAD_DISPLAY_LCD;
 
 	aprint_naive(\n);
 	aprint_normal(\n);
 
-	/* T61 uses \UCMS method for issuing CMOS commands */
-	rv = AcpiGetHandle(NULL, \\UCMS, sc-sc_cmoshdl);
-	if (ACPI_FAILURE(rv))
-		sc-sc_cmoshdl_valid = false;
-	else {
-		aprint_debug_dev(self, using CMOS at \\UCMS\n);
-		sc-sc_cmoshdl_valid = true;
-	}
-
 	sc-sc_ecdev = NULL;
 	for (curdev = deviter_first(di, DEVITER_F_ROOT_FIRST);
 	 curdev != NULL; curdev = deviter_next(di))
@@ -222,6 +213,11 @@
 	(void)acpi_register_notify(sc-sc_node, thinkpad_notify_handler);
 
 	/*
+	 * Obtain a handle for CMOS commands. This is used by T61.
+	 */
+	(void)AcpiGetHandle(NULL, \\UCMS, sc-sc_cmoshdl);
+
+	/*
 	 * Obtain a handle to the power resource available on many models.
 	 * Since pmf(9) is not yet integrated with the ACPI power resource
 	 * code, this must be turned on manually upon resume. Otherwise the
@@ -614,6 +610,7 @@
 
 	if (thinkpad_brightness_read(sc) == 7)
 		return;
+
 	thinkpad_cmos(sc, THINKPAD_CMOS_BRIGHTNESS_UP);
 }
 
@@ -624,6 +621,7 @@
 
 	if (thinkpad_brightness_read(sc) == 0)
 		return;
+
 	thinkpad_cmos(sc, THINKPAD_CMOS_BRIGHTNESS_DOWN);
 }
 
@@ -632,12 +630,13 @@
 {
 	ACPI_STATUS rv;
 
-	if (sc-sc_cmoshdl_valid == false)
+	if (sc-sc_cmoshdl == NULL)
 		return;
 
 	rv = acpi_eval_set_integer(sc-sc_cmoshdl, NULL, cmd);
+
 	if (ACPI_FAILURE(rv))
-		aprint_error_dev(sc-sc_dev, couldn't evalute CMOS: %s\n,
+		aprint_error_dev(sc-sc_dev, couldn't evaluate CMOS: %s\n,
 		AcpiFormatException(rv));
 }
 



CVS commit: src/external/gpl3/binutils/dist

2011-04-14 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Apr 14 07:49:49 UTC 2011

Modified Files:
src/external/gpl3/binutils/dist/bfd: aoutx.h archures.c bfd-in2.h
cpu-mips.c elfxx-mips.c
src/external/gpl3/binutils/dist/binutils: readelf.c
src/external/gpl3/binutils/dist/gas/config: tc-mips.c tc-vax.h
src/external/gpl3/binutils/dist/gas/doc: c-mips.texi
src/external/gpl3/binutils/dist/gas/testsuite/gas/mips: mips.exp
src/external/gpl3/binutils/dist/include/elf: mips.h
src/external/gpl3/binutils/dist/include/opcode: mips.h
src/external/gpl3/binutils/dist/opcodes: mips-dis.c mips-opc.c
Added Files:
src/external/gpl3/binutils/dist/gas/testsuite/gas/mips: xlr-ext.d
xlr-ext.s

Log Message:
Pull in MIPS XLR (XLS) support from patch in
http://sourceware.org/ml/binutils/2009-01/msg00383.html
This replaces local changes to support some xlr instructions.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/gpl3/binutils/dist/bfd/aoutx.h \
src/external/gpl3/binutils/dist/bfd/archures.c \
src/external/gpl3/binutils/dist/bfd/cpu-mips.c
cvs rdiff -u -r1.2 -r1.3 src/external/gpl3/binutils/dist/bfd/bfd-in2.h
cvs rdiff -u -r1.3 -r1.4 src/external/gpl3/binutils/dist/bfd/elfxx-mips.c
cvs rdiff -u -r1.2 -r1.3 src/external/gpl3/binutils/dist/binutils/readelf.c
cvs rdiff -u -r1.2 -r1.3 src/external/gpl3/binutils/dist/gas/config/tc-mips.c \
src/external/gpl3/binutils/dist/gas/config/tc-vax.h
cvs rdiff -u -r1.2 -r1.3 src/external/gpl3/binutils/dist/gas/doc/c-mips.texi
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/external/gpl3/binutils/dist/gas/testsuite/gas/mips/mips.exp
cvs rdiff -u -r0 -r1.1 \
src/external/gpl3/binutils/dist/gas/testsuite/gas/mips/xlr-ext.d \
src/external/gpl3/binutils/dist/gas/testsuite/gas/mips/xlr-ext.s
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/external/gpl3/binutils/dist/include/elf/mips.h
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/external/gpl3/binutils/dist/include/opcode/mips.h
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/external/gpl3/binutils/dist/opcodes/mips-dis.c
cvs rdiff -u -r1.3 -r1.4 src/external/gpl3/binutils/dist/opcodes/mips-opc.c

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

Modified files:

Index: src/external/gpl3/binutils/dist/bfd/aoutx.h
diff -u src/external/gpl3/binutils/dist/bfd/aoutx.h:1.1.1.1 src/external/gpl3/binutils/dist/bfd/aoutx.h:1.2
--- src/external/gpl3/binutils/dist/bfd/aoutx.h:1.1.1.1	Tue Aug 18 09:23:22 2009
+++ src/external/gpl3/binutils/dist/bfd/aoutx.h	Thu Apr 14 07:49:48 2011
@@ -793,6 +793,7 @@
 	case bfd_mach_mipsisa64:
 	case bfd_mach_mipsisa64r2:
 	case bfd_mach_mips_sb1:
+	case bfd_mach_mips_xlr:
 	  /* FIXME: These should be MIPS3, MIPS4, MIPS16, MIPS32, etc.  */
 	  arch_flags = M_MIPS2;
 	  break;
Index: src/external/gpl3/binutils/dist/bfd/archures.c
diff -u src/external/gpl3/binutils/dist/bfd/archures.c:1.1.1.1 src/external/gpl3/binutils/dist/bfd/archures.c:1.2
--- src/external/gpl3/binutils/dist/bfd/archures.c:1.1.1.1	Tue Aug 18 09:23:24 2009
+++ src/external/gpl3/binutils/dist/bfd/archures.c	Thu Apr 14 07:49:48 2011
@@ -173,6 +173,7 @@
 .#define bfd_mach_mips_loongson_2f  3002
 .#define bfd_mach_mips_sb1  12310201 {* octal 'SB', 01 *}
 .#define bfd_mach_mips_octeon		6501
+.#define bfd_mach_mips_xlr  887682   {* decimal 'XLR'  *}
 .#define bfd_mach_mipsisa32 32
 .#define bfd_mach_mipsisa32r2   33
 .#define bfd_mach_mipsisa64 64
Index: src/external/gpl3/binutils/dist/bfd/cpu-mips.c
diff -u src/external/gpl3/binutils/dist/bfd/cpu-mips.c:1.1.1.1 src/external/gpl3/binutils/dist/bfd/cpu-mips.c:1.2
--- src/external/gpl3/binutils/dist/bfd/cpu-mips.c:1.1.1.1	Tue Aug 18 09:24:08 2009
+++ src/external/gpl3/binutils/dist/bfd/cpu-mips.c	Thu Apr 14 07:49:48 2011
@@ -89,7 +89,8 @@
   I_sb1,
   I_loongson_2e,
   I_loongson_2f,
-  I_mipsocteon
+  I_mipsocteon,
+  I_xlr
 };
 
 #define NN(index) (arch_info_struct[(index) + 1])
@@ -125,7 +126,8 @@
   N (64, 64, bfd_mach_mips_sb1, mips:sb1,   FALSE, NN(I_sb1)),
   N (64, 64, bfd_mach_mips_loongson_2e, mips:loongson_2e,   FALSE, NN(I_loongson_2e)),
   N (64, 64, bfd_mach_mips_loongson_2f, mips:loongson_2f,   FALSE, NN(I_loongson_2f)),
-  N (64, 64, bfd_mach_mips_octeon, mips:octeon, FALSE, 0)
+  N (64, 64, bfd_mach_mips_octeon,mips:octeon,  FALSE, NN(I_mipsocteon)),
+  N (64, 64, bfd_mach_mips_xlr, mips:xlr,   FALSE, 0)
 };
 
 /* The default architecture is mips:3000, but with a machine number of

Index: src/external/gpl3/binutils/dist/bfd/bfd-in2.h
diff -u src/external/gpl3/binutils/dist/bfd/bfd-in2.h:1.2 src/external/gpl3/binutils/dist/bfd/bfd-in2.h:1.3
--- src/external/gpl3/binutils/dist/bfd/bfd-in2.h:1.2	Wed Aug 19 07:19:30 2009
+++ src/external/gpl3/binutils/dist/bfd/bfd-in2.h	Thu Apr 14 07:49:48 2011
@@ -1795,6 +1795,7 @@
 #define bfd_mach_mips_loongson_2f  

CVS commit: src/external/gpl3/binutils/lib/libbfd/arch

2011-04-14 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Apr 14 08:04:21 UTC 2011

Modified Files:
src/external/gpl3/binutils/lib/libbfd/arch/mips64eb: bfd.h
src/external/gpl3/binutils/lib/libbfd/arch/mips64el: bfd.h
src/external/gpl3/binutils/lib/libbfd/arch/mipseb: bfd.h
src/external/gpl3/binutils/lib/libbfd/arch/mipsel: bfd.h

Log Message:
Add bfd_mach_mips_xlr


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/external/gpl3/binutils/lib/libbfd/arch/mips64eb/bfd.h
cvs rdiff -u -r1.2 -r1.3 \
src/external/gpl3/binutils/lib/libbfd/arch/mips64el/bfd.h
cvs rdiff -u -r1.1 -r1.2 \
src/external/gpl3/binutils/lib/libbfd/arch/mipseb/bfd.h
cvs rdiff -u -r1.1 -r1.2 \
src/external/gpl3/binutils/lib/libbfd/arch/mipsel/bfd.h

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

Modified files:

Index: src/external/gpl3/binutils/lib/libbfd/arch/mips64eb/bfd.h
diff -u src/external/gpl3/binutils/lib/libbfd/arch/mips64eb/bfd.h:1.2 src/external/gpl3/binutils/lib/libbfd/arch/mips64eb/bfd.h:1.3
--- src/external/gpl3/binutils/lib/libbfd/arch/mips64eb/bfd.h:1.2	Mon Dec 14 15:49:18 2009
+++ src/external/gpl3/binutils/lib/libbfd/arch/mips64eb/bfd.h	Thu Apr 14 08:04:20 2011
@@ -1799,6 +1799,7 @@
 #define bfd_mach_mips_loongson_2f  3002
 #define bfd_mach_mips_sb1  12310201 /* octal 'SB', 01 */
 #define bfd_mach_mips_octeon   6501
+#define bfd_mach_mips_xlr  887682   /* decimal 'XLR'  */
 #define bfd_mach_mipsisa32 32
 #define bfd_mach_mipsisa32r2   33
 #define bfd_mach_mipsisa64 64

Index: src/external/gpl3/binutils/lib/libbfd/arch/mips64el/bfd.h
diff -u src/external/gpl3/binutils/lib/libbfd/arch/mips64el/bfd.h:1.2 src/external/gpl3/binutils/lib/libbfd/arch/mips64el/bfd.h:1.3
--- src/external/gpl3/binutils/lib/libbfd/arch/mips64el/bfd.h:1.2	Mon Dec 14 15:49:18 2009
+++ src/external/gpl3/binutils/lib/libbfd/arch/mips64el/bfd.h	Thu Apr 14 08:04:20 2011
@@ -1799,6 +1799,7 @@
 #define bfd_mach_mips_loongson_2f  3002
 #define bfd_mach_mips_sb1  12310201 /* octal 'SB', 01 */
 #define bfd_mach_mips_octeon   6501
+#define bfd_mach_mips_xlr  887682   /* decimal 'XLR'  */ 
 #define bfd_mach_mipsisa32 32
 #define bfd_mach_mipsisa32r2   33
 #define bfd_mach_mipsisa64 64

Index: src/external/gpl3/binutils/lib/libbfd/arch/mipseb/bfd.h
diff -u src/external/gpl3/binutils/lib/libbfd/arch/mipseb/bfd.h:1.1 src/external/gpl3/binutils/lib/libbfd/arch/mipseb/bfd.h:1.2
--- src/external/gpl3/binutils/lib/libbfd/arch/mipseb/bfd.h:1.1	Tue Aug 18 20:22:00 2009
+++ src/external/gpl3/binutils/lib/libbfd/arch/mipseb/bfd.h	Thu Apr 14 08:04:21 2011
@@ -1799,6 +1799,7 @@
 #define bfd_mach_mips_loongson_2f  3002
 #define bfd_mach_mips_sb1  12310201 /* octal 'SB', 01 */
 #define bfd_mach_mips_octeon   6501
+#define bfd_mach_mips_xlr  887682   /* decimal 'XLR'  */ 
 #define bfd_mach_mipsisa32 32
 #define bfd_mach_mipsisa32r2   33
 #define bfd_mach_mipsisa64 64

Index: src/external/gpl3/binutils/lib/libbfd/arch/mipsel/bfd.h
diff -u src/external/gpl3/binutils/lib/libbfd/arch/mipsel/bfd.h:1.1 src/external/gpl3/binutils/lib/libbfd/arch/mipsel/bfd.h:1.2
--- src/external/gpl3/binutils/lib/libbfd/arch/mipsel/bfd.h:1.1	Tue Aug 18 20:22:00 2009
+++ src/external/gpl3/binutils/lib/libbfd/arch/mipsel/bfd.h	Thu Apr 14 08:04:21 2011
@@ -1799,6 +1799,7 @@
 #define bfd_mach_mips_loongson_2f  3002
 #define bfd_mach_mips_sb1  12310201 /* octal 'SB', 01 */
 #define bfd_mach_mips_octeon   6501
+#define bfd_mach_mips_xlr  887682   /* decimal 'XLR'  */ 
 #define bfd_mach_mipsisa32 32
 #define bfd_mach_mipsisa32r2   33
 #define bfd_mach_mipsisa64 64



CVS commit: src/external/gpl3/binutils/dist/opcodes

2011-04-14 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Apr 14 08:05:00 UTC 2011

Modified Files:
src/external/gpl3/binutils/dist/opcodes: mips-opc.c

Log Message:
Remove old mfcr/mtcr definitions


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/gpl3/binutils/dist/opcodes/mips-opc.c

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

Modified files:

Index: src/external/gpl3/binutils/dist/opcodes/mips-opc.c
diff -u src/external/gpl3/binutils/dist/opcodes/mips-opc.c:1.4 src/external/gpl3/binutils/dist/opcodes/mips-opc.c:1.5
--- src/external/gpl3/binutils/dist/opcodes/mips-opc.c:1.4	Thu Apr 14 07:49:49 2011
+++ src/external/gpl3/binutils/dist/opcodes/mips-opc.c	Thu Apr 14 08:05:00 2011
@@ -961,8 +961,6 @@
 /* mtc2 is at the bottom of the table.  */
 /* mthc2 is at the bottom of the table.  */
 /* mtc3 is at the bottom of the table.  */
-{mfcr,t,s,	0x7018, 0xfc00,	WR_t|RD_s,		0,		I64	},
-{mtcr,t,s,	0x7019, 0xfc00,	WR_t|RD_s,		0,		I64	},
 {mtdr,t,G,	0x7080003d, 0xffe007ff,	COD|RD_t|WR_C0,		0,		N5	},
 {mthi,s,	0x0011, 0xfc1f,	RD_s|WR_HI,		0,		I1	},
 {mthi,s,7,	0x0011, 0xfc1fe7ff, RD_s|WR_HI,		0,		D32	},



CVS commit: src/sys/arch/vax

2011-04-14 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Apr 14 08:17:28 UTC 2011

Modified Files:
src/sys/arch/vax/include: cpu.h
src/sys/arch/vax/vax: vm_machdep.c

Log Message:
Support LWP_PC


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/sys/arch/vax/include/cpu.h
cvs rdiff -u -r1.114 -r1.115 src/sys/arch/vax/vax/vm_machdep.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/vax/include/cpu.h
diff -u src/sys/arch/vax/include/cpu.h:1.91 src/sys/arch/vax/include/cpu.h:1.92
--- src/sys/arch/vax/include/cpu.h:1.91	Tue Dec 14 23:27:37 2010
+++ src/sys/arch/vax/include/cpu.h	Thu Apr 14 08:17:27 2011
@@ -1,4 +1,4 @@
-/*  $NetBSD: cpu.h,v 1.91 2010/12/14 23:27:37 matt Exp $  */
+/*  $NetBSD: cpu.h,v 1.92 2011/04/14 08:17:27 matt Exp $  */
 
 /*
  * Copyright (c) 1994 Ludd, University of Lule}, Sweden
@@ -202,6 +202,8 @@
  */
 #define	IOSPSZ	((64*1024) / VAX_NBPG)	/* 64k == 128 pages */
 
+#define	LWP_PC(l)	cpu_lwp_pc(l)
+
 struct device;
 struct buf;
 struct pte;
@@ -215,6 +217,7 @@
 void	cpu_send_ipi(int, int);
 void	cpu_handle_ipi(void);
 #endif
+vaddr_t	cpu_lwp_pc(struct lwp *);
 int	badaddr(volatile void *, int);
 void	dumpconf(void);
 void	dumpsys(void);

Index: src/sys/arch/vax/vax/vm_machdep.c
diff -u src/sys/arch/vax/vax/vm_machdep.c:1.114 src/sys/arch/vax/vax/vm_machdep.c:1.115
--- src/sys/arch/vax/vax/vm_machdep.c:1.114	Thu Feb 10 14:46:48 2011
+++ src/sys/arch/vax/vax/vm_machdep.c	Thu Apr 14 08:17:27 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_machdep.c,v 1.114 2011/02/10 14:46:48 pooka Exp $	 */
+/*	$NetBSD: vm_machdep.c,v 1.115 2011/04/14 08:17:27 matt Exp $	 */
 
 /*
  * Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vm_machdep.c,v 1.114 2011/02/10 14:46:48 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: vm_machdep.c,v 1.115 2011/04/14 08:17:27 matt Exp $);
 
 #include opt_execfmt.h
 #include opt_compat_ultrix.h
@@ -173,6 +173,13 @@
 	tf-psl = PSL_U|PSL_PREVU;
 }
 
+vaddr_t
+cpu_lwp_pc(struct lwp *l)
+{
+	struct pcb * const pcb = lwp_getpcb(l);
+	return pcb-PC;
+}
+
 #if KERN_SA  0
 void
 cpu_setfunc(struct lwp *l, void (*func)(void *), void *arg)



CVS commit: src/sys/arch/vax/vax

2011-04-14 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Apr 14 08:17:42 UTC 2011

Modified Files:
src/sys/arch/vax/vax: genassym.cf

Log Message:
Add L_PRIVATE


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/vax/vax/genassym.cf

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/vax/vax/genassym.cf
diff -u src/sys/arch/vax/vax/genassym.cf:1.49 src/sys/arch/vax/vax/genassym.cf:1.50
--- src/sys/arch/vax/vax/genassym.cf:1.49	Mon Apr 11 19:11:08 2011
+++ src/sys/arch/vax/vax/genassym.cf	Thu Apr 14 08:17:42 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.49 2011/04/11 19:11:08 rmind Exp $
+#	$NetBSD: genassym.cf,v 1.50 2011/04/14 08:17:42 matt Exp $
 #
 # Copyright (c) 1997 Ludd, University of Lule}, Sweden.
 # All rights reserved.
@@ -57,6 +57,7 @@
 define	L_STAT		offsetof(struct lwp, l_stat)
 define	L_PROC		offsetof(struct lwp, l_proc)
 define	L_CTXSWTCH	offsetof(struct lwp, l_ctxswtch)
+define	L_PRIVATE	offsetof(struct lwp, l_private)
 
 define	P_VMSPACE	offsetof(struct proc, p_vmspace)
 define	P_MD_SYSCALL	offsetof(struct proc, p_md.md_syscall)



CVS commit: src/usr.sbin/crash

2011-04-14 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Apr 14 08:21:06 UTC 2011

Modified Files:
src/usr.sbin/crash: Makefile

Log Message:
enable crash(8) for sparc64.  it's still sort of minimal and segvs
on some commands, but it sort of works and isn't useless.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/crash/Makefile

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/crash/Makefile
diff -u src/usr.sbin/crash/Makefile:1.9 src/usr.sbin/crash/Makefile:1.10
--- src/usr.sbin/crash/Makefile:1.9	Tue Apr 12 01:47:20 2011
+++ src/usr.sbin/crash/Makefile	Thu Apr 14 08:21:06 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.9 2011/04/12 01:47:20 mrg Exp $
+#	$NetBSD: Makefile,v 1.10 2011/04/14 08:21:06 mrg Exp $
 
 PROG=		crash
 MAN=		crash.8
@@ -9,10 +9,15 @@
 
 # some ddb kernel components need limited modifications.  for now,
 # punt if not noted as implemented here.
-.if${MACHINE} != amd64 \
- ${MACHINE} != i386
-SRCS+=	unsupported.c
+.if${MACHINE} == amd64 \
+|| ${MACHINE} == i386 \
+|| ${MACHINE} == sparc64
+REALCRASH=yes
 .else
+REALCRASH=no
+.endif
+
+.if ${REALCRASH} != no	# {
 
 S=		${.CURDIR}/../../sys
 
@@ -28,11 +33,17 @@
 SRCS+=	db_sym.c db_variables.c db_write_cmd.c
 
 .PATH:	${S}/arch/${MACHINE}/${MACHINE}
-SRCS+=	db_machdep.c db_disasm.c
+SRCS+=	db_disasm.c
 
-. if empty(${MACHINE:C/(amd64|i386)//})
+. if${MACHINE} == amd64 \
+ || ${MACHINE} == i386
 .PATH:	${S}/arch/x86/x86
 SRCS+=	db_trace.c
+SRCS+=	db_machdep.c
+. endif
+
+. if ${MACHINE} == sparc64
+SRCS+=	db_trace.c db_interface.c
 . endif
 
 # crash main source
@@ -52,7 +63,11 @@
 	${HOST_SH} ${S}/conf/newvers.sh -r
 CLEANFILES+=	vers.c version
 
-.endif
+.else# } {
+
+SRCS+=	unsupported.c
+
+.endif# }
 
 .include bsd.prog.mk
 .include bsd.klinks.mk



CVS commit: src/sys/arch/sparc/sparc

2011-04-14 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Apr 14 08:59:10 UTC 2011

Modified Files:
src/sys/arch/sparc/sparc: db_disasm.c db_trace.c

Log Message:
port to userspace.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/sparc/sparc/db_disasm.c
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/sparc/sparc/db_trace.c

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

Modified files:

Index: src/sys/arch/sparc/sparc/db_disasm.c
diff -u src/sys/arch/sparc/sparc/db_disasm.c:1.19 src/sys/arch/sparc/sparc/db_disasm.c:1.20
--- src/sys/arch/sparc/sparc/db_disasm.c:1.19	Wed Feb 21 22:59:52 2007
+++ src/sys/arch/sparc/sparc/db_disasm.c	Thu Apr 14 08:59:09 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_disasm.c,v 1.19 2007/02/21 22:59:52 thorpej Exp $ */
+/*	$NetBSD: db_disasm.c,v 1.20 2011/04/14 08:59:09 mrg Exp $ */
 
 /*
  * Copyright (c) 1994 David S. Miller, da...@nadzieja.rutgers.edu
@@ -32,17 +32,22 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: db_disasm.c,v 1.19 2007/02/21 22:59:52 thorpej Exp $);
+__KERNEL_RCSID(0, $NetBSD: db_disasm.c,v 1.20 2011/04/14 08:59:09 mrg Exp $);
 
 #include sys/param.h
 #include machine/db_machdep.h
 #include machine/instr.h
 #include ddb/db_sym.h
 #include ddb/db_interface.h
+#include ddb/db_user.h
 #include ddb/db_extern.h
 #include ddb/db_output.h
 #include ddb/db_access.h
 
+#ifndef _KERNEL
+#include stdlib.h
+#endif
+
 /* Sign extend values */
 #define	SIGNEX(v,width)		({	\
 	unsigned s = sizeof(long)*8-(width);\

Index: src/sys/arch/sparc/sparc/db_trace.c
diff -u src/sys/arch/sparc/sparc/db_trace.c:1.33 src/sys/arch/sparc/sparc/db_trace.c:1.34
--- src/sys/arch/sparc/sparc/db_trace.c:1.33	Thu Jul  1 02:38:27 2010
+++ src/sys/arch/sparc/sparc/db_trace.c	Thu Apr 14 08:59:09 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_trace.c,v 1.33 2010/07/01 02:38:27 rmind Exp $ */
+/*	$NetBSD: db_trace.c,v 1.34 2011/04/14 08:59:09 mrg Exp $ */
 
 /*
  * Mach Operating System
@@ -27,10 +27,11 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: db_trace.c,v 1.33 2010/07/01 02:38:27 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: db_trace.c,v 1.34 2011/04/14 08:59:09 mrg Exp $);
 
 #include sys/param.h
 #include sys/proc.h
+#include sys/cpu.h
 #include machine/db_machdep.h
 
 #include ddb/db_access.h



CVS commit: src/doc

2011-04-14 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Apr 14 09:16:23 UTC 2011

Modified Files:
src/doc: 3RDPARTY

Log Message:
xz-5.0.2 out.


To generate a diff of this commit:
cvs rdiff -u -r1.829 -r1.830 src/doc/3RDPARTY

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.829 src/doc/3RDPARTY:1.830
--- src/doc/3RDPARTY:1.829	Wed Apr  6 09:11:08 2011
+++ src/doc/3RDPARTY	Thu Apr 14 09:16:23 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.829 2011/04/06 09:11:08 roy Exp $
+#	$NetBSD: 3RDPARTY,v 1.830 2011/04/14 09:16:23 wiz Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -1168,7 +1168,7 @@
 
 Package:	xz
 Version:	5.0.0
-Current Vers:	5.0.1
+Current Vers:	5.0.2
 Maintainer:	Lasse Collin lasse.col...@tukanni.org
 Archive Site:	http://tukaani.org/xz/
 Home Page:	http://tukaani.org/xz/



CVS commit: src/sys/arch/mips

2011-04-14 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Apr 14 09:25:05 UTC 2011

Modified Files:
src/sys/arch/mips/mips: db_interface.c mipsX_subr.S
src/sys/arch/mips/rmi: rmixl_fmnvar.h rmixl_subr.S

Log Message:
Use .set arch=xlr to access RMI specific instructions.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/arch/mips/mips/db_interface.c
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/mips/mips/mipsX_subr.S
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/mips/rmi/rmixl_fmnvar.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/mips/rmi/rmixl_subr.S

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

Modified files:

Index: src/sys/arch/mips/mips/db_interface.c
diff -u src/sys/arch/mips/mips/db_interface.c:1.71 src/sys/arch/mips/mips/db_interface.c:1.72
--- src/sys/arch/mips/mips/db_interface.c:1.71	Thu Apr 14 05:09:34 2011
+++ src/sys/arch/mips/mips/db_interface.c	Thu Apr 14 09:25:05 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_interface.c,v 1.71 2011/04/14 05:09:34 cliff Exp $	*/
+/*	$NetBSD: db_interface.c,v 1.72 2011/04/14 09:25:05 matt Exp $	*/
 
 /*
  * Mach Operating System
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: db_interface.c,v 1.71 2011/04/14 05:09:34 cliff Exp $);
+__KERNEL_RCSID(0, $NetBSD: db_interface.c,v 1.72 2011/04/14 09:25:05 matt Exp $);
 
 #include opt_multiprocessor.h
 #include opt_cputype.h	/* which mips CPUs do we support? */
@@ -675,7 +675,7 @@
 	/* value = CR[addr] */
 	__asm volatile(			\
 		.set push 			\n\t			\
-		.set mips64			\n\t			\
+		.set arch=xlr			\n\t			\
 		.set noat			\n\t			\
 		mfcr %0,%1			\n\t			\
 		.set pop 			\n\t			\
@@ -705,7 +705,7 @@
 	/* CR[addr] = value */
 	__asm volatile(			\
 		.set push 			\n\t			\
-		.set mips64			\n\t			\
+		.set arch=xlr			\n\t			\
 		.set noat			\n\t			\
 		mtcr %0,%1			\n\t			\
 		.set pop 			\n\t			\

Index: src/sys/arch/mips/mips/mipsX_subr.S
diff -u src/sys/arch/mips/mips/mipsX_subr.S:1.44 src/sys/arch/mips/mips/mipsX_subr.S:1.45
--- src/sys/arch/mips/mips/mipsX_subr.S:1.44	Thu Apr 14 05:51:27 2011
+++ src/sys/arch/mips/mips/mipsX_subr.S	Thu Apr 14 09:25:05 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: mipsX_subr.S,v 1.44 2011/04/14 05:51:27 cliff Exp $	*/
+/*	$NetBSD: mipsX_subr.S,v 1.45 2011/04/14 09:25:05 matt Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -1440,11 +1440,14 @@
 	PTR_LA	k0, panic			# return to panic
 	PTR_LA	a0, 9f# panicstr
 	_MFC0	a1, MIPS_COP_0_ERROR_PC
-#if defined(MIPS64_XLS)
+#if defined(MIPS64_XLS)  defined(MIPS64)
+	.set	push
+	.set	arch=xlr
 	li	k1, 0x309	/* L1D_CACHE_ERROR_LOG */
 	mfcr	a2, k1
 	li	k1, 0x30b	/* L1D_CACHE_INTERRUPT */
 	mfcr	a3, k1
+	.set	pop
 #if defined(__mips_o32)
 #error O32 not supported.
 #endif

Index: src/sys/arch/mips/rmi/rmixl_fmnvar.h
diff -u src/sys/arch/mips/rmi/rmixl_fmnvar.h:1.2 src/sys/arch/mips/rmi/rmixl_fmnvar.h:1.3
--- src/sys/arch/mips/rmi/rmixl_fmnvar.h:1.2	Sun Feb 20 07:48:37 2011
+++ src/sys/arch/mips/rmi/rmixl_fmnvar.h	Thu Apr 14 09:25:05 2011
@@ -1,4 +1,4 @@
-/*	$Id: rmixl_fmnvar.h,v 1.2 2011/02/20 07:48:37 matt Exp $	*/
+/*	$Id: rmixl_fmnvar.h,v 1.3 2011/04/14 09:25:05 matt Exp $	*/
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -102,7 +102,7 @@
 	\
 	__asm volatile(			\
 		.set push			\n\t			\
-		.set mips64			\n\t			\
+		.set arch=xlr			\n\t			\
 		mfc2 %0,$%1,%2		\n\t			\
 		.set pop			\n\t			\
 	: =r(__val) : n(regnum), n(sel));			\
@@ -115,7 +115,7 @@
 	\
 	__asm volatile(			\
 		.set push			\n\t			\
-		.set mips64			\n\t			\
+		.set arch=xlr			\n\t			\
 		mtc2 %0,$%1,%2		\n\t			\
 		.set pop			\n\t			\
 	:: r(__val), n(regnum), n(sel));			\
@@ -150,7 +150,7 @@
 	__asm__ volatile (
 		.set push		\n\t
 		.set noreorder	\n\t
-		.set mips64		\n\t
+		.set arch=xlr		\n\t
 		sync			\n\t
 		msgsnd %0		\n\t
 		.set pop		\n\t
@@ -163,7 +163,7 @@
 	__asm__ volatile (
 		.set push		\n\t
 		.set noreorder	\n\t
-		.set mips64		\n\t
+		.set arch=xlr		\n\t
 		msgld %0		\n\t
 		.set pop		\n\t
 			:: r(bucket));
@@ -179,7 +179,7 @@
 	__asm__ volatile (
 		.set push		\n\t
 		.set noreorder	\n\t
-		.set mips64		\n\t
+		.set arch=xlr		\n\t
 		addu %0,%0,0		\n\t
 		msgwait %0		\n\t
 		.set pop		\n\t

Index: src/sys/arch/mips/rmi/rmixl_subr.S
diff -u src/sys/arch/mips/rmi/rmixl_subr.S:1.4 src/sys/arch/mips/rmi/rmixl_subr.S:1.5
--- src/sys/arch/mips/rmi/rmixl_subr.S:1.4	Thu Apr 14 05:20:08 2011
+++ src/sys/arch/mips/rmi/rmixl_subr.S	Thu Apr 14 09:25:05 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_subr.S,v 1.4 2011/04/14 05:20:08 cliff Exp $	*/
+/*	$NetBSD: rmixl_subr.S,v 1.5 2011/04/14 09:25:05 matt Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -37,17 +37,16 @@
 #include mips/asm.h
 #include mips/cpuregs.h
 
-RCSID($NetBSD: rmixl_subr.S,v 1.4 2011/04/14 05:20:08 cliff Exp $);
+RCSID($NetBSD: rmixl_subr.S,v 1.5 2011/04/14 09:25:05 matt Exp $);
 
 #include assym.h
 
 

CVS commit: src/external/bsd/pcc/libexec

2011-04-14 Thread Iain Hibbert
Module Name:src
Committed By:   plunky
Date:   Thu Apr 14 09:31:25 UTC 2011

Modified Files:
src/external/bsd/pcc/libexec: Makefile
src/external/bsd/pcc/libexec/ccom: Makefile
Added Files:
src/external/bsd/pcc/libexec/mkext: Makefile

Log Message:
use HOSTPROG to build the mkext program (which creates external.c and
external.h for ccom) rather than HOST_CC directly.

because PROG and HOSTPROG don't play nicely together, put mkext in its
own SUBDIR


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/pcc/libexec/Makefile
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/pcc/libexec/ccom/Makefile
cvs rdiff -u -r0 -r1.1 src/external/bsd/pcc/libexec/mkext/Makefile

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

Modified files:

Index: src/external/bsd/pcc/libexec/Makefile
diff -u src/external/bsd/pcc/libexec/Makefile:1.4 src/external/bsd/pcc/libexec/Makefile:1.5
--- src/external/bsd/pcc/libexec/Makefile:1.4	Fri Feb  5 08:42:39 2010
+++ src/external/bsd/pcc/libexec/Makefile	Thu Apr 14 09:31:25 2011
@@ -1,9 +1,9 @@
-#	$NetBSD: Makefile,v 1.4 2010/02/05 08:42:39 plunky Exp $
+#	$NetBSD: Makefile,v 1.5 2011/04/14 09:31:25 plunky Exp $
 
 .include bsd.own.mk
 
 .if (${MKPCCCMDS} != no)
-SUBDIR=		ccom cpp
+SUBDIR=		mkext .WAIT ccom cpp
 .endif
 
 .include bsd.subdir.mk

Index: src/external/bsd/pcc/libexec/ccom/Makefile
diff -u src/external/bsd/pcc/libexec/ccom/Makefile:1.6 src/external/bsd/pcc/libexec/ccom/Makefile:1.7
--- src/external/bsd/pcc/libexec/ccom/Makefile:1.6	Thu Jun  3 19:17:22 2010
+++ src/external/bsd/pcc/libexec/ccom/Makefile	Thu Apr 14 09:31:25 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.6 2010/06/03 19:17:22 plunky Exp $
+#	$NetBSD: Makefile,v 1.7 2011/04/14 09:31:25 plunky Exp $
 
 WARNS?=	2
 
@@ -31,10 +31,12 @@
 
 DPSRCS=	external.c external.h
 
-external.c external.h: mkext.c table.c common.c
-	${HOST_CC} ${CFLAGS} ${CPPFLAGS} -DMKEXT -o ${.OBJDIR}/mkext ${.ALLSRC}
-	${.OBJDIR}/mkext
+MKEXTDIR!=	cd ../mkext  ${PRINTOBJDIR}
 
-CLEANFILES+=	external.c external.h mkext
+external.c external.h:	${MKEXTDIR}/mkext
+	${_MKTARGET_CREATE}
+	${MKEXTDIR}/mkext
+
+CLEANFILES+=	external.c external.h
 
 .include bsd.prog.mk

Added files:

Index: src/external/bsd/pcc/libexec/mkext/Makefile
diff -u /dev/null src/external/bsd/pcc/libexec/mkext/Makefile:1.1
--- /dev/null	Thu Apr 14 09:31:25 2011
+++ src/external/bsd/pcc/libexec/mkext/Makefile	Thu Apr 14 09:31:25 2011
@@ -0,0 +1,22 @@
+#	$NetBSD: Makefile,v 1.1 2011/04/14 09:31:25 plunky Exp $
+
+#
+# this is really part of ccom, but HOSTPROG and PROG don't mix
+#
+
+.include bsd.init.mk
+
+.PATH:	${PCC_DIST}/cc/ccom \
+	${PCC_DIST}/arch/${TARGMACH} \
+	${PCC_DIST}/mip
+
+HOSTPROG=	mkext
+MAN=
+SRCS=		mkext.c table.c common.c
+
+HOST_CPPFLAGS+=	-DMKEXT
+HOST_CPPFLAGS+=	-I${PCC_DIST}/mip
+HOST_CPPFLAGS+=	-I${PCC_DIST}/arch/${TARGMACH}
+HOST_CPPFLAGS+=	-I${PCC_DIR}/include
+
+.include bsd.hostprog.mk



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

2011-04-14 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Apr 14 10:07:49 UTC 2011

Modified Files:
src/distrib/sets/lists/comp: md.sparc

Log Message:
add sparc64/intr.h


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/distrib/sets/lists/comp/md.sparc

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/comp/md.sparc
diff -u src/distrib/sets/lists/comp/md.sparc:1.71 src/distrib/sets/lists/comp/md.sparc:1.72
--- src/distrib/sets/lists/comp/md.sparc:1.71	Tue Feb  1 20:06:06 2011
+++ src/distrib/sets/lists/comp/md.sparc	Thu Apr 14 10:07:49 2011
@@ -1,4 +1,4 @@
-# $NetBSD: md.sparc,v 1.71 2011/02/01 20:06:06 he Exp $
+# $NetBSD: md.sparc,v 1.72 2011/04/14 10:07:49 mrg Exp $
 ./usr/include/ieeefp.hcomp-c-include
 ./usr/include/sparccomp-c-include
 ./usr/include/sparc/_G_config.h			comp-obsolete		obsolete
@@ -93,6 +93,7 @@
 ./usr/include/sparc64/ieee.h			comp-c-include
 ./usr/include/sparc64/ieeefp.h			comp-c-include
 ./usr/include/sparc64/instr.h			comp-c-include
+./usr/include/sparc64/intr.h			comp-c-include
 ./usr/include/sparc64/int_const.h		comp-c-include
 ./usr/include/sparc64/int_fmtio.h		comp-c-include
 ./usr/include/sparc64/int_limits.h		comp-c-include



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

2011-04-14 Thread Havard Eidnes
Module Name:src
Committed By:   he
Date:   Thu Apr 14 11:17:47 UTC 2011

Modified Files:
src/sys/compat/linux/arch/alpha: linux_pipe.c

Log Message:
Fix this so that it builds (missing struct keyword).


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/compat/linux/arch/alpha/linux_pipe.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/arch/alpha/linux_pipe.c
diff -u src/sys/compat/linux/arch/alpha/linux_pipe.c:1.14 src/sys/compat/linux/arch/alpha/linux_pipe.c:1.15
--- src/sys/compat/linux/arch/alpha/linux_pipe.c:1.14	Thu Apr 14 01:03:23 2011
+++ src/sys/compat/linux/arch/alpha/linux_pipe.c	Thu Apr 14 11:17:47 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_pipe.c,v 1.14 2011/04/14 01:03:23 christos Exp $	*/
+/*	$NetBSD: linux_pipe.c,v 1.15 2011/04/14 11:17:47 he Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: linux_pipe.c,v 1.14 2011/04/14 01:03:23 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: linux_pipe.c,v 1.15 2011/04/14 11:17:47 he Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -73,7 +73,7 @@
 }
 
 int
-linux_sys_pipe2(struct lwp *l, const linux_sys_pipe2_args *uap,
+linux_sys_pipe2(struct lwp *l, const struct linux_sys_pipe2_args *uap,
 register_t *retval)
 {
 	/* {



CVS commit: src/sys/kern

2011-04-14 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Thu Apr 14 15:29:25 UTC 2011

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

Log Message:
assertions


To generate a diff of this commit:
cvs rdiff -u -r1.174 -r1.175 src/sys/kern/vfs_lookup.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_lookup.c
diff -u src/sys/kern/vfs_lookup.c:1.174 src/sys/kern/vfs_lookup.c:1.175
--- src/sys/kern/vfs_lookup.c:1.174	Mon Apr 11 18:24:49 2011
+++ src/sys/kern/vfs_lookup.c	Thu Apr 14 15:29:25 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_lookup.c,v 1.174 2011/04/11 18:24:49 jakllsch Exp $	*/
+/*	$NetBSD: vfs_lookup.c,v 1.175 2011/04/14 15:29:25 yamt Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_lookup.c,v 1.174 2011/04/11 18:24:49 jakllsch Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_lookup.c,v 1.175 2011/04/14 15:29:25 yamt Exp $);
 
 #include opt_magiclinks.h
 
@@ -691,6 +691,8 @@
 	size_t linklen;
 	int error;
 
+	KASSERT(VOP_ISLOCKED(searchdir) == LK_EXCLUSIVE);
+	KASSERT(VOP_ISLOCKED(foundobj) == LK_EXCLUSIVE);
 	if (ndp-ni_loopcnt++ = MAXSYMLINKS) {
 		return ELOOP;
 	}
@@ -769,6 +771,7 @@
 	}
 
 	*newsearchdir_ret = searchdir;
+	KASSERT(VOP_ISLOCKED(searchdir) == LK_EXCLUSIVE);
 	return 0;
 }
 
@@ -875,6 +878,7 @@
 	struct nameidata *ndp = state-ndp;
 
 	KASSERT(cnp == ndp-ni_cnd);
+	KASSERT(VOP_ISLOCKED(searchdir) == LK_EXCLUSIVE);
 	*newsearchdir_ret = searchdir;
 
 	/*
@@ -900,7 +904,8 @@
 foundobj = searchdir;
 vref(foundobj);
 *foundobj_ret = foundobj;
-return 0;
+error = 0;
+goto done;
 			}
 			if (ndp-ni_rootdir != rootvnode) {
 int retval;
@@ -924,7 +929,8 @@
 vn_lock(foundobj, LK_EXCLUSIVE | LK_RETRY);
 *newsearchdir_ret = foundobj;
 *foundobj_ret = foundobj;
-return 0;
+error = 0;
+goto done;
 }
 			}
 			if ((searchdir-v_vflag  VV_ROOT) == 0 ||
@@ -968,7 +974,7 @@
 		}
 
 		if (error != EJUSTRETURN)
-			return error;
+			goto done;
 
 		/*
 		 * If this was not the last component, or there were trailing
@@ -976,7 +982,8 @@
 		 * then the name must exist.
 		 */
 		if ((cnp-cn_flags  (REQUIREDIR | CREATEDIR)) == REQUIREDIR) {
-			return ENOENT;
+			error = ENOENT;
+			goto done;
 		}
 
 		/*
@@ -984,7 +991,8 @@
 		 * allowing file to be created.
 		 */
 		if (state-rdonly) {
-			return EROFS;
+			error = EROFS;
+			goto done;
 		}
 
 		/*
@@ -994,7 +1002,8 @@
 		 * as searchdir.
 		 */
 		*foundobj_ret = NULL;
-		return (0);
+		error = 0;
+		goto done;
 	}
 #ifdef NAMEI_DIAGNOSTIC
 	printf(found\n);
@@ -1028,7 +1037,7 @@
 		error = vfs_busy(mp, NULL);
 		if (error != 0) {
 			vput(foundobj);
-			return error;
+			goto done;
 		}
 		KASSERT(searchdir != foundobj);
 		VOP_UNLOCK(searchdir);
@@ -1037,7 +1046,7 @@
 		vfs_unbusy(mp, false, NULL);
 		if (error) {
 			vn_lock(searchdir, LK_EXCLUSIVE | LK_RETRY);
-			return error;
+			goto done;
 		}
 		VOP_UNLOCK(foundobj);
 		vn_lock(searchdir, LK_EXCLUSIVE | LK_RETRY);
@@ -1045,7 +1054,15 @@
 	}
 
 	*foundobj_ret = foundobj;
-	return 0;
+	error = 0;
+done:
+	KASSERT(VOP_ISLOCKED(*newsearchdir_ret) == LK_EXCLUSIVE);
+	/*
+	 * *foundobj_ret is valid only if error == 0.
+	 */
+	KASSERT(error != 0 || *foundobj_ret == NULL ||
+	VOP_ISLOCKED(*foundobj_ret) == LK_EXCLUSIVE);
+	return error;
 }
 
 //



CVS commit: src/sys/sys

2011-04-14 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Thu Apr 14 15:31:20 UTC 2011

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

Log Message:
fix _STANDALONE build


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/sys/rpst.h

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

Modified files:

Index: src/sys/sys/rpst.h
diff -u src/sys/sys/rpst.h:1.2 src/sys/sys/rpst.h:1.3
--- src/sys/sys/rpst.h:1.2	Mon May 25 14:54:06 2009
+++ src/sys/sys/rpst.h	Thu Apr 14 15:31:20 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rpst.h,v 1.2 2009/05/25 14:54:06 yamt Exp $	*/
+/*	$NetBSD: rpst.h,v 1.3 2011/04/14 15:31:20 yamt Exp $	*/
 
 /*-
  * Copyright (c)2009 YAMAMOTO Takashi,
@@ -29,11 +29,11 @@
 #if !defined(_SYS_RPST_H_)
 #define	_SYS_RPST_H_
 
-#if defined(_KERNEL)
+#if defined(_KERNEL) || defined(_STANDALONE)
 #include sys/types.h
-#else /* defined(_KERNEL) */
+#else /* defined(_KERNEL) || defined(_STANDALONE) */
 #include stdint.h
-#endif /* defined(_KERNEL) */
+#endif /* defined(_KERNEL) || defined(_STANDALONE) */
 
 struct rpst_tree {
 	struct rpst_node *t_root;



CVS commit: src/sys/sys

2011-04-14 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Thu Apr 14 15:34:43 UTC 2011

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

Log Message:
fix _STANDALONE build


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/sys/radixtree.h

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

Modified files:

Index: src/sys/sys/radixtree.h
diff -u src/sys/sys/radixtree.h:1.1 src/sys/sys/radixtree.h:1.2
--- src/sys/sys/radixtree.h:1.1	Tue Feb 22 21:31:15 2011
+++ src/sys/sys/radixtree.h	Thu Apr 14 15:34:43 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: radixtree.h,v 1.1 2011/02/22 21:31:15 yamt Exp $	*/
+/*	$NetBSD: radixtree.h,v 1.2 2011/04/14 15:34:43 yamt Exp $	*/
 
 /*-
  * Copyright (c)2011 YAMAMOTO Takashi,
@@ -34,12 +34,12 @@
 	unsigned int t_height;
 };
 
-#if defined(_KERNEL)
+#if defined(_KERNEL) || defined(_STANDALONE)
 #include sys/types.h
-#else /* defined(_KERNEL) */
+#else /* defined(_KERNEL) || defined(_STANDALONE) */
 #include stdbool.h
 #include stdint.h
-#endif /* defined(_KERNEL) */
+#endif /* defined(_KERNEL) || defined(_STANDALONE) */
 
 /*
  * subsystem



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

2011-04-14 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Thu Apr 14 15:35:44 UTC 2011

Modified Files:
src/common/lib/libc/gen: rpst.c

Log Message:
fix _STANDALONE build


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

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

Modified files:

Index: src/common/lib/libc/gen/rpst.c
diff -u src/common/lib/libc/gen/rpst.c:1.9 src/common/lib/libc/gen/rpst.c:1.10
--- src/common/lib/libc/gen/rpst.c:1.9	Tue May 26 22:39:15 2009
+++ src/common/lib/libc/gen/rpst.c	Thu Apr 14 15:35:44 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rpst.c,v 1.9 2009/05/26 22:39:15 yamt Exp $	*/
+/*	$NetBSD: rpst.c,v 1.10 2011/04/14 15:35:44 yamt Exp $	*/
 
 /*-
  * Copyright (c)2009 YAMAMOTO Takashi,
@@ -42,11 +42,11 @@
 
 #include sys/cdefs.h
 
-#if defined(_KERNEL)
-__KERNEL_RCSID(0, $NetBSD: rpst.c,v 1.9 2009/05/26 22:39:15 yamt Exp $);
+#if defined(_KERNEL) || defined(_STANDALONE)
+__KERNEL_RCSID(0, $NetBSD: rpst.c,v 1.10 2011/04/14 15:35:44 yamt Exp $);
 #include sys/param.h
-#else /* defined(_KERNEL) */
-__RCSID($NetBSD: rpst.c,v 1.9 2009/05/26 22:39:15 yamt Exp $);
+#else /* defined(_KERNEL) || defined(_STANDALONE) */
+__RCSID($NetBSD: rpst.c,v 1.10 2011/04/14 15:35:44 yamt Exp $);
 #include assert.h
 #include stdbool.h
 #include string.h
@@ -55,7 +55,7 @@
 #else
 #define	KASSERT(a)
 #endif
-#endif /* defined(_KERNEL) */
+#endif /* defined(_KERNEL) || defined(_STANDALONE) */
 
 #include sys/rpst.h
 



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

2011-04-14 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Thu Apr 14 15:42:02 UTC 2011

Modified Files:
src/common/lib/libc/gen: radixtree.c

Log Message:
- fix _STANDALONE build.
- use __CTASSERT instead of CTASSERT.  enable it for userland.
- __read_mostly.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/common/lib/libc/gen/radixtree.c

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

Modified files:

Index: src/common/lib/libc/gen/radixtree.c
diff -u src/common/lib/libc/gen/radixtree.c:1.1 src/common/lib/libc/gen/radixtree.c:1.2
--- src/common/lib/libc/gen/radixtree.c:1.1	Tue Feb 22 21:31:15 2011
+++ src/common/lib/libc/gen/radixtree.c	Thu Apr 14 15:42:02 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: radixtree.c,v 1.1 2011/02/22 21:31:15 yamt Exp $	*/
+/*	$NetBSD: radixtree.c,v 1.2 2011/04/14 15:42:02 yamt Exp $	*/
 
 /*-
  * Copyright (c)2011 YAMAMOTO Takashi,
@@ -40,14 +40,14 @@
 
 #include sys/cdefs.h
 
-#if defined(_KERNEL)
-__KERNEL_RCSID(0, $NetBSD: radixtree.c,v 1.1 2011/02/22 21:31:15 yamt Exp $);
+#if defined(_KERNEL) || defined(_STANDALONE)
+__KERNEL_RCSID(0, $NetBSD: radixtree.c,v 1.2 2011/04/14 15:42:02 yamt Exp $);
 #include sys/param.h
 #include sys/null.h
 #include sys/pool.h
 #include sys/radixtree.h
-#else /* defined(_KERNEL) */
-__RCSID($NetBSD: radixtree.c,v 1.1 2011/02/22 21:31:15 yamt Exp $);
+#else /* defined(_KERNEL) || defined(_STANDALONE) */
+__RCSID($NetBSD: radixtree.c,v 1.2 2011/04/14 15:42:02 yamt Exp $);
 #include assert.h
 #include errno.h
 #include stdbool.h
@@ -57,20 +57,16 @@
 #else
 #define KASSERT(a)	/* nothing */
 #endif
-/* XXX */
-#if !defined(CTASSERT)
-#define	CTASSERT(x)	/* nothing */
-#endif
-#endif /* defined(_KERNEL) */
+#endif /* defined(_KERNEL) || defined(_STANDALONE) */
 
 #include sys/radixtree.h
 
 #define	RADIX_TREE_BITS_PER_HEIGHT	4	/* XXX tune */
 #define	RADIX_TREE_PTR_PER_NODE		(1  RADIX_TREE_BITS_PER_HEIGHT)
 #define	RADIX_TREE_MAX_HEIGHT		(64 / RADIX_TREE_BITS_PER_HEIGHT)
-CTASSERT((64 % RADIX_TREE_BITS_PER_HEIGHT) == 0);
+__CTASSERT((64 % RADIX_TREE_BITS_PER_HEIGHT) == 0);
 
-CTASSERT(((1  RADIX_TREE_TAG_ID_MAX)  (sizeof(int) - 1)) == 0);
+__CTASSERT(((1  RADIX_TREE_TAG_ID_MAX)  (sizeof(int) - 1)) == 0);
 #define	RADIX_TREE_TAG_MASK	((1  RADIX_TREE_TAG_ID_MAX) - 1)
 
 static inline void *
@@ -209,7 +205,7 @@
 }
 
 #if defined(_KERNEL)
-pool_cache_t radix_tree_node_cache;
+pool_cache_t radix_tree_node_cache __read_mostly;
 
 static int
 radix_tree_node_ctor(void *dummy, void *item, int flags)



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

2011-04-14 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Apr 14 15:44:39 UTC 2011

Modified Files:
src/sys/arch/mips/mips: cpu_subr.c

Log Message:
Only set userlocal register if l == curlwp in cpu_set_lwpprivate.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/mips/mips/cpu_subr.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/mips/mips/cpu_subr.c
diff -u src/sys/arch/mips/mips/cpu_subr.c:1.9 src/sys/arch/mips/mips/cpu_subr.c:1.10
--- src/sys/arch/mips/mips/cpu_subr.c:1.9	Thu Apr 14 06:54:57 2011
+++ src/sys/arch/mips/mips/cpu_subr.c	Thu Apr 14 15:44:39 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.9 2011/04/14 06:54:57 cliff Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.10 2011/04/14 15:44:39 matt Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu_subr.c,v 1.9 2011/04/14 06:54:57 cliff Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu_subr.c,v 1.10 2011/04/14 15:44:39 matt Exp $);
 
 #include opt_ddb.h
 #include opt_multiprocessor.h
@@ -1006,7 +1006,8 @@
 cpu_lwp_setprivate(lwp_t *l, void *v)
 {
 #if (MIPS32R2 + MIPS64R2)  0
-	if (mips_options.mips_cpu-cpu_cp0flags  MIPS_CP0FL_USERLOCAL) {
+	if (l == curlwp
+	 (mips_options.mips_cpu-cpu_cp0flags  MIPS_CP0FL_USERLOCAL)) {
 		mipsNN_cp0_userlocal_write(v);
 	}
 #endif



CVS commit: src

2011-04-14 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Thu Apr 14 15:45:28 UTC 2011

Modified Files:
src/distrib/sets/lists/modules: md.amd64 md.i386
src/sys/modules: Makefile

Log Message:
re-enable tprof_amdpmi


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/distrib/sets/lists/modules/md.amd64
cvs rdiff -u -r1.23 -r1.24 src/distrib/sets/lists/modules/md.i386
cvs rdiff -u -r1.69 -r1.70 src/sys/modules/Makefile

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/modules/md.amd64
diff -u src/distrib/sets/lists/modules/md.amd64:1.19 src/distrib/sets/lists/modules/md.amd64:1.20
--- src/distrib/sets/lists/modules/md.amd64:1.19	Fri Mar  4 05:02:48 2011
+++ src/distrib/sets/lists/modules/md.amd64	Thu Apr 14 15:45:27 2011
@@ -1,4 +1,4 @@
-# $NetBSD: md.amd64,v 1.19 2011/03/04 05:02:48 jruoho Exp $
+# $NetBSD: md.amd64,v 1.20 2011/04/14 15:45:27 yamt Exp $
 ./@MODULEDIR@/acpiacadbase-kernel-modules	kmod
 ./@MODULEDIR@/acpiacad/acpiacad.kmod		base-kernel-modules	kmod
 ./@MODULEDIR@/acpibatbase-kernel-modules	kmod
@@ -67,8 +67,8 @@
 ./@MODULEDIR@/powernow/powernow.kmod		base-kernel-modules	kmod
 ./@MODULEDIR@/thinkpadbase-kernel-modules	kmod
 ./@MODULEDIR@/thinkpad/thinkpad.kmod		base-kernel-modules	kmod
-#./@MODULEDIR@/tprof_amdpmi			base-kernel-modules	kmod
-#./@MODULEDIR@/tprof_amdpmi/tprof_amdpmi.kmod	base-kernel-modules	kmod
+./@MODULEDIR@/tprof_amdpmi			base-kernel-modules	kmod
+./@MODULEDIR@/tprof_amdpmi/tprof_amdpmi.kmod	base-kernel-modules	kmod
 ./@MODULEDIR@/tprof_pmibase-kernel-modules	kmod
 ./@MODULEDIR@/tprof_pmi/tprof_pmi.kmod		base-kernel-modules	kmod
 ./@MODULEDIR@/wmidellbase-kernel-modules	kmod

Index: src/distrib/sets/lists/modules/md.i386
diff -u src/distrib/sets/lists/modules/md.i386:1.23 src/distrib/sets/lists/modules/md.i386:1.24
--- src/distrib/sets/lists/modules/md.i386:1.23	Fri Mar  4 05:02:48 2011
+++ src/distrib/sets/lists/modules/md.i386	Thu Apr 14 15:45:28 2011
@@ -1,4 +1,4 @@
-# $NetBSD: md.i386,v 1.23 2011/03/04 05:02:48 jruoho Exp $
+# $NetBSD: md.i386,v 1.24 2011/04/14 15:45:28 yamt Exp $
 ./@MODULEDIR@/acpiacadbase-kernel-modules	kmod
 ./@MODULEDIR@/acpiacad/acpiacad.kmod		base-kernel-modules	kmod
 ./@MODULEDIR@/acpibatbase-kernel-modules	kmod
@@ -73,8 +73,8 @@
 ./@MODULEDIR@/powernow/powernow.kmod		base-kernel-modules	kmod
 ./@MODULEDIR@/thinkpadbase-kernel-modules	kmod
 ./@MODULEDIR@/thinkpad/thinkpad.kmod		base-kernel-modules	kmod
-#./@MODULEDIR@/tprof_amdpmi			base-kernel-modules	kmod
-#./@MODULEDIR@/tprof_amdpmi/tprof_amdpmi.kmod	base-kernel-modules	kmod
+./@MODULEDIR@/tprof_amdpmi			base-kernel-modules	kmod
+./@MODULEDIR@/tprof_amdpmi/tprof_amdpmi.kmod	base-kernel-modules	kmod
 ./@MODULEDIR@/tprof_pmibase-kernel-modules	kmod
 ./@MODULEDIR@/tprof_pmi/tprof_pmi.kmod		base-kernel-modules	kmod
 ./@MODULEDIR@/viac7tempbase-kernel-modules	kmod

Index: src/sys/modules/Makefile
diff -u src/sys/modules/Makefile:1.69 src/sys/modules/Makefile:1.70
--- src/sys/modules/Makefile:1.69	Fri Mar  4 05:02:47 2011
+++ src/sys/modules/Makefile	Thu Apr 14 15:45:27 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.69 2011/03/04 05:02:47 jruoho Exp $
+#	$NetBSD: Makefile,v 1.70 2011/04/14 15:45:27 yamt Exp $
 
 .include bsd.own.mk
 
@@ -94,7 +94,7 @@
 SUBDIR+=	odcm
 SUBDIR+=	powernow
 SUBDIR+=	tprof_pmi
-#SUBDIR+=	tprof_amdpmi
+SUBDIR+=	tprof_amdpmi
 .endif
 
 .if ${MACHINE_ARCH} == i386 || \



CVS commit: src/sys/netinet

2011-04-14 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Thu Apr 14 15:48:49 UTC 2011

Modified Files:
src/sys/netinet: tcp_input.c

Log Message:
comments


To generate a diff of this commit:
cvs rdiff -u -r1.307 -r1.308 src/sys/netinet/tcp_input.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/netinet/tcp_input.c
diff -u src/sys/netinet/tcp_input.c:1.307 src/sys/netinet/tcp_input.c:1.308
--- src/sys/netinet/tcp_input.c:1.307	Wed Mar  9 00:44:23 2011
+++ src/sys/netinet/tcp_input.c	Thu Apr 14 15:48:48 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_input.c,v 1.307 2011/03/09 00:44:23 yamt Exp $	*/
+/*	$NetBSD: tcp_input.c,v 1.308 2011/04/14 15:48:48 yamt Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -145,7 +145,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: tcp_input.c,v 1.307 2011/03/09 00:44:23 yamt Exp $);
+__KERNEL_RCSID(0, $NetBSD: tcp_input.c,v 1.308 2011/04/14 15:48:48 yamt Exp $);
 
 #include opt_inet.h
 #include opt_ipsec.h
@@ -1685,7 +1685,7 @@
 		 * Calculate the RTT from the returned time stamp and the
 		 * connection's time base.  If the time stamp is later than
 		 * the current time, or is extremely old, fall back to non-1323
-		 * RTT calculation.  Since ts_ecr is unsigned, we can test both
+		 * RTT calculation.  Since ts_rtt is unsigned, we can test both
 		 * at the same time.
 		 */
 		ts_rtt = TCP_TIMESTAMP(tp) - opti.ts_ecr + 1;
@@ -2990,6 +2990,13 @@
 }
 #endif
 
+/*
+ * tcp_dooptions: parse and process tcp options.
+ *
+ * returns -1 if this segment should be dropped.  (eg. wrong signature)
+ * otherwise returns 0.
+ */
+
 static int
 tcp_dooptions(struct tcpcb *tp, const u_char *cp, int cnt,
 struct tcphdr *th,



CVS commit: src/sys/netinet

2011-04-14 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Thu Apr 14 15:53:36 UTC 2011

Modified Files:
src/sys/netinet: in_offload.c ip_output.c

Log Message:
after ip_input.c rev.1.285 and 1.286, restore kernel_lock for if_output.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/netinet/in_offload.c
cvs rdiff -u -r1.207 -r1.208 src/sys/netinet/ip_output.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/netinet/in_offload.c
diff -u src/sys/netinet/in_offload.c:1.3 src/sys/netinet/in_offload.c:1.4
--- src/sys/netinet/in_offload.c:1.3	Sat Dec 11 22:37:46 2010
+++ src/sys/netinet/in_offload.c	Thu Apr 14 15:53:36 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: in_offload.c,v 1.3 2010/12/11 22:37:46 matt Exp $	*/
+/*	$NetBSD: in_offload.c,v 1.4 2011/04/14 15:53:36 yamt Exp $	*/
 
 /*-
  * Copyright (c)2005, 2006 YAMAMOTO Takashi,
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: in_offload.c,v 1.3 2010/12/11 22:37:46 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: in_offload.c,v 1.4 2011/04/14 15:53:36 yamt Exp $);
 
 #include sys/param.h
 #include sys/mbuf.h
@@ -53,8 +53,12 @@
 {
 	struct ip_tso_output_args *args = vp;
 	struct ifnet *ifp = args-ifp;
+	int error;
 
-	return (*ifp-if_output)(ifp, m, args-sa, args-rt);
+	KERNEL_LOCK(1, NULL);
+	error = (*ifp-if_output)(ifp, m, args-sa, args-rt);
+	KERNEL_UNLOCK_ONE(NULL);
+	return error;
 }
 
 int

Index: src/sys/netinet/ip_output.c
diff -u src/sys/netinet/ip_output.c:1.207 src/sys/netinet/ip_output.c:1.208
--- src/sys/netinet/ip_output.c:1.207	Sat Apr  9 21:00:53 2011
+++ src/sys/netinet/ip_output.c	Thu Apr 14 15:53:36 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_output.c,v 1.207 2011/04/09 21:00:53 martin Exp $	*/
+/*	$NetBSD: ip_output.c,v 1.208 2011/04/14 15:53:36 yamt Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ip_output.c,v 1.207 2011/04/09 21:00:53 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: ip_output.c,v 1.208 2011/04/14 15:53:36 yamt Exp $);
 
 #include opt_pfil_hooks.h
 #include opt_inet.h
@@ -826,11 +826,13 @@
 		if (__predict_true(
 		(m-m_pkthdr.csum_flags  M_CSUM_TSOv4) == 0 ||
 		(ifp-if_capenable  IFCAP_TSOv4) != 0)) {
+			KERNEL_LOCK(1, NULL);
 			error =
 			(*ifp-if_output)(ifp, m,
 (m-m_flags  M_MCAST) ?
 sintocsa(rdst) : sintocsa(dst),
 rt);
+			KERNEL_UNLOCK_ONE(NULL);
 		} else {
 			error =
 			ip_tso_output(ifp, m,
@@ -902,10 +904,12 @@
 			{
 KASSERT((m-m_pkthdr.csum_flags 
 (M_CSUM_UDPv4 | M_CSUM_TCPv4)) == 0);
+KERNEL_LOCK(1, NULL);
 error = (*ifp-if_output)(ifp, m,
 (m-m_flags  M_MCAST) ?
 	sintocsa(rdst) : sintocsa(dst),
 rt);
+KERNEL_UNLOCK_ONE(NULL);
 			}
 		} else
 			m_freem(m);



CVS commit: src/sys/netinet

2011-04-14 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Thu Apr 14 15:54:31 UTC 2011

Modified Files:
src/sys/netinet: tcp_sack.c

Log Message:
- comments
- whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/netinet/tcp_sack.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/netinet/tcp_sack.c
diff -u src/sys/netinet/tcp_sack.c:1.25 src/sys/netinet/tcp_sack.c:1.26
--- src/sys/netinet/tcp_sack.c:1.25	Wed May 27 17:41:03 2009
+++ src/sys/netinet/tcp_sack.c	Thu Apr 14 15:54:31 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: tcp_sack.c,v 1.25 2009/05/27 17:41:03 pooka Exp $ */
+/* $NetBSD: tcp_sack.c,v 1.26 2011/04/14 15:54:31 yamt Exp $ */
 
 /*
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -102,7 +102,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: tcp_sack.c,v 1.25 2009/05/27 17:41:03 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: tcp_sack.c,v 1.26 2011/04/14 15:54:31 yamt Exp $);
 
 #include opt_inet.h
 #include opt_ipsec.h
@@ -226,9 +226,14 @@
 	return next;
 }
 
+/*
+ * tcp_new_dsack: record the reception of a duplicated segment.
+ */
+
 void
 tcp_new_dsack(struct tcpcb *tp, tcp_seq seq, u_int32_t len)
 {
+
 	if (TCP_SACK_ENABLED(tp)) {
 		tp-rcv_dsack_block.left = seq;
 		tp-rcv_dsack_block.right = seq + len;
@@ -236,6 +241,10 @@
 	}
 }
 
+/*
+ * tcp_sack_option: parse the given SACK option and update the scoreboard.
+ */
+
 void
 tcp_sack_option(struct tcpcb *tp, const struct tcphdr *th, const u_char *cp,
 int optlen)
@@ -394,6 +403,10 @@
 	}
 }
 
+/*
+ * tcp_del_sackholes: remove holes covered by a cumulative ACK.
+ */
+
 void
 tcp_del_sackholes(struct tcpcb *tp, const struct tcphdr *th)
 {
@@ -415,6 +428,10 @@
 	}
 }
 
+/*
+ * tcp_free_sackholes: clear the scoreboard.
+ */
+
 void
 tcp_free_sackholes(struct tcpcb *tp)
 {
@@ -556,6 +573,10 @@
 	return;
 }
 
+/*
+ * tcp_sack_numblks: return the number of SACK blocks to send.
+ */
+
 int
 tcp_sack_numblks(const struct tcpcb *tp)
 {



CVS commit: src/sys/netinet

2011-04-14 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Thu Apr 14 15:55:46 UTC 2011

Modified Files:
src/sys/netinet: tcp_var.h

Log Message:
comments


To generate a diff of this commit:
cvs rdiff -u -r1.162 -r1.163 src/sys/netinet/tcp_var.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/netinet/tcp_var.h
diff -u src/sys/netinet/tcp_var.h:1.162 src/sys/netinet/tcp_var.h:1.163
--- src/sys/netinet/tcp_var.h:1.162	Wed Sep 16 15:23:05 2009
+++ src/sys/netinet/tcp_var.h	Thu Apr 14 15:55:46 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_var.h,v 1.162 2009/09/16 15:23:05 pooka Exp $	*/
+/*	$NetBSD: tcp_var.h,v 1.163 2011/04/14 15:55:46 yamt Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -191,6 +191,12 @@
 	short	t_rxtshift;		/* log(2) of rexmt exp. backoff */
 	uint32_t t_rxtcur;		/* current retransmit value */
 	short	t_dupacks;		/* consecutive dup acks recd */
+	/*
+	 * t_partialacks:
+	 *	0	not in fast recovery.
+	 *	==0	in fast recovery.  has not received partial acks
+	 *	0	in fast recovery.  has received partial acks
+	 */
 	short	t_partialacks;		/* partials acks during fast rexmit */
 	u_short	t_peermss;		/* peer's maximum segment size */
 	u_short	t_ourmss;		/* our's maximum segment size */
@@ -233,8 +239,18 @@
 	tcp_seq	snd_wl2;		/* window update seg ack number */
 	tcp_seq	iss;			/* initial send sequence number */
 	u_long	snd_wnd;		/* send window */
-	tcp_seq snd_recover;		/* for use in fast recovery */
-	tcp_seq	snd_high;		/* NewReno false fast rexmit seq */
+/*
+ * snd_recover
+ * 	it's basically same as the recover variable in RFC 2852 (NewReno).
+ * 	when entering fast retransmit, it's set to snd_max.
+ * 	newreno uses this to detect partial ack.
+ * snd_high
+ * 	it's basically same as the send_high variable in RFC 2852 (NewReno).
+ * 	on each RTO, it's set to snd_max.
+ * 	newreno uses this to avoid false fast retransmits.
+ */
+	tcp_seq snd_recover;
+	tcp_seq	snd_high;
 /* receive sequence variables */
 	u_long	rcv_wnd;		/* receive window */
 	tcp_seq	rcv_nxt;		/* receive next */
@@ -245,10 +261,16 @@
  */
 /* receive variables */
 	tcp_seq	rcv_adv;		/* advertised window */
-/* retransmit variables */
-	tcp_seq	snd_max;		/* highest sequence number sent;
-	 * used to recognize retransmits
-	 */
+
+/*
+ * retransmit variables
+ *
+ * snd_max
+ * 	the highest sequence number we've ever sent.
+ *	used to recognize retransmits.
+ */
+	tcp_seq	snd_max;
+
 /* congestion control (for slow start, source quench, retransmit after loss) */
 	u_long	snd_cwnd;		/* congestion-controlled window */
 	u_long	snd_ssthresh;		/* snd_cwnd size threshhold for



CVS commit: src/sys/netinet

2011-04-14 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Thu Apr 14 15:57:02 UTC 2011

Modified Files:
src/sys/netinet: tcp_congctl.h

Log Message:
- comments
- g/c stale extern


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/netinet/tcp_congctl.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/netinet/tcp_congctl.h
diff -u src/sys/netinet/tcp_congctl.h:1.5 src/sys/netinet/tcp_congctl.h:1.6
--- src/sys/netinet/tcp_congctl.h:1.5	Mon Apr 28 20:24:09 2008
+++ src/sys/netinet/tcp_congctl.h	Thu Apr 14 15:57:02 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_congctl.h,v 1.5 2008/04/28 20:24:09 martin Exp $	*/
+/*	$NetBSD: tcp_congctl.h,v 1.6 2011/04/14 15:57:02 yamt Exp $	*/
 
 /*
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -44,18 +44,41 @@
  * Congestion control function table.
  */
 struct tcp_congctl {
+	/*
+	 * fast_retransmit: called on tcprexmtthresh'th dup ACKs.
+	 * this actually retransmits packets by calling tcp_output()
+	 * if appropriate.
+	 * returns 0 if entering fast recovery.  otherwise returns non-0.
+	 */
 	int  (*fast_retransmit)(struct tcpcb *, const struct tcphdr *);
+
+	/*
+	 * slow_retransmit: called on RTO to adjust parameters like cwnd.
+	 */
 	void (*slow_retransmit)(struct tcpcb *);
+
+	/*
+	 * fast_retransmit_newack: called when new data is acked.
+	 * ie. when advancing SND.UNA
+	 * not called if TCP_SACK_ENABLED.
+	 */
 	void (*fast_retransmit_newack)(struct tcpcb *, const struct tcphdr *);
+
+	/*
+	 * newack: called when new data is acked.  ie. when advancing SND.UNA
+	 * it's called before updating tp-snd_una.
+	 */
 	void (*newack)(struct tcpcb *, const struct tcphdr *);
+
+	/*
+	 * cong_exp: called when congestion is detected.  eg. by ECN
+	 */
 	void (*cong_exp)(struct tcpcb *);
 };
 
 extern const struct tcp_congctl tcp_reno_ctl;
 extern const struct tcp_congctl tcp_newreno_ctl;
 
-extern struct simplelock tcp_congctl_slock;
-
 /* currently selected global congestion control */
 extern char tcp_congctl_global_name[TCPCC_MAXLEN];
 



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

2011-04-14 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Thu Apr 14 16:00:21 UTC 2011

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

Log Message:
don't bother to register kernel ptp to uvm_object.  from yamt-vmem branch.


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/sys/arch/x86/x86/pmap.c

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

Modified files:

Index: src/sys/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.118 src/sys/arch/x86/x86/pmap.c:1.119
--- src/sys/arch/x86/x86/pmap.c:1.118	Fri Feb 11 23:08:38 2011
+++ src/sys/arch/x86/x86/pmap.c	Thu Apr 14 16:00:21 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.118 2011/02/11 23:08:38 jmcneill Exp $	*/
+/*	$NetBSD: pmap.c,v 1.119 2011/04/14 16:00:21 yamt Exp $	*/
 
 /*
  * Copyright (c) 2007 Manuel Bouyer.
@@ -142,7 +142,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.118 2011/02/11 23:08:38 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.119 2011/04/14 16:00:21 yamt Exp $);
 
 #include opt_user_ldt.h
 #include opt_lockdebug.h
@@ -4212,11 +4212,8 @@
 		kpreempt_enable();
 	} else {
 		/* XXX */
-		PMAP_SUBOBJ_LOCK(kpm, level - 1);
-		ptp = uvm_pagealloc(kpm-pm_obj[level - 1],
-ptp_va2o(va, level), NULL,
+		ptp = uvm_pagealloc(NULL, 0, NULL,
 UVM_PGA_USERESERVE|UVM_PGA_ZERO);
-		PMAP_SUBOBJ_UNLOCK(kpm, level - 1);
 		if (ptp == NULL)
 			panic(pmap_get_physpage: out of memory);
 		ptp-flags = ~PG_BUSY;



CVS commit: src/sys/arch/i386/i386

2011-04-14 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Thu Apr 14 16:04:12 UTC 2011

Modified Files:
src/sys/arch/i386/i386: vector.S

Log Message:
comments


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/i386/i386/vector.S

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/i386/i386/vector.S
diff -u src/sys/arch/i386/i386/vector.S:1.57 src/sys/arch/i386/i386/vector.S:1.58
--- src/sys/arch/i386/i386/vector.S:1.57	Fri Mar 18 15:18:16 2011
+++ src/sys/arch/i386/i386/vector.S	Thu Apr 14 16:04:12 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: vector.S,v 1.57 2011/03/18 15:18:16 joerg Exp $	*/
+/*	$NetBSD: vector.S,v 1.58 2011/04/14 16:04:12 yamt Exp $	*/
 
 /*
  * Copyright 2002 (c) Wasabi Systems, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include machine/asm.h
-__KERNEL_RCSID(0, $NetBSD: vector.S,v 1.57 2011/03/18 15:18:16 joerg Exp $);
+__KERNEL_RCSID(0, $NetBSD: vector.S,v 1.58 2011/04/14 16:04:12 yamt Exp $);
 
 #include opt_ddb.h
 #include opt_multiprocessor.h
@@ -435,8 +435,9 @@
 	addl	$1,IS_EVCNTLO(%ebp)	/* inc event counter */		;\
 	adcl	$0,IS_EVCNTHI(%ebp)	;\
 1:	\
-	pushl	%esi			;\
+	pushl	%esi			/* if_ppi */			;\
 	movl	%ebx,CPUVAR(ILEVEL)	;\
+	/* switch stack if necessary, and push a ptr to our intrframe */ \
 	IDEPTH_INCR			;\
 	sti;\
 	movl	IS_HANDLERS(%ebp),%ebx	;\



CVS commit: src/sys/arch/i386/i386

2011-04-14 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Thu Apr 14 16:05:59 UTC 2011

Modified Files:
src/sys/arch/i386/i386: db_machdep.c

Log Message:
fix backtrace of interrupt


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/i386/db_machdep.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/i386/i386/db_machdep.c
diff -u src/sys/arch/i386/i386/db_machdep.c:1.2 src/sys/arch/i386/i386/db_machdep.c:1.3
--- src/sys/arch/i386/i386/db_machdep.c:1.2	Mon Apr 11 04:22:31 2011
+++ src/sys/arch/i386/i386/db_machdep.c	Thu Apr 14 16:05:59 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_machdep.c,v 1.2 2011/04/11 04:22:31 mrg Exp $	*/
+/*	$NetBSD: db_machdep.c,v 1.3 2011/04/14 16:05:59 yamt Exp $	*/
 
 /* 
  * Mach Operating System
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: db_machdep.c,v 1.2 2011/04/11 04:22:31 mrg Exp $);
+__KERNEL_RCSID(0, $NetBSD: db_machdep.c,v 1.3 2011/04/14 16:05:59 yamt Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -217,8 +217,7 @@
 	static struct trapframe tf;
 	static struct i386tss tss;
 	struct i386_frame *fp;
-	struct intrframe *ifp;
-	int traptype, trapno, err, i;
+	int traptype;
 	uintptr_t ptr;
 
 	switch (is_trap) {
@@ -256,24 +255,23 @@
 	case INTERRUPT:
 	default:
 		/* The only argument to trap() or syscall() is the trapframe. */
-		ptr = db_get_value((int)argp, 4, false);
-		db_read_bytes((db_addr_t)ptr, sizeof(tf), (char *)tf);
 		switch (is_trap) {
 		case TRAP:
+			ptr = db_get_value((int)argp, 4, false);
+			db_read_bytes((db_addr_t)ptr, sizeof(tf), (char *)tf);
 			(*pr)(--- trap (number %d) ---\n, tf.tf_trapno);
 			break;
 		case SYSCALL:
+			ptr = db_get_value((int)argp, 4, false);
+			db_read_bytes((db_addr_t)ptr, sizeof(tf), (char *)tf);
 			(*pr)(--- syscall (number %d) ---\n, tf.tf_eax);
 			break;
 		case INTERRUPT:
 			(*pr)(--- interrupt ---\n);
 			/*
-			 * Get intrframe address as saved when switching
-			 * to interrupt stack, and convert to trapframe
-			 * (add 4).  See frame.h.
+			 * see the XXX -1 here is a hack comment below.
 			 */
-			ptr = db_get_value((int)(argp - 1) + 4, 4, false);
-			db_read_bytes((db_addr_t)ptr, sizeof(tf), (char *)tf);
+			db_read_bytes((db_addr_t)argp, sizeof(tf), (char *)tf);
 			break;
 		}
 		*ip = (db_addr_t)tf.tf_eip;
@@ -295,16 +293,32 @@
 	if (db_frame_info(*nextframe, (db_addr_t)*ip, NULL, NULL, traptype,
 	NULL) != (db_sym_t)0
 	 traptype == INTERRUPT) {
-		for (i = 0; i  4; i++) {
-			ifp = (struct intrframe *)(argp + i);
-			err = db_get_value((int)ifp-__if_err, 4, false);
-			trapno = db_get_value((int)ifp-__if_trapno, 4, false);
-			if ((err == 0 || err == IREENT_MAGIC)  trapno == T_ASTFLT) {
-*nextframe = (long *)ifp - 1;
-break;
-			}
-		}
-		if (i == 4) {
+		struct intrframe *ifp;
+		int trapno;
+		int err;
+
+		/*
+		 * 2nd argument of interrupt handlers is a pointer to intrframe.
+		 */
+		ifp = (struct intrframe *)
+		db_get_value((db_addr_t)(argp + 1), sizeof(ifp), false);
+		/*
+		 * check if it's a valid intrframe.
+		 */
+		err = db_get_value((db_addr_t)ifp-__if_err,
+		sizeof(ifp-__if_err), false);
+		trapno = db_get_value((db_addr_t)ifp-__if_trapno,
+		sizeof(ifp-__if_trapno), false);
+		if ((err == 0 || err == IREENT_MAGIC)  trapno == T_ASTFLT) {
+			/*
+			 * found seemingly valid intrframe.
+			 *
+			 * XXX -1 here is a hack.
+			 * for the next frame, we will be called with
+			 * argp = *nextframe + 2.  (long *)if - 1 + 2 = tf.
+			 */
+			*nextframe = (long *)ifp - 1;
+		} else {
 			(*pr)(DDB lost frame for );
 			db_printsym(*ip, DB_STGY_ANY, pr);
 			(*pr)(, trying %p\n,argp);



CVS commit: src/sys/netinet

2011-04-14 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Thu Apr 14 16:08:54 UTC 2011

Modified Files:
src/sys/netinet: tcp_output.c

Log Message:
simplify a compile-time assertion


To generate a diff of this commit:
cvs rdiff -u -r1.170 -r1.171 src/sys/netinet/tcp_output.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/netinet/tcp_output.c
diff -u src/sys/netinet/tcp_output.c:1.170 src/sys/netinet/tcp_output.c:1.171
--- src/sys/netinet/tcp_output.c:1.170	Mon Mar 21 20:39:32 2011
+++ src/sys/netinet/tcp_output.c	Thu Apr 14 16:08:53 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_output.c,v 1.170 2011/03/21 20:39:32 matt Exp $	*/
+/*	$NetBSD: tcp_output.c,v 1.171 2011/04/14 16:08:53 yamt Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -135,7 +135,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: tcp_output.c,v 1.170 2011/03/21 20:39:32 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: tcp_output.c,v 1.171 2011/04/14 16:08:53 yamt Exp $);
 
 #include opt_inet.h
 #include opt_ipsec.h
@@ -960,9 +960,7 @@
 			 * stack (rather than big-small-big-small-...).
 			 */
 #ifdef INET6
-#if IPV6_MAXPACKET != IP_MAXPACKET
-#error IPV6_MAXPACKET != IP_MAXPACKET
-#endif
+			CTASSERT(IPV6_MAXPACKET == IP_MAXPACKET);
 #endif
 			len = (min(len, IP_MAXPACKET) / txsegsize) * txsegsize;
 			if (len = txsegsize) {



CVS commit: src/sys/kern

2011-04-14 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Thu Apr 14 16:20:52 UTC 2011

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

Log Message:
comment


To generate a diff of this commit:
cvs rdiff -u -r1.427 -r1.428 src/sys/kern/init_main.c

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

Modified files:

Index: src/sys/kern/init_main.c
diff -u src/sys/kern/init_main.c:1.427 src/sys/kern/init_main.c:1.428
--- src/sys/kern/init_main.c:1.427	Fri Jan 28 18:44:44 2011
+++ src/sys/kern/init_main.c	Thu Apr 14 16:20:52 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: init_main.c,v 1.427 2011/01/28 18:44:44 pooka Exp $	*/
+/*	$NetBSD: init_main.c,v 1.428 2011/04/14 16:20:52 yamt Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: init_main.c,v 1.427 2011/01/28 18:44:44 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: init_main.c,v 1.428 2011/04/14 16:20:52 yamt Exp $);
 
 #include opt_ddb.h
 #include opt_ipsec.h
@@ -1008,7 +1008,7 @@
 }
 
 /*
- * calculate cache size from physmem and vm_map size.
+ * calculate cache size (in bytes) from physmem and vm_map size.
  */
 vaddr_t
 calc_cache_size(struct vm_map *map, int pct, int va_pct)



CVS commit: src/sys/dev/tprof

2011-04-14 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Thu Apr 14 16:23:59 UTC 2011

Modified Files:
src/sys/dev/tprof: tprof.c tprof_ioctl.h tprof_types.h

Log Message:
for each samples, record and report cpuid and lwpid.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/tprof/tprof.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/tprof/tprof_ioctl.h
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/tprof/tprof_types.h

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

Modified files:

Index: src/sys/dev/tprof/tprof.c
diff -u src/sys/dev/tprof/tprof.c:1.9 src/sys/dev/tprof/tprof.c:1.10
--- src/sys/dev/tprof/tprof.c:1.9	Fri Feb 25 22:35:38 2011
+++ src/sys/dev/tprof/tprof.c	Thu Apr 14 16:23:59 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: tprof.c,v 1.9 2011/02/25 22:35:38 yamt Exp $	*/
+/*	$NetBSD: tprof.c,v 1.10 2011/04/14 16:23:59 yamt Exp $	*/
 
 /*-
  * Copyright (c)2008,2009,2010 YAMAMOTO Takashi,
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: tprof.c,v 1.9 2011/02/25 22:35:38 yamt Exp $);
+__KERNEL_RCSID(0, $NetBSD: tprof.c,v 1.10 2011/04/14 16:23:59 yamt Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -76,6 +76,7 @@
 
 typedef struct {
 	tprof_buf_t *c_buf;
+	uint32_t c_cpuid;
 	struct work c_work;
 	callout_t c_callout;
 } __aligned(CACHE_LINE_SIZE) tprof_cpu_t;
@@ -394,7 +395,10 @@
  * tprof_sample: record a sample on the per-cpu buffer.
  *
  * be careful; can be called in NMI context.
- * we are bluntly assuming that curcpu() and curlwp-l_proc-p_pid are safe.
+ * we are bluntly assuming the followings are safe.
+ *	curcpu()
+ *	curlwp-l_lid
+ *	curlwp-l_proc-p_pid
  */
 
 void
@@ -404,6 +408,7 @@
 	tprof_buf_t * const buf = c-c_buf;
 	tprof_sample_t *sp;
 	const uintptr_t pc = tfi-tfi_pc;
+	const lwp_t * const l = curlwp;
 	u_int idx;
 
 	idx = buf-b_used;
@@ -412,7 +417,9 @@
 		return;
 	}
 	sp = buf-b_data[idx];
-	sp-s_pid = curlwp-l_proc-p_pid;
+	sp-s_pid = l-l_proc-p_pid;
+	sp-s_lwpid = l-l_lid;
+	sp-s_cpuid = c-c_cpuid;
 	sp-s_flags = (tfi-tfi_inkernel) ? TPROF_SAMPLE_INKERNEL : 0;
 	sp-s_pc = pc;
 	buf-b_used = idx + 1;
@@ -660,6 +667,7 @@
 static void
 tprof_driver_init(void)
 {
+	unsigned int i;
 
 	mutex_init(tprof_lock, MUTEX_DEFAULT, IPL_NONE);
 	mutex_init(tprof_reader_lock, MUTEX_DEFAULT, IPL_NONE);
@@ -667,6 +675,12 @@
 	cv_init(tprof_cv, tprof);
 	cv_init(tprof_reader_cv, tprof_rd);
 	STAILQ_INIT(tprof_list);
+	for (i = 0; i  __arraycount(tprof_cpus); i++) {
+		tprof_cpu_t * const c = tprof_cpus[i];
+
+		c-c_buf = NULL;
+		c-c_cpuid = i;
+	}
 }
 
 static void

Index: src/sys/dev/tprof/tprof_ioctl.h
diff -u src/sys/dev/tprof/tprof_ioctl.h:1.2 src/sys/dev/tprof/tprof_ioctl.h:1.3
--- src/sys/dev/tprof/tprof_ioctl.h:1.2	Sat Feb  5 14:04:40 2011
+++ src/sys/dev/tprof/tprof_ioctl.h	Thu Apr 14 16:23:59 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: tprof_ioctl.h,v 1.2 2011/02/05 14:04:40 yamt Exp $	*/
+/*	$NetBSD: tprof_ioctl.h,v 1.3 2011/04/14 16:23:59 yamt Exp $	*/
 
 /*-
  * Copyright (c)2008,2010 YAMAMOTO Takashi,
@@ -37,7 +37,7 @@
 
 #include dev/tprof/tprof_types.h
 
-#define	TPROF_VERSION	2
+#define	TPROF_VERSION	3	/* kernel-userland ABI version */
 
 #define	TPROF_IOC_GETVERSION	_IOR('T', 1, int)
 

Index: src/sys/dev/tprof/tprof_types.h
diff -u src/sys/dev/tprof/tprof_types.h:1.1 src/sys/dev/tprof/tprof_types.h:1.2
--- src/sys/dev/tprof/tprof_types.h:1.1	Sat Feb  5 14:04:40 2011
+++ src/sys/dev/tprof/tprof_types.h	Thu Apr 14 16:23:59 2011
@@ -1,7 +1,7 @@
-/*	$NetBSD: tprof_types.h,v 1.1 2011/02/05 14:04:40 yamt Exp $	*/
+/*	$NetBSD: tprof_types.h,v 1.2 2011/04/14 16:23:59 yamt Exp $	*/
 
 /*-
- * Copyright (c)2010 YAMAMOTO Takashi,
+ * Copyright (c)2010,2011 YAMAMOTO Takashi,
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -41,6 +41,8 @@
 
 typedef struct {
 	uint32_t s_pid;		/* process id */
+	uint32_t s_lwpid;	/* lwp id */
+	uint32_t s_cpuid;	/* cpu id */
 	uint32_t s_flags;	/* flags */
 	uintptr_t s_pc;		/* program counter */
 } tprof_sample_t;



CVS commit: src/usr.bin/tpfmt

2011-04-14 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Thu Apr 14 16:25:58 UTC 2011

Modified Files:
src/usr.bin/tpfmt: Makefile

Log Message:
don't link unused library.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/tpfmt/Makefile

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/tpfmt/Makefile
diff -u src/usr.bin/tpfmt/Makefile:1.2 src/usr.bin/tpfmt/Makefile:1.3
--- src/usr.bin/tpfmt/Makefile:1.2	Wed Nov 24 13:17:56 2010
+++ src/usr.bin/tpfmt/Makefile	Thu Apr 14 16:25:58 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.2 2010/11/24 13:17:56 christos Exp $
+#	$NetBSD: Makefile,v 1.3 2011/04/14 16:25:58 yamt Exp $
 
 PROG=	tpfmt
 NOMAN=	
@@ -6,10 +6,8 @@
 CPPFLAGS+= -I${NETBSDSRCDIR}/sys/
 SRCS=	tpfmt.c sym.c
 
-LDADD+= -lpthread
 LDADD+= -lelf
 LDADD+= -lutil
-DPADD+= ${LIBPTHREAD}
 DPADD+= ${LIBELF}
 DPADD+= ${LIBUTIL}
 



CVS commit: src/usr.bin/tpfmt

2011-04-14 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Thu Apr 14 16:27:17 UTC 2011

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

Log Message:
- adapt to the kernel
- add some options


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/tpfmt/tpfmt.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/tpfmt/tpfmt.c
diff -u src/usr.bin/tpfmt/tpfmt.c:1.2 src/usr.bin/tpfmt/tpfmt.c:1.3
--- src/usr.bin/tpfmt/tpfmt.c:1.2	Wed Nov 24 13:17:56 2010
+++ src/usr.bin/tpfmt/tpfmt.c	Thu Apr 14 16:27:17 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: tpfmt.c,v 1.2 2010/11/24 13:17:56 christos Exp $	*/
+/*	$NetBSD: tpfmt.c,v 1.3 2011/04/14 16:27:17 yamt Exp $	*/
 
 /*-
  * Copyright (c) 2010 YAMAMOTO Takashi,
@@ -28,27 +28,38 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: tpfmt.c,v 1.2 2010/11/24 13:17:56 christos Exp $);
+__RCSID($NetBSD: tpfmt.c,v 1.3 2011/04/14 16:27:17 yamt Exp $);
 #endif /* not lint */
 
 #include sys/rbtree.h
 
+#include dev/tprof/tprof_types.h
+
 #include assert.h
 #include err.h
+#include errno.h
 #include inttypes.h
 #include stdbool.h
 #include stdio.h
 #include stdlib.h
 #include string.h
+#include unistd.h
 #include util.h
 
 #include sym.h
 
 static const char ksyms[] = /dev/ksyms;
 
+static bool filter_by_pid;
+static pid_t target_pid;
+
 struct addr {
 	struct rb_node node;
 	uint64_t addr;		/* address */
+	uint32_t pid;		/* process id */
+	uint32_t lwpid;		/* lwp id */
+	uint32_t cpuid;		/* cpu id */
+	bool in_kernel;		/* if addr is in the kernel address space */
 	unsigned int nsamples;	/* number of samples taken for the address */
 };
 
@@ -59,12 +70,32 @@
 addrtree_compare_key(void *ctx, const void *n1, const void *keyp)
 {
 	const struct addr *a1 = n1;
-	const uint64_t key = *(const uint64_t *)keyp;
+	const struct addr *a2 = (const struct addr *)keyp;
 
-	if (a1-addr  key) {
+	if (a1-addr  a2-addr) {
+		return 1;
+	} else if (a1-addr  a2-addr) {
+		return -1;
+	}
+	if (a1-pid  a2-pid) {
+		return -1;
+	} else if (a1-pid  a2-pid) {
+		return 1;
+	}
+	if (a1-lwpid  a2-lwpid) {
+		return -1;
+	} else if (a1-lwpid  a2-lwpid) {
 		return 1;
-	} else if (a1-addr  key) {
+	}
+	if (a1-cpuid  a2-cpuid) {
 		return -1;
+	} else if (a1-cpuid  a2-cpuid) {
+		return 1;
+	}
+	if (a1-in_kernel  a2-in_kernel) {
+		return -1;
+	} else if (a1-in_kernel  a2-in_kernel) {
+		return 1;
 	}
 	return 0;
 }
@@ -74,7 +105,7 @@
 {
 	const struct addr *a2 = n2;
 
-	return addrtree_compare_key(ctx, n1, a2-addr);
+	return addrtree_compare_key(ctx, n1, a2);
 }
 
 static const rb_tree_ops_t addrtree_ops = {
@@ -104,6 +135,47 @@
 	struct addr **l;
 	struct addr **p;
 	size_t naddrs, i;
+	int ch;
+	bool distinguish_processes = true;
+	bool distinguish_cpus = true;
+	bool distinguish_lwps = true;
+	bool kernel_only = false;
+	extern char *optarg;
+	extern int optind;
+
+	while ((ch = getopt(argc, argv, CkLPp:)) != -1) {
+		uintmax_t val;
+		char *ep;
+
+		switch (ch) {
+		case 'C':	/* don't distinguish cpus */
+			distinguish_cpus = false;
+			break;
+		case 'k':	/* kernel only */
+			kernel_only = true;
+			break;
+		case 'L':	/* don't distinguish lwps */
+			distinguish_lwps = false;
+			break;
+		case 'p':	/* only for the process for the given pid */
+			errno = 0;
+			val = strtoumax(optarg, ep, 10);
+			if (optarg[0] == 0 || *ep != 0 ||
+			val  INT32_MAX) {
+errx(EXIT_FAILURE, invalid p option);
+			}
+			target_pid = val;
+			filter_by_pid = true;
+			break;
+		case 'P':	/* don't distinguish processes */
+			distinguish_processes = false;
+			break;
+		default:
+			errx(EXIT_FAILURE, unknown option %c, ch);
+		}
+	}
+	argc -= optind;
+	argv += optind;
 
 	ksymload(ksyms);
 	rb_tree_init(addrtree, addrtree_ops);
@@ -115,8 +187,9 @@
 	naddrs = 0;
 	while (/*CONSTCOND*/true) {
 		struct addr *o;
-		uintptr_t sample;
+		tprof_sample_t sample;
 		size_t n = fread(sample, sizeof(sample), 1, stdin);
+		bool in_kernel;
 
 		if (n == 0) {
 			if (feof(stdin)) {
@@ -126,11 +199,39 @@
 err(EXIT_FAILURE, fread);
 			}
 		}
+		if (filter_by_pid  (pid_t)sample.s_pid != target_pid) {
+			continue;
+		}
+		in_kernel = (sample.s_flags  TPROF_SAMPLE_INKERNEL) != 0;
+		if (kernel_only  !in_kernel) {
+			continue;
+		}
 		a = emalloc(sizeof(*a));
-		a-addr = (uint64_t)sample;
+		a-addr = (uint64_t)sample.s_pc;
+		if (distinguish_processes) {
+			a-pid = sample.s_pid;
+		} else {
+			a-pid = 0;
+		}
+		if (distinguish_lwps) {
+			a-lwpid = sample.s_lwpid;
+		} else {
+			a-lwpid = 0;
+		}
+		if (distinguish_cpus) {
+			a-cpuid = sample.s_cpuid;
+		} else {
+			a-cpuid = 0;
+		}
+		a-in_kernel = in_kernel;
 		a-nsamples = 1;
 		o = rb_tree_insert_node(addrtree, a);
 		if (o != a) {
+			assert(a-addr == o-addr);
+			assert(a-pid == o-pid);
+			assert(a-lwpid == o-lwpid);
+			assert(a-cpuid == o-cpuid);
+			assert(a-in_kernel == o-in_kernel);
 			free(a);
 			o-nsamples++;
 		} else {
@@ -161,7 

CVS commit: src/external/mit/xorg/server/drivers/xf86-video-suncg14

2011-04-14 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Apr 14 16:50:05 UTC 2011

Modified Files:
src/external/mit/xorg/server/drivers/xf86-video-suncg14: Makefile

Log Message:
add cg14_cursor.c


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 \
src/external/mit/xorg/server/drivers/xf86-video-suncg14/Makefile

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

Modified files:

Index: src/external/mit/xorg/server/drivers/xf86-video-suncg14/Makefile
diff -u src/external/mit/xorg/server/drivers/xf86-video-suncg14/Makefile:1.1 src/external/mit/xorg/server/drivers/xf86-video-suncg14/Makefile:1.2
--- src/external/mit/xorg/server/drivers/xf86-video-suncg14/Makefile:1.1	Sun Mar 14 01:13:16 2010
+++ src/external/mit/xorg/server/drivers/xf86-video-suncg14/Makefile	Thu Apr 14 16:50:05 2011
@@ -1,9 +1,9 @@
-#	$NetBSD: Makefile,v 1.1 2010/03/14 01:13:16 macallan Exp $
+#	$NetBSD: Makefile,v 1.2 2011/04/14 16:50:05 macallan Exp $
 
 DRIVER=		xf86-video-suncg14
 DRIVER_NAME=	suncg14_drv
 
-SRCS=		cg14_driver.c
+SRCS=		cg14_driver.c cg14_cursor.c
 MAN=		suncg14.4
 
 CPPFLAGS+=	-I${X11SRCDIR.${DRIVER}}/../include



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

2011-04-14 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Apr 14 16:58:58 UTC 2011

Modified Files:
src/sys/arch/mips/mips: ipifuncs.c

Log Message:
Increment correct counter.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/mips/mips/ipifuncs.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/mips/mips/ipifuncs.c
diff -u src/sys/arch/mips/mips/ipifuncs.c:1.3 src/sys/arch/mips/mips/ipifuncs.c:1.4
--- src/sys/arch/mips/mips/ipifuncs.c:1.3	Sun Feb 20 16:38:13 2011
+++ src/sys/arch/mips/mips/ipifuncs.c	Thu Apr 14 16:58:58 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipifuncs.c,v 1.3 2011/02/20 16:38:13 rmind Exp $	*/
+/*	$NetBSD: ipifuncs.c,v 1.4 2011/04/14 16:58:58 matt Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #include opt_ddb.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ipifuncs.c,v 1.3 2011/02/20 16:38:13 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: ipifuncs.c,v 1.4 2011/04/14 16:58:58 matt Exp $);
 
 #include sys/param.h
 #include sys/cpu.h
@@ -124,7 +124,7 @@
 		ipi_shootdown(ci);
 	}
 	if (ipi_mask  __BIT(IPI_SYNCICACHE)) {
-		ci-ci_evcnt_per_ipi[IPI_NOP].ev_count++;
+		ci-ci_evcnt_per_ipi[IPI_SYNCICACHE].ev_count++;
 		ipi_syncicache(ci);
 	}
 	if (ipi_mask  __BIT(IPI_SUSPEND)) {



CVS commit: xsrc/external/mit/xf86-video-suncg14/dist/src

2011-04-14 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Thu Apr 14 16:59:48 UTC 2011

Modified Files:
xsrc/external/mit/xf86-video-suncg14/dist/src: cg14_driver.c

Log Message:
oops, missed some debug spam


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c

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

Modified files:

Index: xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c:1.6 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c:1.7
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c:1.6	Thu Apr 14 16:48:59 2011
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c	Thu Apr 14 16:59:48 2011
@@ -574,7 +574,6 @@
 /* must be after RGB ordering fixed */
 fbPictureInit (pScreen, 0, 0);
 
-xf86DrvMsg(scrnIndex, X_ERROR, calling CG14ShadowInit\n);
 if (pCg14-use_shadow  !CG14ShadowInit(pScreen)) {
 	xf86DrvMsg(scrnIndex, X_ERROR,
 		shadow framebuffer initialization failed\n);



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

2011-04-14 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Apr 14 17:41:32 UTC 2011

Modified Files:
src/sys/arch/mips/mips: pmap_tlb.c

Log Message:
fix whitespace and comments


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/mips/mips/pmap_tlb.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/mips/mips/pmap_tlb.c
diff -u src/sys/arch/mips/mips/pmap_tlb.c:1.6 src/sys/arch/mips/mips/pmap_tlb.c:1.7
--- src/sys/arch/mips/mips/pmap_tlb.c:1.6	Tue Apr 12 18:53:23 2011
+++ src/sys/arch/mips/mips/pmap_tlb.c	Thu Apr 14 17:41:32 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_tlb.c,v 1.6 2011/04/12 18:53:23 matt Exp $	*/
+/*	$NetBSD: pmap_tlb.c,v 1.7 2011/04/14 17:41:32 matt Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(0, $NetBSD: pmap_tlb.c,v 1.6 2011/04/12 18:53:23 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap_tlb.c,v 1.7 2011/04/14 17:41:32 matt Exp $);
 
 /*
  * Manages address spaces in a TLB.
@@ -266,11 +266,11 @@
 		}
 #ifdef MULTIPROCESSOR
 		const u_int icache_way_pages =
-			mips_cache_info.mci_picache_way_size  PGSHIFT; 
+			mips_cache_info.mci_picache_way_size  PGSHIFT;
 		KASSERT(icache_way_pages = 8*sizeof(pmap_tlb_synci_page_mask));
 		pmap_tlb_synci_page_mask = icache_way_pages - 1;
 		pmap_tlb_synci_map_mask = ~(~0  icache_way_pages);
-		printf(tlb0: synci page mask %#x and map mask %#x used for %u pages\n, 
+		printf(tlb0: synci page mask %#x and map mask %#x used for %u pages\n,
 		pmap_tlb_synci_page_mask, pmap_tlb_synci_map_mask,
 		icache_way_pages);
 #endif
@@ -818,8 +818,9 @@
 		(%s: pmap %p onproc %#x doesn't include cpu %d (%p),
 		__func__, pm, pm-pm_onproc, cpu_index(ci), ci));
 		/*
-		 * The bits in pm_onproc that belong to this TLB can only
-		 * be changed while this TLBs lock is held.
+		 * The bits in pm_onproc that belong to this TLB can
+		 * be changed while this TLBs lock is not held as long
+		 * as we use atomic ops.
 		 */
 		atomic_and_32(pm-pm_onproc, ~cpu_mask);
 		atomic_and_ulong(ci-ci_flags, ~CPUF_USERPMAP);



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

2011-04-14 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Apr 14 17:42:00 UTC 2011

Modified Files:
src/sys/arch/mips/mips: ipifuncs.c

Log Message:
cpu_number() returns a u_int


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/mips/mips/ipifuncs.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/mips/mips/ipifuncs.c
diff -u src/sys/arch/mips/mips/ipifuncs.c:1.4 src/sys/arch/mips/mips/ipifuncs.c:1.5
--- src/sys/arch/mips/mips/ipifuncs.c:1.4	Thu Apr 14 16:58:58 2011
+++ src/sys/arch/mips/mips/ipifuncs.c	Thu Apr 14 17:42:00 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipifuncs.c,v 1.4 2011/04/14 16:58:58 matt Exp $	*/
+/*	$NetBSD: ipifuncs.c,v 1.5 2011/04/14 17:42:00 matt Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #include opt_ddb.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ipifuncs.c,v 1.4 2011/04/14 16:58:58 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: ipifuncs.c,v 1.5 2011/04/14 17:42:00 matt Exp $);
 
 #include sys/param.h
 #include sys/cpu.h
@@ -47,10 +47,8 @@
 #include mips/db_machdep.h
 #endif
 
-
 static void ipi_halt(void) __dead;
 
-
 static const char * const ipi_names[] = {
 	[IPI_NOP]	= ipi nop,
 	[IPI_AST]	= ipi ast,
@@ -97,8 +95,8 @@
 static void
 ipi_halt(void)
 {
-	const int my_cpu = cpu_number();
-	printf(cpu%d: shutting down\n, my_cpu);
+	const u_int my_cpu = cpu_number();
+	printf(cpu%u: shutting down\n, my_cpu);
 	CPUSET_ADD(cpus_halted, my_cpu);
 	splhigh();
 	for (;;)



CVS commit: src/sys/arch/mips

2011-04-14 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Apr 14 17:43:07 UTC 2011

Modified Files:
src/sys/arch/mips/include: locore.h
src/sys/arch/mips/mips: db_interface.c

Log Message:
Fix printing of watch{lo,hi} and make mipsNN_watchlo_* use intptr_t so that
sign extention happens.


To generate a diff of this commit:
cvs rdiff -u -r1.88 -r1.89 src/sys/arch/mips/include/locore.h
cvs rdiff -u -r1.72 -r1.73 src/sys/arch/mips/mips/db_interface.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/mips/include/locore.h
diff -u src/sys/arch/mips/include/locore.h:1.88 src/sys/arch/mips/include/locore.h:1.89
--- src/sys/arch/mips/include/locore.h:1.88	Thu Apr 14 05:08:22 2011
+++ src/sys/arch/mips/include/locore.h	Thu Apr 14 17:43:07 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.h,v 1.88 2011/04/14 05:08:22 cliff Exp $ */
+/* $NetBSD: locore.h,v 1.89 2011/04/14 17:43:07 matt Exp $ */
 
 /*
  * This file should not be included by MI code!!!
@@ -148,8 +148,8 @@
 uint32_t mipsNN_cp0_config2_read(void);
 uint32_t mipsNN_cp0_config3_read(void);
 
-uintptr_t mipsNN_cp0_watchlo_read(u_int);
-void	mipsNN_cp0_watchlo_write(u_int, uintptr_t);
+intptr_t mipsNN_cp0_watchlo_read(u_int);
+void	mipsNN_cp0_watchlo_write(u_int, intptr_t);
 uint32_t mipsNN_cp0_watchhi_read(u_int);
 void	mipsNN_cp0_watchhi_write(u_int, uint32_t);
 

Index: src/sys/arch/mips/mips/db_interface.c
diff -u src/sys/arch/mips/mips/db_interface.c:1.72 src/sys/arch/mips/mips/db_interface.c:1.73
--- src/sys/arch/mips/mips/db_interface.c:1.72	Thu Apr 14 09:25:05 2011
+++ src/sys/arch/mips/mips/db_interface.c	Thu Apr 14 17:43:07 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_interface.c,v 1.72 2011/04/14 09:25:05 matt Exp $	*/
+/*	$NetBSD: db_interface.c,v 1.73 2011/04/14 17:43:07 matt Exp $	*/
 
 /*
  * Mach Operating System
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: db_interface.c,v 1.72 2011/04/14 09:25:05 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: db_interface.c,v 1.73 2011/04/14 17:43:07 matt Exp $);
 
 #include opt_multiprocessor.h
 #include opt_cputype.h	/* which mips CPUs do we support? */
@@ -466,19 +466,12 @@
 
 #if (MIPS32 + MIPS32R2 + MIPS64 + MIPS64R2)  0
 	for (int i=0; i  curcpu()-ci_cpuwatch_count; i++) {
-		uint32_t r = mipsNN_cp0_watchlo_read(i);
-		printf(  %s%d:%*s %#x\n, watchlo, i, FLDWIDTH - 8, , r);
-	}
-	for (int i=0; i  curcpu()-ci_cpuwatch_count; i++) {
-		if (CPUIS64BITS) {
-			uint32_t r = mipsNN_cp0_watchhi_read(i);
-			printf(  %s%d:%*s %#x\n,
-watchhi, i, FLDWIDTH - 8, , r);
-		} else {
-			uint64_t r = mipsNN_cp0_watchhi_read(i);
-			printf(  %s%d:%*s %# PRIx64 \n,
-watchhi, i, FLDWIDTH - 8, , r);
-		}
+		const intptr_t lo = mipsNN_cp0_watchlo_read(i);
+		const uint32_t hi = mipsNN_cp0_watchhi_read(i);
+		printf(  %s%d:%*s %# PRIxPTR \t,
+		watchlo, i, FLDWIDTH - 8, , lo);
+		printf(  %s%d:%*s %# PRIx32 \n,
+		watchhi, i, FLDWIDTH - 8, , hi);
 	}
 #endif
 



CVS commit: src/crypto/external/bsd/heimdal/dist/lib/krb5

2011-04-14 Thread Roland Dowdeswell
Module Name:src
Committed By:   elric
Date:   Thu Apr 14 18:00:30 UTC 2011

Modified Files:
src/crypto/external/bsd/heimdal/dist/lib/krb5: auth_context.c salt.c

Log Message:
Copy coverity alloc comments from old location.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/crypto/external/bsd/heimdal/dist/lib/krb5/auth_context.c \
src/crypto/external/bsd/heimdal/dist/lib/krb5/salt.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/external/bsd/heimdal/dist/lib/krb5/auth_context.c
diff -u src/crypto/external/bsd/heimdal/dist/lib/krb5/auth_context.c:1.1.1.1 src/crypto/external/bsd/heimdal/dist/lib/krb5/auth_context.c:1.2
--- src/crypto/external/bsd/heimdal/dist/lib/krb5/auth_context.c:1.1.1.1	Wed Apr 13 18:15:31 2011
+++ src/crypto/external/bsd/heimdal/dist/lib/krb5/auth_context.c	Thu Apr 14 18:00:30 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: auth_context.c,v 1.1.1.1 2011/04/13 18:15:31 elric Exp $	*/
+/*	$NetBSD: auth_context.c,v 1.2 2011/04/14 18:00:30 elric Exp $	*/
 
 /*
  * Copyright (c) 1997 - 2002 Kungliga Tekniska Högskolan
@@ -264,6 +264,7 @@
 return 0;
 }
 
+/* coverity[+alloc : arg-*2] */
 static krb5_error_code
 copy_key(krb5_context context,
 	 krb5_keyblock *in,
@@ -291,6 +292,7 @@
 return copy_key(context, auth_context-local_subkey, keyblock);
 }
 
+/* coverity[+alloc : arg-*2] */ 
 KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
 krb5_auth_con_getremotesubkey(krb5_context context,
 			  krb5_auth_context auth_context,
Index: src/crypto/external/bsd/heimdal/dist/lib/krb5/salt.c
diff -u src/crypto/external/bsd/heimdal/dist/lib/krb5/salt.c:1.1.1.1 src/crypto/external/bsd/heimdal/dist/lib/krb5/salt.c:1.2
--- src/crypto/external/bsd/heimdal/dist/lib/krb5/salt.c:1.1.1.1	Wed Apr 13 18:15:37 2011
+++ src/crypto/external/bsd/heimdal/dist/lib/krb5/salt.c	Thu Apr 14 18:00:30 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: salt.c,v 1.1.1.1 2011/04/13 18:15:37 elric Exp $	*/
+/*	$NetBSD: salt.c,v 1.2 2011/04/14 18:00:30 elric Exp $	*/
 
 /*
  * Copyright (c) 1997 - 2008 Kungliga Tekniska Högskolan
@@ -35,6 +35,7 @@
 
 #include krb5_locl.h
 
+/* coverity[+alloc : arg-*3] */
 KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
 krb5_salttype_to_string (krb5_context context,
 			 krb5_enctype etype,



CVS commit: src/crypto/external/bsd/heimdal/dist/lib/krb5

2011-04-14 Thread Roland Dowdeswell
Module Name:src
Committed By:   elric
Date:   Thu Apr 14 18:02:08 UTC 2011

Modified Files:
src/crypto/external/bsd/heimdal/dist/lib/krb5: context.c

Log Message:
Turn on the hack which disables Kerberos if there is no /etc/krb5.conf.
We should review this logic and come up with a better way to do this as
now that there are DNS SRV RRs for locating KDCs, the lack of a config
does not imply that Kerberos should be turned off.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/crypto/external/bsd/heimdal/dist/lib/krb5/context.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/external/bsd/heimdal/dist/lib/krb5/context.c
diff -u src/crypto/external/bsd/heimdal/dist/lib/krb5/context.c:1.1.1.1 src/crypto/external/bsd/heimdal/dist/lib/krb5/context.c:1.2
--- src/crypto/external/bsd/heimdal/dist/lib/krb5/context.c:1.1.1.1	Wed Apr 13 18:15:32 2011
+++ src/crypto/external/bsd/heimdal/dist/lib/krb5/context.c	Thu Apr 14 18:02:07 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: context.c,v 1.1.1.1 2011/04/13 18:15:32 elric Exp $	*/
+/*	$NetBSD: context.c,v 1.2 2011/04/14 18:02:07 elric Exp $	*/
 
 /*
  * Copyright (c) 1997 - 2010 Kungliga Tekniska Högskolan
@@ -612,7 +612,7 @@
 	}
 	filenames++;
 }
-#if 0
+#if 1
 /* with this enabled and if there are no config files, Kerberos is
considererd disabled */
 if(tmp == NULL)



CVS commit: src/crypto/external/bsd/heimdal

2011-04-14 Thread Roland Dowdeswell
Module Name:src
Committed By:   elric
Date:   Thu Apr 14 18:12:08 UTC 2011

Modified Files:
src/crypto/external/bsd/heimdal/dist/lib/roken: get_window_size.c
getarg.c roken.h.in
src/crypto/external/bsd/heimdal/include: roken.h

Log Message:
Replicate changes to get_window_size() made in previous location:

revision 1.7
date: 2010/01/24 16:45:57;  author: christos;  state: Exp;
make the window size function return the lines and columns
variables separately instead of depending on the existance
of struct winsize. Technically I should bump the library
version or version the symbol, but nothing seems to use
this outside the library!


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/crypto/external/bsd/heimdal/dist/lib/roken/get_window_size.c \
src/crypto/external/bsd/heimdal/dist/lib/roken/getarg.c \
src/crypto/external/bsd/heimdal/dist/lib/roken/roken.h.in
cvs rdiff -u -r1.1 -r1.2 src/crypto/external/bsd/heimdal/include/roken.h

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

Modified files:

Index: src/crypto/external/bsd/heimdal/dist/lib/roken/get_window_size.c
diff -u src/crypto/external/bsd/heimdal/dist/lib/roken/get_window_size.c:1.1.1.1 src/crypto/external/bsd/heimdal/dist/lib/roken/get_window_size.c:1.2
--- src/crypto/external/bsd/heimdal/dist/lib/roken/get_window_size.c:1.1.1.1	Wed Apr 13 18:15:41 2011
+++ src/crypto/external/bsd/heimdal/dist/lib/roken/get_window_size.c	Thu Apr 14 18:12:08 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: get_window_size.c,v 1.1.1.1 2011/04/13 18:15:41 elric Exp $	*/
+/*	$NetBSD: get_window_size.c,v 1.2 2011/04/14 18:12:08 elric Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan
@@ -60,32 +60,46 @@
 #include krb5/roken.h
 
 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
-get_window_size(int fd, struct winsize *wp)
+get_window_size(int fd, int *lines, int *columns)
 {
-int ret = -1;
-
-memset(wp, 0, sizeof(*wp));
+int ret;
+char *s;
 
 #if defined(TIOCGWINSZ)
-ret = ioctl(fd, TIOCGWINSZ, wp);
+{
+	struct winsize ws;
+	ret = ioctl(fd, TIOCGWINSZ, ws);
+	if (ret != -1) {
+	if (lines)
+		*lines = ws.ws_row;
+	if (columns)
+		*columns = ws.ws_col;
+	return 0;
+	}
+}
 #elif defined(TIOCGSIZE)
 {
 	struct ttysize ts;
 	
 	ret = ioctl(fd, TIOCGSIZE, ts);
-	if(ret == 0) {
-	wp-ws_row = ts.ts_lines;
-	wp-ws_col = ts.ts_cols;
-	}
+	if (ret != -1) {
+	if (lines)
+		*lines = ts.ws_lines;
+	if (columns)
+		*columns = ts.ts_cols;
+	return 0;
+ 	}
 }
 #elif defined(HAVE__SCRSIZE)
 {
 	int dst[2];
-	
-	_scrsize(dst);
-	wp-ws_row = dst[1];
-	wp-ws_col = dst[0];
-	ret = 0;
+ 	
+ 	_scrsize(dst);
+	if (lines)
+	*lines = dst[1];
+	if (columns)
+	*columns = dst[0];
+	return 0;
 }
 #elif defined(_WIN32)
 {
@@ -102,14 +116,17 @@
 }
 }
 #endif
-if (ret != 0) {
-char *s;
-if((s = getenv(COLUMNS)))
-	wp-ws_col = atoi(s);
-	if((s = getenv(LINES)))
-	wp-ws_row = atoi(s);
-	if(wp-ws_col  0  wp-ws_row  0)
-	ret = 0;
+if (columns) {
+	if ((s = getenv(COLUMNS)))
+	*columns = atoi(s);
+	else
+	return -1;
+}
+if (lines) {
+	if ((s = getenv(LINES)))
+	*lines = atoi(s);
+	else
+	return -1;
 }
-return ret;
+return 0;
 }
Index: src/crypto/external/bsd/heimdal/dist/lib/roken/getarg.c
diff -u src/crypto/external/bsd/heimdal/dist/lib/roken/getarg.c:1.1.1.1 src/crypto/external/bsd/heimdal/dist/lib/roken/getarg.c:1.2
--- src/crypto/external/bsd/heimdal/dist/lib/roken/getarg.c:1.1.1.1	Wed Apr 13 18:15:41 2011
+++ src/crypto/external/bsd/heimdal/dist/lib/roken/getarg.c	Thu Apr 14 18:12:08 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: getarg.c,v 1.1.1.1 2011/04/13 18:15:41 elric Exp $	*/
+/*	$NetBSD: getarg.c,v 1.2 2011/04/14 18:12:08 elric Exp $	*/
 
 /*
  * Copyright (c) 1997 - 2002 Kungliga Tekniska Högskolan
@@ -230,7 +230,6 @@
 size_t i, max_len = 0;
 char buf[128];
 int col = 0, columns;
-struct winsize ws;
 
 if (progname == NULL)
 	progname = getprogname();
@@ -242,9 +241,7 @@
 	mandoc_template(args, num_args, progname, extra_string, i18n);
 	return;
 }
-if(get_window_size(2, ws) == 0)
-	columns = ws.ws_col;
-else
+if(get_window_size(2, NULL, columns) == -1)
 	columns = 80;
 col = 0;
 col += fprintf (stderr, %s: %s, usage, progname);
Index: src/crypto/external/bsd/heimdal/dist/lib/roken/roken.h.in
diff -u src/crypto/external/bsd/heimdal/dist/lib/roken/roken.h.in:1.1.1.1 src/crypto/external/bsd/heimdal/dist/lib/roken/roken.h.in:1.2
--- src/crypto/external/bsd/heimdal/dist/lib/roken/roken.h.in:1.1.1.1	Wed Apr 13 18:15:42 2011
+++ src/crypto/external/bsd/heimdal/dist/lib/roken/roken.h.in	Thu Apr 14 18:12:08 2011
@@ -759,7 +759,7 @@
 };
 #endif
 
-ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL get_window_size(int fd, 

CVS commit: src/crypto/external/bsd/heimdal

2011-04-14 Thread Roland Dowdeswell
Module Name:src
Committed By:   elric
Date:   Thu Apr 14 18:16:21 UTC 2011

Modified Files:
src/crypto/external/bsd/heimdal: heimdal2netbsd

Log Message:
Also take the $'s out from around $Id.*$ as well as $Id.* $.  This change
was required because there are many unexanded $Id$'s in Heimdal when you
git clone.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/crypto/external/bsd/heimdal/heimdal2netbsd

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

Modified files:

Index: src/crypto/external/bsd/heimdal/heimdal2netbsd
diff -u src/crypto/external/bsd/heimdal/heimdal2netbsd:1.2 src/crypto/external/bsd/heimdal/heimdal2netbsd:1.3
--- src/crypto/external/bsd/heimdal/heimdal2netbsd:1.2	Wed Apr 13 22:16:52 2011
+++ src/crypto/external/bsd/heimdal/heimdal2netbsd	Thu Apr 14 18:16:21 2011
@@ -1,6 +1,6 @@
 #! /bin/sh
 #
-#	$NetBSD: heimdal2netbsd,v 1.2 2011/04/13 22:16:52 christos Exp $
+#	$NetBSD: heimdal2netbsd,v 1.3 2011/04/14 18:16:21 elric Exp $
 #
 # Copyright (c) 2011 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -198,7 +198,7 @@
 	-e 's/\$\(Author.*\) \$/\1/' \
 	-e 's/\$\(Date.*\) \$/\1/' \
 	-e 's/\$\(Header.*\) \$/\1/' \
-	-e 's/\$\(Id.*\) \$/\1/' \
+	-e 's/\$\(Id.*\)\$/\1/' \
 	-e 's/\$\(Locker.*\) \$/\1/' \
 	-e 's/\$\(Log.*\) \$/\1/' \
 	-e 's/\$\(Name.*\) \$/\1/' \



CVS commit: src/crypto/external/bsd/heimdal/dist/kpasswd

2011-04-14 Thread Roland Dowdeswell
Module Name:src
Committed By:   elric
Date:   Thu Apr 14 18:18:16 UTC 2011

Modified Files:
src/crypto/external/bsd/heimdal/dist/kpasswd: kpasswdd.c

Log Message:
Turn inetd support back on.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/crypto/external/bsd/heimdal/dist/kpasswd/kpasswdd.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/external/bsd/heimdal/dist/kpasswd/kpasswdd.c
diff -u src/crypto/external/bsd/heimdal/dist/kpasswd/kpasswdd.c:1.1.1.1 src/crypto/external/bsd/heimdal/dist/kpasswd/kpasswdd.c:1.2
--- src/crypto/external/bsd/heimdal/dist/kpasswd/kpasswdd.c:1.1.1.1	Wed Apr 13 18:14:38 2011
+++ src/crypto/external/bsd/heimdal/dist/kpasswd/kpasswdd.c	Thu Apr 14 18:18:16 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kpasswdd.c,v 1.1.1.1 2011/04/13 18:14:38 elric Exp $	*/
+/*	$NetBSD: kpasswdd.c,v 1.2 2011/04/14 18:18:16 elric Exp $	*/
 
 /*
  * Copyright (c) 1997-2005 Kungliga Tekniska Högskolan
@@ -34,7 +34,7 @@
  */
 
 #include kpasswd_locl.h
-__RCSID($NetBSD: kpasswdd.c,v 1.1.1.1 2011/04/13 18:14:38 elric Exp $);
+__RCSID($NetBSD: kpasswdd.c,v 1.2 2011/04/14 18:18:16 elric Exp $);
 
 #include kadm5/admin.h
 #ifdef HAVE_SYS_UN_H
@@ -623,6 +623,34 @@
 krb5_auth_con_free (context, auth_context);
 }
 
+#ifdef INETD_SUPPORT
+/*
+ * XXX this code relies on getsockname() returning a valid local
+ * address for a connected DGRAM socket. This is true for most, but
+ * probably not all systems. For some systems, this could be done
+ * cleaner by using the IP_RECVDSTADDR option + recvmsg().
+ */
+static int
+get_local_addr(struct sockaddr *remote, int remlen,
+	   struct sockaddr *local, socklen_t *loclen)
+{
+	int s, ret;
+
+	s = socket(remote-sa_family, SOCK_DGRAM, 0);
+	if (s  0)
+		return -1;
+
+	if (connect(s, remote, remlen)  0) {
+		close(s);
+		return -1;
+	}
+
+	ret = getsockname(s, local, loclen);
+	close(s);
+	return ret;
+}
+#endif
+
 static int
 doit (krb5_keytab keytab, int port)
 {
@@ -631,15 +659,30 @@
 int maxfd;
 krb5_realm *realms;
 krb5_addresses addrs;
+krb5_address *my_addrp;
 unsigned n, i;
 fd_set real_fdset;
 struct sockaddr_storage __ss;
 struct sockaddr *sa = (struct sockaddr *)__ss;
+#ifdef INETD_SUPPORT
+int fdz;
+int from_inetd;
+socklen_t fromlen;
+krb5_address my_addr;
+struct sockaddr_storage __local;
+struct sockaddr *localsa = (struct sockaddr *)__local;
+#endif
 
 ret = krb5_get_default_realms(context, realms);
 if (ret)
 	krb5_err (context, 1, ret, krb5_get_default_realms);
 
+#ifdef INETD_SUPPORT
+fromlen = sizeof __ss;
+from_inetd = (getsockname(0, sa, fromlen) == 0);
+
+if (!from_inetd) {
+#endif
 if (explicit_addresses.len) {
 	addrs = explicit_addresses;
 } else {
@@ -678,6 +721,16 @@
 	krb5_errx (context, 1, fd too large);
 	FD_SET(sockets[i], real_fdset);
 }
+#ifdef INETD_SUPPORT
+} else {
+n = 1;
+maxfd = 0;
+	fdz = 0;
+sockets = fdz;
+FD_ZERO(real_fdset);
+FD_SET(0, real_fdset);
+}
+#endif
 if (maxfd == -1)
 	krb5_errx (context, 1, No sockets!);
 
@@ -705,19 +758,48 @@
 		else
 			krb5_err (context, 1, errno, recvfrom);
 		}
+#ifdef INETD_SUPPORT
+		if (from_inetd) {
+			socklen_t loclen = sizeof(__local);
+			int ret2;
+
+			ret2 = get_local_addr(sa, addrlen, localsa, loclen);
+			if (ret2  0)
+krb5_errx (context, errno, get_local_addr);
+			ret2 = krb5_sockaddr2address(context, localsa,
+			my_addr);
+			if (ret2)
+krb5_errx (context, ret2,
+krb5_sockaddr2address);
+			my_addrp = my_addr;
+		} else
+#endif
+		my_addrp = addrs.val[i];
 
 		process (realms, keytab, sockets[i],
-			 addrs.val[i],
+			 my_addrp,
 			 sa, addrlen,
 			 buf, ret);
+#ifdef INETD_SUPPORT
+		if (from_inetd) {
+		krb5_free_address(context, my_addr);
+		}
+#endif
 	}
+#ifdef INETD_SUPPORT
+	if (from_inetd)
+	break;
+#endif
 }
 
 for (i = 0; i  n; ++i)
 	close(sockets[i]);
 free(sockets);
 
-krb5_free_addresses (context, addrs);
+#ifdef INETD_SUPPORT
+if (!from_inetd)
+#endif
+	krb5_free_addresses (context, addrs);
 krb5_free_host_realm (context, realms);
 krb5_free_context (context);
 return 0;



CVS commit: src/crypto/external/bsd/heimdal/dist/kuser

2011-04-14 Thread Roland Dowdeswell
Module Name:src
Committed By:   elric
Date:   Thu Apr 14 18:21:32 UTC 2011

Modified Files:
src/crypto/external/bsd/heimdal/dist/kuser: klist.c

Log Message:
From prior location, handle ctime returning NULL.

revision 1.11
date: 2010/04/02 15:25:04;  author: christos;  state: Exp;
make it obvious to grep that ctime is being checked.

and

revision 1.10
date: 2010/04/02 15:23:17;  author: christos;  state: Exp;
handle ctime returning NULL.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/crypto/external/bsd/heimdal/dist/kuser/klist.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/external/bsd/heimdal/dist/kuser/klist.c
diff -u src/crypto/external/bsd/heimdal/dist/kuser/klist.c:1.1.1.1 src/crypto/external/bsd/heimdal/dist/kuser/klist.c:1.2
--- src/crypto/external/bsd/heimdal/dist/kuser/klist.c:1.1.1.1	Wed Apr 13 18:14:39 2011
+++ src/crypto/external/bsd/heimdal/dist/kuser/klist.c	Thu Apr 14 18:21:32 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: klist.c,v 1.1.1.1 2011/04/13 18:14:39 elric Exp $	*/
+/*	$NetBSD: klist.c,v 1.2 2011/04/14 18:21:32 elric Exp $	*/
 
 /*
  * Copyright (c) 1997-2008 Kungliga Tekniska Högskolan
@@ -41,21 +41,29 @@
 #include kcc-commands.h
 
 static char*
-printable_time(time_t t)
+printable_time_internal(time_t t, int x)
 {
 static char s[128];
-strlcpy(s, ctime(t)+ 4, sizeof(s));
-s[15] = 0;
+char *p;
+
+if ((p = ctime(t)) == NULL)
+	strlcpy(s, ?, sizeof(s));
+else
+	strlcpy(s, p + 4, sizeof(s));
+s[x] = 0;
 return s;
 }
 
 static char*
+printable_time(time_t t)
+{
+return printable_time_internal(t, 20);
+}
+
+static char*
 printable_time_long(time_t t)
 {
-static char s[128];
-strlcpy(s, ctime(t)+ 4, sizeof(s));
-s[20] = 0;
-return s;
+return printable_time_internal(t, 20);
 }
 
 #define COL_ISSUED		NP_(  Issued,)



CVS commit: src/crypto/external/bsd/heimdal/dist/lib/hx509

2011-04-14 Thread Roland Dowdeswell
Module Name:src
Committed By:   elric
Date:   Thu Apr 14 18:22:35 UTC 2011

Modified Files:
src/crypto/external/bsd/heimdal/dist/lib/hx509: revoke.c

Log Message:
From prior location:

revision 1.2
date: 2010/04/02 15:26:17;  author: christos;  state: Exp;
handle ctime returning NULL.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/crypto/external/bsd/heimdal/dist/lib/hx509/revoke.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/external/bsd/heimdal/dist/lib/hx509/revoke.c
diff -u src/crypto/external/bsd/heimdal/dist/lib/hx509/revoke.c:1.1.1.1 src/crypto/external/bsd/heimdal/dist/lib/hx509/revoke.c:1.2
--- src/crypto/external/bsd/heimdal/dist/lib/hx509/revoke.c:1.1.1.1	Wed Apr 13 18:15:12 2011
+++ src/crypto/external/bsd/heimdal/dist/lib/hx509/revoke.c	Thu Apr 14 18:22:35 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: revoke.c,v 1.1.1.1 2011/04/13 18:15:12 elric Exp $	*/
+/*	$NetBSD: revoke.c,v 1.2 2011/04/14 18:22:35 elric Exp $	*/
 
 /*
  * Copyright (c) 2006 - 2007 Kungliga Tekniska Högskolan
@@ -1057,8 +1057,13 @@
 printable_time(time_t t)
 {
 static char s[128];
-strlcpy(s, ctime(t)+ 4, sizeof(s));
-s[20] = 0;
+char *p;
+if ((p = ctime(t)) == NULL)
+   strlcpy(s, ?, sizeof(s));
+else {
+   strlcpy(s, p + 4, sizeof(s));
+   s[20] = 0;
+}
 return s;
 }
 



CVS commit: src/crypto/external/bsd/heimdal/dist/lib/vers

2011-04-14 Thread Roland Dowdeswell
Module Name:src
Committed By:   elric
Date:   Thu Apr 14 18:23:24 UTC 2011

Modified Files:
src/crypto/external/bsd/heimdal/dist/lib/vers: print_version.c

Log Message:
From prior location.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/crypto/external/bsd/heimdal/dist/lib/vers/print_version.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/external/bsd/heimdal/dist/lib/vers/print_version.c
diff -u src/crypto/external/bsd/heimdal/dist/lib/vers/print_version.c:1.1.1.1 src/crypto/external/bsd/heimdal/dist/lib/vers/print_version.c:1.2
--- src/crypto/external/bsd/heimdal/dist/lib/vers/print_version.c:1.1.1.1	Wed Apr 13 18:15:44 2011
+++ src/crypto/external/bsd/heimdal/dist/lib/vers/print_version.c	Thu Apr 14 18:23:23 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: print_version.c,v 1.1.1.1 2011/04/13 18:15:44 elric Exp $	*/
+/*	$NetBSD: print_version.c,v 1.2 2011/04/14 18:23:23 elric Exp $	*/
 
 /*
  * Copyright (c) 1998 - 2006 Kungliga Tekniska Högskolan
@@ -54,5 +54,7 @@
 	package_list = no version information;
 fprintf(stderr, %s (%s)\n, progname, package_list);
 fprintf(stderr, Copyright 1995-2011 Kungliga Tekniska Högskolan\n);
+#ifdef PACKAGE_BUGREPORT
 fprintf(stderr, Send bug-reports to %s\n, PACKAGE_BUGREPORT);
+#endif
 }



CVS commit: src/crypto/external/bsd/heimdal/dist

2011-04-14 Thread Roland Dowdeswell
Module Name:src
Committed By:   elric
Date:   Thu Apr 14 19:19:20 UTC 2011

Modified Files:
src/crypto/external/bsd/heimdal/dist/admin: ktutil.8
src/crypto/external/bsd/heimdal/dist/kadmin: kadmin.8 kadmind.8
src/crypto/external/bsd/heimdal/dist/kcm: kcm.8
src/crypto/external/bsd/heimdal/dist/kdc: hprop.8 hpropd.8 kdc.8
kstash.8 string2key.8
src/crypto/external/bsd/heimdal/dist/kpasswd: kpasswdd.8
src/crypto/external/bsd/heimdal/dist/kuser: kdestroy.1 kgetcred.1
kimpersonate.8 kinit.1 klist.1
src/crypto/external/bsd/heimdal/dist/lib/gssapi: gssapi.3
src/crypto/external/bsd/heimdal/dist/lib/kadm5: iprop-log.8 iprop.8
src/crypto/external/bsd/heimdal/dist/lib/krb5: krb5_get_in_cred.3
krb5_init_context.3

Log Message:
Updates to man pages found as diffs in prior location in a batch.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.2 -r1.2 \
src/crypto/external/bsd/heimdal/dist/admin/ktutil.8
cvs rdiff -u -r1.1.1.2 -r1.2 \
src/crypto/external/bsd/heimdal/dist/kadmin/kadmin.8 \
src/crypto/external/bsd/heimdal/dist/kadmin/kadmind.8
cvs rdiff -u -r1.1.1.2 -r1.2 src/crypto/external/bsd/heimdal/dist/kcm/kcm.8
cvs rdiff -u -r1.1.1.2 -r1.2 src/crypto/external/bsd/heimdal/dist/kdc/hprop.8 \
src/crypto/external/bsd/heimdal/dist/kdc/hpropd.8 \
src/crypto/external/bsd/heimdal/dist/kdc/kdc.8 \
src/crypto/external/bsd/heimdal/dist/kdc/kstash.8 \
src/crypto/external/bsd/heimdal/dist/kdc/string2key.8
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/crypto/external/bsd/heimdal/dist/kpasswd/kpasswdd.8
cvs rdiff -u -r1.1.1.2 -r1.2 \
src/crypto/external/bsd/heimdal/dist/kuser/kdestroy.1 \
src/crypto/external/bsd/heimdal/dist/kuser/kgetcred.1 \
src/crypto/external/bsd/heimdal/dist/kuser/kimpersonate.8 \
src/crypto/external/bsd/heimdal/dist/kuser/kinit.1 \
src/crypto/external/bsd/heimdal/dist/kuser/klist.1
cvs rdiff -u -r1.1.1.2 -r1.2 \
src/crypto/external/bsd/heimdal/dist/lib/gssapi/gssapi.3
cvs rdiff -u -r1.1.1.2 -r1.2 \
src/crypto/external/bsd/heimdal/dist/lib/kadm5/iprop-log.8 \
src/crypto/external/bsd/heimdal/dist/lib/kadm5/iprop.8
cvs rdiff -u -r1.1.1.2 -r1.2 \
src/crypto/external/bsd/heimdal/dist/lib/krb5/krb5_get_in_cred.3 \
src/crypto/external/bsd/heimdal/dist/lib/krb5/krb5_init_context.3

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

Modified files:

Index: src/crypto/external/bsd/heimdal/dist/admin/ktutil.8
diff -u src/crypto/external/bsd/heimdal/dist/admin/ktutil.8:1.1.1.2 src/crypto/external/bsd/heimdal/dist/admin/ktutil.8:1.2
--- src/crypto/external/bsd/heimdal/dist/admin/ktutil.8:1.1.1.2	Thu Apr 14 14:08:06 2011
+++ src/crypto/external/bsd/heimdal/dist/admin/ktutil.8	Thu Apr 14 19:19:19 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: ktutil.8,v 1.1.1.2 2011/04/14 14:08:06 elric Exp $
+.\	$NetBSD: ktutil.8,v 1.2 2011/04/14 19:19:19 elric Exp $
 .\
 .\ Copyright (c) 1997-2004 Kungliga Tekniska Högskolan
 .\ (Royal Institute of Technology, Stockholm, Sweden). 
@@ -55,72 +55,43 @@
 is a program for managing keytabs.
 Supported options:
 .Bl -tag -width Ds
-.It Xo
-.Fl v ,
-.Fl -verbose
-.Xc
+.It Fl v , Fl -verbose
 Verbose output.
 .El
 .Pp
 .Ar command
 can be one of the following:
 .Bl -tag -width srvconvert
-.It add Xo
-.Op Fl p Ar principal
-.Op Fl -principal= Ns Ar principal
-.Op Fl V Ar kvno
-.Op Fl -kvno= Ns Ar kvno
-.Op Fl e Ar enctype
-.Op Fl -enctype= Ns Ar enctype
-.Op Fl w Ar password
-.Op Fl -password= Ns Ar password
-.Op Fl r
-.Op Fl -random
-.Op Fl s
-.Op Fl -no-salt
-.Op Fl H
-.Op Fl -hex
-.Xc
+.It add Oo Fl p Ar principal Oc Oo Fl -principal= Ns Ar principal Oc \
+Oo Fl V Ar kvno Oc Oo Fl -kvno= Ns Ar kvno Oc Oo Fl e Ar enctype Oc \
+Oo Fl -enctype= Ns Ar enctype Oc Oo Fl w Ar password Oc \
+Oo Fl -password= Ns Ar password Oc Oo Fl r Oc Oo Fl -random Oc \
+Oo Fl s Oc Oo Fl -no-salt Oc Oo Fl H Oc Op Fl -hex
 Adds a key to the keytab. Options that are not specified will be
 prompted for. This requires that you know the password or the hex key of the
 principal to add; if what you really want is to add a new principal to
 the keytab, you should consider the
 .Ar get
 command, which talks to the kadmin server.
-.It change Xo
-.Op Fl r Ar realm
-.Op Fl -realm= Ns Ar realm
-.Op Fl -a Ar host
-.Op Fl -admin-server= Ns Ar host
-.Op Fl -s Ar port
-.Op Fl -server-port= Ns Ar port
-.Xc
+.It change Oo Fl r Ar realm Oc Oo Fl -realm= Ns Ar realm Oc \
+Oo Fl -a Ar host Oc Oo Fl -admin-server= Ns Ar host Oc \
+Oo Fl -s Ar port Oc Op Fl -server-port= Ns Ar port
 Update one or several keys to new versions.  By default, use the admin
 server for the realm of a keytab entry.  Otherwise it will use the
 values specified by the options.
 .Pp
 If no principals are given, all the ones in the keytab are updated.
-.It copy Xo
-.Ar keytab-src
-.Ar keytab-dest
-.Xc
+.It copy Ar keytab-src Ar 

CVS commit: src/tools/slc

2011-04-14 Thread Roland Dowdeswell
Module Name:src
Committed By:   elric
Date:   Thu Apr 14 19:38:21 UTC 2011

Added Files:
src/tools/slc: Makefile

Log Message:
Tool for slc, a command built during the Heimdal build.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/tools/slc/Makefile

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

Added files:

Index: src/tools/slc/Makefile
diff -u /dev/null src/tools/slc/Makefile:1.1
--- /dev/null	Thu Apr 14 19:38:21 2011
+++ src/tools/slc/Makefile	Thu Apr 14 19:38:21 2011
@@ -0,0 +1,6 @@
+#	$NetBSD: Makefile,v 1.1 2011/04/14 19:38:21 elric Exp $
+
+HOSTPROGNAME=	${_TOOL_PREFIX}slc
+HOST_SRCDIR=	crypto/external/bsd/heimdal/lib/libsl/slc
+
+.include ${.CURDIR}/../Makefile.host



CVS commit: src/sys/kern

2011-04-14 Thread Jean-Yves Migeon
Module Name:src
Committed By:   jym
Date:   Thu Apr 14 20:19:36 UTC 2011

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

Log Message:
Typo fix.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/kern/kern_condvar.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_condvar.c
diff -u src/sys/kern/kern_condvar.c:1.28 src/sys/kern/kern_condvar.c:1.29
--- src/sys/kern/kern_condvar.c:1.28	Sat Dec  5 22:38:19 2009
+++ src/sys/kern/kern_condvar.c	Thu Apr 14 20:19:35 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_condvar.c,v 1.28 2009/12/05 22:38:19 pooka Exp $	*/
+/*	$NetBSD: kern_condvar.c,v 1.29 2011/04/14 20:19:35 jym Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_condvar.c,v 1.28 2009/12/05 22:38:19 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_condvar.c,v 1.29 2011/04/14 20:19:35 jym Exp $);
 
 #include sys/param.h
 #include sys/proc.h
@@ -224,7 +224,7 @@
  *
  *	Wait on a condition variable until a awoken or a signal is received. 
  *	Will also return early if the process is exiting.  Returns zero if
- *	awoken normallly, ERESTART if a signal was received and the system
+ *	awoken normally, ERESTART if a signal was received and the system
  *	call is restartable, or EINTR otherwise.
  */
 int
@@ -265,7 +265,7 @@
  *
  *	Wait on a condition variable until a timeout expires, awoken or a
  *	signal is received.  Will also return early if the process is
- *	exiting.  Returns zero if awoken normallly, EWOULDBLOCK if the
+ *	exiting.  Returns zero if awoken normally, EWOULDBLOCK if the
  *	timeout expires, ERESTART if a signal was received and the system
  *	call is restartable, or EINTR otherwise.
  */



CVS commit: src/sys/netinet

2011-04-14 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Apr 14 20:32:05 UTC 2011

Modified Files:
src/sys/netinet: ip_input.c

Log Message:
In ipintr(), don't overwrite ipintrq.ifq_maxlen with IFQ_MAXLEN.

Initialize ipintrq.ifq_maxlen using IFQ_MAXLEN directly instead of using
the global ipqmaxlen.  Get rid of the global ipqmaxlen.

Now it works again to override the maximum IP queue length with, for
example, sysctl -w net.inet.ip.ifq.maxlen=5.


To generate a diff of this commit:
cvs rdiff -u -r1.293 -r1.294 src/sys/netinet/ip_input.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/netinet/ip_input.c
diff -u src/sys/netinet/ip_input.c:1.293 src/sys/netinet/ip_input.c:1.294
--- src/sys/netinet/ip_input.c:1.293	Mon Dec 13 14:18:50 2010
+++ src/sys/netinet/ip_input.c	Thu Apr 14 20:32:04 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_input.c,v 1.293 2010/12/13 14:18:50 matt Exp $	*/
+/*	$NetBSD: ip_input.c,v 1.294 2011/04/14 20:32:04 dyoung Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ip_input.c,v 1.293 2010/12/13 14:18:50 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: ip_input.c,v 1.294 2011/04/14 20:32:04 dyoung Exp $);
 
 #include opt_inet.h
 #include opt_compat_netbsd.h
@@ -221,7 +221,6 @@
 
 struct rttimer_queue *ip_mtudisc_timeout_q = NULL;
 
-int	ipqmaxlen = IFQ_MAXLEN;
 u_long	in_ifaddrhash;/* size of hash table - 1 */
 int	in_ifaddrentries;			/* total number of addrs */
 struct in_ifaddrhead in_ifaddrhead;
@@ -319,7 +318,7 @@
 	ip_ids = ip_id_init();
 	ip_id = time_second  0xf;
 
-	ipintrq.ifq_maxlen = ipqmaxlen;
+	ipintrq.ifq_maxlen = IFQ_MAXLEN;
 
 	TAILQ_INIT(in_ifaddrhead);
 	in_ifaddrhashtbl = hashinit(IN_IFADDR_HASH_SIZE, HASH_LIST, true,
@@ -366,7 +365,6 @@
 	struct ifqueue lcl_intrq;
 
 	memset(lcl_intrq, 0, sizeof(lcl_intrq));
-	ipintrq.ifq_maxlen = ipqmaxlen;
 
 	mutex_enter(softnet_lock);
 	KERNEL_LOCK(1, NULL);



CVS commit: src/external/gpl3/binutils/lib/libbfd/arch/x86_64

2011-04-14 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Apr 14 22:19:59 UTC 2011

Modified Files:
src/external/gpl3/binutils/lib/libbfd/arch/x86_64: bfd.h

Log Message:
Define bfd_mach_mips_xlr here to fix the build!


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 \
src/external/gpl3/binutils/lib/libbfd/arch/x86_64/bfd.h

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

Modified files:

Index: src/external/gpl3/binutils/lib/libbfd/arch/x86_64/bfd.h
diff -u src/external/gpl3/binutils/lib/libbfd/arch/x86_64/bfd.h:1.1 src/external/gpl3/binutils/lib/libbfd/arch/x86_64/bfd.h:1.2
--- src/external/gpl3/binutils/lib/libbfd/arch/x86_64/bfd.h:1.1	Tue Aug 18 20:22:02 2009
+++ src/external/gpl3/binutils/lib/libbfd/arch/x86_64/bfd.h	Thu Apr 14 22:19:58 2011
@@ -1799,6 +1799,7 @@
 #define bfd_mach_mips_loongson_2f  3002
 #define bfd_mach_mips_sb1  12310201 /* octal 'SB', 01 */
 #define bfd_mach_mips_octeon   6501
+#define bfd_mach_mips_xlr  887682   /* decimal 'XLR'  */
 #define bfd_mach_mipsisa32 32
 #define bfd_mach_mipsisa32r2   33
 #define bfd_mach_mipsisa64 64



CVS commit: src/sys/kern

2011-04-14 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Fri Apr 15 00:01:48 UTC 2011

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

Log Message:
sys__ksem_close: use fd_close().


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/kern/uipc_sem.c

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

Modified files:

Index: src/sys/kern/uipc_sem.c
diff -u src/sys/kern/uipc_sem.c:1.32 src/sys/kern/uipc_sem.c:1.33
--- src/sys/kern/uipc_sem.c:1.32	Thu Apr 14 00:32:23 2011
+++ src/sys/kern/uipc_sem.c	Fri Apr 15 00:01:48 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_sem.c,v 1.32 2011/04/14 00:32:23 rmind Exp $	*/
+/*	$NetBSD: uipc_sem.c,v 1.33 2011/04/15 00:01:48 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uipc_sem.c,v 1.32 2011/04/14 00:32:23 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: uipc_sem.c,v 1.33 2011/04/15 00:01:48 rmind Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -490,9 +490,12 @@
 	/* {
 		intptr_t id;
 	} */
-	struct sys_close_args cuap;
-	SCARG(cuap, fd) = SCARG(uap, id);
-	return sys_close(l, (const void *)cuap, retval);
+	int fd = (int)SCARG(uap, id);
+
+	if (fd_getfile(fd) == NULL) {
+		return EBADF;
+	}
+	return fd_close(fd);
 }
 
 static int



CVS commit: src/external/bsd/top/dist/machine

2011-04-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr 15 02:05:53 UTC 2011

Modified Files:
src/external/bsd/top/dist/machine: m_netbsd.c

Log Message:
Swap the command and the thread name in the thread view and let the command
be as long as it wants. (Vladimir Kirillov)


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/external/bsd/top/dist/machine/m_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/external/bsd/top/dist/machine/m_netbsd.c
diff -u src/external/bsd/top/dist/machine/m_netbsd.c:1.14 src/external/bsd/top/dist/machine/m_netbsd.c:1.15
--- src/external/bsd/top/dist/machine/m_netbsd.c:1.14	Mon May 31 14:14:59 2010
+++ src/external/bsd/top/dist/machine/m_netbsd.c	Thu Apr 14 22:05:53 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: m_netbsd.c,v 1.14 2010/05/31 18:14:59 rmind Exp $	*/
+/*	$NetBSD: m_netbsd.c,v 1.15 2011/04/15 02:05:53 christos Exp $	*/
 
 /*
  * top - a top users display for Unix
@@ -37,12 +37,12 @@
  *		Andrew Doran a...@netbsd.org
  *
  *
- * $Id: m_netbsd.c,v 1.14 2010/05/31 18:14:59 rmind Exp $
+ * $Id: m_netbsd.c,v 1.15 2011/04/15 02:05:53 christos Exp $
  */
 #include sys/cdefs.h
 
 #ifndef lint
-__RCSID($NetBSD: m_netbsd.c,v 1.14 2010/05/31 18:14:59 rmind Exp $);
+__RCSID($NetBSD: m_netbsd.c,v 1.15 2011/04/15 02:05:53 christos Exp $);
 #endif
 
 #include sys/param.h
@@ -105,14 +105,14 @@
 /* 0123456   -- field to fill in starts at header+6 */
 #define PROC_UNAME_START 6
 #define Proc_format \
-	%5d %-8.8s %3d %4d%7s %5s %-8.8s%7s %5.*f%% %5.*f%% %.12s
+	%5d %-8.8s %3d %4d%7s %5s %-8.8s%7s %5.*f%% %5.*f%% %s
 
 static char Thread_header[] =
-PID   LID XPRI STATE  TIME   WCPUCPU COMMAND  NAME;
+PID   LID XPRI STATE  TIME   WCPUCPU NAME  COMMAND;
 /* 0123456   -- field to fill in starts at header+6 */
 #define THREAD_UNAME_START 12
 #define Thread_format \
-%5d %5d %-8.8s %3d %-8.8s%7s %5.2f%% %5.2f%% %-12.12s %.12s
+%5d %5d %-8.8s %3d %-8.8s%7s %5.2f%% %5.2f%% %-9.9s %s
 
 /* 
  * Process state names for the STATE column of the display.
@@ -939,8 +939,8 @@
 	format_time(cputime),
 	100.0 * weighted_cpu(l_, pct, pl),
 	100.0 * pct,
-	get_command(hp-sel, pp),
-	printable(pl-l_name));
+	printable(pl-l_name),
+	get_command(hp-sel, pp));
 
 	/* return the result */
 	return(fmt);