CVS commit: src/tests/lib/libm

2011-09-14 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Wed Sep 14 06:50:43 UTC 2011

Modified Files:
src/tests/lib/libm: t_cos.c t_ldexp.c t_sin.c t_tan.c

Log Message:
Use fabsf(3) when appropriate.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libm/t_cos.c \
src/tests/lib/libm/t_sin.c src/tests/lib/libm/t_tan.c
cvs rdiff -u -r1.5 -r1.6 src/tests/lib/libm/t_ldexp.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/libm/t_cos.c
diff -u src/tests/lib/libm/t_cos.c:1.1 src/tests/lib/libm/t_cos.c:1.2
--- src/tests/lib/libm/t_cos.c:1.1	Wed Sep 14 05:18:19 2011
+++ src/tests/lib/libm/t_cos.c	Wed Sep 14 06:50:43 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: t_cos.c,v 1.1 2011/09/14 05:18:19 jruoho Exp $ */
+/* $NetBSD: t_cos.c,v 1.2 2011/09/14 06:50:43 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -173,7 +173,7 @@
 		x = angles[i].x;
 		y = angles[i].y;
 
-		if (fabs(cosf(x) - y)  eps)
+		if (fabsf(cosf(x) - y)  eps)
 			atf_tc_fail_nonfatal(cosf(%d deg) != %0.01f,
 			angles[i].angle, angles[i].y);
 	}
Index: src/tests/lib/libm/t_sin.c
diff -u src/tests/lib/libm/t_sin.c:1.1 src/tests/lib/libm/t_sin.c:1.2
--- src/tests/lib/libm/t_sin.c:1.1	Wed Sep 14 05:18:19 2011
+++ src/tests/lib/libm/t_sin.c	Wed Sep 14 06:50:43 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: t_sin.c,v 1.1 2011/09/14 05:18:19 jruoho Exp $ */
+/* $NetBSD: t_sin.c,v 1.2 2011/09/14 06:50:43 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -173,7 +173,7 @@
 		x = angles[i].x;
 		y = angles[i].y;
 
-		if (fabs(sinf(x) - y)  eps)
+		if (fabsf(sinf(x) - y)  eps)
 			atf_tc_fail_nonfatal(sinf(%d deg) != %0.01f,
 			angles[i].angle, angles[i].y);
 	}
Index: src/tests/lib/libm/t_tan.c
diff -u src/tests/lib/libm/t_tan.c:1.1 src/tests/lib/libm/t_tan.c:1.2
--- src/tests/lib/libm/t_tan.c:1.1	Wed Sep 14 05:18:19 2011
+++ src/tests/lib/libm/t_tan.c	Wed Sep 14 06:50:43 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: t_tan.c,v 1.1 2011/09/14 05:18:19 jruoho Exp $ */
+/* $NetBSD: t_tan.c,v 1.2 2011/09/14 06:50:43 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -170,7 +170,7 @@
 		x = angles[i].x;
 		y = angles[i].y;
 
-		if (fabs(tanf(x) - y)  eps)
+		if (fabsf(tanf(x) - y)  eps)
 			atf_tc_fail_nonfatal(tanf(%d deg) != %0.01f,
 			angles[i].angle, angles[i].y);
 	}

Index: src/tests/lib/libm/t_ldexp.c
diff -u src/tests/lib/libm/t_ldexp.c:1.5 src/tests/lib/libm/t_ldexp.c:1.6
--- src/tests/lib/libm/t_ldexp.c:1.5	Tue Sep 13 07:03:36 2011
+++ src/tests/lib/libm/t_ldexp.c	Wed Sep 14 06:50:43 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: t_ldexp.c,v 1.5 2011/09/13 07:03:36 jruoho Exp $ */
+/* $NetBSD: t_ldexp.c,v 1.6 2011/09/14 06:50:43 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__RCSID($NetBSD: t_ldexp.c,v 1.5 2011/09/13 07:03:36 jruoho Exp $);
+__RCSID($NetBSD: t_ldexp.c,v 1.6 2011/09/14 06:50:43 jruoho Exp $);
 
 #include math.h
 #include limits.h
@@ -164,6 +164,10 @@
 #endif
 }
 
+/*
+ * ldexpf(3)
+ */
+
 ATF_TC(ldexpf_exp2f);
 ATF_TC_HEAD(ldexpf_exp2f, tc)
 {
@@ -207,10 +211,6 @@
 #endif
 }
 
-/*
- * ldexpf(3)
- */
-
 ATF_TC(ldexpf_inf_neg);
 ATF_TC_HEAD(ldexpf_inf_neg, tc)
 {



CVS commit: src/sys/arch/amiga/amiga

2011-09-14 Thread Radoslaw Kujawa
Module Name:src
Committed By:   rkujawa
Date:   Wed Sep 14 09:19:09 UTC 2011

Modified Files:
src/sys/arch/amiga/amiga: simple_busfuncs.c

Log Message:
Fix typo, add missing include (make this compile again).


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/amiga/amiga/simple_busfuncs.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/amiga/amiga/simple_busfuncs.c
diff -u src/sys/arch/amiga/amiga/simple_busfuncs.c:1.9 src/sys/arch/amiga/amiga/simple_busfuncs.c:1.10
--- src/sys/arch/amiga/amiga/simple_busfuncs.c:1.9	Tue Sep 13 19:21:20 2011
+++ src/sys/arch/amiga/amiga/simple_busfuncs.c	Wed Sep 14 09:19:09 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: simple_busfuncs.c,v 1.9 2011/09/13 19:21:20 christos Exp $ */
+/* $NetBSD: simple_busfuncs.c,v 1.10 2011/09/14 09:19:09 rkujawa Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: simple_busfuncs.c,v 1.9 2011/09/13 19:21:20 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: simple_busfuncs.c,v 1.10 2011/09/14 09:19:09 rkujawa Exp $);
 
 /*
  * Do NOT use this standalone.
@@ -45,6 +45,7 @@
 #endif
 
 #include sys/bus.h
+#include sys/null.h
 
 #define MKN2(x,y) __CONCAT(x, y)
 #define MKN1(x,y) MKN2(x, y)
@@ -603,7 +604,7 @@
 	.bsrr4 =	oabs(bsrr4_),
 	.bswr4 =	oabs(bswr4_),
 	.bsrrs4 =	oabs(bsrr4_),
-	.bsrws4 =	oabs(bswr4_),
+	.bswrs4 =	oabs(bswr4_),
 	.bssr4 =	oabs(bssr4_),
 	.bscr4 =	oabs(bscr4_)
 #endif /* AMIGA_SIMPLE_BUS_LONGWORD_METHODS */



CVS commit: src/lib/libutil

2011-09-14 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Wed Sep 14 11:43:29 UTC 2011

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

Log Message:
Kill empty Dv macro.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/lib/libutil/getlabelsector.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/getlabelsector.3
diff -u src/lib/libutil/getlabelsector.3:1.7 src/lib/libutil/getlabelsector.3:1.8
--- src/lib/libutil/getlabelsector.3:1.7	Mon Sep  5 18:25:57 2011
+++ src/lib/libutil/getlabelsector.3	Wed Sep 14 11:43:29 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: getlabelsector.3,v 1.7 2011/09/05 18:25:57 wiz Exp $
+.\	$NetBSD: getlabelsector.3,v 1.8 2011/09/14 11:43:29 njoly Exp $
 .\
 .\
 .\ Copyright 2002 Wasabi Systems, Inc.
@@ -71,7 +71,6 @@
 .Fn getlabelusesmbr
 returns 1 if the disklabel is located inside a MBR partition, 0 if it's stored
 relative to the start of the disk, or \-1 on error.
-.Dv
 .Sh SEE ALSO
 .Xr sysctl 3 ,
 .Xr disklabel 5



CVS commit: src/lib/libc/sys

2011-09-14 Thread Alan Barrett
Module Name:src
Committed By:   apb
Date:   Wed Sep 14 11:49:21 UTC 2011

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

Log Message:
There's no st_block field; it's st_blocks.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/lib/libc/sys/stat.2

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

Modified files:

Index: src/lib/libc/sys/stat.2
diff -u src/lib/libc/sys/stat.2:1.48 src/lib/libc/sys/stat.2:1.49
--- src/lib/libc/sys/stat.2:1.48	Mon Feb 21 07:11:11 2011
+++ src/lib/libc/sys/stat.2	Wed Sep 14 11:49:21 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: stat.2,v 1.48 2011/02/21 07:11:11 pooka Exp $
+.\	$NetBSD: stat.2,v 1.49 2011/09/14 11:49:21 apb Exp $
 .\
 .\ Copyright (c) 1980, 1991, 1993, 1994
 .\	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\
 .\ @(#)stat.2	8.4 (Berkeley) 5/1/95
 .\
-.Dd November 25, 2010
+.Dd September 14, 2011
 .Dt STAT 2
 .Os
 .Sh NAME
@@ -98,7 +98,7 @@
 .It Vt time_t Ta st_mtime Ta time of last data modification
 .It Vt time_t Ta st_ctime Ta  time of last file status change
 .It Vt blksize_t Ta st_blksize Ta preferred I/O block size (fs-specific)
-.It Vt blkcnt_t Ta st_block Ta blocks allocated for the file
+.It Vt blkcnt_t Ta st_blocks Ta blocks allocated for the file
 .El
 .Pp
 These are specified in the



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

2011-09-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Sep 14 12:28:09 UTC 2011

Modified Files:
src/sys/compat/linux/common: linux_futex.c linux_futex.h linux_mod.c

Log Message:
Can't use RUN_ONCE here to initialize the futex_lock, otherwise we cannot
unload the module.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/compat/linux/common/linux_futex.c
cvs rdiff -u -r1.4 -r1.5 src/sys/compat/linux/common/linux_futex.h
cvs rdiff -u -r1.1 -r1.2 src/sys/compat/linux/common/linux_mod.c

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

Modified files:

Index: src/sys/compat/linux/common/linux_futex.c
diff -u src/sys/compat/linux/common/linux_futex.c:1.26 src/sys/compat/linux/common/linux_futex.c:1.27
--- src/sys/compat/linux/common/linux_futex.c:1.26	Tue Jul  6 21:30:35 2010
+++ src/sys/compat/linux/common/linux_futex.c	Wed Sep 14 08:28:08 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_futex.c,v 1.26 2010/07/07 01:30:35 chs Exp $ */
+/*	$NetBSD: linux_futex.c,v 1.27 2011/09/14 12:28:08 christos Exp $ */
 
 /*-
  * Copyright (c) 2005 Emmanuel Dreyfus, all rights reserved.
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(1, $NetBSD: linux_futex.c,v 1.26 2010/07/07 01:30:35 chs Exp $);
+__KERNEL_RCSID(1, $NetBSD: linux_futex.c,v 1.27 2011/09/14 12:28:08 christos Exp $);
 
 #include sys/param.h
 #include sys/time.h
@@ -42,7 +42,6 @@
 #include sys/queue.h
 #include sys/condvar.h
 #include sys/mutex.h
-#include sys/once.h
 #include sys/kmem.h
 #include sys/kernel.h
 #include sys/atomic.h
@@ -92,14 +91,18 @@
 #define FUTEXPRINTF(a)
 #endif
 
-static ONCE_DECL(futex_once);
-
-static int
-futex_init(void)
+void
+linux_futex_init(void)
 {
-	FUTEXPRINTF((futex_init: initializing futex\n));
+	FUTEXPRINTF((%s: initializing futex\n, __func__));
 	mutex_init(futex_lock, MUTEX_DEFAULT, IPL_NONE);
-	return 0;
+}
+
+void
+linux_futex_fini(void)
+{
+	FUTEXPRINTF((%s: destroying futex\n, __func__));
+	mutex_destroy(futex_lock);
 }
 
 static struct waiting_proc *futex_wp_alloc(void);
@@ -158,8 +161,6 @@
 	struct waiting_proc *wp;
 	int op_ret;
 
-	RUN_ONCE(futex_once, futex_init);
-
 	/*
 	 * Our implementation provides only private futexes. Most of the apps
 	 * should use private futexes but don't claim so. Therefore we treat

Index: src/sys/compat/linux/common/linux_futex.h
diff -u src/sys/compat/linux/common/linux_futex.h:1.4 src/sys/compat/linux/common/linux_futex.h:1.5
--- src/sys/compat/linux/common/linux_futex.h:1.4	Tue Jul  6 21:30:35 2010
+++ src/sys/compat/linux/common/linux_futex.h	Wed Sep 14 08:28:08 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_futex.h,v 1.4 2010/07/07 01:30:35 chs Exp $ */
+/*	$NetBSD: linux_futex.h,v 1.5 2011/09/14 12:28:08 christos Exp $ */
 
 /*-
  * Copyright (c) 2005 Emmanuel Dreyfus, all rights reserved.
@@ -76,5 +76,7 @@
 struct linux_sys_futex_args;
 int	linux_do_futex(struct lwp *, const struct linux_sys_futex_args *,
 		   register_t *, struct timespec *);
+void	linux_futex_init(void);
+void	linux_futex_fini(void);
 
 #endif /* !_LINUX_FUTEX_H */

Index: src/sys/compat/linux/common/linux_mod.c
diff -u src/sys/compat/linux/common/linux_mod.c:1.1 src/sys/compat/linux/common/linux_mod.c:1.2
--- src/sys/compat/linux/common/linux_mod.c:1.1	Wed Nov 19 13:36:03 2008
+++ src/sys/compat/linux/common/linux_mod.c	Wed Sep 14 08:28:08 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_mod.c,v 1.1 2008/11/19 18:36:03 ad Exp $	*/
+/*	$NetBSD: linux_mod.c,v 1.2 2011/09/14 12:28:08 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: linux_mod.c,v 1.1 2008/11/19 18:36:03 ad Exp $);
+__KERNEL_RCSID(0, $NetBSD: linux_mod.c,v 1.2 2011/09/14 12:28:08 christos Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_execfmt.h
@@ -46,6 +46,7 @@
 #include sys/signalvar.h
 
 #include compat/linux/common/linux_sysctl.h
+#include compat/linux/common/linux_futex.h
 #include compat/linux/common/linux_exec.h
 
 #if defined(EXEC_ELF32)  ELFSIZE == 32
@@ -111,6 +112,7 @@
 
 	switch (cmd) {
 	case MODULE_CMD_INIT:
+		linux_futex_init();
 		linux_sysctl_init();
 		error = exec_add(linux_execsw,
 		__arraycount(linux_execsw));
@@ -121,8 +123,10 @@
 	case MODULE_CMD_FINI:
 		error = exec_remove(linux_execsw,
 		__arraycount(linux_execsw));
-		if (error == 0)
+		if (error == 0) {
 			linux_sysctl_fini();
+			linux_futex_fini();
+		}
 		return error;
 
 	default:



CVS commit: src/sys/kern

2011-09-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Sep 14 12:29:22 UTC 2011

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

Log Message:
don't increment the number of referenced module as a side effect if we fail.
From jmcneill


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/sys/kern/kern_module.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_module.c
diff -u src/sys/kern/kern_module.c:1.80 src/sys/kern/kern_module.c:1.81
--- src/sys/kern/kern_module.c:1.80	Sat Aug 13 17:04:06 2011
+++ src/sys/kern/kern_module.c	Wed Sep 14 08:29:22 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_module.c,v 1.80 2011/08/13 21:04:06 christos Exp $	*/
+/*	$NetBSD: kern_module.c,v 1.81 2011/09/14 12:29:22 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_module.c,v 1.80 2011/08/13 21:04:06 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_module.c,v 1.81 2011/09/14 12:29:22 christos Exp $);
 
 #define _MODULE_INTERNAL
 
@@ -1032,10 +1032,10 @@
 goto fail;
 			}
 			error = module_do_load(buf, true, flags, NULL,
-			mod-mod_required[mod-mod_nrequired++],
-			MODULE_CLASS_ANY, true);
+			mod2, MODULE_CLASS_ANY, true);
 			if (error != 0)
 goto fail;
+			mod-mod_required[mod-mod_nrequired++] = mod2;
 		}
 	}
 



CVS commit: src/sys/kern

2011-09-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Sep 14 12:30:20 UTC 2011

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

Log Message:
- don't if then else the same thing. print a more meaningful message
- don't leak a dictionary on failure
- minor KNF


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/kern/kern_module_vfs.c

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

Modified files:

Index: src/sys/kern/kern_module_vfs.c
diff -u src/sys/kern/kern_module_vfs.c:1.11 src/sys/kern/kern_module_vfs.c:1.12
--- src/sys/kern/kern_module_vfs.c:1.11	Sat Aug  6 04:11:09 2011
+++ src/sys/kern/kern_module_vfs.c	Wed Sep 14 08:30:20 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_module_vfs.c,v 1.11 2011/08/06 08:11:09 mbalmer Exp $	*/
+/*	$NetBSD: kern_module_vfs.c,v 1.12 2011/09/14 12:30:20 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_module_vfs.c,v 1.11 2011/08/06 08:11:09 mbalmer Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_module_vfs.c,v 1.12 2011/09/14 12:30:20 christos Exp $);
 
 #define _MODULE_INTERNAL
 #include sys/param.h
@@ -95,13 +95,8 @@
 	}
 	if (error != 0) {
 		PNBUF_PUT(path);
-		if (autoload) {
-			module_print(Cannot load kernel object `%s'
-			 error=%d, name, error);
-		} else {
-			module_error(Cannot load kernel object `%s'
-			 error=%d, name, error);
-		}
+		module_print(Cannot %sload kernel object `%s'
+		 error=%d, autoload ? auto : , name, error);
 		return error;
 	}
 
@@ -120,6 +115,7 @@
 			if (noload != NULL  prop_bool_true(noload)) {
 module_error(autoloading is disallowed for %s,
 path);
+prop_object_release(moduledict);
 error = EPERM;
 goto fail;
 			}
@@ -148,7 +144,7 @@
  */
 static int
 module_load_plist_vfs(const char *modpath, const bool nochroot,
-		   prop_dictionary_t *filedictp)
+prop_dictionary_t *filedictp)
 {
 	struct pathbuf *pb;
 	struct nameidata nd;



CVS commit: src/distrib/utils/sysinst/arch/acorn32

2011-09-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Sep 14 12:35:19 UTC 2011

Modified Files:
src/distrib/utils/sysinst/arch/acorn32: md.c

Log Message:
fix fprintfs with no format strings.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/distrib/utils/sysinst/arch/acorn32/md.c

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

Modified files:

Index: src/distrib/utils/sysinst/arch/acorn32/md.c
diff -u src/distrib/utils/sysinst/arch/acorn32/md.c:1.27 src/distrib/utils/sysinst/arch/acorn32/md.c:1.28
--- src/distrib/utils/sysinst/arch/acorn32/md.c:1.27	Mon Apr  4 04:30:15 2011
+++ src/distrib/utils/sysinst/arch/acorn32/md.c	Wed Sep 14 08:35:19 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.27 2011/04/04 08:30:15 mbalmer Exp $ */
+/*	$NetBSD: md.c,v 1.28 2011/09/14 12:35:19 christos Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -96,7 +96,7 @@
 	if (lseek(fd, (off_t)FILECORE_BOOT_SECTOR * DEV_BSIZE, SEEK_SET)  0
 	|| read(fd, bb, sizeof(bb)) - sizeof(bb) != 0) {
 		endwin();
-		fprintf(stderr, msg_string(MSG_badreadbb));
+		fprintf(stderr, %s, msg_string(MSG_badreadbb));
 		close(fd);
 		exit(1);
 	}
@@ -129,7 +129,8 @@
 			if (lseek(fd, (off_t)offset * DEV_BSIZE, SEEK_SET)  0
 			|| read(fd, bb, sizeof(bb)) - sizeof(bb) != 0) {
 endwin();
-fprintf(stderr, msg_string(MSG_badreadriscix));
+fprintf(stderr, %s,
+msg_string(MSG_badreadriscix));
 close(fd);
 exit(1);
 			}
@@ -151,7 +152,8 @@
  * leave this disc alone.
  */
 endwin();
-fprintf(stderr, msg_string(MSG_notnetbsdriscix));
+fprintf(stderr, %s,
+msg_string(MSG_notnetbsdriscix));
 close(fd);
 exit(1);
 			}
@@ -164,7 +166,7 @@
 			 * the filecore boot block first with dd.
 			 */
 			endwin();
-			fprintf(stderr, msg_string(MSG_notnetbsd));
+			fprintf(stderr, %s, msg_string(MSG_notnetbsd));
 			close(fd);
 			exit(1);
 		}



CVS commit: src/lib/libkvm

2011-09-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Sep 14 12:37:56 UTC 2011

Modified Files:
src/lib/libkvm: kvm_sun2.c kvm_sun3.c kvm_sun3x.c

Log Message:
more sys/param.h additions


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libkvm/kvm_sun2.c
cvs rdiff -u -r1.14 -r1.15 src/lib/libkvm/kvm_sun3.c
cvs rdiff -u -r1.11 -r1.12 src/lib/libkvm/kvm_sun3x.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/libkvm/kvm_sun2.c
diff -u src/lib/libkvm/kvm_sun2.c:1.5 src/lib/libkvm/kvm_sun2.c:1.6
--- src/lib/libkvm/kvm_sun2.c:1.5	Mon Sep 20 19:23:16 2010
+++ src/lib/libkvm/kvm_sun2.c	Wed Sep 14 08:37:55 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kvm_sun2.c,v 1.5 2010/09/20 23:23:16 jym Exp $ */
+/*	$NetBSD: kvm_sun2.c,v 1.6 2011/09/14 12:37:55 christos Exp $ */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = @(#)kvm_sparc.c	8.1 (Berkeley) 6/4/93;
 #else
-__RCSID($NetBSD: kvm_sun2.c,v 1.5 2010/09/20 23:23:16 jym Exp $);
+__RCSID($NetBSD: kvm_sun2.c,v 1.6 2011/09/14 12:37:55 christos Exp $);
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -48,7 +48,7 @@
  * Note: This file has to build on ALL m68000 machines,
  * so do NOT include any machine / *.h files here.
  */
-
+#include sys/param.h
 #include sys/types.h
 #include sys/kcore.h
 

Index: src/lib/libkvm/kvm_sun3.c
diff -u src/lib/libkvm/kvm_sun3.c:1.14 src/lib/libkvm/kvm_sun3.c:1.15
--- src/lib/libkvm/kvm_sun3.c:1.14	Mon Sep 20 19:23:16 2010
+++ src/lib/libkvm/kvm_sun3.c	Wed Sep 14 08:37:55 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kvm_sun3.c,v 1.14 2010/09/20 23:23:16 jym Exp $	*/
+/*	$NetBSD: kvm_sun3.c,v 1.15 2011/09/14 12:37:55 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = @(#)kvm_sparc.c	8.1 (Berkeley) 6/4/93;
 #else
-__RCSID($NetBSD: kvm_sun3.c,v 1.14 2010/09/20 23:23:16 jym Exp $);
+__RCSID($NetBSD: kvm_sun3.c,v 1.15 2011/09/14 12:37:55 christos Exp $);
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -48,7 +48,7 @@
  * Note: This file has to build on ALL m68k machines,
  * so do NOT include any machine / *.h files here.
  */
-
+#include sys/param.h
 #include sys/types.h
 #include sys/kcore.h
 

Index: src/lib/libkvm/kvm_sun3x.c
diff -u src/lib/libkvm/kvm_sun3x.c:1.11 src/lib/libkvm/kvm_sun3x.c:1.12
--- src/lib/libkvm/kvm_sun3x.c:1.11	Mon Sep 20 19:23:16 2010
+++ src/lib/libkvm/kvm_sun3x.c	Wed Sep 14 08:37:55 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kvm_sun3x.c,v 1.11 2010/09/20 23:23:16 jym Exp $	*/
+/*	$NetBSD: kvm_sun3x.c,v 1.12 2011/09/14 12:37:55 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)kvm_sparc.c	8.1 (Berkeley) 6/4/93;
 #else
-__RCSID($NetBSD: kvm_sun3x.c,v 1.11 2010/09/20 23:23:16 jym Exp $);
+__RCSID($NetBSD: kvm_sun3x.c,v 1.12 2011/09/14 12:37:55 christos Exp $);
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -44,7 +44,7 @@
  * Note: This file has to build on ALL m68k machines,
  * so do NOT include any machine / *.h files here.
  */
-
+#include sys/param.h
 #include sys/types.h
 #include sys/kcore.h
 



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

2011-09-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Sep 14 13:13:21 UTC 2011

Modified Files:
src/sys/arch/x86/acpi: Makefile.wakecode.inc

Log Message:
Don't depend on the .d file here; since this is the only rule, acpi_wakeup.d
will never be build!


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/x86/acpi/Makefile.wakecode.inc

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

Modified files:

Index: src/sys/arch/x86/acpi/Makefile.wakecode.inc
diff -u src/sys/arch/x86/acpi/Makefile.wakecode.inc:1.5 src/sys/arch/x86/acpi/Makefile.wakecode.inc:1.6
--- src/sys/arch/x86/acpi/Makefile.wakecode.inc:1.5	Fri May 20 09:14:58 2011
+++ src/sys/arch/x86/acpi/Makefile.wakecode.inc	Wed Sep 14 09:13:21 2011
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.wakecode.inc,v 1.5 2011/05/20 13:14:58 joerg Exp $
+# $NetBSD: Makefile.wakecode.inc,v 1.6 2011/09/14 13:13:21 christos Exp $
 # FreeBSD: src/sys/i386/acpica/Makefile,v 1.3 2002/05/01 21:54:07 peter Exp
 
 ACPI_WAKECODE_S=	${S}/arch/${MACHINE}/acpi/acpi_wakecode.S
@@ -20,4 +20,4 @@
 	${ACPI_GENCMD} ${ACPI_GENWAKECODE}  acpi_wakecode.h
 	rm -f acpi_wakecode.bin acpi_wakecode.o acpi_wakecode.bin.map
 
-acpi_wakeup.o acpi_wakeup.d: acpi_wakecode.h
+acpi_wakeup.o: acpi_wakecode.h



CVS commit: src/tests/lib/libm

2011-09-14 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Wed Sep 14 13:29:58 UTC 2011

Modified Files:
src/tests/lib/libm: t_cos.c t_sin.c t_tan.c

Log Message:
Additions to PR lib/45362: the float variants cosf(3), sinf(3), and tanf(3)
do not detect NaN for positive and negative infinity on i386 (qemu).


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libm/t_cos.c \
src/tests/lib/libm/t_sin.c src/tests/lib/libm/t_tan.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/libm/t_cos.c
diff -u src/tests/lib/libm/t_cos.c:1.2 src/tests/lib/libm/t_cos.c:1.3
--- src/tests/lib/libm/t_cos.c:1.2	Wed Sep 14 06:50:43 2011
+++ src/tests/lib/libm/t_cos.c	Wed Sep 14 13:29:58 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: t_cos.c,v 1.2 2011/09/14 06:50:43 jruoho Exp $ */
+/* $NetBSD: t_cos.c,v 1.3 2011/09/14 13:29:58 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -206,7 +206,10 @@
 #ifndef __vax__
 	const float x = -1.0L / 0.0L;
 
-	ATF_CHECK(isnan(cosf(x)) != 0);
+	if (isnan(cosf(x)) == 0) {
+		atf_tc_expect_fail(PR lib/45362);
+		atf_tc_fail(cosf(-Inf) != NaN);
+	}
 #endif
 }
 
@@ -221,7 +224,10 @@
 #ifndef __vax__
 	const float x = 1.0L / 0.0L;
 
-	ATF_CHECK(isnan(cosf(x)) != 0);
+	if (isnan(cosf(x)) == 0) {
+		atf_tc_expect_fail(PR lib/45362);
+		atf_tc_fail(cosf(+Inf) != NaN);
+	}
 #endif
 }
 
Index: src/tests/lib/libm/t_sin.c
diff -u src/tests/lib/libm/t_sin.c:1.2 src/tests/lib/libm/t_sin.c:1.3
--- src/tests/lib/libm/t_sin.c:1.2	Wed Sep 14 06:50:43 2011
+++ src/tests/lib/libm/t_sin.c	Wed Sep 14 13:29:58 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: t_sin.c,v 1.2 2011/09/14 06:50:43 jruoho Exp $ */
+/* $NetBSD: t_sin.c,v 1.3 2011/09/14 13:29:58 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -206,7 +206,10 @@
 #ifndef __vax__
 	const float x = -1.0L / 0.0L;
 
-	ATF_CHECK(isnan(sinf(x)) != 0);
+	if (isnan(sinf(x)) == 0) {
+		atf_tc_expect_fail(PR lib/45362);
+		atf_tc_fail(sinf(-Inf) != NaN);
+	}
 #endif
 }
 
@@ -221,7 +224,10 @@
 #ifndef __vax__
 	const float x = 1.0L / 0.0L;
 
-	ATF_CHECK(isnan(sinf(x)) != 0);
+	if (isnan(sinf(x)) == 0) {
+		atf_tc_expect_fail(PR lib/45362);
+		atf_tc_fail(sinf(+Inf) != NaN);
+	}
 #endif
 }
 
Index: src/tests/lib/libm/t_tan.c
diff -u src/tests/lib/libm/t_tan.c:1.2 src/tests/lib/libm/t_tan.c:1.3
--- src/tests/lib/libm/t_tan.c:1.2	Wed Sep 14 06:50:43 2011
+++ src/tests/lib/libm/t_tan.c	Wed Sep 14 13:29:58 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: t_tan.c,v 1.2 2011/09/14 06:50:43 jruoho Exp $ */
+/* $NetBSD: t_tan.c,v 1.3 2011/09/14 13:29:58 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -203,7 +203,10 @@
 #ifndef __vax__
 	const float x = -1.0L / 0.0L;
 
-	ATF_CHECK(isnan(tanf(x)) != 0);
+	if (isnan(tanf(x)) == 0) {
+		atf_tc_expect_fail(PR lib/45362);
+		atf_tc_fail(tanf(-Inf) != NaN);
+	}
 #endif
 }
 
@@ -218,7 +221,10 @@
 #ifndef __vax__
 	const float x = 1.0L / 0.0L;
 
-	ATF_CHECK(isnan(tanf(x)) != 0);
+	if (isnan(tanf(x)) == 0) {
+		atf_tc_expect_fail(PR lib/45362);
+		atf_tc_fail(tanf(+Inf) != NaN);
+	}
 #endif
 }
 



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

2011-09-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Sep 14 14:34:37 UTC 2011

Modified Files:
src/tests/lib/libc/stdio: t_fopen.c

Log Message:
A test case may not assume opening /dev/tty does something sensible.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/stdio/t_fopen.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/stdio/t_fopen.c
diff -u src/tests/lib/libc/stdio/t_fopen.c:1.2 src/tests/lib/libc/stdio/t_fopen.c:1.3
--- src/tests/lib/libc/stdio/t_fopen.c:1.2	Mon Sep 12 04:23:29 2011
+++ src/tests/lib/libc/stdio/t_fopen.c	Wed Sep 14 14:34:37 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_fopen.c,v 1.2 2011/09/12 04:23:29 jruoho Exp $ */
+/*	$NetBSD: t_fopen.c,v 1.3 2011/09/14 14:34:37 martin Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__RCSID($NetBSD: t_fopen.c,v 1.2 2011/09/12 04:23:29 jruoho Exp $);
+__RCSID($NetBSD: t_fopen.c,v 1.3 2011/09/14 14:34:37 martin Exp $);
 
 #include atf-c.h
 #include errno.h
@@ -312,7 +312,7 @@
 ATF_TC_BODY(fopen_regular, tc)
 {
 	static const char *mode[] = { rf, r+f, wf, w+f, af, a+f };
-	static const char *devs[] = { _PATH_DEVNULL, _PATH_TTY };
+	static const char *devs[] = { _PATH_DEVNULL };
 
 	size_t i, j;
 	FILE *f;



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

2011-09-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Sep 14 14:58:43 UTC 2011

Modified Files:
src/sys/arch/x86/acpi: Makefile.wakecode.inc

Log Message:
revert previous; bug was in the position of the inclusion of the file.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/x86/acpi/Makefile.wakecode.inc

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

Modified files:

Index: src/sys/arch/x86/acpi/Makefile.wakecode.inc
diff -u src/sys/arch/x86/acpi/Makefile.wakecode.inc:1.6 src/sys/arch/x86/acpi/Makefile.wakecode.inc:1.7
--- src/sys/arch/x86/acpi/Makefile.wakecode.inc:1.6	Wed Sep 14 09:13:21 2011
+++ src/sys/arch/x86/acpi/Makefile.wakecode.inc	Wed Sep 14 10:58:43 2011
@@ -1,8 +1,9 @@
-# $NetBSD: Makefile.wakecode.inc,v 1.6 2011/09/14 13:13:21 christos Exp $
+# $NetBSD: Makefile.wakecode.inc,v 1.7 2011/09/14 14:58:43 christos Exp $
 # FreeBSD: src/sys/i386/acpica/Makefile,v 1.3 2002/05/01 21:54:07 peter Exp
 
 ACPI_WAKECODE_S=	${S}/arch/${MACHINE}/acpi/acpi_wakecode.S
 ACPI_GENWAKECODE=	${S}/arch/x86/acpi/genwakecode.sh
+ACPI_WAKEUP_C=		${S}/arch/x86/acpi/acpi_wakeup.c
 ACPI_GENCMD=		AWK=${TOOL_AWK:Q} \
 			HEXDUMP=${TOOL_HEXDUMP:Q} \
 			SED=${TOOL_SED:Q} \
@@ -20,4 +21,4 @@
 	${ACPI_GENCMD} ${ACPI_GENWAKECODE}  acpi_wakecode.h
 	rm -f acpi_wakecode.bin acpi_wakecode.o acpi_wakecode.bin.map
 
-acpi_wakeup.o: acpi_wakecode.h
+acpi_wakeup.o acpu_wakeup.d: acpi_wakecode.h



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

2011-09-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Sep 14 14:59:30 UTC 2011

Modified Files:
src/sys/arch/amd64/conf: Makefile.amd64

Log Message:
include wakecode after kernel rules so that the .depend rules are defined


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/amd64/conf/Makefile.amd64

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/conf/Makefile.amd64
diff -u src/sys/arch/amd64/conf/Makefile.amd64:1.38 src/sys/arch/amd64/conf/Makefile.amd64:1.39
--- src/sys/arch/amd64/conf/Makefile.amd64:1.38	Tue Aug  2 13:22:51 2011
+++ src/sys/arch/amd64/conf/Makefile.amd64	Wed Sep 14 10:59:29 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.amd64,v 1.38 2011/08/02 17:22:51 joerg Exp $
+#	$NetBSD: Makefile.amd64,v 1.39 2011/09/14 14:59:29 christos Exp $
 
 # Makefile for NetBSD
 #
@@ -107,14 +107,14 @@
 
 %RULES
 
-## Include rules for ACPI wakecode
-.include $S/arch/x86/acpi/Makefile.wakecode.inc
-
 ##
 ## (9) port independent kernel machinery
 ##
 .include $S/conf/Makefile.kern.inc
 
+## Include rules for ACPI wakecode
+.include $S/arch/x86/acpi/Makefile.wakecode.inc
+
 ##
 ## (10) Appending make options.
 ##



CVS commit: src/external/bsd/ntp/dist/ntpd

2011-09-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Sep 14 16:18:29 UTC 2011

Modified Files:
src/external/bsd/ntp/dist/ntpd: ntp_io.c

Log Message:
PR/45308: Manuel Bouyer: Update list of broadcast addresses after updating
interfaces.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/ntp/dist/ntpd/ntp_io.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/ntp/dist/ntpd/ntp_io.c
diff -u src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.5 src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.6
--- src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.5	Sun Jan  9 09:49:40 2011
+++ src/external/bsd/ntp/dist/ntpd/ntp_io.c	Wed Sep 14 12:18:29 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ntp_io.c,v 1.5 2011/01/09 14:49:40 kardel Exp $	*/
+/*	$NetBSD: ntp_io.c,v 1.6 2011/09/14 16:18:29 christos Exp $	*/
 
 /*
  * ntp_io.c - input/output routines for ntpd.	The socket-opening code
@@ -1782,7 +1782,10 @@
 	create_wildcards(port);
 
 	update_interfaces(port, NULL, NULL);
-	
+
+	if (sys_bclient)
+		io_setbclient();
+
 	/*
 	 * Now that we have opened all the sockets, turn off the reuse
 	 * flag for security.



CVS commit: src/external/lgpl3/gmp/dist/mpn

2011-09-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Sep 14 16:35:22 UTC 2011

Modified Files:
src/external/lgpl3/gmp/dist/mpn: Makefile.in

Log Message:
PR/45367: Gr�goire Sutre: don't depend on m4-ccas and cpp-ccas to be
executable; invoke the shell to run them.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/lgpl3/gmp/dist/mpn/Makefile.in

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

Modified files:

Index: src/external/lgpl3/gmp/dist/mpn/Makefile.in
diff -u src/external/lgpl3/gmp/dist/mpn/Makefile.in:1.1.1.1 src/external/lgpl3/gmp/dist/mpn/Makefile.in:1.2
--- src/external/lgpl3/gmp/dist/mpn/Makefile.in:1.1.1.1	Mon Jun 20 01:54:38 2011
+++ src/external/lgpl3/gmp/dist/mpn/Makefile.in	Wed Sep 14 12:35:22 2011
@@ -994,7 +994,7 @@
 	$(CCAS) $(COMPILE_FLAGS) tmp-$*.s -o $@
 	$(RM_TMP) tmp-$*.s
 .S.lo:
-	$(LIBTOOL) --mode=compile --tag=CC $(top_srcdir)/mpn/cpp-ccas --cpp=$(CPP) $(PREPROCESS_FLAGS) $(CCAS) $(COMPILE_FLAGS) `test -f '$' || echo '$(srcdir)/'`$
+	$(LIBTOOL) --mode=compile --tag=CC $(SHELL) $(top_srcdir)/mpn/cpp-ccas --cpp=$(CPP) $(PREPROCESS_FLAGS) $(CCAS) $(COMPILE_FLAGS) `test -f '$' || echo '$(srcdir)/'`$
 
 # .asm assembler, preprocessed with m4.
 #
@@ -1022,7 +1022,7 @@
 	$(CCAS) $(COMPILE_FLAGS) tmp-$*.s -o $@
 	$(RM_TMP) tmp-$*.s
 .asm.lo:
-	$(LIBTOOL) --mode=compile --tag=CC $(top_srcdir)/mpn/m4-ccas --m4=$(M4) $(CCAS) $(COMPILE_FLAGS) `test -f '$' || echo '$(srcdir)/'`$
+	$(LIBTOOL) --mode=compile --tag=CC $(SHELL) $(top_srcdir)/mpn/m4-ccas --m4=$(M4) $(CCAS) $(COMPILE_FLAGS) `test -f '$' || echo '$(srcdir)/'`$
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.



CVS commit: src

2011-09-14 Thread Alan Barrett
Module Name:src
Committed By:   apb
Date:   Wed Sep 14 17:35:45 UTC 2011

Modified Files:
src: build.sh

Log Message:
When using random versions of make to try to find the TOOLDIR,
redirect 2/dev/null.  This should hide error messages like
*** missing separator.  Stop. when GNU make doesn't
understand .include.


To generate a diff of this commit:
cvs rdiff -u -r1.249 -r1.250 src/build.sh

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

Modified files:

Index: src/build.sh
diff -u src/build.sh:1.249 src/build.sh:1.250
--- src/build.sh:1.249	Fri Sep  9 18:48:34 2011
+++ src/build.sh	Wed Sep 14 17:35:44 2011
@@ -1,5 +1,5 @@
 #! /usr/bin/env sh
-#	$NetBSD: build.sh,v 1.249 2011/09/09 18:48:34 apb Exp $
+#	$NetBSD: build.sh,v 1.250 2011/09/14 17:35:44 apb Exp $
 #
 # Copyright (c) 2001-2011 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -746,7 +746,7 @@
 EOF
 }
 
-# nobomb_getmakevar --
+# bomb_getmakevar --
 # Given the name of a make variable in $1, print make's idea of the
 # value of that variable, or bomb if there's an error.
 #
@@ -756,7 +756,7 @@
 	nobomb_getmakevar $1 || bomb bomb_getmakevar $1: ${make} failed
 }
 
-# nobomb_getmakevar --
+# getmakevar --
 # Given the name of a make variable in $1, print make's idea of the
 # value of that variable, or print a literal '$' followed by the
 # variable name if ${make} is not executable.  This is intended for use in
@@ -1222,8 +1222,9 @@
 #   a copy of ${toolprefix}make (this should work for everybody who
 #   doesn't override TOOLDIR via /etc/mk.conf);
 # * Failing that, search for ${toolprefix}make, nbmake, bmake, or make,
-#   in the PATH (this might accidentally find a non-NetBSD version of
-#   make, which will lead to failure in the next step);
+#   in the PATH (this might accidentally find a version of make that
+#   does not understand the syntax used by NetBSD make, and that will
+#   lead to failure in the next step);
 # * If a copy of make was found above, try to use it with
 #   nobomb_getmakevar to find the correct value for TOOLDIR, and believe the
 #   result only if it's a directory that already exists;
@@ -1300,7 +1301,8 @@
 	#
 	if [ -x ${possible_make} ]; then
 		possible_TOOLDIR=$(
-			make=${possible_make} nobomb_getmakevar TOOLDIR
+			make=${possible_make} \
+			nobomb_getmakevar TOOLDIR 2/dev/null
 			)
 		if [ $? = 0 ]  [ -n ${possible_TOOLDIR} ] \
 		 [ -d ${possible_TOOLDIR} ];
@@ -1630,7 +1632,7 @@
 	eval cat EOF ${makewrapout}
 #! ${HOST_SH}
 # Set proper variables to allow easy make building of a NetBSD subtree.
-# Generated from:  \$NetBSD: build.sh,v 1.249 2011/09/09 18:48:34 apb Exp $
+# Generated from:  \$NetBSD: build.sh,v 1.250 2011/09/14 17:35:44 apb Exp $
 # with these arguments: ${_args}
 #
 



CVS commit: src/sys/arch/usermode

2011-09-14 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Sep 14 18:26:25 UTC 2011

Modified Files:
src/sys/arch/usermode/include: thunk.h
src/sys/arch/usermode/usermode: thunk.c

Log Message:
Provide thunk fuction to return the host machine's VM_MIN_ADDRESS


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/usermode/include/thunk.h
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/usermode/usermode/thunk.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/usermode/include/thunk.h
diff -u src/sys/arch/usermode/include/thunk.h:1.32 src/sys/arch/usermode/include/thunk.h:1.33
--- src/sys/arch/usermode/include/thunk.h:1.32	Fri Sep  9 20:04:43 2011
+++ src/sys/arch/usermode/include/thunk.h	Wed Sep 14 18:26:24 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.h,v 1.32 2011/09/09 20:04:43 reinoud Exp $ */
+/* $NetBSD: thunk.h,v 1.33 2011/09/14 18:26:24 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -126,6 +126,7 @@
 int	thunk_posix_memalign(void **, size_t, size_t);
 
 char *	thunk_getenv(const char *);
+vaddr_t	thunk_get_vm_min_address(void);
 
 int	thunk_sdl_init(unsigned int, unsigned int, unsigned short);
 void *	thunk_sdl_getfb(size_t);

Index: src/sys/arch/usermode/usermode/thunk.c
diff -u src/sys/arch/usermode/usermode/thunk.c:1.36 src/sys/arch/usermode/usermode/thunk.c:1.37
--- src/sys/arch/usermode/usermode/thunk.c:1.36	Fri Sep  9 20:04:43 2011
+++ src/sys/arch/usermode/usermode/thunk.c	Wed Sep 14 18:26:24 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.c,v 1.36 2011/09/09 20:04:43 reinoud Exp $ */
+/* $NetBSD: thunk.c,v 1.37 2011/09/14 18:26:24 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -28,11 +28,12 @@
 
 #include sys/cdefs.h
 #ifdef __NetBSD__
-__RCSID($NetBSD: thunk.c,v 1.36 2011/09/09 20:04:43 reinoud Exp $);
+__RCSID($NetBSD: thunk.c,v 1.37 2011/09/14 18:26:24 reinoud Exp $);
 #endif
 
 #include sys/types.h
 #include sys/mman.h
+#include machine/vmparam.h
 
 #include aio.h
 #include assert.h
@@ -522,3 +523,10 @@
 {
 	return getenv(name);
 }
+
+vaddr_t
+thunk_get_vm_min_address(void)
+{
+	return VM_MIN_ADDRESS;
+}
+



CVS commit: src/sys/arch/usermode

2011-09-14 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Sep 14 18:28:36 UTC 2011

Modified Files:
src/sys/arch/usermode/conf: GENERIC Makefile.usermode
src/sys/arch/usermode/usermode: machdep.c pmap.c

Log Message:
Implement in-place execution for binaries! No more MKPIE/MKPIC for userland
anymore!


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/usermode/conf/GENERIC
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/usermode/conf/Makefile.usermode
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/usermode/usermode/machdep.c
cvs rdiff -u -r1.60 -r1.61 src/sys/arch/usermode/usermode/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/usermode/conf/GENERIC
diff -u src/sys/arch/usermode/conf/GENERIC:1.15 src/sys/arch/usermode/conf/GENERIC:1.16
--- src/sys/arch/usermode/conf/GENERIC:1.15	Wed Aug 31 12:42:41 2011
+++ src/sys/arch/usermode/conf/GENERIC	Wed Sep 14 18:28:36 2011
@@ -1,15 +1,15 @@
-# $NetBSD: GENERIC,v 1.15 2011/08/31 12:42:41 reinoud Exp $
+# $NetBSD: GENERIC,v 1.16 2011/09/14 18:28:36 reinoud Exp $
 
 include arch/usermode/conf/std.usermode
 
 options 	INCLUDE_CONFIG_FILE
-#ident 		GENERIC-$Revision: 1.15 $
+#ident 		GENERIC-$Revision: 1.16 $
 maxusers 	32
 
 makeoptions	DEBUG=-O1 -g3
 
-#options 	MEMSIZE=65536	# amount of memory to allocate (in KB)
-options 	MEMSIZE=131072	# amount of memory to use for userland (in KB)
+options		TEXTADDR=0x6000	# 1.5 Gb?
+options		KVMSIZE =0x1000
 
 options 	RTC_OFFSET=0
 options 	KTRACE
@@ -22,10 +22,10 @@
 options 	DEBUG
 options 	DIAGNOSTIC
 options		LOCKDEBUG
-options 	DEBUG_EXEC
-#options		CPU_DEBUG
-#options		UVMHIST
-#options		UVMHIST_PRINT
+#options 	DEBUG_EXEC
+#options	CPU_DEBUG
+#options	UVMHIST
+#options	UVMHIST_PRINT
 
 options 	COMPAT_BSDPTY
 options 	COMPAT_50
@@ -48,6 +48,10 @@
 ttycons0	at mainbus?
 ld0		at mainbus?
 
+#options		SDL
+#genfb0		at thunkbus?
+#wsdisplay0	at genfb?
+
 pseudo-device	loop
 
 # Pull in optional local configuration

Index: src/sys/arch/usermode/conf/Makefile.usermode
diff -u src/sys/arch/usermode/conf/Makefile.usermode:1.20 src/sys/arch/usermode/conf/Makefile.usermode:1.21
--- src/sys/arch/usermode/conf/Makefile.usermode:1.20	Thu Sep  8 11:53:18 2011
+++ src/sys/arch/usermode/conf/Makefile.usermode	Wed Sep 14 18:28:36 2011
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.usermode,v 1.20 2011/09/08 11:53:18 jmcneill Exp $
+# $NetBSD: Makefile.usermode,v 1.21 2011/09/14 18:28:36 reinoud Exp $
 
 OPT_CPU_HOST=			%CPU_HOST%
 .if !empty(OPT_CPU_HOST)
@@ -21,7 +21,7 @@
 ##
 USERMODE_HOSTOS!=uname -s
 USERMODE_HOSTMACHINE!=uname -m
-USERMODE_LIBS=	-lrt
+USERMODE_LIBS=	-lc -lrt
 USERMODE_CPPFLAGS=${DEBUG} -U_KERNEL -I/usr/include
 USERMODE_CPPFLAGS+=${CWARNFLAGS} ${NOGCCERROR:D:U-Werror}
 
@@ -76,10 +76,17 @@
 ##
 ## (5) link settings
 ##
+TEXTADDR?=	0x6000
+KVMSIZE?=	0x1000
+
+LINKFLAGS_NORMAL=	-X
+KERN_LDSCRIPT?=	kern.ldscript
+#LINKFORMAT=	-T ${USERMODE}/conf/${KERN_LDSCRIPT}
+
 SYSTEM_LD=	@${_MKSHMSG}link  ${.CURDIR:T}/${.TARGET}; \
 		${_MKSHECHO}\
-		${CC} -static ${COPTS} -Wl,-Map,$@.map -o $@ '$${SYSTEM_OBJ}' '$${EXTRA_OBJ}' vers.o ${USERMODE_LIBS}; \
-		${CC} -static ${COPTS} -Wl,-Map,$@.map -o $@ ${SYSTEM_OBJ} ${EXTRA_OBJ} vers.o ${USERMODE_LIBS}
+		${CC} -static ${COPTS} -Wl,-Map,$@.map -o $@ ${LINKFORMAT} -Ttext ${TEXTADDR} '$${SYSTEM_OBJ}' '$${EXTRA_OBJ}' vers.o ${USERMODE_LIBS}; \
+		${CC} -static ${COPTS} -Wl,-Map,$@.map -o $@ ${LINKFORMAT} -Ttext ${TEXTADDR} ${SYSTEM_OBJ} ${EXTRA_OBJ} vers.o ${USERMODE_LIBS}
 NVFLAGS=	-n
 
 ##

Index: src/sys/arch/usermode/usermode/machdep.c
diff -u src/sys/arch/usermode/usermode/machdep.c:1.30 src/sys/arch/usermode/usermode/machdep.c:1.31
--- src/sys/arch/usermode/usermode/machdep.c:1.30	Mon Sep 12 12:24:34 2011
+++ src/sys/arch/usermode/usermode/machdep.c	Wed Sep 14 18:28:36 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.30 2011/09/12 12:24:34 reinoud Exp $ */
+/* $NetBSD: machdep.c,v 1.31 2011/09/14 18:28:36 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Reinoud Zandijk rein...@netbsd.org
@@ -32,7 +32,7 @@
 #include opt_urkelvisor.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.30 2011/09/12 12:24:34 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.31 2011/09/14 18:28:36 reinoud Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -58,9 +58,6 @@
 char machine[] = usermode;
 char machine_arch[] = usermode;
 
-/* XXX */
-int	physmem = MEMSIZE * 1024 / PAGE_SIZE;
-
 static char **saved_argv;
 char *usermode_root_image_path = NULL;
 

Index: src/sys/arch/usermode/usermode/pmap.c
diff -u src/sys/arch/usermode/usermode/pmap.c:1.60 src/sys/arch/usermode/usermode/pmap.c:1.61
--- src/sys/arch/usermode/usermode/pmap.c:1.60	Tue Sep 13 10:38:48 2011
+++ src/sys/arch/usermode/usermode/pmap.c	Wed Sep 14 18:28:36 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.60 2011/09/13 10:38:48 reinoud Exp $ */
+/* $NetBSD: 

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

2011-09-14 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Sep 14 18:30:13 UTC 2011

Modified Files:
src/sys/arch/usermode/dev: cpu.c

Log Message:
Make stacksize of newly spawn lwp's bigger than one page. Actually use the
variable stack_size now


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/usermode/dev/cpu.c

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

Modified files:

Index: src/sys/arch/usermode/dev/cpu.c
diff -u src/sys/arch/usermode/dev/cpu.c:1.45 src/sys/arch/usermode/dev/cpu.c:1.46
--- src/sys/arch/usermode/dev/cpu.c:1.45	Sat Sep 10 10:37:06 2011
+++ src/sys/arch/usermode/dev/cpu.c	Wed Sep 14 18:30:13 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.45 2011/09/10 10:37:06 reinoud Exp $ */
+/* $NetBSD: cpu.c,v 1.46 2011/09/14 18:30:13 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -30,7 +30,7 @@
 #include opt_hz.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.45 2011/09/10 10:37:06 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.46 2011/09/14 18:30:13 reinoud Exp $);
 
 #include sys/param.h
 #include sys/conf.h
@@ -318,9 +318,9 @@
 	/* copy the PCB and its switchframes from parent */
 	memcpy(pcb2, pcb1, sizeof(struct pcb));
 
-	stacksize = PAGE_SIZE;
-	stack_ucp  = malloc(PAGE_SIZE, M_TEMP, M_NOWAIT);
-	stack_syscall_ucp  = malloc(PAGE_SIZE, M_TEMP, M_NOWAIT);
+	stacksize = 4*PAGE_SIZE;
+	stack_ucp  = malloc(stacksize, M_TEMP, M_NOWAIT);
+	stack_syscall_ucp  = malloc(stacksize, M_TEMP, M_NOWAIT);
 	pcb2-pcb_needfree = true;
 
 	if (thunk_getcontext(pcb2-pcb_ucp))



CVS commit: src/sys/arch/usermode/usermode

2011-09-14 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Sep 14 19:45:27 UTC 2011

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

Log Message:
Code audit revealed missing brackets and a silly old constant of 1024
lingering around. Fixed with the right values.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/usermode/usermode/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/usermode/usermode/pmap.c
diff -u src/sys/arch/usermode/usermode/pmap.c:1.61 src/sys/arch/usermode/usermode/pmap.c:1.62
--- src/sys/arch/usermode/usermode/pmap.c:1.61	Wed Sep 14 18:28:36 2011
+++ src/sys/arch/usermode/usermode/pmap.c	Wed Sep 14 19:45:27 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.61 2011/09/14 18:28:36 reinoud Exp $ */
+/* $NetBSD: pmap.c,v 1.62 2011/09/14 19:45:27 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Reinoud Zandijk rein...@netbsd.org
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.61 2011/09/14 18:28:36 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.62 2011/09/14 19:45:27 reinoud Exp $);
 
 #include opt_memsize.h
 #include opt_kmempages.h
@@ -769,7 +769,7 @@
 	 * to the header.  Otherwise we must search the list for
 	 * the entry.  In either case we free the now unused entry.
 	 */
-	if (pmap == pv-pv_pmap  lpn == pv-pv_lpn) {
+	if ((pmap == pv-pv_pmap)  (lpn == pv-pv_lpn)) {
 		npv = pv-pv_next;
 		if (npv) {
 			/* Pull up first entry from chain. */
@@ -973,7 +973,7 @@
 
 	active_pmap = NULL;
 	pmap-pm_flags =~ PM_ACTIVE;
-	for (i = 0; i  1024; i++) {
+	for (i = 0; i  pm_nentries; i++) {
 		if (pmap-pm_entries[i] != NULL) {
 			pmap_page_deactivate(pmap-pm_entries[i]);
 //			MEMC_WRITE(pmap-pm_entries[i]-pv_deactivate);



CVS commit: src/lib/libc/stdlib

2011-09-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Sep 14 23:33:51 UTC 2011

Modified Files:
src/lib/libc/stdlib: Makefile.inc hcreate.3 hcreate.c

Log Message:
add re-entrant versions of the hash functions based on the GNU api.


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/lib/libc/stdlib/Makefile.inc
cvs rdiff -u -r1.8 -r1.9 src/lib/libc/stdlib/hcreate.3
cvs rdiff -u -r1.6 -r1.7 src/lib/libc/stdlib/hcreate.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/stdlib/Makefile.inc
diff -u src/lib/libc/stdlib/Makefile.inc:1.77 src/lib/libc/stdlib/Makefile.inc:1.78
--- src/lib/libc/stdlib/Makefile.inc:1.77	Wed Apr 13 03:12:52 2011
+++ src/lib/libc/stdlib/Makefile.inc	Wed Sep 14 19:33:51 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.77 2011/04/13 07:12:52 jruoho Exp $
+#	$NetBSD: Makefile.inc,v 1.78 2011/09/14 23:33:51 christos Exp $
 #	from: @(#)Makefile.inc	8.3 (Berkeley) 2/4/95
 
 # stdlib sources
@@ -65,6 +65,7 @@
 MLINKS+=getenv.3 setenv.3 getenv.3 unsetenv.3 getenv.3 putenv.3
 MLINKS+=getenv.3 getenv_r.3
 MLINKS+=hcreate.3 hdestroy.3 hcreate.3 hsearch.3
+MLINKS+=hcreate.3 hcreate_r.3 hcreate.3 hdestroy_r.3 hcreate.3 hsearch_r.3
 MLINKS+=insque.3 remque.3
 MLINKS+=lsearch.3 lfind.3
 MLINKS+=malloc.3 calloc.3 malloc.3 realloc.3 malloc.3 free.3

Index: src/lib/libc/stdlib/hcreate.3
diff -u src/lib/libc/stdlib/hcreate.3:1.8 src/lib/libc/stdlib/hcreate.3:1.9
--- src/lib/libc/stdlib/hcreate.3:1.8	Sat May  1 02:18:03 2010
+++ src/lib/libc/stdlib/hcreate.3	Wed Sep 14 19:33:51 2011
@@ -1,4 +1,4 @@
-.\ 	$NetBSD: hcreate.3,v 1.8 2010/05/01 06:18:03 jruoho Exp $
+.\ 	$NetBSD: hcreate.3,v 1.9 2011/09/14 23:33:51 christos Exp $
 .\
 .\ Copyright (c) 1999 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -27,13 +27,16 @@
 .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\ POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd May 1, 2010
+.Dd September 14, 2011
 .Dt HCREATE 3
 .Os
 .Sh NAME
 .Nm hcreate ,
+.Nm hcreate_r ,
 .Nm hdestroy ,
-.Nm hsearch
+.Nm hdestroy_r ,
+.Nm hsearch ,
+.Nm hsearch_r
 .Nd manage hash search table
 .Sh LIBRARY
 .Lb libc
@@ -41,16 +44,25 @@
 .In search.h
 .Ft int
 .Fn hcreate size_t nel
+.Ft int
+.Fn hcreate_r size_t nel struct hsearch_data *table
 .Ft void
 .Fn hdestroy void
+.Ft void
+.Fn hdestroy_r struct hsearch_data *table
 .Ft ENTRY *
 .Fn hsearch ENTRY item ACTION action
+.Ft int
+.Fn hsearch_r ENTRY item ACTION action ENTRY ** itemp struct hsearch_data *table
 .Sh DESCRIPTION
 The
 .Fn hcreate ,
-.Fn hdestroy
+.Fn hcreate_r ,
+.Fn hdestroy ,
+.Fn hdestroy_r
 and
-.Fn hsearch
+.Fn hsearch ,
+.Fn hsearch_r
 functions manage hash search tables.
 .Pp
 The
@@ -152,18 +164,46 @@
 .Fa key
 is allocated by using
 .Xr strdup 3 .
+.Pp
+The
+.Fn hcreate_r ,
+.Fn hdestroy_r ,
+and
+.Fn hsearch_r
+are re-entrant versions of the above functions that can operate on a table
+supplied by the user.
+The
+.Fn hsearch_r
+function returns
+.Dv 0
+if the action is
+.Dv ENTER
+and the element cannot be created,
+.Dv 1
+otherwise.
+If the element exists or can be created, it will be placed in
+.Fa itemp ,
+otherwise
+.Fa itemp
+will be set to
+.Dv NULL .
 .Sh RETURN VALUES
 If successful, the
 .Fn hcreate
-function returns a non-zero value.
-Otherwise, a value of 0 is returned and
+and
+.Fn hcreate_r
+function return a non-zero value.
+Otherwise, a value of
+.Dv 0
+is returned and
 .Va errno
 is set to indicate the error.
 .Pp
 The
 .Fn hdestroy
-functions
-returns no value.
+and
+.Fn hdestroy_r
+functions return no value.
 .Pp
 If successful, the
 .Fn hsearch
@@ -182,16 +222,45 @@
 .Dv ENTER
 and an entry already existed in the table matching the given
 key, the existing entry is returned and is not replaced.
+.Pp
+The
+.Fn hsearch_r
+function returns
+.Dv 1
+unless the table is full, when it returns
+.Dv 0 .
+If the
+.Fn hsearch
+returns
+.Dv 0
+or the element is not found,
+.Va errno
+is set to indicate the error.
 .Sh ERRORS
 The
-.Fn hcreate
-and
+.Fn hcreate ,
+.Fn hcreate_r ,
 .Fn hsearch
+and
+.Fn hsearch_r
 functions will fail if:
 .Bl -tag -width Er
 .It Bq Er ENOMEM
 Insufficient memory is available.
 .El
+.Pp
+The
+.Fn hsearch
+and
+.Fn hsearch_r
+functions will also fail if the action is
+.Dv SEARCH and the element is not found:
+.Bl -tag -width Er
+.It Bq Er ESRCH
+The 
+.Fa item
+given is not found.
+.El
 .Sh SEE ALSO
 .Xr bsearch 3 ,
 .Xr lsearch 3 ,
@@ -213,11 +282,21 @@
 .Fn hsearch
 functions first appeared in
 .At V .
+The
+.Fn hcreate_r ,
+.Fn hdestroy_r
+and
+.Fn hsearch_r
+are
+.Tn GNU
+extensions.
 .Sh CAVEATS
 At least the following limitations can be mentioned:
 .Bl -bullet
 .It
-The interface permits the use of only one hash table at a time.
+The original, non-
+.Tn GNU
+interface permits the use of only one hash table at a time.
 .It
 Individual hash table entries can be added, but not deleted.
 .It

Index: 

CVS commit: src/include

2011-09-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Sep 14 23:34:27 UTC 2011

Modified Files:
src/include: search.h

Log Message:
add re-entrant versions of the hash api based on the GNU extensions.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/include/search.h

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

Modified files:

Index: src/include/search.h
diff -u src/include/search.h:1.18 src/include/search.h:1.19
--- src/include/search.h:1.18	Wed Jul  6 11:47:15 2005
+++ src/include/search.h	Wed Sep 14 19:34:26 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: search.h,v 1.18 2005/07/06 15:47:15 drochner Exp $	*/
+/*	$NetBSD: search.h,v 1.19 2011/09/14 23:34:26 christos Exp $	*/
 
 /*
  * Written by J.T. Conklin j...@netbsd.org
@@ -21,6 +21,15 @@
 	void *data;
 } ENTRY;
 
+#ifdef _NETBSD_SOURCE
+struct _ENTRY;
+struct hsearch_data {
+	struct _ENTRY *table;
+	size_t size;
+	size_t filled;
+};
+#endif
+
 typedef enum {
 	FIND, ENTER
 } ACTION;
@@ -46,10 +55,17 @@
 void	*bsearch(const void *, const void *, size_t, size_t,
 		  int (*)(const void *, const void *));
 #endif /* __BSEARCH_DECLARED */
+
 int	 hcreate(size_t);
 void	 hdestroy(void);
 ENTRY	*hsearch(ENTRY, ACTION);
 
+#ifdef _NETBSD_SOURCE
+int	 hcreate_r(size_t, struct hsearch_data *);
+void	 hdestroy_r(struct hsearch_data *);
+int	 hsearch_r(ENTRY, ACTION, ENTRY **, struct hsearch_data *);
+#endif /* _NETBSD_SOURCE */
+
 void	*lfind(const void *, const void *, size_t *, size_t,
 		  int (*)(const void *, const void *));
 void	*lsearch(const void *, void *, size_t *, size_t,



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

2011-09-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Sep 14 23:37:33 UTC 2011

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

Log Message:
add h{create,destroy,search}_r


To generate a diff of this commit:
cvs rdiff -u -r1.1673 -r1.1674 src/distrib/sets/lists/comp/mi

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

Modified files:

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.1673 src/distrib/sets/lists/comp/mi:1.1674
--- src/distrib/sets/lists/comp/mi:1.1673	Mon Sep 12 17:13:31 2011
+++ src/distrib/sets/lists/comp/mi	Wed Sep 14 19:37:32 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.1673 2011/09/12 21:13:31 christos Exp $
+#	$NetBSD: mi,v 1.1674 2011/09/14 23:37:32 christos Exp $
 #
 # Note: don't delete entries from here - mark them as obsolete instead.
 #
@@ -6777,7 +6777,9 @@
 ./usr/share/man/cat3/has_il.0			comp-c-catman		.cat
 ./usr/share/man/cat3/hash.0			comp-c-catman		.cat
 ./usr/share/man/cat3/hcreate.0			comp-c-catman		.cat
+./usr/share/man/cat3/hcreate_r.0		comp-c-catman		.cat
 ./usr/share/man/cat3/hdestroy.0			comp-c-catman		.cat
+./usr/share/man/cat3/hdestroy_r.0		comp-c-catman		.cat
 ./usr/share/man/cat3/heapsort.0			comp-c-catman		.cat
 ./usr/share/man/cat3/herror.0			comp-c-catman		.cat
 ./usr/share/man/cat3/hesiod.0			comp-c-catman		hesiod,.cat
@@ -6807,6 +6809,7 @@
 ./usr/share/man/cat3/hosts_access.0		comp-c-catman		.cat
 ./usr/share/man/cat3/hosts_ctl.0		comp-c-catman		.cat
 ./usr/share/man/cat3/hsearch.0			comp-c-catman		.cat
+./usr/share/man/cat3/hsearch_r.0		comp-c-catman		.cat
 ./usr/share/man/cat3/hstrerror.0		comp-c-catman		.cat
 ./usr/share/man/cat3/htonl.0			comp-c-catman		.cat
 ./usr/share/man/cat3/htons.0			comp-c-catman		.cat
@@ -12938,7 +12941,9 @@
 ./usr/share/man/html3/has_il.html		comp-c-htmlman		html
 ./usr/share/man/html3/hash.html			comp-c-htmlman		html
 ./usr/share/man/html3/hcreate.html		comp-c-htmlman		html
+./usr/share/man/html3/hcreate_r.html		comp-c-htmlman		html
 ./usr/share/man/html3/hdestroy.html		comp-c-htmlman		html
+./usr/share/man/html3/hdestroy_r.html		comp-c-htmlman		html
 ./usr/share/man/html3/heapsort.html		comp-c-htmlman		html
 ./usr/share/man/html3/herror.html		comp-c-htmlman		html
 ./usr/share/man/html3/hesiod.html		comp-c-htmlman		hesiod,html
@@ -12967,6 +12972,7 @@
 ./usr/share/man/html3/hosts_access.html		comp-c-htmlman		html
 ./usr/share/man/html3/hosts_ctl.html		comp-c-htmlman		html
 ./usr/share/man/html3/hsearch.html		comp-c-htmlman		html
+./usr/share/man/html3/hsearch_r.html		comp-c-htmlman		html
 ./usr/share/man/html3/hstrerror.html		comp-c-htmlman		html
 ./usr/share/man/html3/htonl.html		comp-c-htmlman		html
 ./usr/share/man/html3/htons.html		comp-c-htmlman		html
@@ -19017,7 +19023,9 @@
 ./usr/share/man/man3/has_il.3			comp-c-man		.man
 ./usr/share/man/man3/hash.3			comp-c-man		.man
 ./usr/share/man/man3/hcreate.3			comp-c-man		.man
+./usr/share/man/man3/hcreate_r.3		comp-c-man		.man
 ./usr/share/man/man3/hdestroy.3			comp-c-man		.man
+./usr/share/man/man3/hdestroy_r.3		comp-c-man		.man
 ./usr/share/man/man3/heapsort.3			comp-c-man		.man
 ./usr/share/man/man3/herror.3			comp-c-man		.man
 ./usr/share/man/man3/hesiod.3			comp-c-man		hesiod,.man
@@ -19047,6 +19055,7 @@
 ./usr/share/man/man3/hosts_access.3		comp-c-man		.man
 ./usr/share/man/man3/hosts_ctl.3		comp-c-man		.man
 ./usr/share/man/man3/hsearch.3			comp-c-man		.man
+./usr/share/man/man3/hsearch_r.3		comp-c-man		.man
 ./usr/share/man/man3/hstrerror.3		comp-c-man		.man
 ./usr/share/man/man3/htonl.3			comp-c-man		.man
 ./usr/share/man/man3/htons.3			comp-c-man		.man