CVS commit: src

2011-04-09 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Sun Apr 10 06:27:21 UTC 2011

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/lib/libc/gen: Makefile
Added Files:
src/tests/lib/libc/gen: t_getcwd.c

Log Message:
A naive test case for getcwd(3).


To generate a diff of this commit:
cvs rdiff -u -r1.302 -r1.303 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.17 -r1.18 src/tests/lib/libc/gen/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/lib/libc/gen/t_getcwd.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/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.302 src/distrib/sets/lists/tests/mi:1.303
--- src/distrib/sets/lists/tests/mi:1.302	Sun Apr 10 06:11:47 2011
+++ src/distrib/sets/lists/tests/mi	Sun Apr 10 06:27:20 2011
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.302 2011/04/10 06:11:47 jruoho Exp $
+# $NetBSD: mi,v 1.303 2011/04/10 06:27:20 jruoho Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -343,6 +343,7 @@
 ./usr/libdata/debug/usr/tests/lib/libc/gen/t_basedirname.debug		tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/gen/t_dir.debug			tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/gen/t_fmtcheck.debug		tests-lib-debug		debug,atf
+./usr/libdata/debug/usr/tests/lib/libc/gen/t_getcwd.debug		tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/gen/t_getgrent.debug		tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/gen/t_glob_star.debug		tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/gen/t_humanize_number.debug	tests-lib-debug		debug,atf
@@ -1744,6 +1745,7 @@
 ./usr/tests/lib/libc/gen/t_basedirname		tests-lib-tests		atf
 ./usr/tests/lib/libc/gen/t_dir			tests-lib-tests		atf
 ./usr/tests/lib/libc/gen/t_fmtcheck		tests-lib-tests		atf
+./usr/tests/lib/libc/gen/t_getcwd		tests-lib-tests		atf
 ./usr/tests/lib/libc/gen/t_getgrent		tests-lib-tests		atf
 ./usr/tests/lib/libc/gen/t_glob_star		tests-lib-tests		atf
 ./usr/tests/lib/libc/gen/t_humanize_number	tests-lib-tests		atf

Index: src/tests/lib/libc/gen/Makefile
diff -u src/tests/lib/libc/gen/Makefile:1.17 src/tests/lib/libc/gen/Makefile:1.18
--- src/tests/lib/libc/gen/Makefile:1.17	Tue Apr  5 06:15:31 2011
+++ src/tests/lib/libc/gen/Makefile	Sun Apr 10 06:27:21 2011
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.17 2011/04/05 06:15:31 jruoho Exp $
+# $NetBSD: Makefile,v 1.18 2011/04/10 06:27:21 jruoho Exp $
 
 .include 
 
@@ -7,6 +7,7 @@
 TESTS_C+=	t_basedirname
 TESTS_C+=	t_dir
 TESTS_C+=	t_fmtcheck
+TESTS_C+=	t_getcwd
 TESTS_C+=	t_getgrent
 TESTS_C+=	t_glob_star
 TESTS_C+=	t_humanize_number

Added files:

Index: src/tests/lib/libc/gen/t_getcwd.c
diff -u /dev/null src/tests/lib/libc/gen/t_getcwd.c:1.1
--- /dev/null	Sun Apr 10 06:27:21 2011
+++ src/tests/lib/libc/gen/t_getcwd.c	Sun Apr 10 06:27:21 2011
@@ -0,0 +1,146 @@
+/*	$NetBSD: t_getcwd.c,v 1.1 2011/04/10 06:27:21 jruoho Exp $ */
+
+/*-
+ * Copyright (c) 2011 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jukka Ruohonen.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#include 
+__RCSID("$NetBSD: t_getcwd.c,v 1.1 2011/04/10 06:27:21 jruoho Exp $");
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+ATF_TC(getcwd_err);
+ATF_TC_HEAD(getcwd_err, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test error conditions in getcwd(3)");
+}
+
+ATF_TC_BODY(getcwd_err, tc)
+{
+	char buf[MAXPATHLEN];
+
+	errno = 0;
+
+	ATF_REQUIRE(getcwd(buf, 0) == NULL);
+	ATF_

CVS commit: src

2011-04-09 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Sun Apr 10 06:11:47 UTC 2011

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/lib/libm: Makefile
Added Files:
src/tests/lib/libm: t_log.c

Log Message:
Add a test case for PR lib/41931 reported by he@. It was verified that these
fail on NetBSD 5.99.48 amd64 but pass on amd64 Linux (glibc 2.7).


To generate a diff of this commit:
cvs rdiff -u -r1.301 -r1.302 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libm/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/lib/libm/t_log.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/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.301 src/distrib/sets/lists/tests/mi:1.302
--- src/distrib/sets/lists/tests/mi:1.301	Sat Apr  9 17:45:25 2011
+++ src/distrib/sets/lists/tests/mi	Sun Apr 10 06:11:47 2011
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.301 2011/04/09 17:45:25 pgoyette Exp $
+# $NetBSD: mi,v 1.302 2011/04/10 06:11:47 jruoho Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -465,6 +465,7 @@
 ./usr/libdata/debug/usr/tests/lib/libm	tests-lib-debug
 ./usr/libdata/debug/usr/tests/lib/libm/t_ceil.debug			tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libm/t_floor.debug			tests-lib-debug		debug,atf
+./usr/libdata/debug/usr/tests/lib/libm/t_log.debug			tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libm/t_libm.debug			tests-obsolete		obsolete
 ./usr/libdata/debug/usr/tests/lib/libm/t_round.debug			tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libm/t_tanh.debug			tests-lib-debug		debug,atf
@@ -1956,6 +1957,7 @@
 ./usr/tests/lib/libm/Atffile			tests-lib-tests		atf
 ./usr/tests/lib/libm/t_ceil			tests-lib-tests		atf
 ./usr/tests/lib/libm/t_floor			tests-lib-tests		atf
+./usr/tests/lib/libm/t_log			tests-lib-tests		atf
 ./usr/tests/lib/libm/t_libm			tests-obsolete		obsolete
 ./usr/tests/lib/libm/t_round			tests-lib-tests		atf
 ./usr/tests/lib/libm/t_tanh			tests-lib-tests		atf

Index: src/tests/lib/libm/Makefile
diff -u src/tests/lib/libm/Makefile:1.4 src/tests/lib/libm/Makefile:1.5
--- src/tests/lib/libm/Makefile:1.4	Fri Apr  8 06:49:21 2011
+++ src/tests/lib/libm/Makefile	Sun Apr 10 06:11:47 2011
@@ -1,12 +1,12 @@
-# $NetBSD: Makefile,v 1.4 2011/04/08 06:49:21 jruoho Exp $
+# $NetBSD: Makefile,v 1.5 2011/04/10 06:11:47 jruoho Exp $
 
 .include 
 
 TESTSDIR=	${TESTSBASE}/lib/libm
 
-TESTS_C+=	t_ceil t_floor t_round t_tanh
+TESTS_C+=	t_ceil t_floor t_log t_round t_tanh
 
-LDADD+=-lm
+LDADD+=		-lm
 COPTS+=		-Wfloat-equal
 
 .include 

Added files:

Index: src/tests/lib/libm/t_log.c
diff -u /dev/null src/tests/lib/libm/t_log.c:1.1
--- /dev/null	Sun Apr 10 06:11:47 2011
+++ src/tests/lib/libm/t_log.c	Sun Apr 10 06:11:47 2011
@@ -0,0 +1,78 @@
+/* $NetBSD: t_log.c,v 1.1 2011/04/10 06:11:47 jruoho Exp $ */
+
+/*-
+ * Copyright (c) 2011 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jukka Ruohonen.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#include 
+__RCSID("$NetBSD: t_log.c,v 1.1 2011/04/10 06:11:47 jruoho Exp $");
+
+#include 
+
+#include 
+
+ATF_TC(log_nan);
+ATF_TC_HEAD(log_nan, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test NaN from log(3)");
+}
+
+ATF_TC_BODY(log_nan, tc)
+{
+#ifndef __vax__
+
+	double d;
+	float f;
+
+	/*
+	 * If the argument is negative,
+	 * the result should be NaN and
+	 * a domain error should follow
+	 */
+	atf_tc_expect_fail("PR lib/41931");
+
+	d = log(-1);
+	ATF_REQUIRE(isnan(d) != 0);
+
+	d

CVS commit: src/usr.bin/kdump

2011-04-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr 10 00:05:51 UTC 2011

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

Log Message:
print detailed info about other SI_ codes.


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/usr.bin/kdump/kdump.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/kdump/kdump.c
diff -u src/usr.bin/kdump/kdump.c:1.106 src/usr.bin/kdump/kdump.c:1.107
--- src/usr.bin/kdump/kdump.c:1.106	Mon Jan 10 00:15:17 2011
+++ src/usr.bin/kdump/kdump.c	Sat Apr  9 20:05:51 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kdump.c,v 1.106 2011/01/10 05:15:17 christos Exp $	*/
+/*	$NetBSD: kdump.c,v 1.107 2011/04/10 00:05:51 christos Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)kdump.c	8.4 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: kdump.c,v 1.106 2011/01/10 05:15:17 christos Exp $");
+__RCSID("$NetBSD: kdump.c,v 1.107 2011/04/10 00:05:51 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -943,14 +943,17 @@
 si->si_uid, si->si_value.sival_ptr);
 return;
 			case SI_ASYNCIO:
-code = "SI_ASYNCIO";
-break;
 			case SI_MESGQ:
-code = "SI_MESGQ";
-break;
+printf(": code=%s with sigval %p)\n",
+si->si_code == SI_ASYNCIO ?
+"SI_ASYNCIO" : "SI_MESGQ",
+si->si_value.sival_ptr);
+return;
 			case SI_LWP:
-code = "SI_LWP";
-break;
+printf(": code=SI_LWP sent by pid=%d, uid=%d "
+"with target lid=%d)\n", si->si_pid,
+si->si_uid, si->si_lid);
+return;
 			default:
 code = NULL;
 break;



CVS commit: src/sys/sys

2011-04-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr 10 00:04:37 UTC 2011

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

Log Message:
Make lwpid part of siginfo so that it can be passed to userland.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/sys/siginfo.h

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

Modified files:

Index: src/sys/sys/siginfo.h
diff -u src/sys/sys/siginfo.h:1.20 src/sys/sys/siginfo.h:1.21
--- src/sys/sys/siginfo.h:1.20	Sun Jan  2 13:12:01 2011
+++ src/sys/sys/siginfo.h	Sat Apr  9 20:04:37 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: siginfo.h,v 1.20 2011/01/02 18:12:01 skrll Exp $	 */
+/*	$NetBSD: siginfo.h,v 1.21 2011/04/10 00:04:37 christos Exp $	 */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -60,6 +60,12 @@
 		struct {
 			pid_t	_pid;
 			uid_t	_uid;
+			lwpid_t	_lid;
+		} _lwp;
+
+		struct {
+			pid_t	_pid;
+			uid_t	_uid;
 			int	_status;
 			clock_t	_utime;
 			clock_t	_stime;
@@ -82,7 +88,6 @@
 	u_long			ksi_flags;	/* 4 or 8 bytes (LP64) */
 	CIRCLEQ_ENTRY(ksiginfo) ksi_list;
 	struct _ksiginfo	ksi_info;
-	lwpid_t			ksi_lid;	/* 0, or directed to LWP */
 } ksiginfo_t;
 
 #define	KSI_TRAP	0x01	/* signal caused by trap */
@@ -140,6 +145,9 @@
 #define	si_value	_info._reason._rt._value
 #define	si_pid		_info._reason._child._pid
 #define	si_uid		_info._reason._child._uid
+#if defined(_NETBSD_SOURCE)
+#define	si_lid		_info._reason._lwp._lid
+#endif
 #define	si_status	_info._reason._child._status
 #define	si_utime	_info._reason._child._utime
 #define	si_stime	_info._reason._child._stime
@@ -157,12 +165,15 @@
 #define	ksi_errno	ksi_info._errno
 
 #define	ksi_value	ksi_info._reason._rt._value
+
 #define	ksi_pid		ksi_info._reason._child._pid
 #define	ksi_uid		ksi_info._reason._child._uid
 #define	ksi_status	ksi_info._reason._child._status
 #define	ksi_utime	ksi_info._reason._child._utime
 #define	ksi_stime	ksi_info._reason._child._stime
 
+#define	ksi_lid		ksi_info._reason._lwp._lid /* 0, or directed to LWP */
+
 #define	ksi_addr	ksi_info._reason._fault._addr
 #define	ksi_trap	ksi_info._reason._fault._trap
 



CVS commit: src/sys/kern

2011-04-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr  9 23:03:59 UTC 2011

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

Log Message:
Preserve SB_ASYNC on the accepted socket. From: Dmitry Matveev
http://mail-index.netbsd.org/tech-net/2011/02/17/msg002457.html


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/sys/kern/uipc_socket2.c

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

Modified files:

Index: src/sys/kern/uipc_socket2.c
diff -u src/sys/kern/uipc_socket2.c:1.106 src/sys/kern/uipc_socket2.c:1.107
--- src/sys/kern/uipc_socket2.c:1.106	Wed Dec 30 17:12:12 2009
+++ src/sys/kern/uipc_socket2.c	Sat Apr  9 19:03:59 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_socket2.c,v 1.106 2009/12/30 22:12:12 elad Exp $	*/
+/*	$NetBSD: uipc_socket2.c,v 1.107 2011/04/09 23:03:59 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_socket2.c,v 1.106 2009/12/30 22:12:12 elad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_socket2.c,v 1.107 2011/04/09 23:03:59 christos Exp $");
 
 #include "opt_mbuftrace.h"
 #include "opt_sb_max.h"
@@ -285,8 +285,8 @@
 	so->so_rcv.sb_lowat = head->so_rcv.sb_lowat;
 	so->so_rcv.sb_timeo = head->so_rcv.sb_timeo;
 	so->so_snd.sb_timeo = head->so_snd.sb_timeo;
-	so->so_rcv.sb_flags |= head->so_rcv.sb_flags & SB_AUTOSIZE;
-	so->so_snd.sb_flags |= head->so_snd.sb_flags & SB_AUTOSIZE;
+	so->so_rcv.sb_flags |= head->so_rcv.sb_flags & (SB_AUTOSIZE | SB_ASYNC);
+	so->so_snd.sb_flags |= head->so_snd.sb_flags & (SB_AUTOSIZE | SB_ASYNC);
 	soqinsque(head, so, soqueue);
 	error = (*so->so_proto->pr_usrreq)(so, PRU_ATTACH, NULL, NULL,
 	NULL, NULL);



CVS commit: src/sys/dev/videomode

2011-04-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr  9 22:09:06 UTC 2011

Modified Files:
src/sys/dev/videomode: edid.c

Log Message:
make this compile again.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/videomode/edid.c

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

Modified files:

Index: src/sys/dev/videomode/edid.c
diff -u src/sys/dev/videomode/edid.c:1.10 src/sys/dev/videomode/edid.c:1.11
--- src/sys/dev/videomode/edid.c:1.10	Sat Apr  9 16:53:39 2011
+++ src/sys/dev/videomode/edid.c	Sat Apr  9 18:09:05 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: edid.c,v 1.10 2011/04/09 20:53:39 christos Exp $ */
+/* $NetBSD: edid.c,v 1.11 2011/04/09 22:09:05 christos Exp $ */
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -32,7 +32,7 @@
  */ 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: edid.c,v 1.10 2011/04/09 20:53:39 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: edid.c,v 1.11 2011/04/09 22:09:05 christos Exp $");
 
 #include 
 #include 
@@ -105,7 +105,7 @@
 	for (n = 0; n < edid_nproducts; n++)
 		if (edid_products[n].product == product &&
 		memcmp(edid_products[n].vendor, vendor, 3) == 0)
-			return (edid_products[n].name;
+			return edid_products[n].name;
 #endif	/* EDIDVERBOSE */
 	return NULL;
 
@@ -425,7 +425,7 @@
 	struct videomode	mode, *exist_mode;
 
 	if (EDID_BLOCK_IS_DET_TIMING(data)) {
-		if (!edid_det_timing(data, &mode)) {
+		if (!edid_det_timing(data, &mode))
 			return;
 		/* Does this mode already exist? */
 		exist_mode = edid_search_mode(edid, &mode);



CVS commit: src/share/man/man4/man4.sparc64

2011-04-09 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Apr  9 21:53:58 UTC 2011

Modified Files:
src/share/man/man4/man4.sparc64: ffb.4

Log Message:
Fix a typo and a whitespace nit.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/share/man/man4/man4.sparc64/ffb.4

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

Modified files:

Index: src/share/man/man4/man4.sparc64/ffb.4
diff -u src/share/man/man4/man4.sparc64/ffb.4:1.1 src/share/man/man4/man4.sparc64/ffb.4:1.2
--- src/share/man/man4/man4.sparc64/ffb.4:1.1	Sat Apr  9 19:37:13 2011
+++ src/share/man/man4/man4.sparc64/ffb.4	Sat Apr  9 21:53:58 2011
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ffb.4,v 1.1 2011/04/09 19:37:13 jdc Exp $
+.\"	$NetBSD: ffb.4,v 1.2 2011/04/09 21:53:58 wiz Exp $
 .\"
 .\" Copyright (c) 2011 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -179,7 +179,7 @@
 .Pp
 The
 .Nm
-driver does not support 3D accleration.
+driver does not support 3D acceleration.
 .Pp
 Not all
 .Dv 13W3
@@ -191,7 +191,7 @@
 .Dv VGA
 pin 9.
 This pin supplies +5V DC to power the monitor
-.Dv EEPROM,
+.Dv EEPROM ,
 even when the monitor
 is powered off, and is necessary in order to obtain
 .Dv EDID



CVS commit: src/sys/netinet

2011-04-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Apr  9 21:00:53 UTC 2011

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

Log Message:
PR kern/43664:
mlelstv pointed out that we sometimes may use checksums on loopback
interfaces. Make the test consistent with the code path selecting
the checksum operation before invoking fragmentation.


To generate a diff of this commit:
cvs rdiff -u -r1.206 -r1.207 src/sys/netinet/ip_output.c

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

Modified files:

Index: src/sys/netinet/ip_output.c
diff -u src/sys/netinet/ip_output.c:1.206 src/sys/netinet/ip_output.c:1.207
--- src/sys/netinet/ip_output.c:1.206	Sat Apr  9 20:34:36 2011
+++ src/sys/netinet/ip_output.c	Sat Apr  9 21:00:53 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_output.c,v 1.206 2011/04/09 20:34:36 martin Exp $	*/
+/*	$NetBSD: ip_output.c,v 1.207 2011/04/09 21:00:53 martin Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.206 2011/04/09 20:34:36 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.207 2011/04/09 21:00:53 martin Exp $");
 
 #include "opt_pfil_hooks.h"
 #include "opt_inet.h"
@@ -1027,9 +1027,10 @@
 	ip->ip_off |= htons(IP_MF);
 	ip->ip_sum = 0;
 	/*
-	 * We do not do checksums on loopback interfaces
+	 * We may not use checksums on loopback interfaces
 	 */
-	if (__predict_true(ifp == NULL || !(ifp->if_flags & IFF_LOOPBACK)))  {
+	if (__predict_false(ifp == NULL) ||
+	IN_NEED_CHECKSUM(ifp, M_CSUM_IPv4)) {
 		if (sw_csum & M_CSUM_IPv4) {
 			ip->ip_sum = in_cksum(m, hlen);
 			m->m_pkthdr.csum_flags &= ~M_CSUM_IPv4;



CVS commit: src/sys/dev/videomode

2011-04-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr  9 20:53:39 UTC 2011

Modified Files:
src/sys/dev/videomode: edid.c pickmode.c

Log Message:
- little KNF
- use struct copy instead of memcpy
- snprintf("%s") -> strlcpy
- fix NUL termination


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/videomode/edid.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/videomode/pickmode.c

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

Modified files:

Index: src/sys/dev/videomode/edid.c
diff -u src/sys/dev/videomode/edid.c:1.9 src/sys/dev/videomode/edid.c:1.10
--- src/sys/dev/videomode/edid.c:1.9	Sat Apr  9 14:18:28 2011
+++ src/sys/dev/videomode/edid.c	Sat Apr  9 16:53:39 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: edid.c,v 1.9 2011/04/09 18:18:28 jdc Exp $ */
+/* $NetBSD: edid.c,v 1.10 2011/04/09 20:53:39 christos Exp $ */
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -32,7 +32,7 @@
  */ 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: edid.c,v 1.9 2011/04/09 18:18:28 jdc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: edid.c,v 1.10 2011/04/09 20:53:39 christos Exp $");
 
 #include 
 #include 
@@ -91,7 +91,7 @@
 
 	for (n = 0; n < edid_nvendors; n++)
 		if (memcmp(edid_vendors[n].vendor, vendor, 3) == 0)
-			return (edid_vendors[n].name);
+			return edid_vendors[n].name;
 #endif
 	return NULL;
 }
@@ -103,9 +103,9 @@
 	int	n;
 
 	for (n = 0; n < edid_nproducts; n++)
-		if ((edid_products[n].product == product) &&
-		(memcmp(edid_products[n].vendor, vendor, 3) == 0))
-			return (edid_products[n].name);
+		if (edid_products[n].product == product &&
+		memcmp(edid_products[n].vendor, vendor, 3) == 0)
+			return (edid_products[n].name;
 #endif	/* EDIDVERBOSE */
 	return NULL;
 
@@ -116,11 +116,11 @@
 {
 	for (;;) {
 		switch (*ptr) {
-		case 0:
+		case '\0':
 			return;
 		case '\r':
 		case '\n':
-			*ptr = 0;
+			*ptr = '\0';
 			return;
 		}
 		ptr++;
@@ -264,8 +264,7 @@
 		edid->edid_modes[i].hdisplay,
 		edid->edid_modes[i].vdisplay,
 		DIVIDE(DIVIDE(edid->edid_modes[i].dot_clock * 1000,
-			   edid->edid_modes[i].htotal),
-			edid->edid_modes[i].vtotal));
+		edid->edid_modes[i].htotal), edid->edid_modes[i].vtotal));
 		printf(" (%d %d %d %d %d %d %d",
 		edid->edid_modes[i].dot_clock,
 		edid->edid_modes[i].hsync_start,
@@ -285,8 +284,8 @@
 		edid->edid_preferred_mode->hdisplay,
 		edid->edid_preferred_mode->vdisplay,
 		DIVIDE(DIVIDE(edid->edid_preferred_mode->dot_clock * 1000,
-			   edid->edid_preferred_mode->htotal),
-			edid->edid_preferred_mode->vtotal));
+		edid->edid_preferred_mode->htotal),
+		edid->edid_preferred_mode->vtotal));
 }
 
 static const struct videomode *
@@ -312,9 +311,8 @@
 		mode->vdisplay == edid->edid_modes[i].vdisplay &&
 		refresh == DIVIDE(DIVIDE(
 		edid->edid_modes[i].dot_clock * 1000,
-		edid->edid_modes[i].htotal),
-		edid->edid_modes[i].vtotal)) {
-			return &(edid->edid_modes[i]);
+		edid->edid_modes[i].htotal), edid->edid_modes[i].vtotal)) {
+			return &edid->edid_modes[i];
 		}
 	}
 	return NULL;
@@ -351,13 +349,11 @@
 	f = EDID_STD_TIMING_VFREQ(data);
 
 	/* first try to lookup the mode as a DMT timing */
-	snprintf(name, sizeof (name), "%dx%dx%d", x, y, f);
+	snprintf(name, sizeof(name), "%dx%dx%d", x, y, f);
 	if ((lookup = edid_mode_lookup_list(name)) != NULL) {
 		*vmp = *lookup;
-	}
-
-	/* failing that, calculate it using gtf */
-	else {
+	} else {
+		/* failing that, calculate it using gtf */
 		/*
 		 * Hmm. I'm not using alternate GTF timings, which
 		 * could, in theory, be present.
@@ -429,68 +425,53 @@
 	struct videomode	mode, *exist_mode;
 
 	if (EDID_BLOCK_IS_DET_TIMING(data)) {
-		if (edid_det_timing(data, &mode)) {
-			/* Does this mode already exist? */
-			exist_mode = edid_search_mode(edid, &mode);
-			if (exist_mode != NULL) {
-memcpy(exist_mode, &mode,
-sizeof(struct videomode));
-if (edid->edid_preferred_mode == NULL) {
-	edid->edid_preferred_mode =
-	exist_mode;
-}
-			} else {
-edid->edid_modes[edid->edid_nmodes] = mode;
-if (edid->edid_preferred_mode == NULL) {
-	edid->edid_preferred_mode =
-	&edid->edid_modes[edid->edid_nmodes];
-}
-edid->edid_nmodes++;	
-			}
+		if (!edid_det_timing(data, &mode)) {
+			return;
+		/* Does this mode already exist? */
+		exist_mode = edid_search_mode(edid, &mode);
+		if (exist_mode != NULL) {
+			*exist_mode = mode;
+			if (edid->edid_preferred_mode == NULL)
+edid->edid_preferred_mode = exist_mode;
+		} else {
+			edid->edid_modes[edid->edid_nmodes] = mode;
+			if (edid->edid_preferred_mode == NULL)
+edid->edid_preferred_mode =
+&edid->edid_modes[edid->edid_nmodes];
+			edid->edid_nmodes++;	
 		}
 		return;
 	}
 
 	switch (EDID_BLOCK_TYPE(data)) {
 	case EDID_DESC_BLOCK_TYPE_SERIAL:
-		memcpy(edid->edid_serial,
-		data + EDID_DESC_ASCII_DATA_OFFSET,
+		memcpy(edid->edid_serial, data

CVS commit: src/tests/net/if_loop

2011-04-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Apr  9 20:42:12 UTC 2011

Modified Files:
src/tests/net/if_loop: t_pr.c

Log Message:
Remove expected failure, PR has been fixed.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/net/if_loop/t_pr.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/net/if_loop/t_pr.c
diff -u src/tests/net/if_loop/t_pr.c:1.3 src/tests/net/if_loop/t_pr.c:1.4
--- src/tests/net/if_loop/t_pr.c:1.3	Wed Nov  3 16:10:25 2010
+++ src/tests/net/if_loop/t_pr.c	Sat Apr  9 20:42:12 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_pr.c,v 1.3 2010/11/03 16:10:25 christos Exp $	*/
+/*	$NetBSD: t_pr.c,v 1.4 2011/04/09 20:42:12 martin Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: t_pr.c,v 1.3 2010/11/03 16:10:25 christos Exp $");
+__RCSID("$NetBSD: t_pr.c,v 1.4 2011/04/09 20:42:12 martin Exp $");
 #endif /* not lint */
 
 #include 
@@ -125,7 +125,11 @@
 	sin.sin_port = htons(12345);
 	sin.sin_addr.s_addr = inet_addr("127.0.0.1");
 
-	atf_tc_expect_signal(SIGABRT, "PR kern/43664");
+	/*
+	 * Should not fail anymore, PR has been fixed...
+	 *
+	 * atf_tc_expect_signal(SIGABRT, "PR kern/43664");
+	 */
 	if (rump_sys_sendto(s, data, sizeof(data), 0,
 	(struct sockaddr *)&sin, sizeof(sin)) == -1)
 		atf_tc_fail_errno("sendto failed");



CVS commit: src/sys/netinet

2011-04-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Apr  9 20:34:36 UTC 2011

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

Log Message:
We do not do checksums on loopback interfaces, not even if fragmenting.
Fixes PR kern/43664.


To generate a diff of this commit:
cvs rdiff -u -r1.205 -r1.206 src/sys/netinet/ip_output.c

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

Modified files:

Index: src/sys/netinet/ip_output.c
diff -u src/sys/netinet/ip_output.c:1.205 src/sys/netinet/ip_output.c:1.206
--- src/sys/netinet/ip_output.c:1.205	Fri Jul 17 22:02:54 2009
+++ src/sys/netinet/ip_output.c	Sat Apr  9 20:34:36 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_output.c,v 1.205 2009/07/17 22:02:54 minskim Exp $	*/
+/*	$NetBSD: ip_output.c,v 1.206 2011/04/09 20:34:36 martin Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.205 2009/07/17 22:02:54 minskim Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.206 2011/04/09 20:34:36 martin Exp $");
 
 #include "opt_pfil_hooks.h"
 #include "opt_inet.h"
@@ -1026,13 +1026,18 @@
 	ip->ip_len = htons((u_int16_t)m->m_pkthdr.len);
 	ip->ip_off |= htons(IP_MF);
 	ip->ip_sum = 0;
-	if (sw_csum & M_CSUM_IPv4) {
-		ip->ip_sum = in_cksum(m, hlen);
-		m->m_pkthdr.csum_flags &= ~M_CSUM_IPv4;
-	} else {
-		KASSERT(m->m_pkthdr.csum_flags & M_CSUM_IPv4);
-		KASSERT(M_CSUM_DATA_IPv4_IPHL(m->m_pkthdr.csum_data) >=
-			sizeof(struct ip));
+	/*
+	 * We do not do checksums on loopback interfaces
+	 */
+	if (__predict_true(ifp == NULL || !(ifp->if_flags & IFF_LOOPBACK)))  {
+		if (sw_csum & M_CSUM_IPv4) {
+			ip->ip_sum = in_cksum(m, hlen);
+			m->m_pkthdr.csum_flags &= ~M_CSUM_IPv4;
+		} else {
+			KASSERT(m->m_pkthdr.csum_flags & M_CSUM_IPv4);
+			KASSERT(M_CSUM_DATA_IPv4_IPHL(m->m_pkthdr.csum_data) >=
+sizeof(struct ip));
+		}
 	}
 sendorfree:
 	/*



CVS commit: src/sys/arch/sandpoint/stand/altboot

2011-04-09 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Sat Apr  9 19:56:20 UTC 2011

Modified Files:
src/sys/arch/sandpoint/stand/altboot: brdsetup.c

Log Message:
Set D-Link DSM-G600 power LED to solid green on start.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/sandpoint/stand/altboot/brdsetup.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/sandpoint/stand/altboot/brdsetup.c
diff -u src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.12 src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.13
--- src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.12	Sat Mar 26 17:55:05 2011
+++ src/sys/arch/sandpoint/stand/altboot/brdsetup.c	Sat Apr  9 19:56:20 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: brdsetup.c,v 1.12 2011/03/26 17:55:05 phx Exp $ */
+/* $NetBSD: brdsetup.c,v 1.13 2011/04/09 19:56:20 phx Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -699,7 +699,8 @@
 {
 
 	init_uart(uart2base, 9600, LCR_8BITS | LCR_PNONE);
-	/* illuminate LEDs */
+	send_sat("SYN\n");
+	send_sat("ZWO\n");	/* power LED solid on */
 }
 
 void



CVS commit: src

2011-04-09 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Sat Apr  9 19:37:13 UTC 2011

Modified Files:
src/distrib/sets/lists/man: mi
src/share/man/man4/man4.sparc64: Makefile
Added Files:
src/share/man/man4/man4.sparc64: ffb.4

Log Message:
Add a manual page for ffb(4).


To generate a diff of this commit:
cvs rdiff -u -r1.1307 -r1.1308 src/distrib/sets/lists/man/mi
cvs rdiff -u -r1.5 -r1.6 src/share/man/man4/man4.sparc64/Makefile
cvs rdiff -u -r0 -r1.1 src/share/man/man4/man4.sparc64/ffb.4

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/man/mi
diff -u src/distrib/sets/lists/man/mi:1.1307 src/distrib/sets/lists/man/mi:1.1308
--- src/distrib/sets/lists/man/mi:1.1307	Tue Apr  5 11:24:46 2011
+++ src/distrib/sets/lists/man/mi	Sat Apr  9 19:37:13 2011
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1307 2011/04/05 11:24:46 phx Exp $
+# $NetBSD: mi,v 1.1308 2011/04/09 19:37:13 jdc Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -1541,6 +1541,7 @@
 ./usr/share/man/cat4/sparc/xy.0			man-sys-catman		.cat
 ./usr/share/man/cat4/sparc/zx.0			man-sys-catman		.cat
 ./usr/share/man/cat4/sparc64/envctrl.0		man-sys-catman		.cat
+./usr/share/man/cat4/sparc64/ffb.0		man-sys-catman		.cat
 ./usr/share/man/cat4/sparc64/fdc.0		man-sys-catman		.cat
 ./usr/share/man/cat4/sparc64/intro.0		man-sys-catman		.cat
 ./usr/share/man/cat4/sparc64/lom.0		man-sys-catman		.cat
@@ -4252,6 +4253,7 @@
 ./usr/share/man/html4/sparc/xy.html		man-sys-htmlman		html
 ./usr/share/man/html4/sparc/zx.html		man-sys-htmlman		html
 ./usr/share/man/html4/sparc64/envctrl.html	man-sys-htmlman		html
+./usr/share/man/html4/sparc64/ffb.html		man-sys-htmlman		html
 ./usr/share/man/html4/sparc64/fdc.html		man-sys-htmlman		html
 ./usr/share/man/html4/sparc64/intro.html	man-sys-htmlman		html
 ./usr/share/man/html4/sparc64/lom.html		man-sys-htmlman		html
@@ -6876,6 +6878,7 @@
 ./usr/share/man/man4/sparc/xy.4			man-sys-man		.man
 ./usr/share/man/man4/sparc/zx.4			man-sys-man		.man
 ./usr/share/man/man4/sparc64/envctrl.4		man-sys-man		.man
+./usr/share/man/man4/sparc64/ffb.4		man-sys-man		.man
 ./usr/share/man/man4/sparc64/fdc.4		man-sys-man		.man
 ./usr/share/man/man4/sparc64/intro.4		man-sys-man		.man
 ./usr/share/man/man4/sparc64/lom.4		man-sys-man		.man

Index: src/share/man/man4/man4.sparc64/Makefile
diff -u src/share/man/man4/man4.sparc64/Makefile:1.5 src/share/man/man4/man4.sparc64/Makefile:1.6
--- src/share/man/man4/man4.sparc64/Makefile:1.5	Fri Oct  2 15:09:16 2009
+++ src/share/man/man4/man4.sparc64/Makefile	Sat Apr  9 19:37:13 2011
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.5 2009/10/02 15:09:16 nakayama Exp $
+# $NetBSD: Makefile,v 1.6 2011/04/09 19:37:13 jdc Exp $
 
 MANSUBDIR=/sparc64
 
-MAN=	envctrl.4 fdc.4 intro.4 lom.4 sab.4
+MAN=	envctrl.4 ffb.4 fdc.4 intro.4 lom.4 sab.4
 
 MLINKS+=	sab.4 sabtty.4
 

Added files:

Index: src/share/man/man4/man4.sparc64/ffb.4
diff -u /dev/null src/share/man/man4/man4.sparc64/ffb.4:1.1
--- /dev/null	Sat Apr  9 19:37:13 2011
+++ src/share/man/man4/man4.sparc64/ffb.4	Sat Apr  9 19:37:13 2011
@@ -0,0 +1,217 @@
+.\"	$NetBSD: ffb.4,v 1.1 2011/04/09 19:37:13 jdc Exp $
+.\"
+.\" Copyright (c) 2011 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Julian Coleman
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"notice, this list of conditions and the following disclaimer in the
+.\"documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.Dd April 1, 2011
+.Dt FFB 4 sparc64
+.Os
+.Sh NAME
+.Nm ffb
+.Nd Sun accelerated 24-bit color frame buffer
+.Sh SYNOPSIS
+.Cd "ffb* at mainbus0 addr 0xff8de000: Creator3D, model SUNW,501

CVS commit: src/sys/arch/sparc64

2011-04-09 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Sat Apr  9 19:31:15 UTC 2011

Modified Files:
src/sys/arch/sparc64/conf: files.sparc64
src/sys/arch/sparc64/dev: ffb.c ffbreg.h ffbvar.h

Log Message:
Add EDID and video mode setting support to FFB.

Add definitions for registers related to video modes, and to DDC.  Rename
other registers to be more descriptive.
Add i2c bus routines to read the EDID data via DDC.
Add routines to calculate, and to set, the video mode.

Note, that interlaced and stereo video modes are not supported.

Thanks to Michael Lorenz and Jared McNeill for advice and encouragement,
and to Martin Husemann for testing.


To generate a diff of this commit:
cvs rdiff -u -r1.129 -r1.130 src/sys/arch/sparc64/conf/files.sparc64
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/sparc64/dev/ffb.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/sparc64/dev/ffbreg.h
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/sparc64/dev/ffbvar.h

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

Modified files:

Index: src/sys/arch/sparc64/conf/files.sparc64
diff -u src/sys/arch/sparc64/conf/files.sparc64:1.129 src/sys/arch/sparc64/conf/files.sparc64:1.130
--- src/sys/arch/sparc64/conf/files.sparc64:1.129	Sun Mar 20 20:55:46 2011
+++ src/sys/arch/sparc64/conf/files.sparc64	Sat Apr  9 19:31:14 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: files.sparc64,v 1.129 2011/03/20 20:55:46 mrg Exp $
+#	$NetBSD: files.sparc64,v 1.130 2011/04/09 19:31:14 jdc Exp $
 
 # @(#)files.sparc64	8.1 (Berkeley) 7/19/93
 # sparc64-specific configuration info
@@ -168,7 +168,7 @@
 attach cgfourteen at sbus
 file	arch/sparc64/dev/cgfourteen.c	cgfourteen needs-flag
 
-device ffb: wsemuldisplaydev, rasops8, rasops32, fb, vcons
+device ffb: wsemuldisplaydev, rasops8, rasops32, fb, vcons, i2cbus, iic, i2c_bitbang, ddc_read_edid, edid, videomode
 file	arch/sparc64/dev/ffb.c			ffb
 defflag opt_ffb.h FFB_DEBUG FFB_SYNC
 attach ffb at mainbus,upa with ffb_mainbus

Index: src/sys/arch/sparc64/dev/ffb.c
diff -u src/sys/arch/sparc64/dev/ffb.c:1.38 src/sys/arch/sparc64/dev/ffb.c:1.39
--- src/sys/arch/sparc64/dev/ffb.c:1.38	Tue Sep 21 03:31:04 2010
+++ src/sys/arch/sparc64/dev/ffb.c	Sat Apr  9 19:31:15 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffb.c,v 1.38 2010/09/21 03:31:04 macallan Exp $	*/
+/*	$NetBSD: ffb.c,v 1.39 2011/04/09 19:31:15 jdc Exp $	*/
 /*	$OpenBSD: creator.c,v 1.20 2002/07/30 19:48:15 jason Exp $	*/
 
 /*
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ffb.c,v 1.38 2010/09/21 03:31:04 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffb.c,v 1.39 2011/04/09 19:31:15 jdc Exp $");
 
 #include 
 #include 
@@ -57,6 +57,10 @@
 #include 
 #include 
 
+#include 
+#include 
+#include 
+
 #include 
 #include 
 
@@ -74,6 +78,19 @@
 #define SYNC
 #endif
 
+/* Debugging */
+#if !defined FFB_DEBUG
+#define FFB_DEBUG 0
+#endif
+#define DPRINTF(x)	if (ffb_debug) printf x
+/* Patchable */
+extern int ffb_debug;
+#if FFB_DEBUG > 0
+int ffb_debug = 1;
+#else
+int ffb_debug = 0;
+#endif
+
 extern struct cfdriver ffb_cd;
 
 struct wsscreen_descr ffb_stdscreen = {
@@ -136,18 +153,53 @@
 	.mmap = ffb_mmap,
 };
 
+/* I2C glue */
+static int ffb_i2c_acquire_bus(void *, int);
+static void ffb_i2c_release_bus(void *, int);
+static int ffb_i2c_send_start(void *, int);
+static int ffb_i2c_send_stop(void *, int);
+static int ffb_i2c_initiate_xfer(void *, i2c_addr_t, int);
+static int ffb_i2c_read_byte(void *, uint8_t *, int);
+static int ffb_i2c_write_byte(void *, uint8_t, int);
+
+/* I2C bitbang glue */
+static void ffb_i2cbb_set_bits(void *, uint32_t);
+static void ffb_i2cbb_set_dir(void *, uint32_t);
+static uint32_t ffb_i2cbb_read(void *);
+
+static const struct i2c_bitbang_ops ffb_i2cbb_ops = {
+	ffb_i2cbb_set_bits,
+	ffb_i2cbb_set_dir,
+	ffb_i2cbb_read,
+	{
+		FFB_DAC_CFG_MPDATA_SDA,
+		FFB_DAC_CFG_MPDATA_SCL,
+		0,
+		0
+	}
+};
+
+void ffb_attach_i2c(struct ffb_softc *);
+
+/* Video mode setting */
+int ffb_tgc_disable(struct ffb_softc *);
+void ffb_get_pclk(int, uint32_t *, int *);
+int ffb_set_vmode(struct ffb_softc *, struct videomode *, int, int *, int *);
+
+
 void
 ffb_attach(struct ffb_softc *sc)
 {
 	struct wsemuldisplaydev_attach_args waa;
 	struct rasops_info *ri;
 	long defattr;
-	const char *model;
+	const char *model, *out_dev;
 	int btype;
 	uint32_t dac;
 	int maxrow, maxcol;
 	u_int blank = WSDISPLAYIO_VIDEO_ON;
 	char buf[6+1];
+	int i, try_edid;
 
 	printf(":");
 		
@@ -157,8 +209,10 @@
 			printf(" Creator3D");
 		else
 			printf(" Creator");
-	} else
+	} else {
 		printf(" Elite3D");
+		btype = 0;
+	}
 
 	model = prom_getpropstring(sc->sc_node, "model");
 	if (model == NULL || strlen(model) == 0)
@@ -166,6 +220,7 @@
 
 	sc->sc_depth = 24;
 	sc->sc_linebytes = 8192;
+	/* We might alter these during EDID mode setting */
 	sc->sc_height = prom_getpropint(sc->sc_node, "height", 0);
 	sc->sc_width = prom_getpropint(sc->sc_node, "width", 0);
 	
@@ -180,10 +235,8 @@
 		? strtoul(buf, NULL, 10

CVS commit: src/sys/dev/videomode

2011-04-09 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Sat Apr  9 18:22:31 UTC 2011

Modified Files:
src/sys/dev/videomode: pickmode.c videomode.h

Log Message:
Add a new function - sort_modes() - to sort video modes in an approximate
order of preference.

The preferred mode is placed first.  If there is no preferred mode, then
the first mode with highest resolution is placed first.  Other modes are
then sorted on difference from the first mode by refresh rate, aspect
ratio, then size.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/videomode/pickmode.c \
src/sys/dev/videomode/videomode.h

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

Modified files:

Index: src/sys/dev/videomode/pickmode.c
diff -u src/sys/dev/videomode/pickmode.c:1.2 src/sys/dev/videomode/pickmode.c:1.3
--- src/sys/dev/videomode/pickmode.c:1.2	Tue Oct 12 16:18:19 2010
+++ src/sys/dev/videomode/pickmode.c	Sat Apr  9 18:22:31 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: pickmode.c,v 1.2 2010/10/12 16:18:19 macallan Exp $ */
+/* $NetBSD: pickmode.c,v 1.3 2011/04/09 18:22:31 jdc Exp $ */
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation
@@ -29,7 +29,7 @@
  */ 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pickmode.c,v 1.2 2010/10/12 16:18:19 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pickmode.c,v 1.3 2011/04/09 18:22:31 jdc Exp $");
 
 #include 
 #include 
@@ -101,3 +101,108 @@
 
 	return best;
 }
+
+static inline void
+swap_modes(struct videomode *left, struct videomode *right)
+{
+	struct videomode temp;
+
+	memcpy(&temp, left, sizeof(struct videomode));
+	memcpy(left, right, sizeof(struct videomode));
+	memcpy(right, &temp, sizeof(struct videomode));
+}
+
+/*
+ * Sort modes by refresh rate, aspect ratio (*), then resolution.
+ * Preferred mode or largest mode is first in the list and other modes
+ * are sorted on closest match to that mode.
+ * (*) Note that the aspect ratio calculation treats "close" aspect ratios
+ * (within 12.5%) as the same for this purpose.
+ */
+#define	DIVIDE(x,y)	(((x) + ((y) / 2)) / (y))
+void
+sort_modes(struct videomode *modes, struct videomode **preferred, int nmodes)
+{
+	int aspect, refresh, hbest, vbest, abest, atemp, rbest, rtemp;
+	int i, j;
+	struct videomode *mtemp = NULL;
+
+	if (nmodes < 2)
+		return;
+
+	if (*preferred != NULL) {
+		/* Put the preferred mode first in the list */
+		aspect = (*preferred)->hdisplay * 100 / (*preferred)->vdisplay;
+		refresh = DIVIDE(DIVIDE((*preferred)->dot_clock * 1000,
+		(*preferred)->htotal), (*preferred)->vtotal);
+		if ((*preferred) != modes) {
+			swap_modes((*preferred), modes);
+			*preferred = modes;
+		}
+	} else {
+		/*
+		 * Find the largest horizontal and vertical mode and put that
+		 * first in the list.  Preferred refresh rate is taken from
+		 * the first mode of this size.
+		 */
+		hbest = 0;
+		vbest = 0;
+		for (i = 0; i < nmodes; i++) {
+			if (modes[i].hdisplay > hbest) {
+hbest = modes[i].hdisplay;
+vbest = modes[i].vdisplay;
+mtemp = &modes[i];
+			} else if (modes[i].hdisplay == hbest &&
+			modes[i].vdisplay > vbest) {
+vbest = modes[i].vdisplay;
+mtemp = &modes[i];
+			}
+		}
+		aspect = mtemp->hdisplay * 100 / mtemp->vdisplay;
+		refresh = DIVIDE(DIVIDE(mtemp->dot_clock * 1000,
+		mtemp->htotal), mtemp->vtotal);
+		if (mtemp != modes)
+			swap_modes(mtemp, modes);
+	}
+
+	/* Sort other modes by refresh rate, aspect ratio, then resolution */
+	for (j = 1; j < nmodes - 1; j++) {
+		rbest = 1000;
+		abest = 1000;
+		hbest = 0;
+		vbest = 0;
+		for (i = j; i < nmodes; i++) {
+			rtemp = abs(refresh -
+			DIVIDE(DIVIDE(modes[i].dot_clock * 1000,
+			modes[i].htotal), modes[i].vtotal));
+			atemp = (modes[i].hdisplay * 100 / modes[i].vdisplay);
+			if (rtemp < rbest) {
+rbest = rtemp;
+mtemp = &modes[i];
+			}
+			if (rtemp == rbest) {
+/* Treat "close" aspect ratios as identical */
+if (abs(abest - atemp) > (abest / 8) &&
+abs(aspect - atemp) <
+abs(aspect - abest)) {
+	abest = atemp;
+	mtemp = &modes[i];
+}
+if (atemp == abest ||
+abs(abest - atemp) <= (abest / 8)) {
+	if (modes[i].hdisplay > hbest) {
+		hbest = modes[i].hdisplay;
+		mtemp = &modes[i];
+	}
+	if (modes[i].hdisplay == hbest &&
+	modes[i].vdisplay > vbest) {
+		vbest = modes[i].vdisplay;
+		mtemp = &modes[i];
+	}
+}
+			}
+		}
+		if (mtemp != &modes[j])
+			swap_modes(mtemp, &modes[j]);
+	}
+}
Index: src/sys/dev/videomode/videomode.h
diff -u src/sys/dev/videomode/videomode.h:1.2 src/sys/dev/videomode/videomode.h:1.3
--- src/sys/dev/videomode/videomode.h:1.2	Tue May  4 21:17:10 2010
+++ src/sys/dev/videomode/videomode.h	Sat Apr  9 18:22:31 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: videomode.h,v 1.2 2010/05/04 21:17:10 macallan Exp $	*/
+/*	$NetBSD: videomode.h,v 1.3 2011/04/09 18:22:31 jdc Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002 Bang Jun-Young
@@ -68,5 

CVS commit: src/sys/dev/videomode

2011-04-09 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Sat Apr  9 18:18:28 UTC 2011

Modified Files:
src/sys/dev/videomode: edid.c

Log Message:
Remove duplicate video modes.

When parsing the established and the detailed timings, check to see if this
mode already exists in our mode list.  If the mode exists when parsing
established timings, then do nothing (we already have this exact mode).  If
the mode exists when parsing detailed timings, then replace our timings with
the timings from the monitor.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/videomode/edid.c

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

Modified files:

Index: src/sys/dev/videomode/edid.c
diff -u src/sys/dev/videomode/edid.c:1.8 src/sys/dev/videomode/edid.c:1.9
--- src/sys/dev/videomode/edid.c:1.8	Wed Mar 30 18:50:37 2011
+++ src/sys/dev/videomode/edid.c	Sat Apr  9 18:18:28 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: edid.c,v 1.8 2011/03/30 18:50:37 jdc Exp $ */
+/* $NetBSD: edid.c,v 1.9 2011/04/09 18:18:28 jdc Exp $ */
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -32,7 +32,7 @@
  */ 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: edid.c,v 1.8 2011/03/30 18:50:37 jdc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: edid.c,v 1.9 2011/04/09 18:18:28 jdc Exp $");
 
 #include 
 #include 
@@ -300,6 +300,26 @@
 	return NULL;
 }
 
+static struct videomode *
+edid_search_mode(struct edid_info *edid, const struct videomode *mode)
+{
+	int	refresh, i;
+
+	refresh = DIVIDE(DIVIDE(mode->dot_clock * 1000,
+	mode->htotal), mode->vtotal);
+	for (i = 0; i < edid->edid_nmodes; i++) {
+		if (mode->hdisplay == edid->edid_modes[i].hdisplay &&
+		mode->vdisplay == edid->edid_modes[i].vdisplay &&
+		refresh == DIVIDE(DIVIDE(
+		edid->edid_modes[i].dot_clock * 1000,
+		edid->edid_modes[i].htotal),
+		edid->edid_modes[i].vtotal)) {
+			return &(edid->edid_modes[i]);
+		}
+	}
+	return NULL;
+}
+
 static int
 edid_std_timing(uint8_t *data, struct videomode *vmp)
 {
@@ -373,7 +393,7 @@
 	vsyncwid = EDID_DET_TIMING_VSYNC_WIDTH(data);
 	vsyncoff = EDID_DET_TIMING_VSYNC_OFFSET(data);
 	
-	/* XXX: I'm not doing anything with the borders, should I? */
+	/* Borders are contained within the blank areas. */
 
 	vmp->hdisplay = hactive;
 	vmp->htotal = hactive + hblank;
@@ -406,16 +426,27 @@
 edid_block(struct edid_info *edid, uint8_t *data)
 {
 	int			i;
-	struct videomode	mode;
+	struct videomode	mode, *exist_mode;
 
 	if (EDID_BLOCK_IS_DET_TIMING(data)) {
 		if (edid_det_timing(data, &mode)) {
-			edid->edid_modes[edid->edid_nmodes] = mode;
-			if (edid->edid_preferred_mode == NULL) {
-edid->edid_preferred_mode =
-&edid->edid_modes[edid->edid_nmodes];
+			/* Does this mode already exist? */
+			exist_mode = edid_search_mode(edid, &mode);
+			if (exist_mode != NULL) {
+memcpy(exist_mode, &mode,
+sizeof(struct videomode));
+if (edid->edid_preferred_mode == NULL) {
+	edid->edid_preferred_mode =
+	exist_mode;
+}
+			} else {
+edid->edid_modes[edid->edid_nmodes] = mode;
+if (edid->edid_preferred_mode == NULL) {
+	edid->edid_preferred_mode =
+	&edid->edid_modes[edid->edid_nmodes];
+}
+edid->edid_nmodes++;	
 			}
-			edid->edid_nmodes++;	
 		}
 		return;
 	}
@@ -473,8 +504,13 @@
 		data += EDID_DESC_STD_TIMING_START;
 		for (i = 0; i < EDID_DESC_STD_TIMING_COUNT; i++) {
 			if (edid_std_timing(data, &mode)) {
-edid->edid_modes[edid->edid_nmodes] = mode;
-edid->edid_nmodes++;
+/* Does this mode already exist? */
+exist_mode = edid_search_mode(edid, &mode);
+if (exist_mode == NULL) {
+	edid->edid_modes[edid->edid_nmodes] =
+	mode;
+	edid->edid_nmodes++;
+}
 			}
 			data += 2;
 		}
@@ -574,11 +610,15 @@
 
 	/* do standard timing section */
 	for (i = 0; i < EDID_STD_TIMING_COUNT; i++) {
-		struct videomode	mode;
+		struct videomode	mode, *exist_mode;
 		if (edid_std_timing(data + EDID_OFFSET_STD_TIMING + i * 2,
 			&mode)) {
-			edid->edid_modes[edid->edid_nmodes] = mode;
-			edid->edid_nmodes++;
+			/* Does this mode already exist? */
+			exist_mode = edid_search_mode(edid, &mode);
+			if (exist_mode == NULL) {
+edid->edid_modes[edid->edid_nmodes] = mode;
+edid->edid_nmodes++;
+			}
 		}
 	}
 



CVS commit: src/regress/lib/libc

2011-04-09 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Apr  9 17:55:54 UTC 2011

Modified Files:
src/regress/lib/libc: Makefile
Removed Files:
src/regress/lib/libc/locale: Makefile
src/regress/lib/libc/locale/ctype1: Makefile ctype1.c
en_US.UTF-8.exp.uue en_US.UTF-8.in.uue ja_JP.ISO-2022-JP.exp.uue
ja_JP.ISO-2022-JP.in.uue ja_JP.SJIS.exp.uue ja_JP.SJIS.in.uue
ja_JP.eucJP.exp.uue ja_JP.eucJP.in.uue
src/regress/lib/libc/locale/ctype2: C.in.uue Makefile
en_US.UTF-8.in.uue ja_JP.ISO-2022-JP-2.in.uue ja_JP.SJIS.in.uue
ja_JP.eucJP.in.uue mbrtowc.c
src/regress/lib/libc/locale/ctype3: Makefile
src/regress/lib/libc/locale/mbtowc: Makefile en_US.UTF-8
ja_JP.ISO-2022-JP ja_JP.SJIS ja_JP.eucJP mbtowc_test.c
zh_CN.GB18030 zh_TW.Big5 zh_TW.eucTW
src/regress/lib/libc/locale/wcstod: Makefile wcstod_test.c
src/regress/lib/libc/locale/wctomb: Makefile Makefile.inc test.c
src/regress/lib/libc/locale/wctomb/iso2022-jp: Makefile iso2022-jp.c
src/regress/lib/libc/locale/wctomb/iso646: Makefile iso646.c

Log Message:
These tests have (finally) been atf-ified


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.80 src/regress/lib/libc/Makefile
cvs rdiff -u -r1.4 -r0 src/regress/lib/libc/locale/Makefile
cvs rdiff -u -r1.4 -r0 src/regress/lib/libc/locale/ctype1/Makefile
cvs rdiff -u -r1.5 -r0 src/regress/lib/libc/locale/ctype1/ctype1.c
cvs rdiff -u -r1.2 -r0 src/regress/lib/libc/locale/ctype1/en_US.UTF-8.exp.uue \
src/regress/lib/libc/locale/ctype1/ja_JP.SJIS.exp.uue \
src/regress/lib/libc/locale/ctype1/ja_JP.eucJP.exp.uue
cvs rdiff -u -r1.1 -r0 src/regress/lib/libc/locale/ctype1/en_US.UTF-8.in.uue \
src/regress/lib/libc/locale/ctype1/ja_JP.ISO-2022-JP.exp.uue \
src/regress/lib/libc/locale/ctype1/ja_JP.ISO-2022-JP.in.uue \
src/regress/lib/libc/locale/ctype1/ja_JP.SJIS.in.uue \
src/regress/lib/libc/locale/ctype1/ja_JP.eucJP.in.uue
cvs rdiff -u -r1.1 -r0 src/regress/lib/libc/locale/ctype2/C.in.uue \
src/regress/lib/libc/locale/ctype2/en_US.UTF-8.in.uue \
src/regress/lib/libc/locale/ctype2/ja_JP.ISO-2022-JP-2.in.uue \
src/regress/lib/libc/locale/ctype2/ja_JP.SJIS.in.uue \
src/regress/lib/libc/locale/ctype2/ja_JP.eucJP.in.uue
cvs rdiff -u -r1.5 -r0 src/regress/lib/libc/locale/ctype2/Makefile \
src/regress/lib/libc/locale/ctype2/mbrtowc.c
cvs rdiff -u -r1.5 -r0 src/regress/lib/libc/locale/ctype3/Makefile
cvs rdiff -u -r1.3 -r0 src/regress/lib/libc/locale/mbtowc/Makefile
cvs rdiff -u -r1.1 -r0 src/regress/lib/libc/locale/mbtowc/en_US.UTF-8 \
src/regress/lib/libc/locale/mbtowc/ja_JP.ISO-2022-JP \
src/regress/lib/libc/locale/mbtowc/ja_JP.SJIS \
src/regress/lib/libc/locale/mbtowc/ja_JP.eucJP \
src/regress/lib/libc/locale/mbtowc/zh_CN.GB18030 \
src/regress/lib/libc/locale/mbtowc/zh_TW.Big5 \
src/regress/lib/libc/locale/mbtowc/zh_TW.eucTW
cvs rdiff -u -r1.2 -r0 src/regress/lib/libc/locale/mbtowc/mbtowc_test.c
cvs rdiff -u -r1.1 -r0 src/regress/lib/libc/locale/wcstod/Makefile
cvs rdiff -u -r1.2 -r0 src/regress/lib/libc/locale/wcstod/wcstod_test.c
cvs rdiff -u -r1.1 -r0 src/regress/lib/libc/locale/wctomb/Makefile \
src/regress/lib/libc/locale/wctomb/Makefile.inc
cvs rdiff -u -r1.3 -r0 src/regress/lib/libc/locale/wctomb/test.c
cvs rdiff -u -r1.1 -r0 src/regress/lib/libc/locale/wctomb/iso2022-jp/Makefile
cvs rdiff -u -r1.2 -r0 \
src/regress/lib/libc/locale/wctomb/iso2022-jp/iso2022-jp.c
cvs rdiff -u -r1.1 -r0 src/regress/lib/libc/locale/wctomb/iso646/Makefile
cvs rdiff -u -r1.2 -r0 src/regress/lib/libc/locale/wctomb/iso646/iso646.c

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

Modified files:

Index: src/regress/lib/libc/Makefile
diff -u src/regress/lib/libc/Makefile:1.79 src/regress/lib/libc/Makefile:1.80
--- src/regress/lib/libc/Makefile:1.79	Tue Jan 11 16:34:27 2011
+++ src/regress/lib/libc/Makefile	Sat Apr  9 17:55:51 2011
@@ -1,6 +1,6 @@
-#	$NetBSD: Makefile,v 1.79 2011/01/11 16:34:27 pgoyette Exp $
+#	$NetBSD: Makefile,v 1.80 2011/04/09 17:55:51 pgoyette Exp $
 
-SUBDIR+= citrus divrem int_fmtio locale
+SUBDIR+= citrus divrem int_fmtio
 
 .include 
 .include 



CVS commit: src

2011-04-09 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Apr  9 17:45:25 UTC 2011

Modified Files:
src/distrib/sets/lists/tests: mi
src/etc/mtree: NetBSD.dist.tests
src/tests/lib/libc: Makefile
Added Files:
src/tests/lib/libc/locale: Makefile t_ctype1.c t_ctype2.c t_mbtowc.c
t_wcstod.c t_wctomb.c

Log Message:
atf-ify the various locale tests


To generate a diff of this commit:
cvs rdiff -u -r1.300 -r1.301 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.35 -r1.36 src/etc/mtree/NetBSD.dist.tests
cvs rdiff -u -r1.38 -r1.39 src/tests/lib/libc/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/lib/libc/locale/Makefile \
src/tests/lib/libc/locale/t_ctype1.c src/tests/lib/libc/locale/t_ctype2.c \
src/tests/lib/libc/locale/t_mbtowc.c src/tests/lib/libc/locale/t_wcstod.c \
src/tests/lib/libc/locale/t_wctomb.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/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.300 src/distrib/sets/lists/tests/mi:1.301
--- src/distrib/sets/lists/tests/mi:1.300	Fri Apr  8 06:49:20 2011
+++ src/distrib/sets/lists/tests/mi	Sat Apr  9 17:45:25 2011
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.300 2011/04/08 06:49:20 jruoho Exp $
+# $NetBSD: mi,v 1.301 2011/04/09 17:45:25 pgoyette Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -370,6 +370,12 @@
 ./usr/libdata/debug/usr/tests/lib/libc/ieeefp/t_nan_inf.debug		tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/ieeefp/t_round.debug		tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/ieeefp/t_subnormal.debug		tests-lib-debug		debug,atf
+./usr/libdata/debug/usr/tests/lib/libc/localetests-lib-debug
+./usr/libdata/debug/usr/tests/lib/libc/locale/t_ctype1			tests-lib-debug		debug,atf
+./usr/libdata/debug/usr/tests/lib/libc/locale/t_ctype2			tests-lib-debug		debug,atf
+./usr/libdata/debug/usr/tests/lib/libc/locale/t_mbtowc			tests-lib-debug		debug,atf
+./usr/libdata/debug/usr/tests/lib/libc/locale/t_wcstod			tests-lib-debug		debug,atf
+./usr/libdata/debug/usr/tests/lib/libc/locale/t_wctomb			tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/inettests-lib-debug
 ./usr/libdata/debug/usr/tests/lib/libc/inet/t_inet_network.debug	tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/nettests-lib-debug
@@ -1787,6 +1793,13 @@
 ./usr/tests/lib/libc/ieeefp/t_nan_inf		tests-lib-tests		atf
 ./usr/tests/lib/libc/ieeefp/t_round		tests-lib-tests		atf
 ./usr/tests/lib/libc/ieeefp/t_subnormal		tests-lib-tests		atf
+./usr/tests/lib/libc/locale			tests-lib-tests
+./usr/tests/lib/libc/locale/Atffile		tests-lib-tests		atf
+./usr/tests/lib/libc/locale/t_ctype1		tests-lib-tests		atf
+./usr/tests/lib/libc/locale/t_ctype2		tests-lib-tests		atf
+./usr/tests/lib/libc/locale/t_mbtowc		tests-lib-tests		atf
+./usr/tests/lib/libc/locale/t_wcstod		tests-lib-tests		atf
+./usr/tests/lib/libc/locale/t_wctomb		tests-lib-tests		atf
 ./usr/tests/lib/libc/inet			tests-lib-tests
 ./usr/tests/lib/libc/inet/Atffile		tests-lib-tests		atf
 ./usr/tests/lib/libc/inet/t_inet_network	tests-lib-tests		atf

Index: src/etc/mtree/NetBSD.dist.tests
diff -u src/etc/mtree/NetBSD.dist.tests:1.35 src/etc/mtree/NetBSD.dist.tests:1.36
--- src/etc/mtree/NetBSD.dist.tests:1.35	Thu Apr  7 06:24:07 2011
+++ src/etc/mtree/NetBSD.dist.tests	Sat Apr  9 17:45:24 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: NetBSD.dist.tests,v 1.35 2011/04/07 06:24:07 plunky Exp $
+#	$NetBSD: NetBSD.dist.tests,v 1.36 2011/04/09 17:45:24 pgoyette Exp $
 
 ./usr/libdata/debug/usr/tests
 ./usr/libdata/debug/usr/tests/atf
@@ -51,6 +51,7 @@
 ./usr/libdata/debug/usr/tests/lib/libc/gen
 ./usr/libdata/debug/usr/tests/lib/libc/hash
 ./usr/libdata/debug/usr/tests/lib/libc/ieeefp
+./usr/libdata/debug/usr/tests/lib/libc/locale
 ./usr/libdata/debug/usr/tests/lib/libc/inet
 ./usr/libdata/debug/usr/tests/lib/libc/net
 ./usr/libdata/debug/usr/tests/lib/libc/net/getaddrinfo
@@ -166,6 +167,7 @@
 ./usr/tests/lib/libc/hash
 ./usr/tests/lib/libc/hash/data
 ./usr/tests/lib/libc/ieeefp
+./usr/tests/lib/libc/locale
 ./usr/tests/lib/libc/inet
 ./usr/tests/lib/libc/net
 ./usr/tests/lib/libc/net/getaddrinfo

Index: src/tests/lib/libc/Makefile
diff -u src/tests/lib/libc/Makefile:1.38 src/tests/lib/libc/Makefile:1.39
--- src/tests/lib/libc/Makefile:1.38	Wed Mar  9 23:10:07 2011
+++ src/tests/lib/libc/Makefile	Sat Apr  9 17:45:24 2011
@@ -1,11 +1,11 @@
-# $NetBSD: Makefile,v 1.38 2011/03/09 23:10:07 joerg Exp $
+# $NetBSD: Makefile,v 1.39 2011/04/09 17:45:24 pgoyette Exp $
 
 .include 
 .include 
 
 SUBDIR+=	tls_dso .WAIT
 
-TESTS_SUBDIRS+=	db gen hash ieeefp inet net regex rpc setjmp stdlib
+TESTS_SUBDIRS+=	db gen hash ieeefp inet locale net regex rpc setjmp stdlib
 TESTS_SUBDIRS+=	stdio string sys time tls ttyio
 
 .if ${HAS_SSP} == "yes"

Added files:

Index: src/tests/lib/libc/locale/Makefile
diff -

CVS commit: src/share/man/man4

2011-04-09 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Sat Apr  9 17:25:28 UTC 2011

Modified Files:
src/share/man/man4: acpicpu.4

Log Message:
Fix SYNOPSIS.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/share/man/man4/acpicpu.4

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

Modified files:

Index: src/share/man/man4/acpicpu.4
diff -u src/share/man/man4/acpicpu.4:1.30 src/share/man/man4/acpicpu.4:1.31
--- src/share/man/man4/acpicpu.4:1.30	Sat Mar 19 05:18:36 2011
+++ src/share/man/man4/acpicpu.4	Sat Apr  9 17:25:28 2011
@@ -1,4 +1,4 @@
-.\" $NetBSD: acpicpu.4,v 1.30 2011/03/19 05:18:36 jruoho Exp $
+.\" $NetBSD: acpicpu.4,v 1.31 2011/04/09 17:25:28 jruoho Exp $
 .\"
 .\" Copyright (c) 2010 Jukka Ruohonen 
 .\" All rights reserved.
@@ -24,14 +24,14 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd March 19, 2011
+.Dd April 9, 2011
 .Dt ACPICPU 4
 .Os
 .Sh NAME
 .Nm acpicpu
 .Nd ACPI CPU
 .Sh SYNOPSIS
-.Cd "acpicpu* at acpi?"
+.Cd "acpicpu* at cpu?"
 .Sh DESCRIPTION
 The
 .Nm



CVS commit: src/sys/kern

2011-04-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Apr  9 12:07:06 UTC 2011

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

Log Message:
Add a few KASSERT to verify we do not accidently use minor(NODEV) as an
index into the pt_softc array.


To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/sys/kern/tty_pty.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/tty_pty.c
diff -u src/sys/kern/tty_pty.c:1.126 src/sys/kern/tty_pty.c:1.127
--- src/sys/kern/tty_pty.c:1.126	Sat Apr  9 07:02:57 2011
+++ src/sys/kern/tty_pty.c	Sat Apr  9 12:07:06 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: tty_pty.c,v 1.126 2011/04/09 07:02:57 martin Exp $	*/
+/*	$NetBSD: tty_pty.c,v 1.127 2011/04/09 12:07:06 martin Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tty_pty.c,v 1.126 2011/04/09 07:02:57 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty_pty.c,v 1.127 2011/04/09 12:07:06 martin Exp $");
 
 #include "opt_ptm.h"
 
@@ -476,7 +476,10 @@
 void
 ptsstart(struct tty *tp)
 {
-	struct pt_softc *pti = pt_softc[minor(tp->t_dev)];
+	struct pt_softc *pti;
+
+	KASSERT(tp->t_dev != NODEV);
+	pti = pt_softc[minor(tp->t_dev)];
 
 	KASSERT(mutex_owned(&tty_lock));
 
@@ -497,7 +500,10 @@
 void
 ptsstop(struct tty *tp, int flush)
 {
-	struct pt_softc *pti = pt_softc[minor(tp->t_dev)];
+	struct pt_softc *pti;
+
+	KASSERT(tp->t_dev != NODEV);
+	pti = pt_softc[minor(tp->t_dev)];
 
 	KASSERT(mutex_owned(&tty_lock));
 



CVS commit: src/tests/kernel/tty

2011-04-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Apr  9 11:55:59 UTC 2011

Modified Files:
src/tests/kernel/tty: t_pr.c

Log Message:
Add two simple testcases to exercise pty/tty communication.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/kernel/tty/t_pr.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/kernel/tty/t_pr.c
diff -u src/tests/kernel/tty/t_pr.c:1.4 src/tests/kernel/tty/t_pr.c:1.5
--- src/tests/kernel/tty/t_pr.c:1.4	Sat Apr  9 06:36:03 2011
+++ src/tests/kernel/tty/t_pr.c	Sat Apr  9 11:55:59 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_pr.c,v 1.4 2011/04/09 06:36:03 martin Exp $	*/
+/*	$NetBSD: t_pr.c,v 1.5 2011/04/09 11:55:59 martin Exp $	*/
 
 #include 
 #include 
@@ -7,14 +7,136 @@
 #include 
 #include 
 
+#include 
+#include 
+#include 
 #include 
 #include 
 
+static bool init_done = false;
+
+static void
+init(void)
+{
+	if (init_done)
+		return;
+	rump_init();
+	init_done = true;
+}
+
+static int
+sendsome(int from, int to)
+{
+	size_t i;
+	ssize_t cnt;
+	static const char msg[] = "hello world\n";
+	char buf[sizeof(msg)+10];
+
+	memset(buf, 0, sizeof(buf));
+	rump_sys_write(from, msg, strlen(msg));
+	cnt = rump_sys_read(to, buf, sizeof(buf));
+	if (cnt < (ssize_t)strlen(msg)) {
+		printf("short message read: %zd chars: \"%s\"\n", cnt, buf);
+		return 1;
+	}
+	for (i = 0; i < sizeof(buf); i++) {
+		if (buf[i] == '\r' || buf[i] == '\n') {
+			buf[i] = '\n';
+			buf[i+1] = '\0';
+			break;
+		}
+	}
+
+	return strcmp(buf, msg) != 0;
+}
+
+static int
+exercise_ptytty(int master, int slave)
+{
+	int error, flags;
+
+	/*
+	 * send a few bytes from master to slave and read them back
+	 */
+	error = sendsome(master, slave);
+	if (error)
+		return error;
+
+	flags = FREAD|FWRITE;
+	rump_sys_ioctl(master, TIOCFLUSH, &flags);
+
+	/*
+	 * and the same in the other direction
+	 */
+	error = sendsome(slave, master);
+	if (error)
+		return error;
+
+	flags = FREAD|FWRITE;
+	rump_sys_ioctl(master, TIOCFLUSH, &flags);
+	return 0;
+}
+
+ATF_TC(client_first);
+ATF_TC_HEAD(client_first, tc)
+{
+
+	atf_tc_set_md_var(tc, "descr",
+	"test basic tty/pty operation when opening client side first");
+}
+
+ATF_TC_BODY(client_first, tc)
+{
+	int master, slave, error, v;
+
+	init();
+	slave =  rump_sys_open("/dev/ttyp1", O_RDWR|O_NONBLOCK);
+	ATF_CHECK(slave != -1);
+
+	master = rump_sys_open("/dev/ptyp1", O_RDWR);
+	ATF_CHECK(master != -1);
+
+	v = 0;
+	rump_sys_ioctl(slave, FIOASYNC, &v);
+	error = exercise_ptytty(master, slave);
+	ATF_CHECK(error == 0);
+
+	rump_sys_close(master);
+	rump_sys_close(slave);
+}
+
+ATF_TC(master_first);
+ATF_TC_HEAD(master_first, tc)
+{
+
+	atf_tc_set_md_var(tc, "descr",
+	"test basic tty/pty operation when opening master side first");
+}
+
+ATF_TC_BODY(master_first, tc)
+{
+	int master, slave, error;
+
+	init();
+	master = rump_sys_open("/dev/ptyp1", O_RDWR);
+	ATF_CHECK(master != -1);
+
+	slave =  rump_sys_open("/dev/ttyp1", O_RDWR);
+	ATF_CHECK(slave != -1);
+
+	error = exercise_ptytty(master, slave);
+	ATF_CHECK(error == 0);
+
+	rump_sys_close(master);
+	rump_sys_close(slave);
+}
+
 ATF_TC(ptyioctl);
 ATF_TC_HEAD(ptyioctl, tc)
 {
 
-	atf_tc_set_md_var(tc, "descr", "ioctl on pty");
+	atf_tc_set_md_var(tc, "descr",
+	"ioctl on pty with client side not open");
 }
 
 ATF_TC_BODY(ptyioctl, tc)
@@ -22,7 +144,7 @@
 	struct termios tio;
 	int fd;
 
-	rump_init();
+	init();
 	fd = rump_sys_open("/dev/ptyp1", O_RDWR);
 	ATF_CHECK(fd != -1);
 
@@ -31,12 +153,16 @@
 	 * atf_tc_expect_signal(-1, "PR kern/40688");
 	 */
 	rump_sys_ioctl(fd, TIOCGETA, &tio);
+
+	rump_sys_close(fd);
 }
 
 ATF_TP_ADD_TCS(tp)
 {
 
 	ATF_TP_ADD_TC(tp, ptyioctl);
+	ATF_TP_ADD_TC(tp, client_first);
+	ATF_TP_ADD_TC(tp, master_first);
 
 	return atf_no_error();
 }



CVS commit: src/sys/kern

2011-04-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Apr  9 07:02:58 UTC 2011

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

Log Message:
KNF, add a comment and an assertion.


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/sys/kern/tty_pty.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/tty_pty.c
diff -u src/sys/kern/tty_pty.c:1.125 src/sys/kern/tty_pty.c:1.126
--- src/sys/kern/tty_pty.c:1.125	Sat Apr  9 06:34:06 2011
+++ src/sys/kern/tty_pty.c	Sat Apr  9 07:02:57 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: tty_pty.c,v 1.125 2011/04/09 06:34:06 martin Exp $	*/
+/*	$NetBSD: tty_pty.c,v 1.126 2011/04/09 07:02:57 martin Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tty_pty.c,v 1.125 2011/04/09 06:34:06 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty_pty.c,v 1.126 2011/04/09 07:02:57 martin Exp $");
 
 #include "opt_ptm.h"
 
@@ -523,11 +523,13 @@
 void
 ptcwakeup(struct tty *tp, int flag)
 {
-	struct pt_softc *pti = NULL;
+	struct pt_softc *pti;
 
-	if (tp->t_dev == NODEV) return;
+	if (tp->t_dev == NODEV)
+		return;	/* client side not open yet */
 
 	pti = pt_softc[minor(tp->t_dev)];
+	KASSERT(pti != NULL);
 
 	mutex_spin_enter(&tty_lock);
 	if (flag & FREAD) {