CVS commit: src/sys/dev/i2c

2011-11-17 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu Nov 17 13:47:27 UTC 2011

Modified Files:
src/sys/dev/i2c: pic16lc.c

Log Message:
Fix last envsys2 conversion (1.10).  From Tetsuya Isaki in PR#45622.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/i2c/pic16lc.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/i2c/pic16lc.c
diff -u src/sys/dev/i2c/pic16lc.c:1.16 src/sys/dev/i2c/pic16lc.c:1.17
--- src/sys/dev/i2c/pic16lc.c:1.16	Mon Jun 20 20:16:19 2011
+++ src/sys/dev/i2c/pic16lc.c	Thu Nov 17 13:47:27 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: pic16lc.c,v 1.16 2011/06/20 20:16:19 pgoyette Exp $ */
+/* $NetBSD: pic16lc.c,v 1.17 2011/11/17 13:47:27 jakllsch Exp $ */
 
 /*-
  * Copyright (c) 2007, 2008 Jared D. McNeill jmcne...@invisible.ca
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pic16lc.c,v 1.16 2011/06/20 20:16:19 pgoyette Exp $);
+__KERNEL_RCSID(0, $NetBSD: pic16lc.c,v 1.17 2011/11/17 13:47:27 jakllsch Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -56,6 +56,10 @@ void		pic16lc_reboot(void);
 void		pic16lc_poweroff(void);
 void		pic16lc_setled(uint8_t);
 
+#define XBOX_SENSOR_CPU0
+#define XBOX_SENSOR_BOARD  1
+#define XBOX_NSENSORS  2
+
 struct pic16lc_softc {
 	device_t	sc_dev;
 
@@ -63,16 +67,12 @@ struct pic16lc_softc {
 	i2c_addr_t	sc_addr;
 	void *		sc_ih;
 
-	envsys_data_t sc_sensor[1];
+	envsys_data_t sc_sensor[XBOX_NSENSORS];
 	struct sysmon_envsys *sc_sme;
 };
 
 static struct pic16lc_softc *pic16lc = NULL;
 
-#define XBOX_SENSOR_CPU		0
-#define XBOX_SENSOR_BOARD	1
-#define XBOX_NSENSORS		2
-
 static void	pic16lc_update(struct pic16lc_softc *, envsys_data_t *);
 static void	pic16lc_refresh(struct sysmon_envsys *, envsys_data_t *);
 



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

2011-11-17 Thread VANHULLEBUS Yvan
Module Name:src
Committed By:   vanhu
Date:   Thu Nov 17 14:41:55 UTC 2011

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

Log Message:
fixed some crashes in LIST_FOREACH where current element could be removed 
during the loop


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/crypto/dist/ipsec-tools/src/racoon/handler.c

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

Modified files:

Index: src/crypto/dist/ipsec-tools/src/racoon/handler.c
diff -u src/crypto/dist/ipsec-tools/src/racoon/handler.c:1.39 src/crypto/dist/ipsec-tools/src/racoon/handler.c:1.40
--- src/crypto/dist/ipsec-tools/src/racoon/handler.c:1.39	Mon Mar 14 17:18:12 2011
+++ src/crypto/dist/ipsec-tools/src/racoon/handler.c	Thu Nov 17 14:41:55 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: handler.c,v 1.39 2011/03/14 17:18:12 tteras Exp $	*/
+/*	$NetBSD: handler.c,v 1.40 2011/11/17 14:41:55 vanhu Exp $	*/
 
 /* Id: handler.c,v 1.28 2006/05/26 12:17:29 manubsd Exp */
 
@@ -611,9 +611,11 @@ getph2byid(src, dst, spid)
 	struct sockaddr *src, *dst;
 	u_int32_t spid;
 {
-	struct ph2handle *p;
+	struct ph2handle *p, *next;
+
+	for (p = LIST_FIRST(ph2tree); p; p = next) {
+		next = LIST_NEXT(p, chain);
 
-	LIST_FOREACH(p, ph2tree, chain) {
 		if (spid == p-spid 
 		cmpsaddr(src, p-src) = CMPSADDR_WILDPORT_MATCH 
 		cmpsaddr(dst, p-dst) = CMPSADDR_WILDPORT_MATCH){
@@ -985,9 +987,11 @@ void
 remcontacted(remote)
 	struct sockaddr *remote;
 {
-	struct contacted *p;
+	struct contacted *p, *next;
+
+	for (p = LIST_FIRST(ctdtree); p; p = next) {
+		next = LIST_NEXT(p, chain);
 
-	LIST_FOREACH(p, ctdtree, chain) {
 		if (cmpsaddr(remote, p-remote) = CMPSADDR_WILDPORT_MATCH) {
 			LIST_REMOVE(p, chain);
 			racoon_free(p-remote);
@@ -1555,10 +1559,12 @@ int
 purgeph1bylogin(login)
 	char *login;
 {
-	struct ph1handle *p;
+	struct ph1handle *p, *next;
 	int found = 0;
 
-	LIST_FOREACH(p, ph1tree, chain) {
+	for (p = LIST_FIRST(ph1tree); p; p = next) {
+		next = LIST_NEXT(p, chain);
+
 		if (p-mode_cfg == NULL)
 			continue;
 		if (strncmp(p-mode_cfg-login, login, LOGINLEN) == 0) {



CVS commit: [ipsec-tools-0_8-branch] src/crypto/dist/ipsec-tools/src/racoon

2011-11-17 Thread VANHULLEBUS Yvan
Module Name:src
Committed By:   vanhu
Date:   Thu Nov 17 14:46:31 UTC 2011

Modified Files:
src/crypto/dist/ipsec-tools/src/racoon [ipsec-tools-0_8-branch]:
handler.c

Log Message:
fixed some crashes in LIST_FOREACH where current element could be removed 
during the loop


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.39.2.1 \
src/crypto/dist/ipsec-tools/src/racoon/handler.c

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

Modified files:

Index: src/crypto/dist/ipsec-tools/src/racoon/handler.c
diff -u src/crypto/dist/ipsec-tools/src/racoon/handler.c:1.39 src/crypto/dist/ipsec-tools/src/racoon/handler.c:1.39.2.1
--- src/crypto/dist/ipsec-tools/src/racoon/handler.c:1.39	Mon Mar 14 17:18:12 2011
+++ src/crypto/dist/ipsec-tools/src/racoon/handler.c	Thu Nov 17 14:46:31 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: handler.c,v 1.39 2011/03/14 17:18:12 tteras Exp $	*/
+/*	$NetBSD: handler.c,v 1.39.2.1 2011/11/17 14:46:31 vanhu Exp $	*/
 
 /* Id: handler.c,v 1.28 2006/05/26 12:17:29 manubsd Exp */
 
@@ -611,9 +611,11 @@ getph2byid(src, dst, spid)
 	struct sockaddr *src, *dst;
 	u_int32_t spid;
 {
-	struct ph2handle *p;
+	struct ph2handle *p, *next;
+
+	for (p = LIST_FIRST(ph2tree); p; p = next) {
+		next = LIST_NEXT(p, chain);
 
-	LIST_FOREACH(p, ph2tree, chain) {
 		if (spid == p-spid 
 		cmpsaddr(src, p-src) = CMPSADDR_WILDPORT_MATCH 
 		cmpsaddr(dst, p-dst) = CMPSADDR_WILDPORT_MATCH){
@@ -985,9 +987,11 @@ void
 remcontacted(remote)
 	struct sockaddr *remote;
 {
-	struct contacted *p;
+	struct contacted *p, *next;
+
+	for (p = LIST_FIRST(ctdtree); p; p = next) {
+		next = LIST_NEXT(p, chain);
 
-	LIST_FOREACH(p, ctdtree, chain) {
 		if (cmpsaddr(remote, p-remote) = CMPSADDR_WILDPORT_MATCH) {
 			LIST_REMOVE(p, chain);
 			racoon_free(p-remote);
@@ -1555,10 +1559,12 @@ int
 purgeph1bylogin(login)
 	char *login;
 {
-	struct ph1handle *p;
+	struct ph1handle *p, *next;
 	int found = 0;
 
-	LIST_FOREACH(p, ph1tree, chain) {
+	for (p = LIST_FIRST(ph1tree); p; p = next) {
+		next = LIST_NEXT(p, chain);
+
 		if (p-mode_cfg == NULL)
 			continue;
 		if (strncmp(p-mode_cfg-login, login, LOGINLEN) == 0) {



CVS commit: src/sys/arch/arm/arm32

2011-11-17 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Nov 17 15:02:22 UTC 2011

Modified Files:
src/sys/arch/arm/arm32: sys_machdep.c

Log Message:
Don't return ENOSYS if nothing needs to be done for the CPU.

XXX Shouldn't this be a runtime test on the CPU?


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/arm32/sys_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/arm/arm32/sys_machdep.c
diff -u src/sys/arch/arm/arm32/sys_machdep.c:1.13 src/sys/arch/arm/arm32/sys_machdep.c:1.14
--- src/sys/arch/arm/arm32/sys_machdep.c:1.13	Thu Jun 30 20:09:20 2011
+++ src/sys/arch/arm/arm32/sys_machdep.c	Thu Nov 17 15:02:22 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_machdep.c,v 1.13 2011/06/30 20:09:20 wiz Exp $	*/
+/*	$NetBSD: sys_machdep.c,v 1.14 2011/11/17 15:02:22 joerg Exp $	*/
 
 /*
  * Copyright (c) 1995-1997 Mark Brinicombe.
@@ -41,7 +41,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: sys_machdep.c,v 1.13 2011/06/30 20:09:20 wiz Exp $);
+__KERNEL_RCSID(0, $NetBSD: sys_machdep.c,v 1.14 2011/11/17 15:02:22 joerg Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -122,6 +122,6 @@ cpu_lwp_setprivate(lwp_t *l, void *addr)
 	}
 	return 0;
 #else
-	return ENOSYS;
+	return 0;
 #endif
 }



CVS commit: src/sys/dev/i2c

2011-11-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov 17 16:04:07 UTC 2011

Modified Files:
src/sys/dev/i2c: pic16lc.c

Log Message:
tidy up.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/i2c/pic16lc.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/i2c/pic16lc.c
diff -u src/sys/dev/i2c/pic16lc.c:1.17 src/sys/dev/i2c/pic16lc.c:1.18
--- src/sys/dev/i2c/pic16lc.c:1.17	Thu Nov 17 08:47:27 2011
+++ src/sys/dev/i2c/pic16lc.c	Thu Nov 17 11:04:07 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: pic16lc.c,v 1.17 2011/11/17 13:47:27 jakllsch Exp $ */
+/* $NetBSD: pic16lc.c,v 1.18 2011/11/17 16:04:07 christos Exp $ */
 
 /*-
  * Copyright (c) 2007, 2008 Jared D. McNeill jmcne...@invisible.ca
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pic16lc.c,v 1.17 2011/11/17 13:47:27 jakllsch Exp $);
+__KERNEL_RCSID(0, $NetBSD: pic16lc.c,v 1.18 2011/11/17 16:04:07 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -56,9 +56,9 @@ void		pic16lc_reboot(void);
 void		pic16lc_poweroff(void);
 void		pic16lc_setled(uint8_t);
 
-#define XBOX_SENSOR_CPU0
-#define XBOX_SENSOR_BOARD  1
-#define XBOX_NSENSORS  2
+#define	XBOX_SENSOR_CPU		0
+#define	XBOX_SENSOR_BOARD	1
+#define	XBOX_NSENSORS		2
 
 struct pic16lc_softc {
 	device_t	sc_dev;
@@ -188,22 +188,28 @@ pic16lc_read_1(struct pic16lc_softc *sc,
 static void
 pic16lc_update(struct pic16lc_softc *sc, envsys_data_t *edata)
 {
-	uint8_t cputemp, boardtemp;
+	uint8_t temp, sensor;
+
+	switch (edata-sensor) {
+	case XBOX_SENSOR_CPU:
+		sensor = PIC16LC_REG_CPUTEMP;
+		break;
+	case XBOX_SENSOR_BOARD:
+		sensor = PIC16LC_REG_BOARDTEMP;
+		break;
+	default:
+		aprint_error(: invalid sensor %u\n, edata-sensor);
+		return;
+	}
 
 	if (iic_acquire_bus(sc-sc_tag, 0) != 0) {
 		aprint_error(: unable to acquire i2c bus\n);
 		return;
 	}
 
-	if (edata-sensor == XBOX_SENSOR_CPU) {
-		pic16lc_read_1(sc, PIC16LC_REG_CPUTEMP, cputemp);
-		edata-state = ENVSYS_SVALID;
-		edata-value_cur = (int)cputemp * 100 + 27315;
-	} else {
-		pic16lc_read_1(sc, PIC16LC_REG_BOARDTEMP, boardtemp);
-		edata-state = ENVSYS_SVALID;
-		edata-value_cur = (int)boardtemp * 100 + 27315;
-	}
+	pic16lc_read_1(sc, sensor, temp);
+	edata-state = ENVSYS_SVALID;
+	edata-value_cur = (unsigned int)temp * 100 + 27315;
 
 	iic_release_bus(sc-sc_tag, 0);
 



CVS commit: src

2011-11-17 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Nov 17 16:20:11 UTC 2011

Modified Files:
src/libexec/ld.elf_so: rtld.c
src/tests/lib/libc/tls: t_tls_dlopen.c t_tls_dynamic.c
src/tests/lib/libc/tls/dso: h_tls_dlopen.c
src/tests/lib/libc/tls_dso: h_tls_dynamic.c

Log Message:
FreeBSD bug report 161344: TLS area for the main thread is set up to
early, if e.g. pointers to functions are used as initializers.


To generate a diff of this commit:
cvs rdiff -u -r1.153 -r1.154 src/libexec/ld.elf_so/rtld.c
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/tls/t_tls_dlopen.c \
src/tests/lib/libc/tls/t_tls_dynamic.c
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/tls/dso/h_tls_dlopen.c
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/tls_dso/h_tls_dynamic.c

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

Modified files:

Index: src/libexec/ld.elf_so/rtld.c
diff -u src/libexec/ld.elf_so/rtld.c:1.153 src/libexec/ld.elf_so/rtld.c:1.154
--- src/libexec/ld.elf_so/rtld.c:1.153	Sun Oct 23 21:06:07 2011
+++ src/libexec/ld.elf_so/rtld.c	Thu Nov 17 16:20:11 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtld.c,v 1.153 2011/10/23 21:06:07 christos Exp $	 */
+/*	$NetBSD: rtld.c,v 1.154 2011/11/17 16:20:11 joerg Exp $	 */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -40,7 +40,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: rtld.c,v 1.153 2011/10/23 21:06:07 christos Exp $);
+__RCSID($NetBSD: rtld.c,v 1.154 2011/11/17 16:20:11 joerg Exp $);
 #endif /* not lint */
 
 #include sys/param.h
@@ -642,13 +642,12 @@ _rtld(Elf_Addr *sp, Elf_Addr relocbase)
 	}
 
 #if defined(__HAVE_TLS_VARIANT_I) || defined(__HAVE_TLS_VARIANT_II)
-	dbg((initializing initial Thread Local Storage));
+	dbg((initializing initial Thread Local Storage offsets));
 	/*
 	 * All initial objects get the TLS space from the static block.
 	 */
 	for (obj = _rtld_objlist; obj != NULL; obj = obj-next)
 		_rtld_tls_offset_allocate(obj);
-	_rtld_tls_initial_allocation();
 #endif
 
 	dbg((relocating objects));
@@ -659,6 +658,16 @@ _rtld(Elf_Addr *sp, Elf_Addr relocbase)
 	if (_rtld_do_copy_relocations(_rtld_objmain) == -1)
 		_rtld_die();
 
+#if defined(__HAVE_TLS_VARIANT_I) || defined(__HAVE_TLS_VARIANT_II)
+	dbg((initializing Thread Local Storage for main thread));
+	/*
+	 * Set up TLS area for the main thread.
+	 * This has to be done after all relocations are processed,
+	 * since .tdata may contain relocations.
+	 */
+	_rtld_tls_initial_allocation();
+#endif
+
 	/*
 	 * Set the __progname,  environ and, __mainprog_obj before
 	 * calling anything that might use them.

Index: src/tests/lib/libc/tls/t_tls_dlopen.c
diff -u src/tests/lib/libc/tls/t_tls_dlopen.c:1.1 src/tests/lib/libc/tls/t_tls_dlopen.c:1.2
--- src/tests/lib/libc/tls/t_tls_dlopen.c:1.1	Wed Mar  9 23:10:07 2011
+++ src/tests/lib/libc/tls/t_tls_dlopen.c	Thu Nov 17 16:20:11 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_tls_dlopen.c,v 1.1 2011/03/09 23:10:07 joerg Exp $	*/
+/*	$NetBSD: t_tls_dlopen.c,v 1.2 2011/11/17 16:20:11 joerg Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -32,11 +32,12 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: t_tls_dlopen.c,v 1.1 2011/03/09 23:10:07 joerg Exp $);
+__RCSID($NetBSD: t_tls_dlopen.c,v 1.2 2011/11/17 16:20:11 joerg Exp $);
 
 #include atf-c.h
 #include dlfcn.h
 #include pthread.h
+#include unistd.h
 
 #include sys/tls.h
 
@@ -56,18 +57,24 @@ void (*testf_helper)(int, int);
 
 __thread int var1 = 1;
 __thread int var2;
+__thread int *var3 = optind;
+int var4_helper;
+__thread int *var4 = var4_helper;
 
 static void *
 testf(void *dummy)
 {
 	ATF_CHECK_EQ(var1, 1);
 	ATF_CHECK_EQ(var2, 0);
+	ATF_CHECK_EQ(var3, optind);
+	ATF_CHECK_EQ(var4, var4_helper);
 	testf_helper(2, 2);
 	ATF_CHECK_EQ(var1, 2);
 	ATF_CHECK_EQ(var2, 2);
 	testf_helper(3, 3);
 	ATF_CHECK_EQ(var1, 3);
 	ATF_CHECK_EQ(var2, 3);
+	ATF_CHECK_EQ(var3, optind);
 
 	return NULL;
 }
Index: src/tests/lib/libc/tls/t_tls_dynamic.c
diff -u src/tests/lib/libc/tls/t_tls_dynamic.c:1.1 src/tests/lib/libc/tls/t_tls_dynamic.c:1.2
--- src/tests/lib/libc/tls/t_tls_dynamic.c:1.1	Wed Mar  9 23:10:07 2011
+++ src/tests/lib/libc/tls/t_tls_dynamic.c	Thu Nov 17 16:20:11 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_tls_dynamic.c,v 1.1 2011/03/09 23:10:07 joerg Exp $	*/
+/*	$NetBSD: t_tls_dynamic.c,v 1.2 2011/11/17 16:20:11 joerg Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -32,10 +32,11 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: t_tls_dynamic.c,v 1.1 2011/03/09 23:10:07 joerg Exp $);
+__RCSID($NetBSD: t_tls_dynamic.c,v 1.2 2011/11/17 16:20:11 joerg Exp $);
 
 #include atf-c.h
 #include pthread.h
+#include unistd.h
 
 #include sys/tls.h
 
@@ -55,6 +56,11 @@ void testf_dso_helper(int, int);
 
 extern __thread int var1;
 extern __thread int var2;
+extern __thread pid_t (*dso_var1)(void);
+
+__thread int *var3 = optind;
+int var4_helper;
+__thread int 

CVS commit: src/sbin

2011-11-17 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Nov 17 16:20:47 UTC 2011

Modified Files:
src/sbin/iscsictl: iscsic_globals.h iscsic_main.c
src/sbin/iscsid: iscsid_globals.h

Log Message:
Use __dead


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sbin/iscsictl/iscsic_globals.h \
src/sbin/iscsictl/iscsic_main.c
cvs rdiff -u -r1.2 -r1.3 src/sbin/iscsid/iscsid_globals.h

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

Modified files:

Index: src/sbin/iscsictl/iscsic_globals.h
diff -u src/sbin/iscsictl/iscsic_globals.h:1.3 src/sbin/iscsictl/iscsic_globals.h:1.4
--- src/sbin/iscsictl/iscsic_globals.h:1.3	Sun Oct 30 18:40:06 2011
+++ src/sbin/iscsictl/iscsic_globals.h	Thu Nov 17 16:20:47 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: iscsic_globals.h,v 1.3 2011/10/30 18:40:06 christos Exp $	*/
+/*	$NetBSD: iscsic_globals.h,v 1.4 2011/11/17 16:20:47 joerg Exp $	*/
 
 /*-
  * Copyright (c) 2005,2006,2011 The NetBSD Foundation, Inc.
@@ -152,13 +152,13 @@ ntohq(uint64_t x)
 
 /* iscsic_main.c */
 
-void arg_error(char *, const char *, ...) __printflike(2, 3);
-void arg_missing(const char *);
-void io_error(const char *, ...) __printflike(1, 2);
-void gen_error(const char *, ...) __printflike(1, 2);
+void arg_error(char *, const char *, ...) __printflike(2, 3) __dead;
+void arg_missing(const char *) __dead;
+void io_error(const char *, ...) __printflike(1, 2) __dead;
+void gen_error(const char *, ...) __printflike(1, 2) __dead;
 void check_extra_args(int, char **);
-void status_error(unsigned);
-void status_error_slist(unsigned);
+void status_error(unsigned) __dead;
+void status_error_slist(unsigned) __dead;
 
 void send_request(unsigned, size_t, void *);
 iscsid_response_t *get_response(int);
Index: src/sbin/iscsictl/iscsic_main.c
diff -u src/sbin/iscsictl/iscsic_main.c:1.3 src/sbin/iscsictl/iscsic_main.c:1.4
--- src/sbin/iscsictl/iscsic_main.c:1.3	Sun Oct 30 18:40:06 2011
+++ src/sbin/iscsictl/iscsic_main.c	Thu Nov 17 16:20:47 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: iscsic_main.c,v 1.3 2011/10/30 18:40:06 christos Exp $	*/
+/*	$NetBSD: iscsic_main.c,v 1.4 2011/11/17 16:20:47 joerg Exp $	*/
 
 /*-
  * Copyright (c) 2005,2006,2011 The NetBSD Foundation, Inc.
@@ -219,7 +219,7 @@ int debug_level = ISCSI_DEBUG;			/* How 
  *Cleanup and exit. Does not return.
 */
 
-static void
+__dead static void
 bye(void)
 {
 	close(sock);

Index: src/sbin/iscsid/iscsid_globals.h
diff -u src/sbin/iscsid/iscsid_globals.h:1.2 src/sbin/iscsid/iscsid_globals.h:1.3
--- src/sbin/iscsid/iscsid_globals.h:1.2	Sat Oct 29 16:54:49 2011
+++ src/sbin/iscsid/iscsid_globals.h	Thu Nov 17 16:20:47 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: iscsid_globals.h,v 1.2 2011/10/29 16:54:49 christos Exp $	*/
+/*	$NetBSD: iscsid_globals.h,v 1.3 2011/11/17 16:20:47 joerg Exp $	*/
 
 /*-
  * Copyright (c) 2005,2006,2011 The NetBSD Foundation, Inc.
@@ -418,7 +418,7 @@ int debug_level;/* How much info to 
 /* iscsid_main.c */
 
 iscsid_response_t *make_rsp(size_t, iscsid_response_t **, int *);
-void exit_daemon(void);
+void exit_daemon(void) __dead;
 
 /* iscsid_lists.c */
 



CVS commit: src/external/bsd/tre/dist/src

2011-11-17 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Nov 17 16:21:08 UTC 2011

Modified Files:
src/external/bsd/tre/dist/src: agrep.c

Log Message:
Use __dead


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/tre/dist/src/agrep.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/tre/dist/src/agrep.c
diff -u src/external/bsd/tre/dist/src/agrep.c:1.1.1.1 src/external/bsd/tre/dist/src/agrep.c:1.2
--- src/external/bsd/tre/dist/src/agrep.c:1.1.1.1	Thu Feb 25 07:33:19 2010
+++ src/external/bsd/tre/dist/src/agrep.c	Thu Nov 17 16:21:08 2011
@@ -88,7 +88,7 @@ static struct option const long_options[
 };
 #endif /* HAVE_GETOPT_LONG */
 
-static void
+__dead static void
 tre_agrep_usage(int status)
 {
   if (status != 0)



CVS commit: src/tests/lib/libc/tls/dso

2011-11-17 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Nov 17 16:39:12 UTC 2011

Modified Files:
src/tests/lib/libc/tls/dso: h_tls_dlopen.c

Log Message:
Reorder to make GCC happy.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/tls/dso/h_tls_dlopen.c

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

Modified files:

Index: src/tests/lib/libc/tls/dso/h_tls_dlopen.c
diff -u src/tests/lib/libc/tls/dso/h_tls_dlopen.c:1.2 src/tests/lib/libc/tls/dso/h_tls_dlopen.c:1.3
--- src/tests/lib/libc/tls/dso/h_tls_dlopen.c:1.2	Thu Nov 17 16:20:11 2011
+++ src/tests/lib/libc/tls/dso/h_tls_dlopen.c	Thu Nov 17 16:39:11 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: h_tls_dlopen.c,v 1.2 2011/11/17 16:20:11 joerg Exp $	*/
+/*	$NetBSD: h_tls_dlopen.c,v 1.3 2011/11/17 16:39:11 joerg Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: h_tls_dlopen.c,v 1.2 2011/11/17 16:20:11 joerg Exp $);
+__RCSID($NetBSD: h_tls_dlopen.c,v 1.3 2011/11/17 16:39:11 joerg Exp $);
 
 #include atf-c.h
 #include unistd.h
@@ -45,7 +45,7 @@ __RCSID($NetBSD: h_tls_dlopen.c,v 1.2 2
 extern __thread int var1;
 extern __thread int var2;
 extern __thread int *var3;
-__thread static pid_t (*local_var)(void) = getpid;
+static __thread pid_t (*local_var)(void) = getpid;
 
 void testf_dso_helper(int x, int y);
 



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

2011-11-17 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Thu Nov 17 20:04:25 UTC 2011

Modified Files:
src/sys/arch/x86/pci: ichlpcib.c

Log Message:
Also match ICH8, ICH9 and ICH10 devices.  Tested on ICH10.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/x86/pci/ichlpcib.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/pci/ichlpcib.c
diff -u src/sys/arch/x86/pci/ichlpcib.c:1.33 src/sys/arch/x86/pci/ichlpcib.c:1.34
--- src/sys/arch/x86/pci/ichlpcib.c:1.33	Sun Aug 14 12:42:19 2011
+++ src/sys/arch/x86/pci/ichlpcib.c	Thu Nov 17 20:04:25 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ichlpcib.c,v 1.33 2011/08/14 12:42:19 msaitoh Exp $	*/
+/*	$NetBSD: ichlpcib.c,v 1.34 2011/11/17 20:04:25 riz Exp $	*/
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ichlpcib.c,v 1.33 2011/08/14 12:42:19 msaitoh Exp $);
+__KERNEL_RCSID(0, $NetBSD: ichlpcib.c,v 1.34 2011/11/17 20:04:25 riz Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -212,6 +212,21 @@ static struct lpcib_device {
 	{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_QM67_LPC, 1, 0 }, 
 	{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_QS67_LPC, 1, 0 }, 
 	{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_UM67_LPC, 1, 0 }, 
+	{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801H_LPC, 1, 0 }, 
+	{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801HEM_LPC, 1, 0 }, 
+	{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801HH_LPC, 1, 0 }, 
+	{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801HO_LPC, 1, 0 }, 
+	{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801HBM_LPC, 1, 0 }, 
+	{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801IH_LPC, 1, 0 }, 
+	{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801IO_LPC, 1, 0 }, 
+	{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801IR_LPC, 1, 0 }, 
+	{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801IEM_LPC, 1, 0 }, 
+	{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801IB_LPC, 1, 0 }, 
+	{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801IM_LPC, 1, 0 }, 
+	{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JDO_LPC, 1, 0 }, 
+	{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JIR_LPC, 1, 0 }, 
+	{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JIB_LPC, 1, 0 }, 
+	{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JD_LPC, 1, 0 }, 
 
 	{ 0, 0, 0, 0 },
 };



CVS commit: src/libexec/httpd

2011-11-17 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Nov 17 22:09:12 UTC 2011

Modified Files:
src/libexec/httpd: bozohttpd.8 bozohttpd.c main.c

Log Message:
allow the -I option to be useful in non-daemon mode, by letting it force
the returned port number


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/libexec/httpd/bozohttpd.8
cvs rdiff -u -r1.28 -r1.29 src/libexec/httpd/bozohttpd.c
cvs rdiff -u -r1.3 -r1.4 src/libexec/httpd/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/libexec/httpd/bozohttpd.8
diff -u src/libexec/httpd/bozohttpd.8:1.29 src/libexec/httpd/bozohttpd.8:1.30
--- src/libexec/httpd/bozohttpd.8:1.29	Sun Apr 24 07:18:59 2011
+++ src/libexec/httpd/bozohttpd.8	Thu Nov 17 22:09:12 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: bozohttpd.8,v 1.29 2011/04/24 07:18:59 jmmv Exp $
+.\	$NetBSD: bozohttpd.8,v 1.30 2011/11/17 22:09:12 mrg Exp $
 .\
 .\	$eterna: bozohttpd.8,v 1.99 2010/09/20 22:26:28 mrg Exp $
 .\
@@ -135,14 +135,18 @@ Also see
 .Fl X .
 .It Fl I Ar port
 Causes
+.Nm
+to use
 .Ar port
-to use used as the port to bind daemon mode.
-The default is the
+instead of the default
 .Dq http
 port.
-This option is only valid with the
+When used with the
 .Fl b
-option.
+option, it changes the bound port.
+Otherwise it forces redirections to use this port instead of the
+value obtained via
+.Xr getsockname 2 .
 .It Fl i Ar address
 Causes
 .Ar address

Index: src/libexec/httpd/bozohttpd.c
diff -u src/libexec/httpd/bozohttpd.c:1.28 src/libexec/httpd/bozohttpd.c:1.29
--- src/libexec/httpd/bozohttpd.c:1.28	Sat Aug 27 15:33:59 2011
+++ src/libexec/httpd/bozohttpd.c	Thu Nov 17 22:09:12 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: bozohttpd.c,v 1.28 2011/08/27 15:33:59 joerg Exp $	*/
+/*	$NetBSD: bozohttpd.c,v 1.29 2011/11/17 22:09:12 mrg Exp $	*/
 
 /*	$eterna: bozohttpd.c,v 1.176 2010/09/20 22:26:28 mrg Exp $	*/
 
@@ -563,14 +563,26 @@ bozo_read_request(bozohttpd_t *httpd)
 	if (addr != NULL)
 		request-hr_remoteaddr = bozostrdup(request-hr_httpd, addr);
 	slen = sizeof(ss);
-	if (getsockname(0, (struct sockaddr *)(void *)ss, slen)  0)
-		port = NULL;
-	else {
-		if (getnameinfo((struct sockaddr *)(void *)ss, slen, NULL, 0,
-bufport, sizeof bufport, NI_NUMERICSERV) == 0)
-			port = bufport;
+
+	/*
+	 * Override the bound port from the request value, so it works even
+	 * if passed through a proxy that doesn't rewrite the port.
+	 */
+	if (httpd-bindport) {
+		if (strcmp(httpd-bindport, 80) != 0)
+			port = httpd-bindport;
 		else
 			port = NULL;
+	} else {
+		if (getsockname(0, (struct sockaddr *)(void *)ss, slen)  0)
+			port = NULL;
+		else {
+			if (getnameinfo((struct sockaddr *)(void *)ss, slen, NULL, 0,
+	bufport, sizeof bufport, NI_NUMERICSERV) == 0)
+port = bufport;
+			else
+port = NULL;
+		}
 	}
 	if (port != NULL)
 		request-hr_serverport = bozostrdup(request-hr_httpd, port);

Index: src/libexec/httpd/main.c
diff -u src/libexec/httpd/main.c:1.3 src/libexec/httpd/main.c:1.4
--- src/libexec/httpd/main.c:1.3	Sat Aug 27 15:33:59 2011
+++ src/libexec/httpd/main.c	Thu Nov 17 22:09:12 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.3 2011/08/27 15:33:59 joerg Exp $	*/
+/*	$NetBSD: main.c,v 1.4 2011/11/17 22:09:12 mrg Exp $	*/
 
 /*	$eterna: main.c,v 1.4 2010/07/11 00:34:28 mrg Exp $	*/
 /* from: eterna: bozohttpd.c,v 1.159 2009/05/23 02:14:30 mrg Exp 	*/
@@ -198,12 +198,15 @@ main(int argc, char **argv)
 			bozo_set_pref(prefs, index.html, optarg);
 			break;
 
+		case 'I':
+			bozo_set_pref(prefs, port number, optarg);
+			break;
+
 #ifdef NO_DAEMON_MODE
 		case 'b':
 		case 'e':
 		case 'f':
 		case 'i':
-		case 'I':
 		case 'P':
 			bozo_err(httpd, 1, Daemon mode is not enabled);
 			/* NOTREACHED */
@@ -233,9 +236,6 @@ main(int argc, char **argv)
 			bozo_set_pref(prefs, bind address, optarg);
 			break;
 
-		case 'I':
-			bozo_set_pref(prefs, port number, optarg);
-			break;
 		case 'P':
 			bozo_set_pref(prefs, pid file, optarg);
 			break;



CVS commit: src/libexec/httpd

2011-11-17 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Nov 17 23:19:30 UTC 2011

Modified Files:
src/libexec/httpd: bozohttpd.8

Log Message:
Bump date for previous.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/libexec/httpd/bozohttpd.8

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

Modified files:

Index: src/libexec/httpd/bozohttpd.8
diff -u src/libexec/httpd/bozohttpd.8:1.30 src/libexec/httpd/bozohttpd.8:1.31
--- src/libexec/httpd/bozohttpd.8:1.30	Thu Nov 17 22:09:12 2011
+++ src/libexec/httpd/bozohttpd.8	Thu Nov 17 23:19:30 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: bozohttpd.8,v 1.30 2011/11/17 22:09:12 mrg Exp $
+.\	$NetBSD: bozohttpd.8,v 1.31 2011/11/17 23:19:30 wiz Exp $
 .\
 .\	$eterna: bozohttpd.8,v 1.99 2010/09/20 22:26:28 mrg Exp $
 .\
@@ -26,7 +26,7 @@
 .\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\ SUCH DAMAGE.
 .\
-.Dd April 24, 2011
+.Dd November 17, 2011
 .Dt HTTPD 8
 .Os
 .Sh NAME



CVS commit: src/lib/libm/man

2011-11-17 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Nov 17 23:46:33 UTC 2011

Modified Files:
src/lib/libm/man: tanh.3

Log Message:
Fix a lint warning noted by njoly.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/lib/libm/man/tanh.3

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

Modified files:

Index: src/lib/libm/man/tanh.3
diff -u src/lib/libm/man/tanh.3:1.14 src/lib/libm/man/tanh.3:1.15
--- src/lib/libm/man/tanh.3:1.14	Sun Sep 18 05:33:14 2011
+++ src/lib/libm/man/tanh.3	Thu Nov 17 23:46:32 2011
@@ -26,7 +26,7 @@
 .\ SUCH DAMAGE.
 .\
 .\ from: @(#)tanh.3	5.1 (Berkeley) 5/2/91
-.\	$NetBSD: tanh.3,v 1.14 2011/09/18 05:33:14 jruoho Exp $
+.\	$NetBSD: tanh.3,v 1.15 2011/11/17 23:46:32 wiz Exp $
 .\
 .Dd September 18, 2011
 .Dt TANH 3
@@ -60,7 +60,7 @@ The following may also occur:
 .It
 If
 .Fa x
-is \*(Pm\* 0,
+is \*(Pm 0,
 .Fa x
 is returned.
 .It



CVS commit: [yamt-pagecache] src/sys/arch/x86

2011-11-17 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Fri Nov 18 00:51:29 UTC 2011

Modified Files:
src/sys/arch/x86/include [yamt-pagecache]: pmap.h
src/sys/arch/x86/x86 [yamt-pagecache]: pmap.c

Log Message:
share a lock among pmap uobjs


To generate a diff of this commit:
cvs rdiff -u -r1.43.2.1 -r1.43.2.2 src/sys/arch/x86/include/pmap.h
cvs rdiff -u -r1.137.2.3 -r1.137.2.4 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/include/pmap.h
diff -u src/sys/arch/x86/include/pmap.h:1.43.2.1 src/sys/arch/x86/include/pmap.h:1.43.2.2
--- src/sys/arch/x86/include/pmap.h:1.43.2.1	Thu Nov 10 14:31:43 2011
+++ src/sys/arch/x86/include/pmap.h	Fri Nov 18 00:51:28 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.43.2.1 2011/11/10 14:31:43 yamt Exp $	*/
+/*	$NetBSD: pmap.h,v 1.43.2.2 2011/11/18 00:51:28 yamt Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -130,9 +130,7 @@ extern kmutex_t pmaps_lock;/* protec
  * note that the pm_obj contains the lock pointer, the reference count,
  * page list, and number of PTPs within the pmap.
  *
- * pm_lock is the same as the lock for vm object 0.  Changes to
- * the other objects may only be made if that lock has been taken
- * (the other object locks are only used when uvm_pagealloc is called)
+ * pm_lock is shared among vm objects.
  *
  * XXX If we ever support processor numbers higher than 31, we'll have
  * XXX to rethink the CPU mask.
@@ -140,8 +138,7 @@ extern kmutex_t pmaps_lock;/* protec
 
 struct pmap {
 	struct uvm_object pm_obj[PTP_LEVELS-1]; /* objects for lvl = 1) */
-#define	pm_lock	pm_obj[0].vmobjlock
-	kmutex_t pm_obj_lock[PTP_LEVELS-1];	/* locks for pm_objs */
+	kmutex_t pm_lock[1];		/* lock for pm_objs */
 	LIST_ENTRY(pmap) pm_list;	/* list (lck by pm_list lock) */
 	pd_entry_t *pm_pdir;		/* VA of PD (lck by object lock) */
 	paddr_t pm_pdirpa[PDP_SIZE];	/* PA of PDs (read-only after create) */

Index: src/sys/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.137.2.3 src/sys/arch/x86/x86/pmap.c:1.137.2.4
--- src/sys/arch/x86/x86/pmap.c:1.137.2.3	Thu Nov 10 14:32:36 2011
+++ src/sys/arch/x86/x86/pmap.c	Fri Nov 18 00:51:28 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.137.2.3 2011/11/10 14:32:36 yamt Exp $	*/
+/*	$NetBSD: pmap.c,v 1.137.2.4 2011/11/18 00:51:28 yamt Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
@@ -171,7 +171,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.137.2.3 2011/11/10 14:32:36 yamt Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.137.2.4 2011/11/18 00:51:28 yamt Exp $);
 
 #include opt_user_ldt.h
 #include opt_lockdebug.h
@@ -324,24 +324,6 @@ kmutex_t pmaps_lock;
 static vaddr_t pmap_maxkvaddr;
 
 /*
- * XXX kludge: dummy locking to make KASSERTs in uvm_page.c comfortable.
- * actual locking is done by pm_lock.
- */
-#if defined(DIAGNOSTIC)
-#define	PMAP_SUBOBJ_LOCK(pm, idx) \
-	KASSERT(mutex_owned((pm)-pm_lock)); \
-	if ((idx) != 0) \
-		mutex_enter((pm)-pm_obj[(idx)].vmobjlock)
-#define	PMAP_SUBOBJ_UNLOCK(pm, idx) \
-	KASSERT(mutex_owned((pm)-pm_lock)); \
-	if ((idx) != 0) \
-		mutex_exit((pm)-pm_obj[(idx)].vmobjlock)
-#else /* defined(DIAGNOSTIC) */
-#define	PMAP_SUBOBJ_LOCK(pm, idx)	/* nothing */
-#define	PMAP_SUBOBJ_UNLOCK(pm, idx)	/* nothing */
-#endif /* defined(DIAGNOSTIC) */
-
-/*
  * Misc. event counters.
  */
 struct evcnt pmap_iobmp_evcnt;
@@ -1224,10 +1206,10 @@ pmap_bootstrap(vaddr_t kva_start)
 	 */
 
 	kpm = pmap_kernel();
+	mutex_init(kpm-pm_lock, MUTEX_DEFAULT, IPL_NONE);
 	for (i = 0; i  PTP_LEVELS - 1; i++) {
-		mutex_init(kpm-pm_obj_lock[i], MUTEX_DEFAULT, IPL_NONE);
 		uvm_obj_init(kpm-pm_obj[i], NULL, false, 1);
-		uvm_obj_setlock(kpm-pm_obj[i], kpm-pm_obj_lock[i]);
+		uvm_obj_setlock(kpm-pm_obj[i], kpm-pm_lock);
 		kpm-pm_ptphint[i] = NULL;
 	}
 	memset(kpm-pm_list, 0, sizeof(kpm-pm_list));  /* pm_list not used */
@@ -1781,10 +1763,7 @@ pmap_find_ptp(struct pmap *pmap, vaddr_t
 	pa == VM_PAGE_TO_PHYS(pmap-pm_ptphint[lidx])) {
 		return (pmap-pm_ptphint[lidx]);
 	}
-	PMAP_SUBOBJ_LOCK(pmap, lidx);
 	pg = uvm_pagelookup(pmap-pm_obj[lidx], ptp_va2o(va, level));
-	PMAP_SUBOBJ_UNLOCK(pmap, lidx);
-
 	KASSERT(pg == NULL || pg-wire_count = 1);
 	return pg;
 }
@@ -1944,7 +1923,6 @@ pmap_get_ptp(struct pmap *pmap, vaddr_t 
 
 		obj = pmap-pm_obj[i-2];
 		l = curlwp;
-		PMAP_SUBOBJ_LOCK(pmap, i - 2);
 		ncsw = l-l_ncsw;
 		ptp = uvm_pagealloc(obj, ptp_va2o(va, i - 1), NULL,
 		UVM_PGA_USERESERVE|UVM_PGA_ZERO);
@@ -1957,13 +1935,10 @@ pmap_get_ptp(struct pmap *pmap, vaddr_t 
 			if (ptp != NULL) {
 uvm_pagefree(ptp);
 			}
-			PMAP_SUBOBJ_UNLOCK(pmap, i - 2);
 			/* XXX shut up the assertion in pmap_unmap_ptes */
 			pmap-pm_ncsw = l-l_ncsw;
 			return EAGAIN;
 		}
-		PMAP_SUBOBJ_UNLOCK(pmap, i - 2);
-
 		if (ptp == NULL)
 			return ENOMEM;
 
@@ -2218,10 +2193,10 @@ 

CVS commit: [yamt-pagecache] src/sys

2011-11-17 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Fri Nov 18 00:57:34 UTC 2011

Modified Files:
src/sys/kern [yamt-pagecache]: kern_mutex_obj.c
src/sys/sys [yamt-pagecache]: mutex.h
src/sys/uvm [yamt-pagecache]: uvm_aobj.c uvm_loan.c uvm_page.c
uvm_page.h uvm_pdaemon.c

Log Message:
- use mutex obj for pageable object
- add a function to wait for a mutex obj being available
- replace some livelock kpauses with it


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.5.2.1 src/sys/kern/kern_mutex_obj.c
cvs rdiff -u -r1.20 -r1.20.10.1 src/sys/sys/mutex.h
cvs rdiff -u -r1.116.2.4 -r1.116.2.5 src/sys/uvm/uvm_aobj.c
cvs rdiff -u -r1.81.2.2 -r1.81.2.3 src/sys/uvm/uvm_loan.c
cvs rdiff -u -r1.178.2.5 -r1.178.2.6 src/sys/uvm/uvm_page.c
cvs rdiff -u -r1.73.2.5 -r1.73.2.6 src/sys/uvm/uvm_page.h
cvs rdiff -u -r1.103.2.1 -r1.103.2.2 src/sys/uvm/uvm_pdaemon.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_mutex_obj.c
diff -u src/sys/kern/kern_mutex_obj.c:1.5 src/sys/kern/kern_mutex_obj.c:1.5.2.1
--- src/sys/kern/kern_mutex_obj.c:1.5	Tue Sep 27 01:02:38 2011
+++ src/sys/kern/kern_mutex_obj.c	Fri Nov 18 00:57:33 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_mutex_obj.c,v 1.5 2011/09/27 01:02:38 jym Exp $	*/
+/*	$NetBSD: kern_mutex_obj.c,v 1.5.2.1 2011/11/18 00:57:33 yamt Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_mutex_obj.c,v 1.5 2011/09/27 01:02:38 jym Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_mutex_obj.c,v 1.5.2.1 2011/11/18 00:57:33 yamt Exp $);
 
 #include sys/param.h
 #include sys/atomic.h
@@ -134,10 +134,56 @@ mutex_obj_free(kmutex_t *lock)
 	%s: lock %p: mo-mo_refcnt (%#x) == 0,
 	 __func__, mo, mo-mo_refcnt);
 
-	if (atomic_dec_uint_nv(mo-mo_refcnt)  0) {
+	/*
+	 * if mo_refcnt is 1, no one except us have a reference to it and
+	 * thus it's stable.
+	 */
+	if (mo-mo_refcnt != 1  atomic_dec_uint_nv(mo-mo_refcnt)  0) {
 		return false;
 	}
 	mutex_destroy(mo-mo_lock);
 	pool_cache_put(mutex_obj_cache, mo);
 	return true;
 }
+
+/*
+ * mutex_obj_pause:
+ *
+ *	Pause until lock1 is available.
+ *	Temporarily release and reacquire lock2.
+ *
+ *	Typically used when we need to acquire locks in a reversed order
+ *	and trylock failed.
+ */
+void
+mutex_obj_pause(kmutex_t *lock1, kmutex_t *lock2)
+{
+
+	KASSERT(mutex_owned(lock2));
+	mutex_obj_hold(lock1);
+	mutex_exit(lock2);
+	mutex_enter(lock1);
+	mutex_exit(lock1);
+	mutex_obj_free(lock1);
+	mutex_enter(lock2);
+}
+
+/*
+ * mutex_obj_alloc_kernel_obj_lock:
+ *
+ *	mutex_obj_alloc for kernel object lock.
+ *	used for bootstrap.
+ */
+kmutex_t *
+mutex_obj_alloc_kernel_obj_lock(kmutex_type_t type, int ipl)
+{
+	static struct kmutexobj kernel_obj_lock;
+	struct kmutexobj *mo = kernel_obj_lock;
+
+	KASSERT(mo-mo_refcnt == 0);
+	mutex_obj_ctor(NULL, mo, 0);
+	mutex_init(mo-mo_lock, type, ipl);
+	mo-mo_refcnt = 1;
+	return (kmutex_t *)mo;
+}
+

Index: src/sys/sys/mutex.h
diff -u src/sys/sys/mutex.h:1.20 src/sys/sys/mutex.h:1.20.10.1
--- src/sys/sys/mutex.h:1.20	Mon Feb  8 09:54:27 2010
+++ src/sys/sys/mutex.h	Fri Nov 18 00:57:33 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: mutex.h,v 1.20 2010/02/08 09:54:27 skrll Exp $	*/
+/*	$NetBSD: mutex.h,v 1.20.10.1 2011/11/18 00:57:33 yamt Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -210,6 +210,8 @@ void	mutex_obj_init(void);
 kmutex_t *mutex_obj_alloc(kmutex_type_t, int);
 void	mutex_obj_hold(kmutex_t *);
 bool	mutex_obj_free(kmutex_t *);
+void	mutex_obj_pause(kmutex_t *, kmutex_t *);
+kmutex_t *mutex_obj_alloc_kernel_obj_lock(kmutex_type_t, int);
 
 #endif /* _KERNEL */
 

Index: src/sys/uvm/uvm_aobj.c
diff -u src/sys/uvm/uvm_aobj.c:1.116.2.4 src/sys/uvm/uvm_aobj.c:1.116.2.5
--- src/sys/uvm/uvm_aobj.c:1.116.2.4	Sun Nov 13 01:18:02 2011
+++ src/sys/uvm/uvm_aobj.c	Fri Nov 18 00:57:33 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_aobj.c,v 1.116.2.4 2011/11/13 01:18:02 yamt Exp $	*/
+/*	$NetBSD: uvm_aobj.c,v 1.116.2.5 2011/11/18 00:57:33 yamt Exp $	*/
 
 /*
  * Copyright (c) 1998 Chuck Silvers, Charles D. Cranor and
@@ -38,7 +38,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uvm_aobj.c,v 1.116.2.4 2011/11/13 01:18:02 yamt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_aobj.c,v 1.116.2.5 2011/11/18 00:57:33 yamt Exp $);
 
 #include opt_uvmhist.h
 
@@ -437,7 +437,6 @@ struct uvm_object *
 uao_create(vsize_t size, int flags)
 {
 	static struct uvm_aobj kernel_object_store;
-	static kmutex_t kernel_object_lock;
 	static int kobj_alloced = 0;
 	pgoff_t pages = round_page(size)  PAGE_SHIFT;
 	struct uvm_aobj *aobj;
@@ -506,8 +505,8 @@ uao_create(vsize_t size, int flags)
 	uvm_obj_init(aobj-u_obj, aobj_pager, !kernobj, refs);
 	if (__predict_false(kernobj)) {
 		/* Initialisation only once, for UAO_FLAG_KERNOBJ. */
-		

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

2011-11-17 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Nov 18 01:32:33 UTC 2011

Modified Files:
src/tests/lib/libc/tls: Makefile

Log Message:
Add some dependencies


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

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

Modified files:

Index: src/tests/lib/libc/tls/Makefile
diff -u src/tests/lib/libc/tls/Makefile:1.3 src/tests/lib/libc/tls/Makefile:1.4
--- src/tests/lib/libc/tls/Makefile:1.3	Wed Mar 30 11:43:15 2011
+++ src/tests/lib/libc/tls/Makefile	Fri Nov 18 01:32:33 2011
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.3 2011/03/30 11:43:15 he Exp $
+# $NetBSD: Makefile,v 1.4 2011/11/18 01:32:33 joerg Exp $
 
 .include bsd.own.mk
 
@@ -15,9 +15,12 @@ TESTS_C+=	t_tls_dynamic t_tls_dlopen
 DSODIR!=	cd ${.CURDIR}/../tls_dso  ${PRINTOBJDIR}
 
 SRCS.t_tls_static=	t_tls_static.c t_tls_static_helper.c
+DPADD.t_tls_static+=	${LIBPTHREAD}
 LDADD.t_tls_static+=	-lpthread -static
+DPADD.t_tls_dynamic+=	${LIBPTHREAD} ${DSODIR}/libh_tls_dynamic.so
 LDADD.t_tls_dynamic+=	-lpthread \
 			-Wl,-rpath,${TESTSDIR} -L${DSODIR} -lh_tls_dynamic
+DPADD.t_tls_dlopen+=	${LIBPTHREAD}
 LDADD.t_tls_dlopen+=	-lpthread -Wl,-rpath,${TESTSDIR} -Wl,-export-dynamic
 
 .include bsd.test.mk



CVS commit: src/lib/libc/gdtoa

2011-11-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Nov 18 02:38:18 UTC 2011

Modified Files:
src/lib/libc/gdtoa: misc.c

Log Message:
PR/45627: Martin Husemann: Plug memory leak


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/lib/libc/gdtoa/misc.c

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

Modified files:

Index: src/lib/libc/gdtoa/misc.c
diff -u src/lib/libc/gdtoa/misc.c:1.7 src/lib/libc/gdtoa/misc.c:1.8
--- src/lib/libc/gdtoa/misc.c:1.7	Mon Mar 21 00:52:09 2011
+++ src/lib/libc/gdtoa/misc.c	Thu Nov 17 21:38:17 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: misc.c,v 1.7 2011/03/21 04:52:09 christos Exp $ */
+/* $NetBSD: misc.c,v 1.8 2011/11/18 02:38:17 christos Exp $ */
 
 /
 
@@ -432,6 +432,7 @@ pow5mult
 			b1 = mult(b, p5);
 			if (b1 == NULL)
 return NULL;
+			Bfree(b);
 			b = b1;
 			}
 		if (!(k = (unsigned int)k  1))



CVS commit: src/sys

2011-11-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Nov 18 03:34:14 UTC 2011

Modified Files:
src/sys/compat/common: kern_time_50.c
src/sys/compat/netbsd32: netbsd32_compat_50.c netbsd32_signal.c
src/sys/kern: sys_sig.c
src/sys/sys: signalvar.h

Log Message:
add a copyin function for sigset so that we can use sigtimedwait1 from
emulations.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/compat/common/kern_time_50.c
cvs rdiff -u -r1.19 -r1.20 src/sys/compat/netbsd32/netbsd32_compat_50.c
cvs rdiff -u -r1.35 -r1.36 src/sys/compat/netbsd32/netbsd32_signal.c
cvs rdiff -u -r1.35 -r1.36 src/sys/kern/sys_sig.c
cvs rdiff -u -r1.81 -r1.82 src/sys/sys/signalvar.h

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

Modified files:

Index: src/sys/compat/common/kern_time_50.c
diff -u src/sys/compat/common/kern_time_50.c:1.19 src/sys/compat/common/kern_time_50.c:1.20
--- src/sys/compat/common/kern_time_50.c:1.19	Thu Mar  3 20:36:56 2011
+++ src/sys/compat/common/kern_time_50.c	Thu Nov 17 22:34:13 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_time_50.c,v 1.19 2011/03/04 01:36:56 christos Exp $	*/
+/*	$NetBSD: kern_time_50.c,v 1.20 2011/11/18 03:34:13 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_time_50.c,v 1.19 2011/03/04 01:36:56 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_time_50.c,v 1.20 2011/11/18 03:34:13 christos Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_aio.h
@@ -480,8 +480,8 @@ compat_50_sys___sigtimedwait(struct lwp 
 	int res;
 
 	res = sigtimedwait1(l,
-	(const struct sys_sigtimedwait50_args *)uap, retval, copyout,
-	tscopyin, tscopyout);
+	(const struct sys_sigtimedwait50_args *)uap, retval, copyin,
+	copyout, tscopyin, tscopyout);
 	if (!res)
 		*retval = 0; /* XXX NetBSD=5 was not POSIX compliant */
 	return res;

Index: src/sys/compat/netbsd32/netbsd32_compat_50.c
diff -u src/sys/compat/netbsd32/netbsd32_compat_50.c:1.19 src/sys/compat/netbsd32/netbsd32_compat_50.c:1.20
--- src/sys/compat/netbsd32/netbsd32_compat_50.c:1.19	Mon May 23 17:34:47 2011
+++ src/sys/compat/netbsd32/netbsd32_compat_50.c	Thu Nov 17 22:34:13 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_compat_50.c,v 1.19 2011/05/23 21:34:47 joerg Exp $	*/
+/*	$NetBSD: netbsd32_compat_50.c,v 1.20 2011/11/18 03:34:13 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: netbsd32_compat_50.c,v 1.19 2011/05/23 21:34:47 joerg Exp $);
+__KERNEL_RCSID(0, $NetBSD: netbsd32_compat_50.c,v 1.20 2011/11/18 03:34:13 christos Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_sysv.h
@@ -501,6 +501,7 @@ compat_50_netbsd32___sigtimedwait(struct
 	NETBSD32TOP_UAP(timeout, struct timespec);
 
 	res = sigtimedwait1(l, ua, retval,
+	copyin,
 	compat_50_netbsd32_sigtimedwait_put_info,
 	compat_50_netbsd32_sigtimedwait_fetch_timeout,
 	compat_50_netbsd32_sigtimedwait_put_timeout);

Index: src/sys/compat/netbsd32/netbsd32_signal.c
diff -u src/sys/compat/netbsd32/netbsd32_signal.c:1.35 src/sys/compat/netbsd32/netbsd32_signal.c:1.36
--- src/sys/compat/netbsd32/netbsd32_signal.c:1.35	Thu Feb  3 16:45:31 2011
+++ src/sys/compat/netbsd32/netbsd32_signal.c	Thu Nov 17 22:34:13 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_signal.c,v 1.35 2011/02/03 21:45:31 joerg Exp $	*/
+/*	$NetBSD: netbsd32_signal.c,v 1.36 2011/11/18 03:34:13 christos Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: netbsd32_signal.c,v 1.35 2011/02/03 21:45:31 joerg Exp $);
+__KERNEL_RCSID(0, $NetBSD: netbsd32_signal.c,v 1.36 2011/11/18 03:34:13 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -483,6 +483,7 @@ netbsd32_sigtimedwait50(struct lwp *
 	NETBSD32TOP_UAP(timeout, struct timespec);
 
 	return sigtimedwait1(l, ua, retval,
+	copyin,
 	netbsd32_sigtimedwait_put_info,
 	netbsd32_sigtimedwait_fetch_timeout,
 	netbsd32_sigtimedwait_put_timeout);

Index: src/sys/kern/sys_sig.c
diff -u src/sys/kern/sys_sig.c:1.35 src/sys/kern/sys_sig.c:1.36
--- src/sys/kern/sys_sig.c:1.35	Sun May 29 18:14:53 2011
+++ src/sys/kern/sys_sig.c	Thu Nov 17 22:34:13 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_sig.c,v 1.35 2011/05/29 22:14:53 christos Exp $	*/
+/*	$NetBSD: sys_sig.c,v 1.36 2011/11/18 03:34:13 christos Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: sys_sig.c,v 1.35 2011/05/29 22:14:53 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: sys_sig.c,v 1.36 2011/11/18 03:34:13 christos Exp $);
 
 #include sys/param.h
 #include sys/kernel.h
@@ -365,7 +365,7 @@ 

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

2011-11-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Nov 18 04:03:51 UTC 2011

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

Log Message:
add sigtimedwait


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/compat/linux/arch/alpha/syscalls.master
cvs rdiff -u -r1.39 -r1.40 src/sys/compat/linux/arch/amd64/syscalls.master
cvs rdiff -u -r1.47 -r1.48 src/sys/compat/linux/arch/arm/syscalls.master
cvs rdiff -u -r1.106 -r1.107 src/sys/compat/linux/arch/i386/syscalls.master
cvs rdiff -u -r1.72 -r1.73 src/sys/compat/linux/arch/m68k/syscalls.master
cvs rdiff -u -r1.42 -r1.43 src/sys/compat/linux/arch/mips/syscalls.master
cvs rdiff -u -r1.49 -r1.50 src/sys/compat/linux/arch/powerpc/syscalls.master

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/syscalls.master
diff -u src/sys/compat/linux/arch/alpha/syscalls.master:1.75 src/sys/compat/linux/arch/alpha/syscalls.master:1.76
--- src/sys/compat/linux/arch/alpha/syscalls.master:1.75	Sat Jul  9 10:49:40 2011
+++ src/sys/compat/linux/arch/alpha/syscalls.master	Thu Nov 17 23:03:50 2011
@@ -1,4 +1,4 @@
-	$NetBSD: syscalls.master,v 1.75 2011/07/09 14:49:40 christos Exp $
+	$NetBSD: syscalls.master,v 1.76 2011/11/18 04:03:50 christos Exp $
 ;
 ;	@(#)syscalls.master	8.1 (Berkeley) 7/19/93
 
@@ -567,7 +567,10 @@
 354	STD		{ int|linux_sys||rt_sigpending( \
 			linux_sigset_t *set, \
 			size_t sigsetsize); }
-355	UNIMPL		rt_sigtimedwait
+355	STD		{ int|linux_sys||rt_sigtimedwait( \
+			const linux_sigset_t *set, \
+			linux_siginfo_t *info, \
+			const struct linux_timespec *timeout); }
 356	STD		{ int|linux_sys||rt_queueinfo(int pid, int signum, \
 			linux_siginfo_t *uinfo); }
 357	STD		{ int|linux_sys||rt_sigsuspend(linux_sigset_t *unewset, \

Index: src/sys/compat/linux/arch/amd64/syscalls.master
diff -u src/sys/compat/linux/arch/amd64/syscalls.master:1.39 src/sys/compat/linux/arch/amd64/syscalls.master:1.40
--- src/sys/compat/linux/arch/amd64/syscalls.master:1.39	Sat Jul  9 19:46:32 2011
+++ src/sys/compat/linux/arch/amd64/syscalls.master	Thu Nov 17 23:03:50 2011
@@ -1,4 +1,4 @@
-	$NetBSD: syscalls.master,v 1.39 2011/07/09 23:46:32 christos Exp $
+	$NetBSD: syscalls.master,v 1.40 2011/11/18 04:03:50 christos Exp $
 
 ;	@(#)syscalls.master	8.1 (Berkeley) 7/19/93
 
@@ -287,7 +287,10 @@
 127	STD		{ int|linux_sys||rt_sigpending( \
 			linux_sigset_t *set, \
 			size_t sigsetsize); }
-128	UNIMPL		rt_sigtimedwait
+128	STD		{ int|linux_sys||rt_sigtimedwait( \
+			const linux_sigset_t *set, \
+			linux_siginfo_t *info, \
+			const struct linux_timespec *timeout); }
 129	STD		{ int|linux_sys||rt_queueinfo(int pid, int signum, \
 			linux_siginfo_t *uinfo); }
 130	STD		{ int|linux_sys||rt_sigsuspend(linux_sigset_t *unewset, \

Index: src/sys/compat/linux/arch/arm/syscalls.master
diff -u src/sys/compat/linux/arch/arm/syscalls.master:1.47 src/sys/compat/linux/arch/arm/syscalls.master:1.48
--- src/sys/compat/linux/arch/arm/syscalls.master:1.47	Sat Jul  9 10:49:40 2011
+++ src/sys/compat/linux/arch/arm/syscalls.master	Thu Nov 17 23:03:50 2011
@@ -1,4 +1,4 @@
-	$NetBSD: syscalls.master,v 1.47 2011/07/09 14:49:40 christos Exp $
+	$NetBSD: syscalls.master,v 1.48 2011/11/18 04:03:50 christos Exp $
 
 ; Derived from sys/compat/linux/arch/*/syscalls.master
 ; and from Linux 2.4.12 arch/arm/kernel/calls.S
@@ -306,7 +306,10 @@
 176	STD		{ int|linux_sys||rt_sigpending( \
 			linux_sigset_t *set, \
 			size_t sigsetsize); }
-177	UNIMPL		rt_sigtimedwait
+177	STD		{ int|linux_sys||rt_sigtimedwait( \
+			const linux_sigset_t *set, \
+			linux_siginfo_t *info, \
+			const struct linux_timespec *timeout); }
 178	STD		{ int|linux_sys||rt_queueinfo(int pid, int signum, \
 			linux_siginfo_t *uinfo); }
 179	STD		{ int|linux_sys||rt_sigsuspend(linux_sigset_t *unewset, \

Index: src/sys/compat/linux/arch/i386/syscalls.master
diff -u src/sys/compat/linux/arch/i386/syscalls.master:1.106 src/sys/compat/linux/arch/i386/syscalls.master:1.107
--- src/sys/compat/linux/arch/i386/syscalls.master:1.106	Sat Jul  9 10:49:40 2011
+++ src/sys/compat/linux/arch/i386/syscalls.master	Thu Nov 17 23:03:50 2011
@@ -1,4 +1,4 @@
-	$NetBSD: syscalls.master,v 1.106 2011/07/09 14:49:40 christos Exp $
+	$NetBSD: syscalls.master,v 1.107 2011/11/18 04:03:50 christos Exp $
 
 ;	@(#)syscalls.master	8.1 (Berkeley) 7/19/93
 
@@ -307,7 +307,10 @@
 176	STD		{ int|linux_sys||rt_sigpending( \
 			linux_sigset_t *set, \
 			size_t sigsetsize); }
-177	

CVS commit: src/sys/compat/linux32

2011-11-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Nov 18 04:08:56 UTC 2011

Modified Files:
src/sys/compat/linux32/arch/amd64: linux32_signal.h linux32_syscall.h
linux32_syscallargs.h linux32_syscalls.c linux32_sysent.c
syscalls.master
src/sys/compat/linux32/common: linux32_misc.c linux32_signal.c
linux32_signal.h linux32_time.c linux32_types.h
Added Files:
src/sys/compat/linux32/arch/amd64: linux32_siginfo.h
src/sys/compat/linux32/common: linux32_sched.h linux32_siginfo.h

Log Message:
add sigtimedwait support


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/compat/linux32/arch/amd64/linux32_siginfo.h
cvs rdiff -u -r1.2 -r1.3 src/sys/compat/linux32/arch/amd64/linux32_signal.h
cvs rdiff -u -r1.63 -r1.64 \
src/sys/compat/linux32/arch/amd64/linux32_syscall.h \
src/sys/compat/linux32/arch/amd64/linux32_syscallargs.h \
src/sys/compat/linux32/arch/amd64/linux32_syscalls.c \
src/sys/compat/linux32/arch/amd64/linux32_sysent.c
cvs rdiff -u -r1.59 -r1.60 src/sys/compat/linux32/arch/amd64/syscalls.master
cvs rdiff -u -r1.21 -r1.22 src/sys/compat/linux32/common/linux32_misc.c
cvs rdiff -u -r0 -r1.1 src/sys/compat/linux32/common/linux32_sched.h \
src/sys/compat/linux32/common/linux32_siginfo.h
cvs rdiff -u -r1.13 -r1.14 src/sys/compat/linux32/common/linux32_signal.c
cvs rdiff -u -r1.2 -r1.3 src/sys/compat/linux32/common/linux32_signal.h
cvs rdiff -u -r1.35 -r1.36 src/sys/compat/linux32/common/linux32_time.c
cvs rdiff -u -r1.14 -r1.15 src/sys/compat/linux32/common/linux32_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/compat/linux32/arch/amd64/linux32_signal.h
diff -u src/sys/compat/linux32/arch/amd64/linux32_signal.h:1.2 src/sys/compat/linux32/arch/amd64/linux32_signal.h:1.3
--- src/sys/compat/linux32/arch/amd64/linux32_signal.h:1.2	Mon Jun  8 10:42:10 2009
+++ src/sys/compat/linux32/arch/amd64/linux32_signal.h	Thu Nov 17 23:08:56 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux32_signal.h,v 1.2 2009/06/08 14:42:10 njoly Exp $ */
+/*	$NetBSD: linux32_signal.h,v 1.3 2011/11/18 04:08:56 christos Exp $ */
 
 /*-
  * Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved.
@@ -91,137 +91,6 @@ struct linux32_sigaction {
 	linux32_sigset_t	linux_sa_mask;
 };
 
-typedef union linux32_sigval {
-	int	sival_int;
-	netbsd32_voidp	sival_ptr;
-} linux32_sigval_t;
-
-#define SI_MAX_SIZE	128
-#define SI_PAD_SIZE	((SI_MAX_SIZE/sizeof(int)) - 3)
-
-typedef struct linux32_siginfo {
-	int	lsi_signo;
-	int	lsi_errno;
-	int	lsi_code;
-	union {
-		int _pad[SI_PAD_SIZE];
-
-		/* kill() */
-		struct {
-			linux32_pid_t	_pid;
-			linux32_uid_t	_uid;
-		} _kill;
-
-		/* POSIX.1b signals */
-		struct {
-			linux32_pid_t	_pid;
-			linux32_uid_t	_uid;
-			linux32_sigval_t	_sigval;
-		} _rt;
-
-		/* POSIX.1b timers */
-		struct {
-			unsigned int	_timer1;
-			unsigned int	_timer2;
-		} _timer;
-
-		/* SIGCHLD */
-		struct {
-			linux32_pid_t	_pid;
-			linux32_uid_t	_uid;
-			int		_status;
-			linux32_clock_t	_utime;
-			linux32_clock_t	_stime;
-		} _sigchld;
-
-		/* SIGPOLL */
-		struct {
-			int _band;
-			int _fd;
-		} _sigpoll;
-
-		/* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
-		struct {
-			netbsd32_voidp _addr;
-		} _sigfault;
-	} _sidata;
-} linux32_siginfo_t;
-
-#define lsi_pid		_sidata._kill._pid
-#define lsi_uid		_sidata._kill._uid
-#define lsi_status  _sidata._sigchld._status
-#define lsi_utime   _sidata._sigchld._utime
-#define lsi_stime   _sidata._sigchld._stime
-#define lsi_value   _sidata._rt._sigval
-#define lsi_int _sidata._rt._sigval.sival_int
-#define lsi_ptr _sidata._rt._sigval.sival_ptr
-#define lsi_addr_sidata._sigfault._addr
-#define lsi_band_sidata._sigpoll._band
-#define lsi_fd  _sidata._sigpoll._fd
-
-/*
- * si_code values for non-signals
- */
-#define LINUX32_SI_USER		0
-#define	LINUX32_SI_KERNEL		0x80
-#define LINUX32_SI_QUEUE		-1
-#define LINUX32_SI_TIMER		-2
-#define LINUX32_SI_MESGQ		-3
-#define LINUX32_SI_ASYNCIO	-4
-#define LINUX32_SI_SIGIO		-5
-#define LINUX32_SI_SIGNL		-6
-
-/* si_code values for SIGILL */
-#define	LINUX32_ILL_ILLOPC	1
-#define	LINUX32_ILL_ILLOPN	2
-#define	LINUX32_ILL_ILLADR	3
-#define	LINUX32_ILL_ILLTRP	4
-#define	LINUX32_ILL_PRVOPC	5
-#define	LINUX32_ILL_PRVREG	6
-#define	LINUX32_ILL_COPROC	7
-#define	LINUX32_ILL_BADSTK	8
-
-/* si_code values for SIGFPE */
-#define	LINUX32_FPE_INTDIV 	1
-#define	LINUX32_FPE_INTOVF	2
-#define	LINUX32_FPE_FLTDIV	3
-#define	LINUX32_FPE_FLTOVF	4
-#define	LINUX32_FPE_FLTUND	5
-#define	LINUX32_FPE_FLTRES	6
-#define	LINUX32_FPE_FLTINV	7
-#define	LINUX32_FPE_FLTSUB	8
-
-/* si_code values for SIGSEGV */
-#define	LINUX32_SEGV_MAPERR	1
-#define	LINUX32_SEGV_ACCERR	2
-
-/* si_code values for SIGBUS */
-#define	LINUX32_BUS_ADRALN	1
-#define	LINUX32_BUS_ADRERR	2
-#define	LINUX32_BUS_OBJERR	3
-
-/* si_code 

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

2011-11-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Nov 18 04:09:18 UTC 2011

Modified Files:
src/sys/arch/amd64/include: linux32_machdep.h

Log Message:
include the new siginfo.h file


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

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

Modified files:

Index: src/sys/arch/amd64/include/linux32_machdep.h
diff -u src/sys/arch/amd64/include/linux32_machdep.h:1.1 src/sys/arch/amd64/include/linux32_machdep.h:1.2
--- src/sys/arch/amd64/include/linux32_machdep.h:1.1	Thu Feb  9 14:18:56 2006
+++ src/sys/arch/amd64/include/linux32_machdep.h	Thu Nov 17 23:09:17 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux32_machdep.h,v 1.1 2006/02/09 19:18:56 manu Exp $ */
+/*	$NetBSD: linux32_machdep.h,v 1.2 2011/11/18 04:09:17 christos Exp $ */
 
 #ifndef _MACHINE_LINUX32_H_
 #define _MACHINE_LINUX32_H_
@@ -7,6 +7,7 @@
 
 #include compat/linux32/common/linux32_types.h
 
+#include compat/linux32/arch/amd64/linux32_siginfo.h
 #include compat/linux32/arch/amd64/linux32_signal.h
 #include compat/linux32/arch/amd64/linux32_syscallargs.h
 #include compat/linux32/arch/amd64/linux32_syscall.h



CVS commit: src/lib/libutil

2011-11-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Nov 18 04:15:41 UTC 2011

Modified Files:
src/lib/libutil: getfstypename.3

Log Message:
remove clauses 3 and 4


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libutil/getfstypename.3

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

Modified files:

Index: src/lib/libutil/getfstypename.3
diff -u src/lib/libutil/getfstypename.3:1.2 src/lib/libutil/getfstypename.3:1.3
--- src/lib/libutil/getfstypename.3:1.2	Sun Nov 13 18:49:39 2011
+++ src/lib/libutil/getfstypename.3	Thu Nov 17 23:15:41 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: getfstypename.3,v 1.2 2011/11/13 23:49:39 wiz Exp $
+.\	$NetBSD: getfstypename.3,v 1.3 2011/11/18 04:15:41 christos Exp $
 .\
 .\ Copyright (c) 2011 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -14,13 +14,6 @@
 .\ 2. Redistributions in binary form must reproduce the above copyright
 .\notice, this list of conditions and the following disclaimer in the
 .\documentation and/or other materials provided with the distribution.
-.\ 3. All advertising materials mentioning features or use of this software
-.\must display the following acknowledgement:
-.\This product includes software developed by the NetBSD
-.\Foundation, Inc. and its contributors.
-.\ 4. Neither the name of The NetBSD Foundation nor the names of its
-.\contributors may be used to endorse or promote products derived
-.\from this software without specific prior written permission.
 .\
 .\ THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
 .\ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED



CVS commit: src/lib/libc/gdtoa

2011-11-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Nov 18 04:17:23 UTC 2011

Modified Files:
src/lib/libc/gdtoa: misc.c

Log Message:
unlock before returning on error, thanks enami.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/lib/libc/gdtoa/misc.c

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

Modified files:

Index: src/lib/libc/gdtoa/misc.c
diff -u src/lib/libc/gdtoa/misc.c:1.8 src/lib/libc/gdtoa/misc.c:1.9
--- src/lib/libc/gdtoa/misc.c:1.8	Thu Nov 17 21:38:17 2011
+++ src/lib/libc/gdtoa/misc.c	Thu Nov 17 23:17:23 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: misc.c,v 1.8 2011/11/18 02:38:17 christos Exp $ */
+/* $NetBSD: misc.c,v 1.9 2011/11/18 04:17:23 christos Exp $ */
 
 /
 
@@ -415,8 +415,10 @@ pow5mult
 		ACQUIRE_DTOA_LOCK(1);
 		if (!(p5 = p5s)) {
 			p5 = p5s = i2b(625);
-			if (p5 == NULL)
+			if (p5 == NULL) {
+FREE_DTOA_LOCK(1);
 return NULL;
+			}
 			p5-next = 0;
 			}
 		FREE_DTOA_LOCK(1);



CVS commit: src/sys/compat/linux32/arch/amd64

2011-11-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Nov 18 04:20:16 UTC 2011

Modified Files:
src/sys/compat/linux32/arch/amd64: linux32_syscall.h
linux32_syscallargs.h linux32_syscalls.c linux32_sysent.c

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 \
src/sys/compat/linux32/arch/amd64/linux32_syscall.h \
src/sys/compat/linux32/arch/amd64/linux32_syscallargs.h \
src/sys/compat/linux32/arch/amd64/linux32_syscalls.c \
src/sys/compat/linux32/arch/amd64/linux32_sysent.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/linux32/arch/amd64/linux32_syscall.h
diff -u src/sys/compat/linux32/arch/amd64/linux32_syscall.h:1.64 src/sys/compat/linux32/arch/amd64/linux32_syscall.h:1.65
--- src/sys/compat/linux32/arch/amd64/linux32_syscall.h:1.64	Thu Nov 17 23:08:56 2011
+++ src/sys/compat/linux32/arch/amd64/linux32_syscall.h	Thu Nov 17 23:20:16 2011
@@ -1,10 +1,10 @@
-/* $NetBSD: linux32_syscall.h,v 1.64 2011/11/18 04:08:56 christos Exp $ */
+/* $NetBSD: linux32_syscall.h,v 1.65 2011/11/18 04:20:16 christos Exp $ */
 
 /*
  * System call numbers.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.59 2011/05/30 17:50:32 alnsn Exp
+ * created from	NetBSD: syscalls.master,v 1.60 2011/11/18 04:08:56 christos Exp
  */
 
 #ifndef _LINUX32_SYS_SYSCALL_H_
Index: src/sys/compat/linux32/arch/amd64/linux32_syscallargs.h
diff -u src/sys/compat/linux32/arch/amd64/linux32_syscallargs.h:1.64 src/sys/compat/linux32/arch/amd64/linux32_syscallargs.h:1.65
--- src/sys/compat/linux32/arch/amd64/linux32_syscallargs.h:1.64	Thu Nov 17 23:08:56 2011
+++ src/sys/compat/linux32/arch/amd64/linux32_syscallargs.h	Thu Nov 17 23:20:16 2011
@@ -1,10 +1,10 @@
-/* $NetBSD: linux32_syscallargs.h,v 1.64 2011/11/18 04:08:56 christos Exp $ */
+/* $NetBSD: linux32_syscallargs.h,v 1.65 2011/11/18 04:20:16 christos Exp $ */
 
 /*
  * System call argument lists.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.59 2011/05/30 17:50:32 alnsn Exp
+ * created from	NetBSD: syscalls.master,v 1.60 2011/11/18 04:08:56 christos Exp
  */
 
 #ifndef _LINUX32_SYS_SYSCALLARGS_H_
Index: src/sys/compat/linux32/arch/amd64/linux32_syscalls.c
diff -u src/sys/compat/linux32/arch/amd64/linux32_syscalls.c:1.64 src/sys/compat/linux32/arch/amd64/linux32_syscalls.c:1.65
--- src/sys/compat/linux32/arch/amd64/linux32_syscalls.c:1.64	Thu Nov 17 23:08:56 2011
+++ src/sys/compat/linux32/arch/amd64/linux32_syscalls.c	Thu Nov 17 23:20:16 2011
@@ -1,14 +1,14 @@
-/* $NetBSD: linux32_syscalls.c,v 1.64 2011/11/18 04:08:56 christos Exp $ */
+/* $NetBSD: linux32_syscalls.c,v 1.65 2011/11/18 04:20:16 christos Exp $ */
 
 /*
  * System call names.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.59 2011/05/30 17:50:32 alnsn Exp
+ * created from	NetBSD: syscalls.master,v 1.60 2011/11/18 04:08:56 christos Exp
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: linux32_syscalls.c,v 1.64 2011/11/18 04:08:56 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: linux32_syscalls.c,v 1.65 2011/11/18 04:20:16 christos Exp $);
 
 #if defined(_KERNEL_OPT)
 #include sys/param.h
Index: src/sys/compat/linux32/arch/amd64/linux32_sysent.c
diff -u src/sys/compat/linux32/arch/amd64/linux32_sysent.c:1.64 src/sys/compat/linux32/arch/amd64/linux32_sysent.c:1.65
--- src/sys/compat/linux32/arch/amd64/linux32_sysent.c:1.64	Thu Nov 17 23:08:56 2011
+++ src/sys/compat/linux32/arch/amd64/linux32_sysent.c	Thu Nov 17 23:20:16 2011
@@ -1,14 +1,14 @@
-/* $NetBSD: linux32_sysent.c,v 1.64 2011/11/18 04:08:56 christos Exp $ */
+/* $NetBSD: linux32_sysent.c,v 1.65 2011/11/18 04:20:16 christos Exp $ */
 
 /*
  * System call switch table.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.59 2011/05/30 17:50:32 alnsn Exp
+ * created from	NetBSD: syscalls.master,v 1.60 2011/11/18 04:08:56 christos Exp
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: linux32_sysent.c,v 1.64 2011/11/18 04:08:56 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: linux32_sysent.c,v 1.65 2011/11/18 04:20:16 christos Exp $);
 
 #include sys/param.h
 #include sys/poll.h



CVS commit: src/sys/arch/xen/xen

2011-11-17 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Fri Nov 18 06:01:50 UTC 2011

Modified Files:
src/sys/arch/xen/xen: clock.c

Log Message:
[merging from cherry-xenmp]
 - Make clock MP aware.
 - Bring in fixes that bouyer@ brought in via:
   cvs rdiff -u -r1.54.6.4 -r1.54.6.5 src/sys/arch/xen/xen/clock.c

Thanks to riz@ for testing on dom0


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/xen/xen/clock.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/xen/xen/clock.c
diff -u src/sys/arch/xen/xen/clock.c:1.56 src/sys/arch/xen/xen/clock.c:1.57
--- src/sys/arch/xen/xen/clock.c:1.56	Tue Sep 20 00:12:24 2011
+++ src/sys/arch/xen/xen/clock.c	Fri Nov 18 06:01:50 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: clock.c,v 1.56 2011/09/20 00:12:24 jym Exp $	*/
+/*	$NetBSD: clock.c,v 1.57 2011/11/18 06:01:50 cherry Exp $	*/
 
 /*
  *
@@ -29,7 +29,7 @@
 #include opt_xen.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: clock.c,v 1.56 2011/09/20 00:12:24 jym Exp $);
+__KERNEL_RCSID(0, $NetBSD: clock.c,v 1.57 2011/11/18 06:01:50 cherry Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -43,6 +43,7 @@ __KERNEL_RCSID(0, $NetBSD: clock.c,v 1.
 #include xen/xen.h
 #include xen/hypervisor.h
 #include xen/evtchn.h
+#include xen/xen3-public/vcpu.h
 #include machine/cpu_counter.h
 
 #include dev/clock_subr.h
@@ -66,22 +67,32 @@ static struct timecounter xen_timecounte
 };
 
 /* These are periodically updated in shared_info, and then copied here. */
-static volatile uint64_t shadow_tsc_stamp;
-static volatile uint64_t shadow_system_time;
-static volatile unsigned long shadow_time_version; /* XXXSMP */
-static volatile uint32_t shadow_freq_mul;
-static volatile int8_t shadow_freq_shift;
-static volatile struct timespec shadow_ts;
+struct shadow {
+	uint64_t tsc_stamp;
+	uint64_t system_time;
+	unsigned long time_version; /* XXXSMP */
+	uint32_t freq_mul;
+	int8_t freq_shift;
+	struct timespec ts;
+};
+
+/* Protects volatile variables ci_shadow  xen_clock_bias */
+static kmutex_t tmutex;
 
-/* The time when the last hardclock(9) call should have taken place. */
-static volatile uint64_t processed_system_time;
+/* Per CPU shadow time values */
+static volatile struct shadow ci_shadow[MAXCPUS];
+
+/* The time when the last hardclock(9) call should have taken place,
+ * per cpu.
+ */
+static volatile uint64_t vcpu_system_time[MAXCPUS];
 
 /*
  * The clock (as returned by xen_get_timecount) may need to be held
  * back to maintain the illusion that hardclock(9) was called when it
  * was supposed to be, not when Xen got around to scheduling us.
  */
-static volatile uint64_t xen_clock_bias = 0;
+static volatile uint64_t xen_clock_bias[MAXCPUS];
 
 #ifdef DOM0OPS
 /* If we're dom0, send our time to Xen every minute or so. */
@@ -96,25 +107,30 @@ static callout_t xen_timepush_co;
  * area.  Must be called at splhigh (per timecounter requirements).
  */
 static void
-get_time_values_from_xen(void)
+get_time_values_from_xen(struct cpu_info *ci)
 {
-	volatile struct vcpu_time_info *t = curcpu()-ci_vcpu-time;
+
+	volatile struct shadow *shadow = ci_shadow[ci-ci_cpuid];
+
+	volatile struct vcpu_time_info *t = ci-ci_vcpu-time;
 	uint32_t tversion;
 
+	KASSERT(mutex_owned(tmutex));
+
 	do {
-		shadow_time_version = t-version;
+		shadow-time_version = t-version;
 		xen_rmb();
-		shadow_tsc_stamp = t-tsc_timestamp;
-		shadow_system_time = t-system_time;
-		shadow_freq_mul = t-tsc_to_system_mul;
-		shadow_freq_shift = t-tsc_shift;
+		shadow-tsc_stamp = t-tsc_timestamp;
+		shadow-system_time = t-system_time;
+		shadow-freq_mul = t-tsc_to_system_mul;
+		shadow-freq_shift = t-tsc_shift;
 		xen_rmb();
-	} while ((t-version  1) || (shadow_time_version != t-version));
+	} while ((t-version  1) || (shadow-time_version != t-version));
 	do {
 		tversion = HYPERVISOR_shared_info-wc_version;
 		xen_rmb();
-		shadow_ts.tv_sec = HYPERVISOR_shared_info-wc_sec;
-		shadow_ts.tv_nsec = HYPERVISOR_shared_info-wc_nsec;
+		shadow-ts.tv_sec = HYPERVISOR_shared_info-wc_sec;
+		shadow-ts.tv_nsec = HYPERVISOR_shared_info-wc_nsec;
 		xen_rmb();
 	} while ((HYPERVISOR_shared_info-wc_version  1) ||
 	(tversion != HYPERVISOR_shared_info-wc_version));
@@ -124,12 +140,17 @@ get_time_values_from_xen(void)
  * Are the values we have up to date?
  */
 static inline int
-time_values_up_to_date(void)
+time_values_up_to_date(struct cpu_info *ci)
 {
 	int rv;
 
+	volatile struct shadow *shadow = ci_shadow[ci-ci_cpuid];
+
+	KASSERT(ci != NULL);
+	KASSERT(mutex_owned(tmutex));
+
 	xen_rmb();
-	rv = shadow_time_version == curcpu()-ci_vcpu-time.version;
+	rv = shadow-time_version == ci-ci_vcpu-time.version;
 	xen_rmb();
 
 	return rv;
@@ -164,52 +185,40 @@ scale_delta(uint64_t delta, uint32_t mul
  * Must be called at splhigh (per timecounter requirements).
  */
 static uint64_t
-get_tsc_offset_ns(void)
+get_tsc_offset_ns(struct cpu_info *ci)