CVS commit: src/lib/libc/stdlib

2011-09-15 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Sep 15 09:14:54 UTC 2011

Modified Files:
src/lib/libc/stdlib: hcreate.3

Log Message:
Various fixes, mostly missing words or letters.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/lib/libc/stdlib/hcreate.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/libc/stdlib/hcreate.3
diff -u src/lib/libc/stdlib/hcreate.3:1.9 src/lib/libc/stdlib/hcreate.3:1.10
--- src/lib/libc/stdlib/hcreate.3:1.9	Wed Sep 14 23:33:51 2011
+++ src/lib/libc/stdlib/hcreate.3	Thu Sep 15 09:14:54 2011
@@ -1,4 +1,4 @@
-.\ 	$NetBSD: hcreate.3,v 1.9 2011/09/14 23:33:51 christos Exp $
+.\ 	$NetBSD: hcreate.3,v 1.10 2011/09/15 09:14:54 wiz Exp $
 .\
 .\ Copyright (c) 1999 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -60,8 +60,8 @@
 .Fn hcreate_r ,
 .Fn hdestroy ,
 .Fn hdestroy_r
-and
 .Fn hsearch ,
+and
 .Fn hsearch_r
 functions manage hash search tables.
 .Pp
@@ -170,8 +170,8 @@
 .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.
+functions are re-entrant versions of the above functions that can
+operate on a table supplied by the user.
 The
 .Fn hsearch_r
 function returns
@@ -192,7 +192,7 @@
 .Fn hcreate
 and
 .Fn hcreate_r
-function return a non-zero value.
+functions return a non-zero value.
 Otherwise, a value of
 .Dv 0
 is returned and
@@ -229,7 +229,7 @@
 .Dv 1
 unless the table is full, when it returns
 .Dv 0 .
-If the
+If
 .Fn hsearch
 returns
 .Dv 0
@@ -254,10 +254,11 @@
 and
 .Fn hsearch_r
 functions will also fail if the action is
-.Dv SEARCH and the element is not found:
+.Dv SEARCH
+and the element is not found:
 .Bl -tag -width Er
 .It Bq Er ESRCH
-The 
+The
 .Fa item
 given is not found.
 .El
@@ -287,15 +288,15 @@
 .Fn hdestroy_r
 and
 .Fn hsearch_r
-are
+functions are
 .Tn GNU
 extensions.
 .Sh CAVEATS
 At least the following limitations can be mentioned:
 .Bl -bullet
 .It
-The original, non-
-.Tn GNU
+The original,
+.Pf 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.



CVS commit: src/usr.bin/fold

2011-09-15 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Sep 15 09:39:57 UTC 2011

Modified Files:
src/usr.bin/fold: fold.1

Log Message:
Mark file argument(s) as being optional (as does the usage message
from fold.c, which is correct); minor spelling correction; note
`width' as being an argument to `-w'; reference fmt(1) in `SEE
ALSO' section.

From Snader_LB.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/fold/fold.1

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

Modified files:

Index: src/usr.bin/fold/fold.1
diff -u src/usr.bin/fold/fold.1:1.12 src/usr.bin/fold/fold.1:1.13
--- src/usr.bin/fold/fold.1:1.12	Fri May 14 16:54:48 2010
+++ src/usr.bin/fold/fold.1	Thu Sep 15 09:39:57 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: fold.1,v 1.12 2010/05/14 16:54:48 joerg Exp $
+.\	$NetBSD: fold.1,v 1.13 2011/09/15 09:39:57 wiz Exp $
 .\
 .\ Copyright (c) 1980, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\
 .\	@(#)fold.1	8.1 (Berkeley) 6/6/93
 .\
-.Dd July 21, 2009
+.Dd September 15, 2011
 .Dt FOLD 1
 .Os
 .Sh NAME
@@ -39,12 +39,12 @@
 .Nm
 .Op Fl bs
 .Op Fl w Ar width
-.Ar
+.Op Ar
 .Sh DESCRIPTION
 .Nm
 is a filter which folds the contents of the specified files,
 or the standard input if no files are specified,
-breaking the lines to have maximum of 80 characters.
+breaking the lines to have a maximum of 80 characters.
 .Pp
 The options are as follows:
 .Bl -tag -width indent
@@ -57,7 +57,9 @@
 .Ar width
 column positions (or bytes).
 .It Fl w
-Specifies a line width to use instead of the default 80 characters.
+Specifies
+.Ar width
+to use as a line width, instead of the default 80 characters.
 .El
 .Sh ENVIRONMENT
 .Bl -tag -width indent
@@ -66,7 +68,8 @@
 .Sh EXIT STATUS
 .Ex -std
 .Sh SEE ALSO
-.Xr expand 1
+.Xr expand 1 ,
+.Xr fmt 1
 .Sh STANDARDS
 The
 .Nm



CVS commit: src/usr.bin/fold

2011-09-15 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Sep 15 09:40:57 UTC 2011

Modified Files:
src/usr.bin/fold: fold.1

Log Message:
Add argument in options table. Resize to fit.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/fold/fold.1

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

Modified files:

Index: src/usr.bin/fold/fold.1
diff -u src/usr.bin/fold/fold.1:1.13 src/usr.bin/fold/fold.1:1.14
--- src/usr.bin/fold/fold.1:1.13	Thu Sep 15 09:39:57 2011
+++ src/usr.bin/fold/fold.1	Thu Sep 15 09:40:57 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: fold.1,v 1.13 2011/09/15 09:39:57 wiz Exp $
+.\	$NetBSD: fold.1,v 1.14 2011/09/15 09:40:57 wiz Exp $
 .\
 .\ Copyright (c) 1980, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -47,7 +47,7 @@
 breaking the lines to have a maximum of 80 characters.
 .Pp
 The options are as follows:
-.Bl -tag -width indent
+.Bl -tag -width XwXwidthXX
 .It Fl b
 Count
 .Ar width
@@ -56,7 +56,7 @@
 Fold line after the last blank character within the first
 .Ar width
 column positions (or bytes).
-.It Fl w
+.It Fl w Ar width
 Specifies
 .Ar width
 to use as a line width, instead of the default 80 characters.



CVS commit: src/sbin/mount_msdos

2011-09-15 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Sep 15 09:45:00 UTC 2011

Modified Files:
src/sbin/mount_msdos: mount_msdos.8

Log Message:
Consistently spell MS-DOS with a hyphen. From Snader_LB.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sbin/mount_msdos/mount_msdos.8

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

Modified files:

Index: src/sbin/mount_msdos/mount_msdos.8
diff -u src/sbin/mount_msdos/mount_msdos.8:1.33 src/sbin/mount_msdos/mount_msdos.8:1.34
--- src/sbin/mount_msdos/mount_msdos.8:1.33	Sat Jan 24 10:45:44 2009
+++ src/sbin/mount_msdos/mount_msdos.8	Thu Sep 15 09:44:59 2011
@@ -1,4 +1,4 @@
-.\ $NetBSD: mount_msdos.8,v 1.33 2009/01/24 10:45:44 wiz Exp $
+.\ $NetBSD: mount_msdos.8,v 1.34 2011/09/15 09:44:59 wiz Exp $
 .\
 .\ Copyright (c) 1993, 1994 Christopher G. Demetriou
 .\ All rights reserved.
@@ -82,7 +82,7 @@
 .It Fl G
 This option causes the filesystem to be interpreted as an Atari-Gemdos
 filesystem.
-The differences to the MSDOS filesystem are minimal and
+The differences to the MS-DOS filesystem are minimal and
 limited to the boot block.
 This option enforces
 .Fl s .



CVS commit: src/tests/lib/libm

2011-09-15 Thread Havard Eidnes
Module Name:src
Committed By:   he
Date:   Thu Sep 15 11:05:51 UTC 2011

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

Log Message:
#ifdef on __vax__ one more place, to avoid reference to tanf() for vax.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 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_tan.c
diff -u src/tests/lib/libm/t_tan.c:1.3 src/tests/lib/libm/t_tan.c:1.4
--- src/tests/lib/libm/t_tan.c:1.3	Wed Sep 14 13:29:58 2011
+++ src/tests/lib/libm/t_tan.c	Thu Sep 15 11:05:50 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: t_tan.c,v 1.3 2011/09/14 13:29:58 jruoho Exp $ */
+/* $NetBSD: t_tan.c,v 1.4 2011/09/15 11:05:50 he Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -161,6 +161,7 @@
 
 ATF_TC_BODY(tanf_angles, tc)
 {
+#ifndef __vax__
 	const float eps = 1.0e-6;
 	float x, y;
 	size_t i;
@@ -174,6 +175,7 @@
 			atf_tc_fail_nonfatal(tanf(%d deg) != %0.01f,
 			angles[i].angle, angles[i].y);
 	}
+#endif
 }
 
 ATF_TC(tanf_nan);



CVS commit: src/tests/lib/libcurses

2011-09-15 Thread Brett Lymn
Module Name:src
Committed By:   blymn
Date:   Thu Sep 15 11:36:43 UTC 2011

Modified Files:
src/tests/lib/libcurses: t_curses.sh

Log Message:
Remove the beep test for the moment, the return code does not conform
to SUSv2.  An update to the slave code will break this test until
beep() is fixed but that will require a major bump on the libcurses
library due to the interface change which is being deferred until all
the tests are done and all the interface changes can be batched up.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/lib/libcurses/t_curses.sh

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

Modified files:

Index: src/tests/lib/libcurses/t_curses.sh
diff -u src/tests/lib/libcurses/t_curses.sh:1.7 src/tests/lib/libcurses/t_curses.sh:1.8
--- src/tests/lib/libcurses/t_curses.sh:1.7	Thu Sep  8 10:56:49 2011
+++ src/tests/lib/libcurses/t_curses.sh	Thu Sep 15 11:36:43 2011
@@ -284,7 +284,7 @@
 	atf_add_test_case can_change_color
 	atf_add_test_case assume_default_colors
 	atf_add_test_case attributes
-	atf_add_test_case beep
+#	atf_add_test_case beep  # comment out for now - return is wrong
 	atf_add_test_case background
 	atf_add_test_case cbreak
 	atf_add_test_case clear



CVS commit: src/tests/lib/libcurses/slave

2011-09-15 Thread Brett Lymn
Module Name:src
Committed By:   blymn
Date:   Thu Sep 15 11:46:19 UTC 2011

Modified Files:
src/tests/lib/libcurses/slave: command_table.h commands.c
curses_commands.c curses_commands.h slave.c slave.h

Log Message:
- add support for getparyx and getyx calls
- allow a NULL pointer to be returned to the director
- add support for passing back a single chtype character
- fix some indentation
- fix a lot of curses command calls that were just plain wrong
- don't try to allocate storage for a NULL parameter, it doesn't need it


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libcurses/slave/command_table.h \
src/tests/lib/libcurses/slave/curses_commands.h \
src/tests/lib/libcurses/slave/slave.h
cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libcurses/slave/commands.c
cvs rdiff -u -r1.5 -r1.6 src/tests/lib/libcurses/slave/curses_commands.c \
src/tests/lib/libcurses/slave/slave.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/libcurses/slave/command_table.h
diff -u src/tests/lib/libcurses/slave/command_table.h:1.2 src/tests/lib/libcurses/slave/command_table.h:1.3
--- src/tests/lib/libcurses/slave/command_table.h:1.2	Mon Apr 11 09:02:02 2011
+++ src/tests/lib/libcurses/slave/command_table.h	Thu Sep 15 11:46:19 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: command_table.h,v 1.2 2011/04/11 09:02:02 blymn Exp $	*/
+/*	$NetBSD: command_table.h,v 1.3 2011/09/15 11:46:19 blymn Exp $	*/
 
 /*-
  * Copyright 2009 Brett Lymn bl...@netbsd.org
@@ -143,12 +143,14 @@
 	{getbkgd, cmd_getbkgd},
 	{getcury, cmd_getcury},
 	{getcurx, cmd_getcurx},
+	{getyx, cmd_getyx},
 	{getbegy, cmd_getbegy},
 	{getbegx, cmd_getbegx},
 	{getmaxy, cmd_getmaxy},
 	{getmaxx, cmd_getmaxx},
 	{getpary, cmd_getpary},
 	{getparx, cmd_getparx},
+	{getparyx, cmd_getparyx},
 	{gettmode, cmd_gettmode},
 	{getwin, cmd_getwin},
 	{halfdelay, cmd_halfdelay},
Index: src/tests/lib/libcurses/slave/curses_commands.h
diff -u src/tests/lib/libcurses/slave/curses_commands.h:1.2 src/tests/lib/libcurses/slave/curses_commands.h:1.3
--- src/tests/lib/libcurses/slave/curses_commands.h:1.2	Mon Apr 11 09:02:02 2011
+++ src/tests/lib/libcurses/slave/curses_commands.h	Thu Sep 15 11:46:19 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: curses_commands.h,v 1.2 2011/04/11 09:02:02 blymn Exp $	*/
+/*	$NetBSD: curses_commands.h,v 1.3 2011/09/15 11:46:19 blymn Exp $	*/
 
 /*-
  * Copyright 2009 Brett Lymn bl...@netbsd.org
@@ -148,12 +148,14 @@
 void cmd_getbkgd(int, char **);
 void cmd_getcury(int, char **);
 void cmd_getcurx(int, char **);
+void cmd_getyx(int, char **);
 void cmd_getbegy(int, char **);
 void cmd_getbegx(int, char **);
 void cmd_getmaxy(int, char **);
 void cmd_getmaxx(int, char **);
 void cmd_getpary(int, char **);
 void cmd_getparx(int, char **);
+void cmd_getparyx(int, char **);
 void cmd_gettmode(int, char **);
 void cmd_getwin(int, char **);
 void cmd_halfdelay(int, char **);
Index: src/tests/lib/libcurses/slave/slave.h
diff -u src/tests/lib/libcurses/slave/slave.h:1.2 src/tests/lib/libcurses/slave/slave.h:1.3
--- src/tests/lib/libcurses/slave/slave.h:1.2	Sat Jun 11 18:03:18 2011
+++ src/tests/lib/libcurses/slave/slave.h	Thu Sep 15 11:46:19 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: slave.h,v 1.2 2011/06/11 18:03:18 christos Exp $	*/
+/*	$NetBSD: slave.h,v 1.3 2011/09/15 11:46:19 blymn Exp $	*/
 
 /*-
  * Copyright 2009 Brett Lymn bl...@netbsd.org
@@ -40,6 +40,7 @@
 void report_count(int);
 void report_error(const char *);
 void report_int(int);
+void report_byte(chtype);
 void report_return(int);
 void report_nstr(chtype *);
 void report_status(const char *);

Index: src/tests/lib/libcurses/slave/commands.c
diff -u src/tests/lib/libcurses/slave/commands.c:1.3 src/tests/lib/libcurses/slave/commands.c:1.4
--- src/tests/lib/libcurses/slave/commands.c:1.3	Sat Jun 11 18:03:18 2011
+++ src/tests/lib/libcurses/slave/commands.c	Thu Sep 15 11:46:19 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: commands.c,v 1.3 2011/06/11 18:03:18 christos Exp $	*/
+/*	$NetBSD: commands.c,v 1.4 2011/09/15 11:46:19 blymn Exp $	*/
 
 /*-
  * Copyright 2009 Brett Lymn bl...@netbsd.org
@@ -76,7 +76,10 @@
 {
 	char *string;
 
-	asprintf(string, %p, ptr);
+	if (ptr == NULL)
+		asprintf(string, NULL);
+	else
+		asprintf(string, %p, ptr);
 	report_status(string);
 	free(string);
 }
@@ -181,6 +184,19 @@
  * Report a string of chtype back to the director via the command pipe.
  */
 void
+report_byte(chtype c)
+{
+	chtype string[2];
+
+	string[0] = c;
+	string[1] = A_NORMAL | '\0';
+	report_nstr(string);
+}
+
+/*
+ * Report a string of chtype back to the director via the command pipe.
+ */
+void
 report_nstr(chtype *string)
 {
 	int len, type;
@@ -193,6 +209,9 @@
 		len++;
 	}
 
+	len++; /* add in the termination chtype */
+	len *= sizeof(chtype);
+
 	type = ret_byte;
 	if (write(slvpipe[WRITE_PIPE], type, sizeof(int))  0)
 		err(1, %s: command pipe write for status type 

CVS commit: src/usr.sbin/gpioctl

2011-09-15 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Thu Sep 15 11:46:32 UTC 2011

Modified Files:
src/usr.sbin/gpioctl: gpioctl.c

Log Message:
Bump (c) year.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/gpioctl/gpioctl.c

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

Modified files:

Index: src/usr.sbin/gpioctl/gpioctl.c
diff -u src/usr.sbin/gpioctl/gpioctl.c:1.12 src/usr.sbin/gpioctl/gpioctl.c:1.13
--- src/usr.sbin/gpioctl/gpioctl.c:1.12	Tue Aug 30 18:50:48 2011
+++ src/usr.sbin/gpioctl/gpioctl.c	Thu Sep 15 11:46:32 2011
@@ -1,7 +1,7 @@
-/* $NetBSD: gpioctl.c,v 1.12 2011/08/30 18:50:48 joerg Exp $ */
+/* $NetBSD: gpioctl.c,v 1.13 2011/09/15 11:46:32 mbalmer Exp $ */
 
 /*
- * Copyright (c) 2008, 2010 Marc Balmer mbal...@netbsd.org
+ * Copyright (c) 2008, 2010, 2011 Marc Balmer mbal...@netbsd.org
  * Copyright (c) 2004 Alexander Yurchenko gra...@openbsd.org
  *
  * Permission to use, copy, modify, and distribute this software for any



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

2011-09-15 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Sep 15 11:52:09 UTC 2011

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

Log Message:
Wording, from Snader_LB.


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

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

Modified files:

Index: src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8
diff -u src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8:1.24 src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8:1.25
--- src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8:1.24	Wed Feb  3 17:16:29 2010
+++ src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8	Thu Sep 15 11:52:09 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: mount_psshfs.8,v 1.24 2010/02/03 17:16:29 pooka Exp $
+.\	$NetBSD: mount_psshfs.8,v 1.25 2011/09/15 11:52:09 wiz Exp $
 .\
 .\ Copyright (c) 2007-2009 Antti Kantee.  All rights reserved.
 .\
@@ -129,7 +129,7 @@
 This option is used to adjust the timeout period to
 .Ar timeout
 seconds.
-A value 0 means the cache is never valid and \-1 means it is
+A value of 0 means the cache is never valid; \-1 means it is
 valid indefinitely.
 It is possible to force a re-read regardless of timeout status by sending
 .Dv SIGHUP



CVS commit: src/tests/lib/libcurses/director

2011-09-15 Thread Brett Lymn
Module Name:src
Committed By:   blymn
Date:   Thu Sep 15 11:53:12 UTC 2011

Modified Files:
src/tests/lib/libcurses/director: director.c testlang_parse.y

Log Message:
- Add erase and kill to the terminal attributes so we can test
  fetching them
- Remove functions from the input_functions array that don't really do
  input
- Re-enable the reporting of poll events after a function call
- Check that the return_type from the slave matches the expected one
- If verbose then print out the byte streams being compared in
  validate_byte
- When reporting a length mismatch during a byte validation, report
  the actual lengths.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/lib/libcurses/director/director.c
cvs rdiff -u -r1.10 -r1.11 src/tests/lib/libcurses/director/testlang_parse.y

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/libcurses/director/director.c
diff -u src/tests/lib/libcurses/director/director.c:1.7 src/tests/lib/libcurses/director/director.c:1.8
--- src/tests/lib/libcurses/director/director.c:1.7	Fri Jun 17 16:59:51 2011
+++ src/tests/lib/libcurses/director/director.c	Thu Sep 15 11:53:12 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: director.c,v 1.7 2011/06/17 16:59:51 christos Exp $	*/
+/*	$NetBSD: director.c,v 1.8 2011/09/15 11:53:12 blymn Exp $	*/
 
 /*-
  * Copyright 2009 Brett Lymn bl...@netbsd.org
@@ -236,6 +236,8 @@
 	term_attr.c_cflag = TTYDEF_CFLAG;
 	term_attr.c_lflag = TTYDEF_LFLAG;
 	cfsetspeed(term_attr, TTYDEF_SPEED);
+	term_attr.c_cc[VERASE] = '\b';
+	term_attr.c_cc[VKILL] = '\025'; /* ^U */
 
 	if ((slave_pid = forkpty(master, NULL, term_attr, NULL))  0)
 		err(1, Fork of pty for slave failed\n);

Index: src/tests/lib/libcurses/director/testlang_parse.y
diff -u src/tests/lib/libcurses/director/testlang_parse.y:1.10 src/tests/lib/libcurses/director/testlang_parse.y:1.11
--- src/tests/lib/libcurses/director/testlang_parse.y:1.10	Thu Sep  8 10:56:49 2011
+++ src/tests/lib/libcurses/director/testlang_parse.y	Thu Sep 15 11:53:12 2011
@@ -1,5 +1,5 @@
 %{
-/*	$NetBSD: testlang_parse.y,v 1.10 2011/09/08 10:56:49 blymn Exp $	*/
+/*	$NetBSD: testlang_parse.y,v 1.11 2011/09/15 11:53:12 blymn Exp $	*/
 
 /*-
  * Copyright 2009 Brett Lymn bl...@netbsd.org
@@ -30,6 +30,7 @@
  *
  */
 #include assert.h
+#include curses.h
 #include errno.h
 #include fcntl.h
 #include err.h
@@ -147,10 +148,8 @@
 static void	perform_delay(struct timespec *);
 
 static const char *input_functions[] = {
-	inch, getch, getnstr, getstr, innstr, instr, mvgetnstr,
-	mvgetstr, mvinchstr, mvinchnstr, mvgetnstr, mvgetstr,
-	mvinchstr, mvinchnstr, winch, wgetch, wgetnstr, wgetstr,
-	winchnstr, winchstr, winnstr, winstr
+	getch, getnstr, getstr, mvgetnstr, mvgetstr, mvgetnstr,
+	mvgetstr, wgetch, wgetnstr, wgetstr
 };
 
 static const unsigned ninput_functions =
@@ -939,7 +938,7 @@
 		input_str = NULL;
 	}
 
-	if (verbose  0) {
+	if (verbose) {
 		fds[0].fd = slvpipe[READ_PIPE];
 		fds[0].events = POLLIN;
 
@@ -1114,8 +1113,18 @@
 	byte_response = data;
 	if ((command.returns[i].return_type != ret_byte) 
 	(command.returns[i].return_type != ret_err) 
-	(command.returns[i].return_type != ret_ok))
+	(command.returns[i].return_type != ret_ok)) {
+		if ((byte_response-return_type == ret_byte) ||
+		(byte_response-return_type == ret_err) ||
+		(byte_response-return_type == ret_ok))
+			err(1, validate: expecting type %s, received type %s
+			 at line %d of file %s,
+			returns_enum_names[command.returns[i].return_type],
+			returns_enum_names[byte_response-return_type],
+			line, cur_file);
+
 		response = byte_response-return_value;
+	}
 
 	switch (command.returns[i].return_type) {
 	case ret_err:
@@ -1247,11 +1256,30 @@
 static void
 validate_byte(returns_t *expected, returns_t *value, int check)
 {
+	char *ch;
+	size_t i;
+
+	if (verbose) {
+		ch = value-return_value;
+		fprintf(stderr, checking returned byte stream: );
+		for (i = 0; i  value-return_len; i++)
+			fprintf(stderr, %s0x%x, (i != 0)? ,  : , ch[i]);
+		fprintf(stderr, \n);
+
+		fprintf(stderr, %s byte stream: ,
+			(check == 0)? matches : does not match);
+		ch = (char *) expected-return_value;
+		for (i = 0; i  expected-return_len; i++)
+			fprintf(stderr, %s0x%x, (i != 0)? ,  : , ch[i]);
+		fprintf(stderr, \n);
+	}
+
 	/*
 	 * No chance of a match if lengths differ...
 	 */
 	if ((check == 0)  (expected-return_len != value-return_len))
-	errx(1, Byte validation failed, length mismatch);
+	errx(1, Byte validation failed, length mismatch, expected %zu,
+		received %zu, expected-return_len, value-return_len);
 
 	/*
 	 * If check is 0 then we want to throw an error IFF the byte streams



CVS commit: src/lib/libcurses

2011-09-15 Thread Brett Lymn
Module Name:src
Committed By:   blymn
Date:   Thu Sep 15 11:58:05 UTC 2011

Modified Files:
src/lib/libcurses: curses_window.3 mvwin.c

Log Message:
- Make mvderwin work as per the SUSv2 specification and other curses
  implementations.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/lib/libcurses/curses_window.3
cvs rdiff -u -r1.15 -r1.16 src/lib/libcurses/mvwin.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/libcurses/curses_window.3
diff -u src/lib/libcurses/curses_window.3:1.13 src/lib/libcurses/curses_window.3:1.14
--- src/lib/libcurses/curses_window.3:1.13	Mon May 18 09:30:31 2009
+++ src/lib/libcurses/curses_window.3	Thu Sep 15 11:58:05 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: curses_window.3,v 1.13 2009/05/18 09:30:31 wiz Exp $
+.\	$NetBSD: curses_window.3,v 1.14 2011/09/15 11:58:05 blymn Exp $
 .\
 .\ Copyright (c) 2002
 .\	Brett Lymn (bl...@netbsd.org, brett_l...@yahoo.com.au)
@@ -155,18 +155,28 @@
 If the new position would cause the any part of the window to lie outside
 the screen, it is an error and the window is not moved.
 .Pp
-A subwindow can be moved relative to the parent window by calling the
+A mapping of a region relative to the parent window may be created by
+calling the
 .Fn mvderwin
 function, the
 .Fa y
 and
 .Fa x
 positions are relative to the origin of the parent window.
+The screen offset of
+.Fa win
+is not updated, the characters beginning at 
+.Fa y ,
+.Fa x
+for the area the size of
+.Fa win
+will be displayed at the screen offset of 
+.Fa win .
 If the given window in
 .Fa win
 is not a subwindow then an error will be returned.
 If the new position would cause the any part of the window to lie outside
-the parent window, it is an error and the window is not moved.
+the parent window, it is an error and the mapping is not updated.
 .Pp
 The
 .Fn newwin

Index: src/lib/libcurses/mvwin.c
diff -u src/lib/libcurses/mvwin.c:1.15 src/lib/libcurses/mvwin.c:1.16
--- src/lib/libcurses/mvwin.c:1.15	Thu Aug  7 16:44:22 2003
+++ src/lib/libcurses/mvwin.c	Thu Sep 15 11:58:05 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvwin.c,v 1.15 2003/08/07 16:44:22 agc Exp $	*/
+/*	$NetBSD: mvwin.c,v 1.16 2011/09/15 11:58:05 blymn Exp $	*/
 
 /*
  * Copyright (c) 1981, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)mvwin.c	8.2 (Berkeley) 5/4/94;
 #else
-__RCSID($NetBSD: mvwin.c,v 1.15 2003/08/07 16:44:22 agc Exp $);
+__RCSID($NetBSD: mvwin.c,v 1.16 2011/09/15 11:58:05 blymn Exp $);
 #endif
 #endif/* not lint */
 
@@ -43,14 +43,16 @@
 
 /*
  * mvderwin --
- *  Move a derived window.
+ *  Move a derived window.  This does not change the physical screen
+ * coordinates of the subwin, rather maps the characters in the subwin
+ * sized part of the parent window starting at dy, dx into the subwin.
  *
  */
 int
 mvderwin(WINDOW *win, int dy, int dx)
 {
 	WINDOW *parent;
-	int x, y;
+	int ox, oy, i;
 
 	if (win == NULL)
 		return ERR;
@@ -60,9 +62,25 @@
 	if (parent == NULL)
 		return ERR;
 
-	x = parent-begx + dx;
-	y = parent-begy + dy;
-	return mvwin(win, y, x);
+	if (((win-maxx + dx)  parent-maxx) ||
+	((win-maxy + dy)  parent-maxy))
+		return ERR;
+
+	ox = win-begx;
+	oy = win-begy;
+
+	win-begx = parent-begx + dx;
+	win-begy = parent-begy + dy;
+
+	__set_subwin(parent, win);
+
+	win-begx = ox;
+	win-begy = oy;
+
+	for (i = 0; i  win-maxy; i++)
+win-alines[i]-flags = __ISDIRTY;
+
+	return OK;
 }
 
 /*



CVS commit: src/lib/libcurses

2011-09-15 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Sep 15 12:01:18 UTC 2011

Modified Files:
src/lib/libcurses: curses_window.3

Log Message:
Remove trailing whitespace. Bump date for previous.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/lib/libcurses/curses_window.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/libcurses/curses_window.3
diff -u src/lib/libcurses/curses_window.3:1.14 src/lib/libcurses/curses_window.3:1.15
--- src/lib/libcurses/curses_window.3:1.14	Thu Sep 15 11:58:05 2011
+++ src/lib/libcurses/curses_window.3	Thu Sep 15 12:01:18 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: curses_window.3,v 1.14 2011/09/15 11:58:05 blymn Exp $
+.\	$NetBSD: curses_window.3,v 1.15 2011/09/15 12:01:18 wiz Exp $
 .\
 .\ Copyright (c) 2002
 .\	Brett Lymn (bl...@netbsd.org, brett_l...@yahoo.com.au)
@@ -30,7 +30,7 @@
 .\ SUCH DAMAGE.
 .\
 .\
-.Dd March 31, 2008
+.Dd September 15, 2011
 .Dt CURSES_WINDOW 3
 .Os
 .Sh NAME
@@ -165,12 +165,12 @@
 positions are relative to the origin of the parent window.
 The screen offset of
 .Fa win
-is not updated, the characters beginning at 
+is not updated, the characters beginning at
 .Fa y ,
 .Fa x
 for the area the size of
 .Fa win
-will be displayed at the screen offset of 
+will be displayed at the screen offset of
 .Fa win .
 If the given window in
 .Fa win



CVS commit: src/sys/arch/usermode

2011-09-15 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Thu Sep 15 12:23:51 UTC 2011

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

Log Message:
Implement a dprintf_debug() analog to aprint_debug() but printing it to stderr
using vdprintf() to bypass the kernel buffer. It is currently printing only on
the -x boot flag but might get a more specific one since its quite verbose!


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/usermode/include/thunk.h
cvs rdiff -u -r1.37 -r1.38 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.33 src/sys/arch/usermode/include/thunk.h:1.34
--- src/sys/arch/usermode/include/thunk.h:1.33	Wed Sep 14 18:26:24 2011
+++ src/sys/arch/usermode/include/thunk.h	Thu Sep 15 12:23:51 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.h,v 1.33 2011/09/14 18:26:24 reinoud Exp $ */
+/* $NetBSD: thunk.h,v 1.34 2011/09/15 12:23:51 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -69,6 +69,8 @@
 
 struct aiocb;
 
+void	dprintf_debug(const char *fmt, ...) __attribute__((__format__(__printf__, 1, 2)));
+
 int	thunk_setitimer(int, const struct thunk_itimerval *, struct thunk_itimerval *);
 int	thunk_gettimeofday(struct thunk_timeval *, void *);
 unsigned int thunk_getcounter(void);

Index: src/sys/arch/usermode/usermode/thunk.c
diff -u src/sys/arch/usermode/usermode/thunk.c:1.37 src/sys/arch/usermode/usermode/thunk.c:1.38
--- src/sys/arch/usermode/usermode/thunk.c:1.37	Wed Sep 14 18:26:24 2011
+++ src/sys/arch/usermode/usermode/thunk.c	Thu Sep 15 12:23:51 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.c,v 1.37 2011/09/14 18:26:24 reinoud Exp $ */
+/* $NetBSD: thunk.c,v 1.38 2011/09/15 12:23:51 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.37 2011/09/14 18:26:24 reinoud Exp $);
+__RCSID($NetBSD: thunk.c,v 1.38 2011/09/15 12:23:51 reinoud Exp $);
 #endif
 
 #include sys/types.h
 #include sys/mman.h
+#include sys/reboot.h
 #include machine/vmparam.h
 
 #include aio.h
@@ -59,6 +60,20 @@
 #define MAP_ANON MAP_ANONYMOUS
 #endif
 
+extern int boothowto;
+
+void
+dprintf_debug(const char *fmt, ...)
+{
+if (boothowto  AB_DEBUG) {
+va_list ap;
+
+va_start(ap, fmt);
+vdprintf(2, fmt, ap);
+va_end(ap);
+}
+}
+
 static void
 thunk_to_timeval(const struct thunk_timeval *ttv, struct timeval *tv)
 {



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

2011-09-15 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Thu Sep 15 12:25:25 UTC 2011

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

Log Message:
Move to dprintf_debug()


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/usermode/usermode/intr.c
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/usermode/usermode/pmap.c
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/usermode/usermode/trap.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/intr.c
diff -u src/sys/arch/usermode/usermode/intr.c:1.6 src/sys/arch/usermode/usermode/intr.c:1.7
--- src/sys/arch/usermode/usermode/intr.c:1.6	Tue Sep 13 10:38:04 2011
+++ src/sys/arch/usermode/usermode/intr.c	Thu Sep 15 12:25:25 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: intr.c,v 1.6 2011/09/13 10:38:04 reinoud Exp $ */
+/* $NetBSD: intr.c,v 1.7 2011/09/15 12:25:25 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: intr.c,v 1.6 2011/09/13 10:38:04 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: intr.c,v 1.7 2011/09/15 12:25:25 reinoud Exp $);
 
 #include sys/types.h
 
@@ -74,7 +74,7 @@
 		return;
 	}
 
-	//printf(\nX : %d\n, x);
+	dprintf_debug(spl_intr: queue %d when %d\n, x, usermode_x);
 	spli = spl_intrs[x][spl_intr_wr[x]];
 	spli-func = func;
 	spli-arg = arg;
@@ -111,17 +111,17 @@
 
 	/* `eat' interrupts that came by until we got back to x */
 	if (usermode_x  x) {
-restart:
+//restart:
 		for (y = usermode_x; y = x; y--) {
 			while (spl_intr_rd[y] != spl_intr_wr[y]) {
-// printf(spl y %d firing\n, y);
+dprintf_debug(spl y %d firing\n, y);
 spli = spl_intrs[y][spl_intr_rd[y]];
 if (!spli-func)
 	panic(%s: spli-func is NULL for ipl %d, rd %d, wr %d\n,
 		__func__, y, spl_intr_rd[y], spl_intr_wr[y]);
 spli-func(spli-arg);
 spl_intr_rd[y] = (spl_intr_rd[y] + 1) % MAX_QUEUED_EVENTS;
-goto restart;
+//goto restart;
 			}
 		}
 		usermode_x = x;

Index: src/sys/arch/usermode/usermode/pmap.c
diff -u src/sys/arch/usermode/usermode/pmap.c:1.62 src/sys/arch/usermode/usermode/pmap.c:1.63
--- src/sys/arch/usermode/usermode/pmap.c:1.62	Wed Sep 14 19:45:27 2011
+++ src/sys/arch/usermode/usermode/pmap.c	Thu Sep 15 12:25:25 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.62 2011/09/14 19:45:27 reinoud Exp $ */
+/* $NetBSD: pmap.c,v 1.63 2011/09/15 12:25:25 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.62 2011/09/14 19:45:27 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.63 2011/09/15 12:25:25 reinoud Exp $);
 
 #include opt_memsize.h
 #include opt_kmempages.h
@@ -136,13 +136,13 @@
 	vm_min_addr = thunk_get_vm_min_address();
 	vm_min_addr = vm_min_addr  PAGE_SIZE ? PAGE_SIZE : vm_min_addr;
 
-	aprint_debug(Information retrieved from system and elf image\n);
-	aprint_debug(min VM address  at %p\n, (void *) vm_min_addr);
-	aprint_debug(start kernelat %p\n, _start);
-	aprint_debug(  end kernelat %p\n, etext);
-	aprint_debug(  end of init. data at %p\n, edata);
-	aprint_debug(1st end of data at %p\n, end);
-	aprint_debug(CUR end dataat %p\n, thunk_sbrk(0));
+	dprintf_debug(Information retrieved from system and elf image\n);
+	dprintf_debug(min VM address  at %p\n, (void *) vm_min_addr);
+	dprintf_debug(start kernelat %p\n, _start);
+	dprintf_debug(  end kernelat %p\n, etext);
+	dprintf_debug(  end of init. data at %p\n, edata);
+	dprintf_debug(1st end of data at %p\n, end);
+	dprintf_debug(CUR end dataat %p\n, thunk_sbrk(0));
 
 	/* calculate kernel section (R-X) */
 	kmem_k_start = (vaddr_t) PAGE_SIZE * (atop(_start));
@@ -173,19 +173,19 @@
 	kmem_ext_end   = mpos;
 
 	/* print summary */
-	aprint_debug(\nMemory summary\n);
-	aprint_debug(\tkmem_k_start\t%p\n,(void *) kmem_k_start);
-	aprint_debug(\tkmem_k_end\t%p\n,  (void *) kmem_k_end);
-	aprint_debug(\tkmem_ext_start\t%p\n,  (void *) kmem_ext_start);
-	aprint_debug(\tkmem_ext_end\t%p\n,(void *) kmem_ext_end);
-	aprint_debug(\tkmem_user_start\t%p\n, (void *) kmem_user_start);
-	aprint_debug(\tkmem_user_end\t%p\n,   (void *) kmem_user_end);
-
-	aprint_debug(\ttotmem_len\t%10d\n, (int) totmem_len);
-	aprint_debug(\tkvmsize\t\t%10d\n, (int) KVMSIZE);
-	aprint_debug(\tuser_len\t%10d\n, (int) user_len);
+	dprintf_debug(\nMemory summary\n);
+	dprintf_debug(\tkmem_k_start\t%p\n,(void *) kmem_k_start);
+	dprintf_debug(\tkmem_k_end\t%p\n,  (void *) kmem_k_end);
+	dprintf_debug(\tkmem_ext_start\t%p\n,  (void *) kmem_ext_start);
+	dprintf_debug(\tkmem_ext_end\t%p\n,(void *) kmem_ext_end);
+	dprintf_debug(\tkmem_user_start\t%p\n, (void *) kmem_user_start);
+	dprintf_debug(\tkmem_user_end\t%p\n,   (void *) kmem_user_end);
+
+	

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

2011-09-15 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Thu Sep 15 12:26:51 UTC 2011

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

Log Message:
Move to dprintf_debug() too


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/usermode/usermode/syscall.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/syscall.c
diff -u src/sys/arch/usermode/usermode/syscall.c:1.9 src/sys/arch/usermode/usermode/syscall.c:1.10
--- src/sys/arch/usermode/usermode/syscall.c:1.9	Fri Sep  9 12:44:27 2011
+++ src/sys/arch/usermode/usermode/syscall.c	Thu Sep 15 12:26:51 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: syscall.c,v 1.9 2011/09/09 12:44:27 reinoud Exp $ */
+/* $NetBSD: syscall.c,v 1.10 2011/09/15 12:26:51 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: syscall.c,v 1.9 2011/09/09 12:44:27 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: syscall.c,v 1.10 2011/09/15 12:26:51 reinoud Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -64,7 +64,7 @@
 	/* XXX? */
 //	frame-registers[0] = 0;
 
-	printf(child return! lwp %p\n, l);
+	aprint_debug(child return! lwp %p\n, l);
 	userret(l);
 	ktrsysret(SYS_fork, 0, 0);
 }
@@ -101,31 +101,47 @@
 	error = md_syscall_getargs(l, ucp, nargs, argsize, args);
 
 #if 0
-	printf(syscall no. %d, , code);
-	printf(nargs %d, argsize %d =  , nargs, argsize);
+	aprint_debug(syscall no. %d, , code);
+	aprint_debug(nargs %d, argsize %d =  , nargs, argsize);
+	dprintf_debug(syscall no. %d, , code);
+	dprintf_debug(nargs %d, argsize %d =  , nargs, argsize);
+#endif
+	if ((code == 4)) {
+		dprintf_debug([us] %s, (char *) args[1]);
+		printf([us] %s, (char *) args[1]);
+	}
+
+	if (code == 5)
+		aprint_debug(open('%s', %d,...) = , (char *) (args[0]),
+			(int) (args[1]));
+#if 0
 
 	if (code == 3)
-		printf(read(%d, %p, %d) = , (int) args[0],
+		aprint_debug(read(%d, %p, %d) = , (int) args[0],
 			(void *) args[1], (int) args[2]);
+#if 0
 	if (code == 4)
-		printf(write(%d, %p ('%s'), %d) = ,
+		aprint_debug(write(%d, %p ('%s'), %d) = ,
 			(int) args[0], (void *) args[1],
 			(char *) args[1], (int) args[2]);
 	if (code == 5)
-		printf(open('%s', %d,...) = , (char *) (args[0]),
+		aprint_debug(open('%s', %d,...) = , (char *) (args[0]),
 			(int) (args[1]));
+#endif
 	if (code == 440)
-		printf(stat(%d, %p) = , (uint32_t) args[0],
+		aprint_debug(stat(%d, %p) = , (uint32_t) args[0],
 			(void *) args[1]);
 #endif
 
 	if (!error) 
 		error = (*callp-sy_call)(l, args, rval);
 
+	if (code == 5)
+		aprint_debug(%s\n, error ? error:OK);
 #if 0
 	if (code ==3)
-		printf({'%s'} = , (char *) args[1]);
-	printf(error = %d, rval[0] = 0x%PRIx32, retval[1] = 0x%PRIx32\n,
+		aprint_debug({'%s'} = , (char *) args[1]);
+	aprint_debug(error = %d, rval[0] = 0x%PRIx32, retval[1] = 0x%PRIx32\n,
 		error, (uint) (rval[0]), (uint) (rval[1]));
 #endif
 
@@ -143,7 +159,7 @@
 		break;
 	}
 
-//	printf(end of syscall : return to userland\n);
+//	aprint_debug(end of syscall : return to userland\n);
 	userret(l);
 }
 



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

2011-09-15 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Thu Sep 15 12:28:25 UTC 2011

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

Log Message:
Adjust default parameters


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/usermode/conf/GENERIC
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/usermode/conf/Makefile.usermode

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.16 src/sys/arch/usermode/conf/GENERIC:1.17
--- src/sys/arch/usermode/conf/GENERIC:1.16	Wed Sep 14 18:28:36 2011
+++ src/sys/arch/usermode/conf/GENERIC	Thu Sep 15 12:28:24 2011
@@ -1,15 +1,15 @@
-# $NetBSD: GENERIC,v 1.16 2011/09/14 18:28:36 reinoud Exp $
+# $NetBSD: GENERIC,v 1.17 2011/09/15 12:28:24 reinoud Exp $
 
 include arch/usermode/conf/std.usermode
 
 options 	INCLUDE_CONFIG_FILE
-#ident 		GENERIC-$Revision: 1.16 $
+#ident 		GENERIC-$Revision: 1.17 $
 maxusers 	32
 
 makeoptions	DEBUG=-O1 -g3
 
 options		TEXTADDR=0x6000	# 1.5 Gb?
-options		KVMSIZE =0x1000
+options		KVMSIZE=0x01000
 
 options 	RTC_OFFSET=0
 options 	KTRACE

Index: src/sys/arch/usermode/conf/Makefile.usermode
diff -u src/sys/arch/usermode/conf/Makefile.usermode:1.21 src/sys/arch/usermode/conf/Makefile.usermode:1.22
--- src/sys/arch/usermode/conf/Makefile.usermode:1.21	Wed Sep 14 18:28:36 2011
+++ src/sys/arch/usermode/conf/Makefile.usermode	Thu Sep 15 12:28:24 2011
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.usermode,v 1.21 2011/09/14 18:28:36 reinoud Exp $
+# $NetBSD: Makefile.usermode,v 1.22 2011/09/15 12:28:24 reinoud Exp $
 
 OPT_CPU_HOST=			%CPU_HOST%
 .if !empty(OPT_CPU_HOST)
@@ -76,8 +76,9 @@
 ##
 ## (5) link settings
 ##
-TEXTADDR?=	0x6000
-KVMSIZE?=	0x1000
+# XXX fixme: TEXTADDR is not imported yet??
+TEXTADDR?=	  6000
+#KVMSIZE?=	  1000
 
 LINKFLAGS_NORMAL=	-X
 KERN_LDSCRIPT?=	kern.ldscript



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

2011-09-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Sep 15 12:32:30 UTC 2011

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

Log Message:
fix typo, revert to previous version


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 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.7 src/sys/arch/x86/acpi/Makefile.wakecode.inc:1.8
--- src/sys/arch/x86/acpi/Makefile.wakecode.inc:1.7	Wed Sep 14 10:58:43 2011
+++ src/sys/arch/x86/acpi/Makefile.wakecode.inc	Thu Sep 15 08:32:30 2011
@@ -1,9 +1,8 @@
-# $NetBSD: Makefile.wakecode.inc,v 1.7 2011/09/14 14:58:43 christos Exp $
+# $NetBSD: Makefile.wakecode.inc,v 1.8 2011/09/15 12:32:30 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} \
@@ -21,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 acpu_wakeup.d: acpi_wakecode.h
+acpi_wakeup.o acpi_wakeup.d: acpi_wakecode.h



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

2011-09-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Sep 15 12:50:00 UTC 2011

Modified Files:
src/sys/arch/amiga/amiga: amiga_bus_simple_1word.c amiga_bus_simple_4.c

Log Message:
add c99 initializers.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/amiga/amiga/amiga_bus_simple_1word.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/amiga/amiga/amiga_bus_simple_4.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/amiga_bus_simple_1word.c
diff -u src/sys/arch/amiga/amiga/amiga_bus_simple_1word.c:1.4 src/sys/arch/amiga/amiga/amiga_bus_simple_1word.c:1.5
--- src/sys/arch/amiga/amiga/amiga_bus_simple_1word.c:1.4	Thu Aug  4 13:48:50 2011
+++ src/sys/arch/amiga/amiga/amiga_bus_simple_1word.c	Thu Sep 15 08:50:00 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: amiga_bus_simple_1word.c,v 1.4 2011/08/04 17:48:50 rkujawa Exp $ */
+/* $NetBSD: amiga_bus_simple_1word.c,v 1.5 2011/09/15 12:50:00 christos Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #include machine/pte.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(1, $NetBSD: amiga_bus_simple_1word.c,v 1.4 2011/08/04 17:48:50 rkujawa Exp $);
+__KERNEL_RCSID(1, $NetBSD: amiga_bus_simple_1word.c,v 1.5 2011/09/15 12:50:00 christos Exp $);
 
 #define AMIGA_SIMPLE_BUS_STRIDE 1		/* 1 byte per byte */
 #define AMIGA_SIMPLE_BUS_WORD_METHODS
@@ -131,99 +131,97 @@
 
 const struct amiga_bus_space_methods amiga_bus_stride_1swap_abs = {
 
-	oabs(bsm_absolute_),
-	oabs(bsms_),
-	oabs(bsu_),
-	0,
-	0,
-
-	oabs(bsr1_),
-	oabs(bsw1_),
-	oabs(bsrm1_),
-	oabs(bswm1_),
-	oabs(bsrr1_),
-	oabs(bswr1_),
-	oabs(bssr1_),
-	oabs(bscr1_),
-
-	oabs(bsr2_),/* XXX swap? */
-	oabs(bsw2_),/* XXX swap? */
-	oabs(bsr2_),
-	oabs(bsw2_),
-	oabs(bsrm2_swap_),
-	oabs(bswm2_swap_),
-	oabs(bsrm2_),
-	oabs(bswm2_),
-	oabs(bsrr2_),   /* XXX swap? */
-	oabs(bswr2_),   /* XXX swap? */
-	oabs(bsrr2_),
-	oabs(bswr2_),
-	oabs(bssr2_),   /* XXX swap? */
-	oabs(bscr2_),   /* XXX swap? */
-
-	oabs(bsr4_swap_),
-	oabs(bsw4_swap_),
-	oabs(bsr4_),
-	oabs(bsw4_),
-	oabs(bsrm4_),		/* XXX swap? */
-	oabs(bswm4_),		/* XXX swap? */
-	oabs(bsrm4_),
-	oabs(bswm4_),
-	oabs(bsrr4_),		/* XXX swap? */
-	oabs(bswr4_),		/* XXX swap? */
-	oabs(bsrr4_),
-	oabs(bswr4_),
-	oabs(bssr4_),		/* XXX swap? */
-	oabs(bscr4_)		/* XXX swap? */
-
+	.bsm =		oabs(bsm_absolute_),
+	.bsms =		oabs(bsms_),
+	.bsu =		oabs(bsu_),
+	.bsa =		NULL,
+	.bsf =		NULL,
+
+	.bsr1 =		oabs(bsr1_),
+	.bsw1 =		oabs(bsw1_),
+	.bsrm1 =	oabs(bsrm1_),
+	.bswm1 =	oabs(bswm1_),
+	.bsrr1 =	oabs(bsrr1_),
+	.bswr1 =	oabs(bswr1_),
+	.bssr1 =	oabs(bssr1_),
+	.bscr1 =	oabs(bscr1_),
+
+	.bsr2 =		oabs(bsr2_),/* XXX swap? */
+	.bsw2 =		oabs(bsw2_),/* XXX swap? */
+	.bsrs2 =	oabs(bsr2_),
+	.bsws2 =	oabs(bsw2_),
+	.bsrm2 =	oabs(bsrm2_swap_),
+	.bswm2 =	oabs(bswm2_swap_),
+	.bsrms2 =	oabs(bsrm2_),
+	.bswms2 =	oabs(bswm2_),
+	.bsrr2 =	oabs(bsrr2_),   /* XXX swap? */
+	.bswr2 =	oabs(bswr2_),   /* XXX swap? */
+	.bsrr2 =	oabs(bsrr2_),
+	.bswr2 =	oabs(bswr2_),
+	.bssr2 =	oabs(bssr2_),   /* XXX swap? */
+	.bscr2 =	oabs(bscr2_),   /* XXX swap? */
+
+	.bsr4 =		oabs(bsr4_swap_),
+	.bsw4 =		oabs(bsw4_swap_),
+	.bsrs4 =	oabs(bsr4_),
+	.bsws4 =	oabs(bsw4_),
+	.bsrm4 =	oabs(bsrm4_),		/* XXX swap? */
+	.bswm4 =	oabs(bswm4_),		/* XXX swap? */
+	.bsrms4 =	oabs(bsrm4_),
+	.bswms4 =	oabs(bswm4_),
+	.bsrr4 =	oabs(bsrr4_),		/* XXX swap? */
+	.bswr4 =	oabs(bswr4_),		/* XXX swap? */
+	.bsrrs4 =	oabs(bsrr4_),
+	.bswrs4 =	oabs(bswr4_),
+	.bssr4 =	oabs(bssr4_),		/* XXX swap? */
+	.bscr4 =	oabs(bscr4_)		/* XXX swap? */
 };
 
 const struct amiga_bus_space_methods amiga_bus_stride_1swap = {
 
-	oabs(bsm_),
-	oabs(bsms_),
-	oabs(bsu_),
-	0,
-	0,
-
-	oabs(bsr1_),
-	oabs(bsw1_),
-	oabs(bsrm1_),
-	oabs(bswm1_),
-	oabs(bsrr1_),
-	oabs(bswr1_),
-	oabs(bssr1_),
-	oabs(bscr1_),
-
-	oabs(bsr2_),		/* XXX swap? */
-	oabs(bsw2_),		/* XXX swap? */
-	oabs(bsr2_),
-	oabs(bsw2_),
-	oabs(bsrm2_swap_),
-	oabs(bswm2_swap_),
-	oabs(bsrm2_),
-	oabs(bswm2_),
-	oabs(bsrr2_),		/* XXX swap? */
-	oabs(bswr2_),		/* XXX swap? */
-	oabs(bsrr2_),
-	oabs(bswr2_),
-	oabs(bssr2_),		/* XXX swap? */
-	oabs(bscr2_),		/* XXX swap? */
-
-	oabs(bsr4_swap_),
-	oabs(bsw4_swap_),
-	oabs(bsr4_),
-	oabs(bsw4_),
-	oabs(bsrm4_),		/* XXX swap? */
-	oabs(bswm4_),		/* XXX swap? */
-	oabs(bsrm4_),
-	oabs(bswm4_),
-	oabs(bsrr4_),		/* XXX swap? */
-	oabs(bswr4_),		/* XXX swap? */
-	oabs(bsrr4_),
-	oabs(bswr4_),
-	oabs(bssr4_),		/* XXX swap? */
-	oabs(bscr4_)		/* XXX swap? */
-
+	.bsm =		oabs(bsm_),
+	.bsms =		oabs(bsms_),
+	.bsu =		oabs(bsu_),
+	.bsa =		NULL,
+	.bsf =		NULL,
+
+	.bsr1 =		oabs(bsr1_),
+	.bsw1 =		oabs(bsw1_),
+	.bsrm1 =	oabs(bsrm1_),
+	.bswm1 =	oabs(bswm1_),
+	.bsrr1 =	oabs(bsrr1_),
+	.bsrw1 =	oabs(bswr1_),
+	.bssr1 =	oabs(bssr1_),
+	.bscr1 =	oabs(bscr1_),
+
+	.bsr2 =	

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

2011-09-15 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Thu Sep 15 14:45:22 UTC 2011

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

Log Message:
Only activate pages that are in active pmaps


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 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.63 src/sys/arch/usermode/usermode/pmap.c:1.64
--- src/sys/arch/usermode/usermode/pmap.c:1.63	Thu Sep 15 12:25:25 2011
+++ src/sys/arch/usermode/usermode/pmap.c	Thu Sep 15 14:45:22 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.63 2011/09/15 12:25:25 reinoud Exp $ */
+/* $NetBSD: pmap.c,v 1.64 2011/09/15 14:45:22 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.63 2011/09/15 12:25:25 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.64 2011/09/15 14:45:22 reinoud Exp $);
 
 #include opt_memsize.h
 #include opt_kmempages.h
@@ -465,7 +465,7 @@
 	}
 	/* If this mapping exists already, use that. */
 	for (pv = pv; pv != NULL; pv = pv-pv_next) {
-		if (pv-pv_pmap == pmap  pv-pv_lpn == lpn) {
+		if ((pv-pv_pmap == pmap)  (pv-pv_lpn == lpn)) {
 			return pv;
 		}
 	}
@@ -676,7 +676,11 @@
 			ppn, pv-pv_pmap);
 		if (pv-pv_pmap != NULL) {
 			pv_update(pv);
-			pmap_page_activate(pv);
+			if (pv-pv_pmap-pm_flags  PM_ACTIVE)
+pmap_page_activate(pv);
+			else
+pmap_page_deactivate(pv)
+			;
 		}
 	}
 }



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

2011-09-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Sep 15 14:51:06 UTC 2011

Modified Files:
src/tests/lib/libc/stdlib: t_hsearch.c

Log Message:
add the reentrant function tests (copies of the non-reentrant one).


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/stdlib/t_hsearch.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/stdlib/t_hsearch.c
diff -u src/tests/lib/libc/stdlib/t_hsearch.c:1.2 src/tests/lib/libc/stdlib/t_hsearch.c:1.3
--- src/tests/lib/libc/stdlib/t_hsearch.c:1.2	Thu Jul  7 07:12:18 2011
+++ src/tests/lib/libc/stdlib/t_hsearch.c	Thu Sep 15 10:51:06 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: t_hsearch.c,v 1.2 2011/07/07 11:12:18 jruoho Exp $ */
+/* $NetBSD: t_hsearch.c,v 1.3 2011/09/15 14:51:06 christos Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
 #include sys/cdefs.h
 __COPYRIGHT(@(#) Copyright (c) 2008\
  The NetBSD Foundation, inc. All rights reserved.);
-__RCSID($NetBSD: t_hsearch.c,v 1.2 2011/07/07 11:12:18 jruoho Exp $);
+__RCSID($NetBSD: t_hsearch.c,v 1.3 2011/09/15 14:51:06 christos Exp $);
 
 #include errno.h
 #include search.h
@@ -233,6 +233,164 @@
 	hdestroy();
 }
 
+ATF_TC(hsearch_r_basic);
+ATF_TC_HEAD(hsearch_r_basic, tc)
+{
+
+	atf_tc_set_md_var(tc, descr, Checks basic insertions and searching);
+}
+
+ATF_TC_BODY(hsearch_r_basic, tc)
+{
+	ENTRY e, *ep;
+	char ch[2];
+	int i;
+	struct hsearch_data t;
+
+	REQUIRE_ERRNO(hcreate_r(16, t) != 0);
+
+	/* ch[1] should be constant from here on down. */
+	ch[1] = '\0';
+
+	/* Basic insertions.  Check enough that there'll be collisions. */
+	for (i = 0; i  26; i++) {
+		ch[0] = 'a' + i;
+		e.key = strdup(ch);	/* ptr to provided key is kept! */
+		ATF_REQUIRE(e.key != NULL);
+		e.data = (void *)(long)i;
+
+		ATF_REQUIRE(hsearch_r(e, ENTER, ep, t) == 1);
+		ATF_REQUIRE(ep != NULL);
+		ATF_REQUIRE_STREQ(ep-key, ch);
+		ATF_REQUIRE_EQ((long)ep-data, i);
+	}
+
+	/* e.key should be constant from here on down. */
+	e.key = ch;
+
+	/* Basic lookups. */
+	for (i = 0; i  26; i++) {
+		ch[0] = 'a' + i;
+
+		ATF_REQUIRE(hsearch_r(e, FIND, ep, t) == 1);
+		ATF_REQUIRE(ep != NULL);
+		ATF_REQUIRE_STREQ(ep-key, ch);
+		ATF_REQUIRE_EQ((long)ep-data, i);
+	}
+
+	hdestroy_r(t);
+}
+
+ATF_TC(hsearch_r_duplicate);
+ATF_TC_HEAD(hsearch_r_duplicate, tc)
+{
+
+	atf_tc_set_md_var(tc, descr, Checks that inserting duplicate 
+	doesn't overwrite existing data);
+}
+
+ATF_TC_BODY(hsearch_r_duplicate, tc)
+{
+	ENTRY e, *ep;
+	struct hsearch_data t;
+
+	REQUIRE_ERRNO(hcreate_r(16, t));
+
+	e.key = strdup(a);
+	ATF_REQUIRE(e.key != NULL);
+	e.data = (void *)(long) 0;
+
+	ATF_REQUIRE(hsearch_r(e, ENTER, ep, t) == 1);
+	ATF_REQUIRE(ep != NULL);
+	ATF_REQUIRE_STREQ(ep-key, a);
+	ATF_REQUIRE_EQ((long)ep-data, 0);
+
+	e.data = (void *)(long)12345;
+
+	ATF_REQUIRE(hsearch_r(e, ENTER, ep, t) == 1);
+	ATF_REQUIRE(hsearch_r(e, FIND, ep, t) == 1);
+
+	ATF_REQUIRE(ep != NULL);
+	ATF_REQUIRE_STREQ(ep-key, a);
+	ATF_REQUIRE_EQ((long)ep-data, 0);
+
+	hdestroy_r(t);
+}
+
+ATF_TC(hsearch_r_nonexistent);
+ATF_TC_HEAD(hsearch_r_nonexistent, tc)
+{
+
+	atf_tc_set_md_var(tc, descr,
+	Checks searching for non-existent entry);
+}
+
+ATF_TC_BODY(hsearch_r_nonexistent, tc)
+{
+	ENTRY e, *ep;
+	struct hsearch_data t;
+
+	REQUIRE_ERRNO(hcreate_r(16, t));
+
+	e.key = strdup(A);
+	ATF_REQUIRE(hsearch_r(e, FIND, ep, t) == 1);
+	ATF_REQUIRE_EQ(ep, NULL);
+
+	hdestroy_r(t);
+}
+
+ATF_TC(hsearch_r_two);
+ATF_TC_HEAD(hsearch_r_two, tc)
+{
+
+	atf_tc_set_md_var(tc, descr,
+	Checks that searching doesn't overwrite previous search results);
+}
+
+ATF_TC_BODY(hsearch_r_two, tc)
+{
+	ENTRY e, *ep, *ep2;
+	char *sa, *sb;
+	struct hsearch_data t;
+
+	ATF_REQUIRE((sa = strdup(a)) != NULL);
+	ATF_REQUIRE((sb = strdup(b)) != NULL);
+
+	REQUIRE_ERRNO(hcreate_r(16, t));
+
+	e.key = sa;
+	e.data = (void*)(long)0;
+
+	ATF_REQUIRE(hsearch_r(e, ENTER, ep, t) == 1);
+	ATF_REQUIRE(ep != NULL);
+	ATF_REQUIRE_STREQ(ep-key, a);
+	ATF_REQUIRE_EQ((long)ep-data, 0);
+
+	e.key = sb;
+	e.data = (void*)(long)1;
+
+	ATF_REQUIRE(hsearch_r(e, ENTER, ep, t) == 1);
+	ATF_REQUIRE(ep != NULL);
+	ATF_REQUIRE_STREQ(ep-key, b);
+	ATF_REQUIRE_EQ((long)ep-data, 1);
+
+	e.key = sa;
+	ATF_REQUIRE(hsearch_r(e, FIND, ep, t) == 1);
+
+	e.key = sb;
+	ATF_REQUIRE(hsearch_r(e, FIND, ep2, t) == 1);
+
+	ATF_REQUIRE(ep != NULL);
+	ATF_REQUIRE_STREQ(ep-key, a);
+	ATF_REQUIRE_EQ((long)ep-data, 0);
+
+	ATF_REQUIRE(ep2 != NULL);
+	ATF_REQUIRE_STREQ(ep2-key, b);
+	ATF_REQUIRE_EQ((long)ep2-data, 1);
+
+	hdestroy_r(t);
+}
+
 ATF_TP_ADD_TCS(tp)
 {
 
@@ -241,5 +399,10 @@
 	ATF_TP_ADD_TC(tp, hsearch_nonexistent);
 	ATF_TP_ADD_TC(tp, hsearch_two);
 
+	ATF_TP_ADD_TC(tp, hsearch_r_basic);
+	ATF_TP_ADD_TC(tp, hsearch_r_duplicate);
+	ATF_TP_ADD_TC(tp, hsearch_r_nonexistent);
+	ATF_TP_ADD_TC(tp, hsearch_r_two);
+
 	return atf_no_error();
 }



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

2011-09-15 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Thu Sep 15 14:55:23 UTC 2011

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

Log Message:
On entering an entry to pmap, activate the entry directly if adding to an
already active pmap.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 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.64 src/sys/arch/usermode/usermode/pmap.c:1.65
--- src/sys/arch/usermode/usermode/pmap.c:1.64	Thu Sep 15 14:45:22 2011
+++ src/sys/arch/usermode/usermode/pmap.c	Thu Sep 15 14:55:23 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.64 2011/09/15 14:45:22 reinoud Exp $ */
+/* $NetBSD: pmap.c,v 1.65 2011/09/15 14:55:23 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.64 2011/09/15 14:45:22 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.65 2011/09/15 14:55:23 reinoud Exp $);
 
 #include opt_memsize.h
 #include opt_kmempages.h
@@ -724,7 +724,7 @@
 	pv-pv_lpn= lpn;
 	pv-pv_prot   = prot;
 	pv-pv_vflags = 0;
-	pv-pv_next   = NULL;
+	/* pv-pv_next   = NULL; */	/* might confuse linked list? */
 	if (flags  PMAP_WIRED)
 		pv-pv_vflags |= PV_WIRED;
 
@@ -748,6 +748,10 @@
 
 	splx(s);
 
+	/* activate page directly when on active pmap */
+	if (pmap-pm_flags  PM_ACTIVE)
+		pmap_page_activate(pv);
+
 	return 0;
 }
 



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

2011-09-15 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Thu Sep 15 15:02:35 UTC 2011

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

Log Message:
Remove temporary the optimalization code of pmap_remove_all() until the
suspected pmap problems are fixed/found.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 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.65 src/sys/arch/usermode/usermode/pmap.c:1.66
--- src/sys/arch/usermode/usermode/pmap.c:1.65	Thu Sep 15 14:55:23 2011
+++ src/sys/arch/usermode/usermode/pmap.c	Thu Sep 15 15:02:35 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.65 2011/09/15 14:55:23 reinoud Exp $ */
+/* $NetBSD: pmap.c,v 1.66 2011/09/15 15:02:35 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.65 2011/09/15 14:55:23 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.66 2011/09/15 15:02:35 reinoud Exp $);
 
 #include opt_memsize.h
 #include opt_kmempages.h
@@ -789,7 +789,7 @@
 		}
 	} else {
 		for (npv = pv-pv_next; npv; npv = npv-pv_next) {
-			if (pmap == npv-pv_pmap  lpn == npv-pv_lpn)
+			if ((pmap == npv-pv_pmap)  (lpn == npv-pv_lpn))
 break;
 			pv = npv;
 		}
@@ -842,8 +842,11 @@
 	if (pmap == pmap_kernel())
 		return;
 
+#if 0
+	/* remove all mappings in one-go; not needed */
 	pmap_remove(pmap, VM_MIN_ADDRESS, VM_MAXUSER_ADDRESS);
 	thunk_munmap((void *) VM_MIN_ADDRESS, VM_MAXUSER_ADDRESS - VM_MIN_ADDRESS);
+#endif
 #if 0
 	/* remove all cached info from the pages */
 	thunk_msync(VM_MIN_ADDRESS, VM_MAXUSER_ADDRESS - VM_MIN_ADDRESS,



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

2011-09-15 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Thu Sep 15 15:08:51 UTC 2011

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

Log Message:
Implement pmap_unwire(); not seen it called yet though


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 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.66 src/sys/arch/usermode/usermode/pmap.c:1.67
--- src/sys/arch/usermode/usermode/pmap.c:1.66	Thu Sep 15 15:02:35 2011
+++ src/sys/arch/usermode/usermode/pmap.c	Thu Sep 15 15:08:51 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.66 2011/09/15 15:02:35 reinoud Exp $ */
+/* $NetBSD: pmap.c,v 1.67 2011/09/15 15:08:51 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.66 2011/09/15 15:02:35 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.67 2011/09/15 15:08:51 reinoud Exp $);
 
 #include opt_memsize.h
 #include opt_kmempages.h
@@ -892,7 +892,22 @@
 void
 pmap_unwire(pmap_t pmap, vaddr_t va)
 {
-printf(pmap_unwire called not implemented\n');
+	struct pv_entry *pv;
+	intptr_t lpn;
+
+	dprintf_debug(pmap_unwire called\n');
+	if (pmap == NULL)
+		return;
+
+	lpn = atop(va - VM_MIN_ADDRESS);	/* V-L */
+	pv = pmap-pm_entries[lpn];
+	if (pv == NULL)
+		return;
+	/* but is it wired? */
+	if ((pv-pv_vflags  PV_WIRED) == 0)
+		return;
+	pmap-pm_stats.wired_count--;
+	pv-pv_vflags = ~PV_WIRED;
 }
 
 bool



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

2011-09-15 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Thu Sep 15 15:24:40 UTC 2011

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

Log Message:
Clarify pmap_copy's function as a dummy


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 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.68 src/sys/arch/usermode/usermode/pmap.c:1.69
--- src/sys/arch/usermode/usermode/pmap.c:1.68	Thu Sep 15 15:20:17 2011
+++ src/sys/arch/usermode/usermode/pmap.c	Thu Sep 15 15:24:39 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.68 2011/09/15 15:20:17 reinoud Exp $ */
+/* $NetBSD: pmap.c,v 1.69 2011/09/15 15:24:39 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.68 2011/09/15 15:20:17 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.69 2011/09/15 15:24:39 reinoud Exp $);
 
 #include opt_memsize.h
 #include opt_kmempages.h
@@ -940,7 +940,7 @@
 {
 	dprintf_debug(pmap_kenter_pa : v %p, p %p, prot %d, flags %d\n,
 		(void *) va, (void *) pa, (int) prot, (int) flags);
-	pmap_do_enter(pmap_kernel(),  va, pa, prot, prot | PMAP_WIRED, 1);
+	pmap_do_enter(pmap_kernel(), va, pa, prot, prot | PMAP_WIRED, 1);
 }
 
 void
@@ -953,7 +953,7 @@
 pmap_copy(pmap_t dst_map, pmap_t src_map, vaddr_t dst_addr, vsize_t len,
 vaddr_t src_addr)
 {
-	printf(pmap_copy not implemented\n);
+	dprintf_debug(pmap_copy (dummy)\n);
 }
 
 void



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

2011-09-15 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Thu Sep 15 15:34:20 UTC 2011

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

Log Message:
Implement pmap_copy_page()! That was missing a long time!


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 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.69 src/sys/arch/usermode/usermode/pmap.c:1.70
--- src/sys/arch/usermode/usermode/pmap.c:1.69	Thu Sep 15 15:24:39 2011
+++ src/sys/arch/usermode/usermode/pmap.c	Thu Sep 15 15:34:19 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.69 2011/09/15 15:24:39 reinoud Exp $ */
+/* $NetBSD: pmap.c,v 1.70 2011/09/15 15:34:19 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.69 2011/09/15 15:24:39 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.70 2011/09/15 15:34:19 reinoud Exp $);
 
 #include opt_memsize.h
 #include opt_kmempages.h
@@ -1021,13 +1021,24 @@
 	memset(blob, 0, PAGE_SIZE);
 	num = thunk_pwrite(mem_fh, blob, PAGE_SIZE, pa);
 	if (num != PAGE_SIZE)
-		panic(pmap_zero_page couldn't write out\n);
+		panic(%s: couldn't write out\n, __func__);
 }
 
+/* XXX braindead copy page implementation but it works for now */
 void
 pmap_copy_page(paddr_t src, paddr_t dst)
 {
-dprintf_debug(pmap_copy_page not implemented\n);
+	char blob[PAGE_SIZE];
+	int num;
+
+	dprintf_debug(pmap_copy_page: pa src %p, pa dst %p\n,
+		(void *) src, (void *) dst);
+	num = thunk_pread(mem_fh, blob, PAGE_SIZE, src);
+	if (num != PAGE_SIZE)
+		panic(%s: can't read in src\n, __func__);
+	num = thunk_pwrite(mem_fh, blob, PAGE_SIZE, dst);
+	if (num != PAGE_SIZE)
+		panic(%s: couldn't write out dst\n, __func__);
 }
 
 /* change access permissions on a given physical page */



CVS commit: src/tests/lib/libcurses/director

2011-09-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Sep 15 16:25:17 UTC 2011

Modified Files:
src/tests/lib/libcurses/director: testlang_parse.y

Log Message:
fix printf format strings


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/lib/libcurses/director/testlang_parse.y

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/libcurses/director/testlang_parse.y
diff -u src/tests/lib/libcurses/director/testlang_parse.y:1.11 src/tests/lib/libcurses/director/testlang_parse.y:1.12
--- src/tests/lib/libcurses/director/testlang_parse.y:1.11	Thu Sep 15 07:53:12 2011
+++ src/tests/lib/libcurses/director/testlang_parse.y	Thu Sep 15 12:25:17 2011
@@ -1,5 +1,5 @@
 %{
-/*	$NetBSD: testlang_parse.y,v 1.11 2011/09/15 11:53:12 blymn Exp $	*/
+/*	$NetBSD: testlang_parse.y,v 1.12 2011/09/15 16:25:17 christos Exp $	*/
 
 /*-
  * Copyright 2009 Brett Lymn bl...@netbsd.org
@@ -1117,8 +1117,8 @@
 		if ((byte_response-return_type == ret_byte) ||
 		(byte_response-return_type == ret_err) ||
 		(byte_response-return_type == ret_ok))
-			err(1, validate: expecting type %s, received type %s
-			 at line %d of file %s,
+			err(1, %s: expecting type %s, received type %s
+			 at line %zu of file %s, __func__,
 			returns_enum_names[command.returns[i].return_type],
 			returns_enum_names[byte_response-return_type],
 			line, cur_file);
@@ -1182,7 +1182,7 @@
 
 	if (verbose) {
 		fprintf(stderr,
-		validate_reference: return type of %s, value %s \n,
+		%s: return type of %s, value %s \n, __func__,
 		returns_enum_names[varp-type],
 		(const char *)varp-value);
 	}



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

2011-09-15 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Thu Sep 15 17:44:13 UTC 2011

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

Log Message:
Re-implement pmap_zero_page() and pmap_copy_page() by using
mmap + memset/memcpy + munmap.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 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.70 src/sys/arch/usermode/usermode/pmap.c:1.71
--- src/sys/arch/usermode/usermode/pmap.c:1.70	Thu Sep 15 15:34:19 2011
+++ src/sys/arch/usermode/usermode/pmap.c	Thu Sep 15 17:44:13 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.70 2011/09/15 15:34:19 reinoud Exp $ */
+/* $NetBSD: pmap.c,v 1.71 2011/09/15 17:44:13 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.70 2011/09/15 15:34:19 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.71 2011/09/15 17:44:13 reinoud Exp $);
 
 #include opt_memsize.h
 #include opt_kmempages.h
@@ -603,8 +603,9 @@
 	addr = thunk_mmap((void *) va, PAGE_SIZE, pv-pv_mmap_ppl,
 		THUNK_MAP_FILE | THUNK_MAP_FIXED | THUNK_MAP_SHARED,
 		mem_fh, pa);
-	dprintf_debug(page_activate: (va %p, pa %p, ppl %d) - %p\n,
-		(void *) va, (void *) pa, pv-pv_mmap_ppl, (void *) addr);
+	dprintf_debug(page_activate: (va %p, pa %p, prot %d, ppl %d) - %p\n,
+		(void *) va, (void *) pa, pv-pv_prot, pv-pv_mmap_ppl,
+		(void *) addr);
 	if (addr != (void *) va)
 		panic(pmap_page_activate: mmap failed (expected %p got %p): %d,
 		(void *)va, addr, thunk_geterrno());
@@ -1009,36 +1010,51 @@
 //	cpu_cache_flush();
 }
 
-/* XXX braindead zero_page implementation but it works for now */
 void
 pmap_zero_page(paddr_t pa)
 {
-	char blob[PAGE_SIZE];
-	int num;
+	char *blob;
 
 	dprintf_debug(pmap_zero_page: pa %p\n, (void *) pa);
 
+	blob = thunk_mmap(NULL, PAGE_SIZE,
+		THUNK_PROT_READ | THUNK_PROT_WRITE,
+		THUNK_MAP_FILE | THUNK_MAP_SHARED,
+		mem_fh, pa);
+	if (!blob)
+		panic(%s: couldn't get mapping, __func__);
+
 	memset(blob, 0, PAGE_SIZE);
-	num = thunk_pwrite(mem_fh, blob, PAGE_SIZE, pa);
-	if (num != PAGE_SIZE)
-		panic(%s: couldn't write out\n, __func__);
+
+	thunk_munmap(blob, PAGE_SIZE);
 }
 
-/* XXX braindead copy page implementation but it works for now */
 void
-pmap_copy_page(paddr_t src, paddr_t dst)
+pmap_copy_page(paddr_t src_pa, paddr_t dst_pa)
 {
-	char blob[PAGE_SIZE];
-	int num;
+	char *sblob, *dblob;
 
 	dprintf_debug(pmap_copy_page: pa src %p, pa dst %p\n,
-		(void *) src, (void *) dst);
-	num = thunk_pread(mem_fh, blob, PAGE_SIZE, src);
-	if (num != PAGE_SIZE)
-		panic(%s: can't read in src\n, __func__);
-	num = thunk_pwrite(mem_fh, blob, PAGE_SIZE, dst);
-	if (num != PAGE_SIZE)
-		panic(%s: couldn't write out dst\n, __func__);
+		(void *) src_pa, (void *) dst_pa);
+
+	sblob = thunk_mmap(NULL, PAGE_SIZE,
+		THUNK_PROT_READ,
+		THUNK_MAP_FILE | THUNK_MAP_SHARED,
+		mem_fh, src_pa);
+	if (!sblob)
+		panic(%s: couldn't get src mapping, __func__);
+
+	dblob = thunk_mmap(NULL, PAGE_SIZE,
+		THUNK_PROT_WRITE,
+		THUNK_MAP_FILE | THUNK_MAP_SHARED,
+		mem_fh, dst_pa);
+	if (!dblob)
+		panic(%s: couldn't get dst mapping, __func__);
+
+	memcpy(dblob, sblob, PAGE_SIZE);
+
+	thunk_munmap(sblob, PAGE_SIZE);
+	thunk_munmap(dblob, PAGE_SIZE);
 }
 
 /* change access permissions on a given physical page */
@@ -1054,7 +1070,7 @@
 	if (prot == VM_PROT_NONE) {
 		/* visit all mappings */
 		npv = pv = pv_table[ppn];
-		while (pv != NULL  pv-pv_pmap != NULL) {
+		while ((pv != NULL)  (pv-pv_pmap != NULL)) {
 			/* skip unmanaged entries */
 			if (pv-pv_vflags  PV_UNMANAGED) {
 pv = pv-pv_next;



CVS commit: src/lib/libbluetooth

2011-09-15 Thread Iain Hibbert
Module Name:src
Committed By:   plunky
Date:   Thu Sep 15 17:51:57 UTC 2011

Modified Files:
src/lib/libbluetooth: sdp_data.c

Log Message:
when printing URLs, don't use VIS_HTTPSTYLE as it doesn't
really do what I expected.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libbluetooth/sdp_data.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/libbluetooth/sdp_data.c
diff -u src/lib/libbluetooth/sdp_data.c:1.2 src/lib/libbluetooth/sdp_data.c:1.3
--- src/lib/libbluetooth/sdp_data.c:1.2	Thu Jul  7 10:44:50 2011
+++ src/lib/libbluetooth/sdp_data.c	Thu Sep 15 17:51:57 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdp_data.c,v 1.2 2011/07/07 10:44:50 plunky Exp $	*/
+/*	$NetBSD: sdp_data.c,v 1.3 2011/09/15 17:51:57 plunky Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: sdp_data.c,v 1.2 2011/07/07 10:44:50 plunky Exp $);
+__RCSID($NetBSD: sdp_data.c,v 1.3 2011/09/15 17:51:57 plunky Exp $);
 
 #include sdp.h
 #include stdarg.h
@@ -345,10 +345,10 @@
 }
 
 static void
-_sdp_putstr(int indent, int style, const char *type,
-const uint8_t *str, size_t len)
+_sdp_putstr(int indent, const char *type, const uint8_t *str, size_t len)
 {
 	char buf[50], *dst = buf;
+	int style;
 
 	indent = printf(%*s%s(%zu), indent, , type, len);
 	indent = 18 - indent;
@@ -357,7 +357,7 @@
 
 	printf(%*s, indent, );
 
-	style |= VIS_NL;
+	style = VIS_CSTYLE | VIS_NL;
 	buf[0] = '\0';
 
 	while (len  0  (dst + 5)  (buf + sizeof(buf))) {
@@ -540,7 +540,7 @@
 			if (next + len  end)
 return false;
 
-			_sdp_putstr(indent, VIS_CSTYLE, str8, next, len);
+			_sdp_putstr(indent, str8, next, len);
 			next += len;
 			break;
 
@@ -554,7 +554,7 @@
 			if (next + len  end)
 return false;
 
-			_sdp_putstr(indent, VIS_HTTPSTYLE, url8, next, len);
+			_sdp_putstr(indent, url8, next, len);
 			next += len;
 			break;
 
@@ -568,7 +568,7 @@
 			if (next + len  end)
 return false;
 
-			_sdp_putstr(indent, VIS_CSTYLE, str16, next, len);
+			_sdp_putstr(indent, str16, next, len);
 			next += len;
 			break;
 
@@ -582,7 +582,7 @@
 			if (next + len  end)
 return false;
 
-			_sdp_putstr(indent, VIS_HTTPSTYLE, url16, next, len);
+			_sdp_putstr(indent, url16, next, len);
 			next += len;
 			break;
 
@@ -596,7 +596,7 @@
 			if (next + len  end)
 return false;
 
-			_sdp_putstr(indent, VIS_CSTYLE, str32, next, len);
+			_sdp_putstr(indent, str32, next, len);
 			next += len;
 			break;
 
@@ -610,7 +610,7 @@
 			if (next + len  end)
 return false;
 
-			_sdp_putstr(indent, VIS_HTTPSTYLE, url32, next, len);
+			_sdp_putstr(indent, url32, next, len);
 			next += len;
 			break;
 



CVS commit: src/usr.bin/sdpquery

2011-09-15 Thread Iain Hibbert
Module Name:src
Committed By:   plunky
Date:   Thu Sep 15 17:52:53 UTC 2011

Modified Files:
src/usr.bin/sdpquery: print.c

Log Message:
when printing URL strings, don't use VIS_HTTPSTYLE, it does
not quite work as I expected.. just use VIS_CSTYLE


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/sdpquery/print.c

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

Modified files:

Index: src/usr.bin/sdpquery/print.c
diff -u src/usr.bin/sdpquery/print.c:1.18 src/usr.bin/sdpquery/print.c:1.19
--- src/usr.bin/sdpquery/print.c:1.18	Sat Aug 20 09:18:47 2011
+++ src/usr.bin/sdpquery/print.c	Thu Sep 15 17:52:53 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: print.c,v 1.18 2011/08/20 09:18:47 plunky Exp $	*/
+/*	$NetBSD: print.c,v 1.19 2011/09/15 17:52:53 plunky Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: print.c,v 1.18 2011/08/20 09:18:47 plunky Exp $);
+__RCSID($NetBSD: print.c,v 1.19 2011/09/15 17:52:53 plunky Exp $);
 
 #include ctype.h
 #include iconv.h
@@ -64,7 +64,7 @@
 } language_t;
 
 static const char *string_uuid(uuid_t *);
-static const char *string_vis(int, const char *, size_t);
+static const char *string_vis(const char *, size_t);
 
 static void print_hexdump(const char *, const uint8_t *, size_t);
 static bool print_attribute(uint16_t, sdp_data_t *, attr_t *, size_t);
@@ -553,13 +553,14 @@
 }
 
 static const char *
-string_vis(int style, const char *src, size_t len)
+string_vis(const char *src, size_t len)
 {
 	static char buf[50];
 	char *dst = buf;
+	int style;
 
 	buf[0] = '\0';
-	style |= VIS_NL;
+	style = VIS_CSTYLE | VIS_NL;
 	while (len  0  (dst + 5)  (buf + sizeof(buf))) {
 		dst = vis(dst, src[0], style, (len  1 ? src[1] : 0));
 		src++;
@@ -776,7 +777,7 @@
 	if (!sdp_get_str(data, str, len))
 		return;
 
-	printf(\%s\\n, string_vis(VIS_CSTYLE, str, len));
+	printf(\%s\\n, string_vis(str, len));
 }
 
 static void
@@ -799,7 +800,7 @@
 			len -= l + 1;
 			ep++;
 		}
-		printf(%s\n, string_vis(VIS_CSTYLE, str, l));
+		printf(%s\n, string_vis(str, l));
 		str = ep;
 	}
 }
@@ -813,7 +814,7 @@
 	if (!sdp_get_url(data, url, len))
 		return;
 
-	printf(\%s\\n, string_vis(VIS_HTTPSTYLE, url, len));
+	printf(\%s\\n, string_vis(url, len));
 }
 
 static void
@@ -1608,7 +1609,7 @@
 		}
 
 		l = (size_t)(ep - str + 1);
-		printf(%s\n, string_vis(VIS_CSTYLE, str, l));
+		printf(%s\n, string_vis(str, l));
 		str += l;
 		len -= l;
 	}



CVS commit: src/external/bsd/libpcap/lib

2011-09-15 Thread Iain Hibbert
Module Name:src
Committed By:   plunky
Date:   Thu Sep 15 17:59:45 UTC 2011

Modified Files:
src/external/bsd/libpcap/lib: Makefile

Log Message:
revert v1.31 (when this was lib/libpcap/Makefile), the HAVE_PCC
is not any longer required since pcc understands gcc attributes
now


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/libpcap/lib/Makefile

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

Modified files:

Index: src/external/bsd/libpcap/lib/Makefile
diff -u src/external/bsd/libpcap/lib/Makefile:1.5 src/external/bsd/libpcap/lib/Makefile:1.6
--- src/external/bsd/libpcap/lib/Makefile:1.5	Tue Aug 16 10:34:23 2011
+++ src/external/bsd/libpcap/lib/Makefile	Thu Sep 15 17:59:45 2011
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.5 2011/08/16 10:34:23 christos Exp $	
+# $NetBSD: Makefile,v 1.6 2011/09/15 17:59:45 plunky Exp $	
 
 .include bsd.own.mk
 
@@ -73,12 +73,7 @@
 YHEADER=	1
 
 CPPFLAGS+=	-DHAVE_CONFIG_H
-
-.if defined(HAVE_PCC)
-CPPFLAGS+=	-D_U_=
-.elif defined(HAVE_GCC)
 CPPFLAGS+=	-D_U_=__attribute__((__unused__))
-.endif
 
 .if (${USE_INET6} != no)
 CPPFLAGS+=	-DINET6



CVS commit: src/sys/arch/evbmips/loongson/dev

2011-09-15 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Sep 15 19:29:23 UTC 2011

Modified Files:
src/sys/arch/evbmips/loongson/dev: stvii.c

Log Message:
add envsys support


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbmips/loongson/dev/stvii.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/evbmips/loongson/dev/stvii.c
diff -u src/sys/arch/evbmips/loongson/dev/stvii.c:1.2 src/sys/arch/evbmips/loongson/dev/stvii.c:1.3
--- src/sys/arch/evbmips/loongson/dev/stvii.c:1.2	Wed Sep  7 13:37:49 2011
+++ src/sys/arch/evbmips/loongson/dev/stvii.c	Thu Sep 15 19:29:23 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: stvii.c,v 1.2 2011/09/07 13:37:49 macallan Exp $	*/
+/*	$NetBSD: stvii.c,v 1.3 2011/09/15 19:29:23 macallan Exp $	*/
 
 /*-
  * Copyright (C) 2011 Michael Lorenz.
@@ -30,7 +30,7 @@
 
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: stvii.c,v 1.2 2011/09/07 13:37:49 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: stvii.c,v 1.3 2011/09/15 19:29:23 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -94,6 +94,7 @@
 	i2c_tag_t sc_i2c;
 	int sc_address, sc_version;
 	int sc_sleep;
+	int sc_flags, sc_charge;
 	struct sysmon_envsys *sc_sme;
 	envsys_data_t sc_sensor[BAT_NSENSORS];
 	struct sysmon_pswitch sc_sm_acpower;
@@ -106,6 +107,8 @@
 static void stvii_writereg(struct stvii_softc *, int, uint8_t);
 static int stvii_readreg(struct stvii_softc *, int);
 static void stvii_worker(void *);
+static void stvii_setup_envsys(struct stvii_softc *);
+static void stvii_refresh(struct sysmon_envsys *, envsys_data_t *);
 
 CFATTACH_DECL_NEW(stvii, sizeof(struct stvii_softc),
 stvii_match, stvii_attach, NULL, NULL);
@@ -181,6 +184,7 @@
 	if (sysmon_pswitch_register(sc-sc_sm_powerbutton) != 0)
 		printf(%s: unable to register power button with sysmon\n,
 		device_xname(sc-sc_dev));
+	stvii_setup_envsys(sc);
 }
 
 static void
@@ -222,11 +226,13 @@
 static int
 stvii_battery_level(struct stvii_softc *sc)
 {
-	int bl, bh;
+	int bl, bh, ret;
 
 	bl = stvii_readreg(sc, ST7_BATTERY_L);
 	bh = stvii_readreg(sc, ST7_BATTERY_H);
-	return (bl  3) | (bh  2);	
+	ret = (bl  3) | (bh  2);
+	ret = ((ret * 1) / 1024) * 1000;
+	return ret;
 }
 
 static void
@@ -274,6 +280,7 @@
 			}
 			status = st;
 		}
+		sc-sc_flags = status;
 		if (0) {
 			bl = stvii_battery_level(sc);
 			if (bl != battery_level) {
@@ -284,3 +291,81 @@
 		tsleep(sc-sc_sleep, 0, stvii, hz / 2);
 	}
 }
+
+#define INITDATA(index, unit, string)	\
+	sc-sc_sensor[index].units = unit; \
+	sc-sc_sensor[index].state = ENVSYS_SINVALID;			\
+	snprintf(sc-sc_sensor[index].desc,\
+	sizeof(sc-sc_sensor[index].desc), %s, string);
+
+static void
+stvii_setup_envsys(struct stvii_softc *sc)
+{
+	int i;
+
+	sc-sc_sme = sysmon_envsys_create();
+
+	INITDATA(BAT_AC_PRESENT, ENVSYS_INDICATOR, AC present);
+	INITDATA(BAT_BATTERY_PRESENT, ENVSYS_INDICATOR, Battery present);
+	INITDATA(BAT_CHARGING, ENVSYS_BATTERY_CHARGE, Battery charging);
+	INITDATA(BAT_CHARGE, ENVSYS_SVOLTS_DC, Battery voltage);
+	INITDATA(BAT_MAX_CHARGE, ENVSYS_SVOLTS_DC, Battery design cap);
+#undef INITDATA
+
+	for (i = 0; i  BAT_NSENSORS; i++) {
+		if (sysmon_envsys_sensor_attach(sc-sc_sme,
+		sc-sc_sensor[i])) {
+			sysmon_envsys_destroy(sc-sc_sme);
+			return;
+		}
+	}
+
+	sc-sc_sme-sme_name = device_xname(sc-sc_dev);
+	sc-sc_sme-sme_cookie = sc;
+	sc-sc_sme-sme_refresh = stvii_refresh;
+
+	if (sysmon_envsys_register(sc-sc_sme)) {
+		aprint_error_dev(sc-sc_dev,
+		unable to register with sysmon\n);
+		sysmon_envsys_destroy(sc-sc_sme);
+	}
+}
+
+static void
+stvii_refresh(struct sysmon_envsys *sme, envsys_data_t *edata)
+{
+	struct stvii_softc *sc = sme-sme_cookie;
+	int which = edata-sensor, ctl, bat;
+
+	edata-state = ENVSYS_SINVALID;
+	switch (which) {
+	case BAT_AC_PRESENT:
+		edata-value_cur = (sc-sc_flags  STS_AC_AVAILABLE);
+		edata-state = ENVSYS_SVALID;
+		break;
+	case BAT_BATTERY_PRESENT:
+		edata-value_cur = (sc-sc_flags  STS_BATTERY_PRESENT);
+		edata-state = ENVSYS_SVALID;
+		break;
+	case BAT_CHARGE:
+		if (sc-sc_flags  STS_BATTERY_PRESENT) {
+			bat = stvii_battery_level(sc);
+			edata-value_cur = bat;
+			edata-state = ENVSYS_SVALID;
+		}
+		break;
+	case BAT_MAX_CHARGE:
+		if (sc-sc_flags  STS_BATTERY_PRESENT) {
+			edata-value_cur = 830;
+			/*edata-state = ENVSYS_SVALID;*/
+		}
+		break;
+	case BAT_CHARGING:
+		ctl = stvii_readreg(sc, ST7_CONTROL);
+		if (ctl != -1) {
+			edata-value_cur = ctl  STC_CHARGE_ENABLE;
+		}
+		edata-state = ENVSYS_SVALID;
+		break;
+	}
+}



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

2011-09-15 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Thu Sep 15 19:32:28 UTC 2011

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

Log Message:
Check reentry to prevent double use of the aiocb structure


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/usermode/dev/ld_thunkbus.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/ld_thunkbus.c
diff -u src/sys/arch/usermode/dev/ld_thunkbus.c:1.14 src/sys/arch/usermode/dev/ld_thunkbus.c:1.15
--- src/sys/arch/usermode/dev/ld_thunkbus.c:1.14	Tue Sep 13 10:40:26 2011
+++ src/sys/arch/usermode/dev/ld_thunkbus.c	Thu Sep 15 19:32:28 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: ld_thunkbus.c,v 1.14 2011/09/13 10:40:26 reinoud Exp $ */
+/* $NetBSD: ld_thunkbus.c,v 1.15 2011/09/15 19:32:28 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ld_thunkbus.c,v 1.14 2011/09/13 10:40:26 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: ld_thunkbus.c,v 1.15 2011/09/15 19:32:28 reinoud Exp $);
 
 #include sys/param.h
 #include sys/proc.h
@@ -68,6 +68,7 @@
 	void		*sc_ih;
 
 	struct ld_thunkbus_transfer sc_tt;
+	bool		busy;
 };
 
 CFATTACH_DECL_NEW(ld_thunkbus, sizeof(struct ld_thunkbus_softc),
@@ -128,6 +129,8 @@
 	if (thunk_sigaction(SIGIO, sa, NULL) == -1)
 		panic(couldn't register SIGIO handler: %d, thunk_geterrno());
 
+	sc-busy = false;
+
 	ldattach(ld);
 }
 
@@ -145,6 +148,7 @@
 		if (tt) {
 			sc = tt-tt_sc;
 			spl_intr(IPL_BIO, softint_schedule, sc-sc_ih);
+			// spl_intr(IPL_BIO, ld_thunkbus_complete, sc);
 			// softint_schedule(sc-sc_ih);
 		}
 	}
@@ -159,6 +163,9 @@
 	struct ld_thunkbus_transfer *tt = sc-sc_tt;
 	struct buf *bp = tt-tt_bp;
 
+	if (!sc-busy)
+		panic(%s: but not busy?\n, __func__);
+
 	if (thunk_aio_error(tt-tt_aio) == 0 
 	thunk_aio_return(tt-tt_aio) != -1) {
 		bp-b_resid = 0;
@@ -167,10 +174,11 @@
 		bp-b_resid = bp-b_bcount;
 	}
 
-//printf(\tfin\n);
+	dprintf_debug(\tfin\n);
 	if (bp-b_error)
-		printf(error!\n);
+		dprintf_debug(error!\n);
 
+	sc-busy = false;
 	lddone(sc-sc_ld, bp);
 }
 
@@ -200,6 +208,10 @@
 	(long long)bp-b_rawblkno,
 	(long long)bp-b_bcount);
 #endif
+	if (sc-busy)
+		panic(%s: reentry, __func__);
+	sc-busy = true;
+
 	if (bp-b_flags  B_READ)
 		error = thunk_aio_read(tt-tt_aio);
 	else



CVS commit: src/usr.bin/stat

2011-09-15 Thread Alan Barrett
Module Name:src
Committed By:   apb
Date:   Thu Sep 15 19:56:35 UTC 2011

Modified Files:
src/usr.bin/stat: stat.1

Log Message:
Add examples of formats for stat(1) to simulate find -ls and ls -lTd.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/usr.bin/stat/stat.1

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

Modified files:

Index: src/usr.bin/stat/stat.1
diff -u src/usr.bin/stat/stat.1:1.29 src/usr.bin/stat/stat.1:1.30
--- src/usr.bin/stat/stat.1:1.29	Wed Feb 16 23:08:29 2011
+++ src/usr.bin/stat/stat.1	Thu Sep 15 19:56:35 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: stat.1,v 1.29 2011/02/16 23:08:29 christos Exp $
+.\	$NetBSD: stat.1,v 1.30 2011/09/15 19:56:35 apb Exp $
 .\
 .\ Copyright (c) 2002-2005 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -27,7 +27,7 @@
 .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\ POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd February 16, 2011
+.Dd September 15, 2011
 .Dt STAT 1
 .Os
 .Sh NAME
@@ -473,6 +473,32 @@
 0 78852 -rw-r--r-- 1 root wheel 0 0 Jul  8 10:26:03 2004 Jul  8 10:26:03 2004 Jul  8 10:28:13 2004 Jan  1 09:00:00 1970 16384 0 0 /tmp/bar
 .Ed
 .Pp
+This example produces output very similar to that from
+.Ic find ... -ls
+(except that
+.Xr find 1
+displays the time in a different format):
+.Bd -literal -offset indent
+\*[Gt] stat -f %7i %6b %-11Sp %3l %-17Su %-17Sg %9Z %Sm %N%SY /tmp/bar
+  78852  0 -rw-r--r--1 root  wheel 0 Jul  8 10:26:03 2004 /tmp/bar
+
+\*[Gt] find /tmp/bar -ls -exit
+  78852  0 -rw-r--r--1 root  wheel 0 Jul  8  2004 /tmp/bar
+.Ed
+.Pp
+This example produces output very similar to that from
+.Ic ls -lTd
+(except that
+.Xr ls 1
+adjusts the column spacing differently when listing multiple files):
+.Bd -literal -offset indent
+\*[Gt] stat -f %-11Sp %l %Su  %Sg  %5Z %Sm %N%SY /tmp/bar
+-rw-r--r--  1 root  wheel  0 Jul  8 10:26:03 2004 /tmp/bar
+
+\*[Gt] ls -lTd /tmp/bar
+-rw-r--r--  1 root  wheel  0 Jul  8 10:26:03 2004 /tmp/bar
+.Ed
+.Pp
 Given a symbolic link
 .Dq foo
 that points from



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

2011-09-15 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Thu Sep 15 20:25:23 UTC 2011

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

Log Message:
Use vfprintf() to make it compile under 5.1 again


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 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/usermode/thunk.c
diff -u src/sys/arch/usermode/usermode/thunk.c:1.38 src/sys/arch/usermode/usermode/thunk.c:1.39
--- src/sys/arch/usermode/usermode/thunk.c:1.38	Thu Sep 15 12:23:51 2011
+++ src/sys/arch/usermode/usermode/thunk.c	Thu Sep 15 20:25:23 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.c,v 1.38 2011/09/15 12:23:51 reinoud Exp $ */
+/* $NetBSD: thunk.c,v 1.39 2011/09/15 20:25:23 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -28,7 +28,7 @@
 
 #include sys/cdefs.h
 #ifdef __NetBSD__
-__RCSID($NetBSD: thunk.c,v 1.38 2011/09/15 12:23:51 reinoud Exp $);
+__RCSID($NetBSD: thunk.c,v 1.39 2011/09/15 20:25:23 reinoud Exp $);
 #endif
 
 #include sys/types.h
@@ -69,7 +69,7 @@
 va_list ap;
 
 va_start(ap, fmt);
-vdprintf(2, fmt, ap);
+vfprintf(stderr, fmt, ap);
 va_end(ap);
 }
 }



CVS commit: src/sys/kern

2011-09-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Sep 16 01:03:02 UTC 2011

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

Log Message:
check that we have valid event strings on attach too, so that the error
is obvious instead of catching it when vmstat -e runs!


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/kern/subr_evcnt.c

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

Modified files:

Index: src/sys/kern/subr_evcnt.c
diff -u src/sys/kern/subr_evcnt.c:1.9 src/sys/kern/subr_evcnt.c:1.10
--- src/sys/kern/subr_evcnt.c:1.9	Sat Jan 29 12:35:24 2011
+++ src/sys/kern/subr_evcnt.c	Thu Sep 15 21:03:02 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_evcnt.c,v 1.9 2011/01/29 17:35:24 matt Exp $ */
+/* $NetBSD: subr_evcnt.c,v 1.10 2011/09/16 01:03:02 christos Exp $ */
 
 /*
  * Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -77,7 +77,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: subr_evcnt.c,v 1.9 2011/01/29 17:35:24 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: subr_evcnt.c,v 1.10 2011/09/16 01:03:02 christos Exp $);
 
 #include sys/param.h
 #include sys/evcnt.h
@@ -137,14 +137,14 @@
 
 	len = strlen(ev-ev_group);
 #ifdef DIAGNOSTIC
-	if (len = EVCNT_STRING_MAX)		/* ..._MAX includes NUL */
+	if (len == 0 || len = EVCNT_STRING_MAX) /* ..._MAX includes NUL */
 		panic(evcnt_attach_static: group length (%s), ev-ev_group);
 #endif
 	ev-ev_grouplen = len;
 
 	len = strlen(ev-ev_name);
 #ifdef DIAGNOSTIC
-	if (len = EVCNT_STRING_MAX)		/* ..._MAX includes NUL */
+	if (len == 0 || len = EVCNT_STRING_MAX) /* ..._MAX includes NUL */
 		panic(evcnt_attach_static: name length (%s), ev-ev_name);
 #endif
 	ev-ev_namelen = len;



CVS commit: src/sys/kern

2011-09-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Sep 16 01:03:52 UTC 2011

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

Log Message:
This is no place to attach the primary cpu. Things go wrong from here because
for example it is missing its name.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/kern/sched_m2.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/sched_m2.c
diff -u src/sys/kern/sched_m2.c:1.29 src/sys/kern/sched_m2.c:1.30
--- src/sys/kern/sched_m2.c:1.29	Sun Nov 22 14:09:16 2009
+++ src/sys/kern/sched_m2.c	Thu Sep 15 21:03:52 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: sched_m2.c,v 1.29 2009/11/22 19:09:16 mbalmer Exp $	*/
+/*	$NetBSD: sched_m2.c,v 1.30 2011/09/16 01:03:52 christos Exp $	*/
 
 /*
  * Copyright (c) 2007, 2008 Mindaugas Rasiukevicius rmind at NetBSD org
@@ -33,7 +33,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: sched_m2.c,v 1.29 2009/11/22 19:09:16 mbalmer Exp $);
+__KERNEL_RCSID(0, $NetBSD: sched_m2.c,v 1.30 2011/09/16 01:03:52 christos Exp $);
 
 #include sys/param.h
 
@@ -81,8 +81,6 @@
 void
 sched_rqinit(void)
 {
-	struct cpu_info *ci = curcpu();
-
 	if (hz  100) {
 		panic(sched_rqinit: value of HZ is too low\n);
 	}
@@ -93,8 +91,11 @@
 	rt_ts = mstohz(100);			/* ~100 ms */
 	sched_precalcts();
 
+#ifdef notdef
+	/* Need to set the name etc. This does not belong here */
 	/* Attach the primary CPU here */
-	sched_cpuattach(ci);
+	sched_cpuattach(curcpu());
+#endif
 
 	sched_lwp_fork(NULL, lwp0);
 	sched_newts(lwp0);



CVS commit: src/tests/lib/libm

2011-09-15 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Fri Sep 16 04:54:47 UTC 2011

Modified Files:
src/tests/lib/libm: t_ldexp.c

Log Message:
Adjust to see where this fails on i386/qemu.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 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_ldexp.c
diff -u src/tests/lib/libm/t_ldexp.c:1.7 src/tests/lib/libm/t_ldexp.c:1.8
--- src/tests/lib/libm/t_ldexp.c:1.7	Wed Sep 14 13:47:40 2011
+++ src/tests/lib/libm/t_ldexp.c	Fri Sep 16 04:54:46 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: t_ldexp.c,v 1.7 2011/09/14 13:47:40 jruoho Exp $ */
+/* $NetBSD: t_ldexp.c,v 1.8 2011/09/16 04:54:46 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.7 2011/09/14 13:47:40 jruoho Exp $);
+__RCSID($NetBSD: t_ldexp.c,v 1.8 2011/09/16 04:54:46 jruoho Exp $);
 
 #include math.h
 #include limits.h
@@ -51,13 +51,19 @@
 {
 #ifndef __vax__
 	const double n[] = { 1, 2, 3, 25, 50, 100, 123, 321, 500 };
-	const double x = 12.1288221;
+	const double eps = 1.0e-40;
+	const double x = 12.0;
 	double y;
 	size_t i;
 
 	for (i = 0; i  __arraycount(n); i++) {
+
 		y = ldexp(x, n[i]);
-		ATF_CHECK(y == x * exp2(n[i]));
+
+		if (fabs(y - (x * exp2(n[i])))  eps) {
+			atf_tc_fail_nonfatal(ldexp(%0.01f, %0.01f) 
+			!= %0.01f * exp2(%0.01f), x, n[i], x, n[i]);
+		}
 	}
 #endif
 }
@@ -178,13 +184,19 @@
 {
 #ifndef __vax__
 	const float n[] = { 1, 2, 3, 25, 50, 100, 123, 321, 500 };
-	const float x = 12.1288221;
+	const float eps = 1.0e-9;
+	const float x = 12;
 	float y;
 	size_t i;
 
 	for (i = 0; i  __arraycount(n); i++) {
+
 		y = ldexpf(x, n[i]);
-		ATF_CHECK(y == x * exp2f(n[i]));
+
+		if (fabsf(y - (x * exp2f(n[i])))  eps) {
+			atf_tc_fail_nonfatal(ldexpf(%0.01f, %0.01f) 
+			!= %0.01f * exp2f(%0.01f), x, n[i], x, n[i]);
+		}
 	}
 #endif
 }