CVS commit: src/external/mit/xorg/lib/pixman

2010-12-01 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Dec  1 08:59:13 UTC 2010

Modified Files:
src/external/mit/xorg/lib/pixman: Makefile

Log Message:
dsable SSE2 support on amd64 for now.  GCC generates code that causes
alignment faults.  the code is:

0x7f7ffd40ccd7 _pixman_implementation_create_sse2+0:  push   %rbp
0x7f7ffd40ccd8 _pixman_implementation_create_sse2+1:  mov%rsp,%rbp
0x7f7ffd40ccdb _pixman_implementation_create_sse2+4:  sub
$0x10,%rsp
...
0x7f7ffd40cdab _pixman_implementation_create_sse2+212:mov
$0x,%rdx
0x7f7ffd40cdb2 _pixman_implementation_create_sse2+219:mov
%rdx,0xfff0(%rbp)
0x7f7ffd40cdb6 _pixman_implementation_create_sse2+223:mov
%rdx,0xfff8(%rbp)
0x7f7ffd40cdba _pixman_implementation_create_sse2+227:movdqa 
0xfff0(%rbp),%xmm0

upon entry we have stack aligned to 16 bytes.  the first instruction
subtracts 8, we copy this not-16-byte aligned value into %rbp, and
then decrement the stack by 16 bytes.

then we store a big -1 into 16 bytes on the stack, and then load it
into %xmm0.. except we load it from an unaligned pointer and GP.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/external/mit/xorg/lib/pixman/Makefile

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

Modified files:

Index: src/external/mit/xorg/lib/pixman/Makefile
diff -u src/external/mit/xorg/lib/pixman/Makefile:1.12 src/external/mit/xorg/lib/pixman/Makefile:1.13
--- src/external/mit/xorg/lib/pixman/Makefile:1.12	Sun Nov 21 09:01:35 2010
+++ src/external/mit/xorg/lib/pixman/Makefile	Wed Dec  1 08:59:12 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.12 2010/11/21 09:01:35 mrg Exp $
+#	$NetBSD: Makefile,v 1.13 2010/12/01 08:59:12 mrg Exp $
 
 NOLINT=	1	# defined
 
@@ -44,10 +44,10 @@
 MKDEPFLAGS+=		-mmmx -fvisibility=hidden
 .elif ${MACHINE_ARCH} == x86_64
 SRCS+=	pixman-mmx.c
-SRCS+=	pixman-sse2.c
+# XXX sse2 is broken with pixman 0.21.2; GCC generates unaligned accesses
+#SRCS+=	pixman-sse2.c
 COPTS.pixman-mmx.c=	-mmmx -fvisibility=hidden
-COPTS.pixman-sse2.c=	-msse2 -fvisibility=hidden
-MKDEPFLAGS+=		-mmmx -msse2 -fvisibility=hidden
+#COPTS.pixman-sse2.c=	-msse2 -fvisibility=hidden
 .endif
 
 # .if VMX



CVS commit: xsrc/external/mit/pixman/include

2010-12-01 Thread matthew green
Module Name:xsrc
Committed By:   mrg
Date:   Wed Dec  1 08:59:38 UTC 2010

Modified Files:
xsrc/external/mit/pixman/include: config.h

Log Message:
disable sse2 on amd64 for now.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 xsrc/external/mit/pixman/include/config.h

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

Modified files:

Index: xsrc/external/mit/pixman/include/config.h
diff -u xsrc/external/mit/pixman/include/config.h:1.12 xsrc/external/mit/pixman/include/config.h:1.13
--- xsrc/external/mit/pixman/include/config.h:1.12	Sun Nov 21 20:49:46 2010
+++ xsrc/external/mit/pixman/include/config.h	Wed Dec  1 08:59:38 2010
@@ -123,7 +123,7 @@
 /* use OpenMP in the test suite */
 #define USE_OPENMP 1
 
-#if defined(__x86_64__)
+#if defined(__x86_64__)  0 /* GCC generates unaligned accesses; see PR 44159 */
 /* use SSE2 compiler intrinsics */
 #define USE_SSE2 1
 #endif



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

2010-12-01 Thread Havard Eidnes
Module Name:src
Committed By:   he
Date:   Wed Dec  1 09:52:29 UTC 2010

Modified Files:
src/sys/arch/macppc/dev: if_wi_obio.c

Log Message:
Follow up the changes done to wivar.h -- the consequence here is that
instead of a _disable and _enable routine, we have a single _enable which
takes a flag, and has a slightly different function signature.
Macppc kernels should build again.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/macppc/dev/if_wi_obio.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/macppc/dev/if_wi_obio.c
diff -u src/sys/arch/macppc/dev/if_wi_obio.c:1.19 src/sys/arch/macppc/dev/if_wi_obio.c:1.20
--- src/sys/arch/macppc/dev/if_wi_obio.c:1.19	Fri Sep 26 04:06:59 2008
+++ src/sys/arch/macppc/dev/if_wi_obio.c	Wed Dec  1 09:52:28 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wi_obio.c,v 1.19 2008/09/26 04:06:59 macallan Exp $	*/
+/*	$NetBSD: if_wi_obio.c,v 1.20 2010/12/01 09:52:28 he Exp $	*/
 
 /*-
  * Copyright (c) 2001 Tsubai Masanari.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_wi_obio.c,v 1.19 2008/09/26 04:06:59 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_wi_obio.c,v 1.20 2010/12/01 09:52:28 he Exp $);
 
 #include opt_inet.h
 
@@ -56,8 +56,7 @@
 
 static int wi_obio_match(struct device *, struct cfdata *, void *);
 static void wi_obio_attach(struct device *, struct device *, void *);
-static int wi_obio_enable(struct wi_softc *);
-static void wi_obio_disable(struct wi_softc *);
+static int wi_obio_enable(device_t, int);
 
 struct wi_obio_softc {
 	struct wi_softc sc_wi;
@@ -105,7 +104,6 @@
 
 	wisc-sc_enabled = 1;
 	wisc-sc_enable = wi_obio_enable;
-	wisc-sc_disable = wi_obio_disable;
 
 	if (wi_attach(wisc, 0)) {
 		printf(%s: failed to attach controller\n, self-dv_xname);
@@ -119,52 +117,48 @@
 
 	/* Disable the card. */
 	wisc-sc_enabled = 0;
-	wi_obio_disable(wisc);
+	wi_obio_enable(self, 0);
 }
 
 int
-wi_obio_enable(struct wi_softc *wisc)
+wi_obio_enable(device_t self, int enable)
 {
 	uint32_t x;
 
-	x = obio_read_4(OBIO_WI_FCR2);
-	x |= 0x4;
-	obio_write_4(OBIO_WI_FCR2, x);
-
-	/* Enable card slot. */
-	obio_write_1(OBIO_WI_GPIO + 0x0f, 5);
-	delay(1000);
-	obio_write_1(OBIO_WI_GPIO + 0x0f, 4);
-	delay(1000);
-	x = obio_read_4(OBIO_WI_FCR2);
-	x = ~0x800;
-
-	obio_write_4(OBIO_WI_FCR2, x);
-	/* out8(gpio + 0x10, 4); */
-
-	obio_write_1(OBIO_WI_EXTINT + 0x0b, 0);
-	obio_write_1(OBIO_WI_EXTINT + 0x0a, 0x28);
-	obio_write_1(OBIO_WI_EXTINT + 0x0d, 0x28);
-	obio_write_1(OBIO_WI_GPIO + 0x0d, 0x28);
-	obio_write_1(OBIO_WI_GPIO + 0x0e, 0x28);
-	obio_write_4(0x1c000, 0);
-
-	/* Initialize the card. */
-	obio_write_4(0x1a3e0, 0x41);
-	x = obio_read_4(OBIO_WI_FCR2);
-	x |= 0x800;
-	obio_write_4(OBIO_WI_FCR2, x);
+	if (enable) {
+		x = obio_read_4(OBIO_WI_FCR2);
+		x |= 0x4;
+		obio_write_4(OBIO_WI_FCR2, x);
+
+		/* Enable card slot. */
+		obio_write_1(OBIO_WI_GPIO + 0x0f, 5);
+		delay(1000);
+		obio_write_1(OBIO_WI_GPIO + 0x0f, 4);
+		delay(1000);
+		x = obio_read_4(OBIO_WI_FCR2);
+		x = ~0x800;
+
+		obio_write_4(OBIO_WI_FCR2, x);
+		/* out8(gpio + 0x10, 4); */
+
+		obio_write_1(OBIO_WI_EXTINT + 0x0b, 0);
+		obio_write_1(OBIO_WI_EXTINT + 0x0a, 0x28);
+		obio_write_1(OBIO_WI_EXTINT + 0x0d, 0x28);
+		obio_write_1(OBIO_WI_GPIO + 0x0d, 0x28);
+		obio_write_1(OBIO_WI_GPIO + 0x0e, 0x28);
+		obio_write_4(0x1c000, 0);
+
+		/* Initialize the card. */
+		obio_write_4(0x1a3e0, 0x41);
+		x = obio_read_4(OBIO_WI_FCR2);
+		x |= 0x800;
+		obio_write_4(OBIO_WI_FCR2, x);
+	} else {
+		x = obio_read_4(OBIO_WI_FCR2);
+		x = ~0x4;
+		obio_write_4(OBIO_WI_FCR2, x);
+		/* out8(gpio + 0x10, 0); */
+	}
 
 	return 0;
 }
-
-void
-wi_obio_disable(struct wi_softc *wisc)
-{
-	uint32_t x;
-
-	x = obio_read_4(OBIO_WI_FCR2);
-	x = ~0x4;
-	obio_write_4(OBIO_WI_FCR2, x);
-	/* out8(gpio + 0x10, 0); */
-}



CVS commit: src/sys/rump/librump/rumpkern

2010-12-01 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Dec  1 11:19:18 UTC 2010

Modified Files:
src/sys/rump/librump/rumpkern: vm.c

Log Message:
Make uvm_pagealloc_tele() fail if the request can't be immediately
satisfied.  This allows the caller to unlock the object and the
pagedaemon to avoid deadlock even if ~all memory is consumed by
one vm object.  This in turn makes is possible to copy a large file
into a rump kernel with a 10MB memory limit (where large  10MB).
A little more tuning will be required to avoid the pagedaemon
hitting the sleep-and-retry path, though.

+ fix some outdated unrelated comments


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.103 src/sys/rump/librump/rumpkern/vm.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/rump/librump/rumpkern/vm.c
diff -u src/sys/rump/librump/rumpkern/vm.c:1.102 src/sys/rump/librump/rumpkern/vm.c:1.103
--- src/sys/rump/librump/rumpkern/vm.c:1.102	Mon Nov 22 20:42:19 2010
+++ src/sys/rump/librump/rumpkern/vm.c	Wed Dec  1 11:19:18 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm.c,v 1.102 2010/11/22 20:42:19 pooka Exp $	*/
+/*	$NetBSD: vm.c,v 1.103 2010/12/01 11:19:18 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007-2010 Antti Kantee.  All Rights Reserved.
@@ -41,7 +41,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vm.c,v 1.102 2010/11/22 20:42:19 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: vm.c,v 1.103 2010/12/01 11:19:18 pooka Exp $);
 
 #include sys/param.h
 #include sys/atomic.h
@@ -146,8 +146,9 @@
 	struct vm_page *pg = obj;
 
 	memset(pg, 0, sizeof(*pg));
-	pg-uanon = rump_hypermalloc(PAGE_SIZE, PAGE_SIZE, true, pgalloc);
-	return 0;
+	pg-uanon = rump_hypermalloc(PAGE_SIZE, PAGE_SIZE,
+	(flags  PR_WAITOK) == PR_WAITOK, pgalloc);
+	return pg-uanon == NULL;
 }
 
 static void
@@ -172,7 +173,10 @@
 	KASSERT(uobj  mutex_owned(uobj-vmobjlock));
 	KASSERT(anon == NULL);
 
-	pg = pool_cache_get(pagecache, PR_WAITOK);
+	pg = pool_cache_get(pagecache, PR_NOWAIT);
+	if (__predict_false(pg == NULL))
+		return NULL;
+
 	pg-offset = off;
 	pg-uobject = uobj;
 
@@ -326,8 +330,7 @@
 /*
  * This satisfies the disgusting mmap hack used by proplib.
  * We probably should grow some more assertables to make sure we're
- * not satisfying anything we shouldn't be satisfying.  At least we
- * should make sure it's the local machine we're mmapping ...
+ * not satisfying anything we shouldn't be satisfying.
  */
 int
 uvm_mmap(struct vm_map *map, vaddr_t *addr, vsize_t size, vm_prot_t prot,
@@ -760,8 +763,7 @@
 {
 
 	/*
-	 * there is only vmspace0.  we're not planning on
-	 * feeding it to the fishes.
+	 * No dynamically allocated vmspaces exist.
 	 */
 }
 
@@ -1052,8 +1054,9 @@
 		newmem = atomic_add_long_nv(curphysmem, howmuch);
 		if (newmem  rump_physmemlimit) {
 			newmem = atomic_add_long_nv(curphysmem, -howmuch);
-			if (!waitok)
+			if (!waitok) {
 return NULL;
+			}
 			uvm_wait(wmsg);
 			goto limitagain;
 		}



CVS commit: src/share/man/man7

2010-12-01 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Wed Dec  1 11:23:40 UTC 2010

Modified Files:
src/share/man/man7: c.7

Log Message:
Minor grammar patrol.

XXX: if this is going to mention the c89 TC's, it should really
XXX: mention the c99 TC's too.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/share/man/man7/c.7

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/man7/c.7
diff -u src/share/man/man7/c.7:1.2 src/share/man/man7/c.7:1.3
--- src/share/man/man7/c.7:1.2	Tue Nov 30 20:59:59 2010
+++ src/share/man/man7/c.7	Wed Dec  1 11:23:39 2010
@@ -1,4 +1,4 @@
-.\ $NetBSD: c.7,v 1.2 2010/11/30 20:59:59 jruoho Exp $
+.\ $NetBSD: c.7,v 1.3 2010/12/01 11:23:39 dholland Exp $
 .\
 .\ Copyright (C) 2007, 2010 Gabor Kovesdan. All rights reserved.
 .\
@@ -112,7 +112,7 @@
 standard, which contains the new features and fixes the known defects and
 deficiencies of the language.
 As a result, ISO/IEC 9899:1999 was born in 1999.
-Similarly to the other standards, this is referred after the
+Similarly to the other standards, this is referred to after the
 publication year as C99.
 The improvements include the following:
 .Bl -bullet -offset indent
@@ -141,7 +141,7 @@
 New and useful features have been showed up in the most famous
 C compiler: GNU C.
 Most of the UNIX-like operating systems use GNU C as a system compiler,
-but those addition in GNU C should not be considered as
+but the various extensions to GNU C should not be considered
 standard features.
 .Sh SEE ALSO
 .Xr cc 1 ,



CVS commit: src/share/man/man7

2010-12-01 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Wed Dec  1 11:24:38 UTC 2010

Modified Files:
src/share/man/man7: c.7

Log Message:
typo


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/share/man/man7/c.7

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/man7/c.7
diff -u src/share/man/man7/c.7:1.3 src/share/man/man7/c.7:1.4
--- src/share/man/man7/c.7:1.3	Wed Dec  1 11:23:39 2010
+++ src/share/man/man7/c.7	Wed Dec  1 11:24:38 2010
@@ -1,4 +1,4 @@
-.\ $NetBSD: c.7,v 1.3 2010/12/01 11:23:39 dholland Exp $
+.\ $NetBSD: c.7,v 1.4 2010/12/01 11:24:38 dholland Exp $
 .\
 .\ Copyright (C) 2007, 2010 Gabor Kovesdan. All rights reserved.
 .\
@@ -124,7 +124,7 @@
 New high-precision integer type named long long int, and other integer types
 defined in stdint.h
 .It
-New boolen data type implemented in stdbool.h
+New boolean data type implemented in stdbool.h
 .It
 One line comments taken from the C++ language
 .It



CVS commit: [netbsd-5] src/distrib/notes/common

2010-12-01 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Wed Dec  1 12:28:38 UTC 2010

Modified Files:
src/distrib/notes/common [netbsd-5]: main

Log Message:
Add myself to releng on netbsd-5 branch


To generate a diff of this commit:
cvs rdiff -u -r1.425.2.14 -r1.425.2.15 src/distrib/notes/common/main

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

Modified files:

Index: src/distrib/notes/common/main
diff -u src/distrib/notes/common/main:1.425.2.14 src/distrib/notes/common/main:1.425.2.15
--- src/distrib/notes/common/main:1.425.2.14	Sat Nov  6 03:42:21 2010
+++ src/distrib/notes/common/main	Wed Dec  1 12:28:38 2010
@@ -1,4 +1,4 @@
-.\	$NetBSD: main,v 1.425.2.14 2010/11/06 03:42:21 snj Exp $
+.\	$NetBSD: main,v 1.425.2.15 2010/12/01 12:28:38 sborrill Exp $
 .\
 .\ Copyright (c) 1999-2008 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -2363,6 +2363,7 @@
 .It Ta Soren Jacobsen Ta Mt s...@netbsd.org
 .It Ta Phil Nelson Ta Mt p...@netbsd.org
 .It Ta Jeff Rizzo Ta Mt r...@netbsd.org
+.It Ta Stephen Borrill Ta Mt sborr...@netbsd.org
 .It Ta Ta
 .
 .br_ne 2i



CVS commit: src/share/man/man7

2010-12-01 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Wed Dec  1 13:27:15 UTC 2010

Modified Files:
src/share/man/man7: c.7

Log Message:
Reference stdbool(3), stdint(3), and inttypes(3). Use .Vt.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/share/man/man7/c.7

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/man7/c.7
diff -u src/share/man/man7/c.7:1.4 src/share/man/man7/c.7:1.5
--- src/share/man/man7/c.7:1.4	Wed Dec  1 11:24:38 2010
+++ src/share/man/man7/c.7	Wed Dec  1 13:27:15 2010
@@ -1,4 +1,4 @@
-.\ $NetBSD: c.7,v 1.4 2010/12/01 11:24:38 dholland Exp $
+.\ $NetBSD: c.7,v 1.5 2010/12/01 13:27:15 jruoho Exp $
 .\
 .\ Copyright (C) 2007, 2010 Gabor Kovesdan. All rights reserved.
 .\
@@ -117,23 +117,30 @@
 The improvements include the following:
 .Bl -bullet -offset indent
 .It
-Inline functions
+Inline functions.
 .It
-Support for variable length arrays
+Support for variable length arrays.
 .It
-New high-precision integer type named long long int, and other integer types
-defined in stdint.h
+New high-precision integer type named
+.Vt long long int ,
+and other integer types described in
+.Xr stdint 3
+and
+.Xr inttypes 3 .
 .It
-New boolean data type implemented in stdbool.h
+New boolean data type; see
+.Xr stdbool 3 .
 .It
-One line comments taken from the C++ language
+One line comments taken from the C++ language.
 .It
-Some new preprocessor features
+Some new preprocessor features.
 .It
 New variables can be declared anywhere, not just in the beginning of the
-program or program blocks
+program or program blocks.
 .It
-No implicit int type
+No implicit
+.Vt int
+type.
 .El
 .Pp
 Since then new standards have not been published, but the C language is still



CVS commit: src

2010-12-01 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Dec  1 14:59:39 UTC 2010

Modified Files:
src/lib/librumpuser: rumpuser_pth.c
src/sys/rump/include/rump: rumpuser.h
src/sys/rump/librump/rumpkern: intr.c klock.c locks.c ltsleep.c rump.c
rump_private.h

Log Message:
Track lwp as the rumpuser mutex owner instead of pthread_t (this
is done in rumpuser for simplicity, since on the kernel side things
we assume we have only one pointer of space).  As a side-effect,
we can no longer know if the current thread is holding on to a
mutex locked without curlwp context (basically all mutexes inited
outside of mutex_init()).  The only thing that called rumpuser_mutex_held()
for a non-kmutex was the giant lock.  So, instead implement recursive
locking for the giant lock in the rump kernel and get rid of the
now-unused recursive pthread mutex in the hypercall interface.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/librumpuser/rumpuser_pth.c
cvs rdiff -u -r1.54 -r1.55 src/sys/rump/include/rump/rumpuser.h
cvs rdiff -u -r1.34 -r1.35 src/sys/rump/librump/rumpkern/intr.c
cvs rdiff -u -r1.2 -r1.3 src/sys/rump/librump/rumpkern/klock.c
cvs rdiff -u -r1.42 -r1.43 src/sys/rump/librump/rumpkern/locks.c
cvs rdiff -u -r1.27 -r1.28 src/sys/rump/librump/rumpkern/ltsleep.c
cvs rdiff -u -r1.207 -r1.208 src/sys/rump/librump/rumpkern/rump.c
cvs rdiff -u -r1.64 -r1.65 src/sys/rump/librump/rumpkern/rump_private.h

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

Modified files:

Index: src/lib/librumpuser/rumpuser_pth.c
diff -u src/lib/librumpuser/rumpuser_pth.c:1.3 src/lib/librumpuser/rumpuser_pth.c:1.4
--- src/lib/librumpuser/rumpuser_pth.c:1.3	Mon May 31 23:09:30 2010
+++ src/lib/librumpuser/rumpuser_pth.c	Wed Dec  1 14:59:37 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpuser_pth.c,v 1.3 2010/05/31 23:09:30 pooka Exp $	*/
+/*	$NetBSD: rumpuser_pth.c,v 1.4 2010/12/01 14:59:37 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007-2010 Antti Kantee.  All Rights Reserved.
@@ -27,7 +27,7 @@
 
 #include sys/cdefs.h
 #if !defined(lint)
-__RCSID($NetBSD: rumpuser_pth.c,v 1.3 2010/05/31 23:09:30 pooka Exp $);
+__RCSID($NetBSD: rumpuser_pth.c,v 1.4 2010/12/01 14:59:37 pooka Exp $);
 #endif /* !lint */
 
 #ifdef __linux__
@@ -62,22 +62,20 @@
 	}\
 } while (/*CONSTCOND*/0)
 
-#define RUMTX_INCRECURSION(mtx) ((mtx)-recursion++)
-#define RUMTX_DECRECURSION(mtx) ((mtx)-recursion--)
 struct rumpuser_mtx {
 	pthread_mutex_t pthmtx;
-	pthread_t owner;
-	unsigned recursion;
+	struct lwp *owner;
+	int iskmutex;
 };
 
-#define RURW_AMWRITER(rw) (pthread_equal(rw-writer, pthread_self())	\
+#define RURW_AMWRITER(rw) (rw-writer == rumpuser_get_curlwp()		\
  rw-readers == -1)
 #define RURW_HASREAD(rw)  (rw-readers  0)
 
 #define RURW_SETWRITE(rw)		\
 do {	\
 	assert(rw-readers == 0);	\
-	rw-writer = pthread_self();	\
+	rw-writer = rumpuser_get_curlwp();\
 	rw-readers = -1;		\
 } while (/*CONSTCOND*/0)
 #define RURW_CLRWRITE(rw)		\
@@ -104,7 +102,7 @@
 	pthread_rwlock_t pthrw;
 	pthread_spinlock_t spin;
 	int readers;
-	pthread_t writer;
+	struct lwp *writer;
 };
 
 struct rumpuser_cv {
@@ -277,11 +275,19 @@
 	pthread_mutexattr_destroy(att);
 
 	(*mtx)-owner = NULL;
-	(*mtx)-recursion = 0;
+	(*mtx)-iskmutex = 0;
 }
 
 void
-rumpuser_mutex_recursive_init(struct rumpuser_mtx **mtx)
+rumpuser_mutex_init_kmutex(struct rumpuser_mtx **mtx)
+{
+
+	rumpuser_mutex_init(mtx);
+	(*mtx)-iskmutex = 1;
+}
+
+void
+rumpuser_mutex_init_krecursive(struct rumpuser_mtx **mtx)
 {
 	pthread_mutexattr_t mattr;
 
@@ -291,7 +297,7 @@
 	NOFAIL(*mtx = malloc(sizeof(struct rumpuser_mtx)));
 	NOFAIL_ERRNO(pthread_mutex_init(((*mtx)-pthmtx), mattr));
 	(*mtx)-owner = NULL;
-	(*mtx)-recursion = 0;
+	(*mtx)-iskmutex = 1;
 
 	pthread_mutexattr_destroy(mattr);
 }
@@ -300,21 +306,22 @@
 mtxenter(struct rumpuser_mtx *mtx)
 {
 
-	if (mtx-recursion++ == 0) {
-		assert(mtx-owner == NULL);
-		mtx-owner = pthread_self();
-	} else {
-		assert(pthread_equal(mtx-owner, pthread_self()));
-	}
+	if (!mtx-iskmutex)
+		return;
+
+	assert(mtx-owner == NULL);
+	mtx-owner = rumpuser_get_curlwp();
 }
 
 static void
 mtxexit(struct rumpuser_mtx *mtx)
 {
 
+	if (!mtx-iskmutex)
+		return;
+
 	assert(mtx-owner != NULL);
-	if (--mtx-recursion == 0)
-		mtx-owner = NULL;
+	mtx-owner = NULL;
 }
 
 void
@@ -367,7 +374,12 @@
 rumpuser_mutex_held(struct rumpuser_mtx *mtx)
 {
 
-	return mtx-recursion  pthread_equal(mtx-owner, pthread_self());
+	if (__predict_false(!mtx-iskmutex)) {
+		printf(panic: rumpuser_mutex_held unsupported on non-kmtx\n);
+		abort();
+	}
+
+	return mtx-owner == rumpuser_get_curlwp();
 }
 
 void
@@ -481,7 +493,6 @@
 
 	cv-nwaiters++;
 	rumpuser__kunlock(0, nlocks, mtx);
-	assert(mtx-recursion == 1);
 	mtxexit(mtx);
 	NOFAIL_ERRNO(pthread_cond_wait(cv-pthcv, mtx-pthmtx));
 	mtxenter(mtx);
@@ -494,7 +505,6 @@
 {
 
 	cv-nwaiters++;
-	

CVS commit: src/lib/librumpuser

2010-12-01 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Dec  1 15:01:53 UTC 2010

Modified Files:
src/lib/librumpuser: rumpuser_pth.c

Log Message:
Umm, delete recursive mutex interface instead of renaming it.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/librumpuser/rumpuser_pth.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/librumpuser/rumpuser_pth.c
diff -u src/lib/librumpuser/rumpuser_pth.c:1.4 src/lib/librumpuser/rumpuser_pth.c:1.5
--- src/lib/librumpuser/rumpuser_pth.c:1.4	Wed Dec  1 14:59:37 2010
+++ src/lib/librumpuser/rumpuser_pth.c	Wed Dec  1 15:01:52 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpuser_pth.c,v 1.4 2010/12/01 14:59:37 pooka Exp $	*/
+/*	$NetBSD: rumpuser_pth.c,v 1.5 2010/12/01 15:01:52 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007-2010 Antti Kantee.  All Rights Reserved.
@@ -27,7 +27,7 @@
 
 #include sys/cdefs.h
 #if !defined(lint)
-__RCSID($NetBSD: rumpuser_pth.c,v 1.4 2010/12/01 14:59:37 pooka Exp $);
+__RCSID($NetBSD: rumpuser_pth.c,v 1.5 2010/12/01 15:01:52 pooka Exp $);
 #endif /* !lint */
 
 #ifdef __linux__
@@ -286,22 +286,6 @@
 	(*mtx)-iskmutex = 1;
 }
 
-void
-rumpuser_mutex_init_krecursive(struct rumpuser_mtx **mtx)
-{
-	pthread_mutexattr_t mattr;
-
-	pthread_mutexattr_init(mattr);
-	pthread_mutexattr_settype(mattr, PTHREAD_MUTEX_RECURSIVE);
-
-	NOFAIL(*mtx = malloc(sizeof(struct rumpuser_mtx)));
-	NOFAIL_ERRNO(pthread_mutex_init(((*mtx)-pthmtx), mattr));
-	(*mtx)-owner = NULL;
-	(*mtx)-iskmutex = 1;
-
-	pthread_mutexattr_destroy(mattr);
-}
-
 static void
 mtxenter(struct rumpuser_mtx *mtx)
 {



CVS commit: src/sys/rump/include/rump

2010-12-01 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Dec  1 15:02:05 UTC 2010

Modified Files:
src/sys/rump/include/rump: rumpuser.h

Log Message:
rumpuser interface changed


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/rump/include/rump/rumpuser.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/rump/include/rump/rumpuser.h
diff -u src/sys/rump/include/rump/rumpuser.h:1.55 src/sys/rump/include/rump/rumpuser.h:1.56
--- src/sys/rump/include/rump/rumpuser.h:1.55	Wed Dec  1 14:59:39 2010
+++ src/sys/rump/include/rump/rumpuser.h	Wed Dec  1 15:02:04 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpuser.h,v 1.55 2010/12/01 14:59:39 pooka Exp $	*/
+/*	$NetBSD: rumpuser.h,v 1.56 2010/12/01 15:02:04 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007 Antti Kantee.  All Rights Reserved.
@@ -36,7 +36,7 @@
 #include stdint.h
 #endif
 
-#define RUMPUSER_VERSION 6
+#define RUMPUSER_VERSION 7
 int rumpuser_getversion(void);
 
 int rumpuser_daemonize_begin(void);



CVS commit: src/sys/rump/net/lib/libvirtif

2010-12-01 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Dec  1 15:13:24 UTC 2010

Modified Files:
src/sys/rump/net/lib/libvirtif: if_virt.c

Log Message:
Don't bother asserting: if we create the thread without KTHREAD_MPSAFE,
it's not going to be MPSAFE.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/rump/net/lib/libvirtif/if_virt.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/rump/net/lib/libvirtif/if_virt.c
diff -u src/sys/rump/net/lib/libvirtif/if_virt.c:1.21 src/sys/rump/net/lib/libvirtif/if_virt.c:1.22
--- src/sys/rump/net/lib/libvirtif/if_virt.c:1.21	Mon Nov 15 20:23:11 2010
+++ src/sys/rump/net/lib/libvirtif/if_virt.c	Wed Dec  1 15:13:24 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_virt.c,v 1.21 2010/11/15 20:23:11 pooka Exp $	*/
+/*	$NetBSD: if_virt.c,v 1.22 2010/12/01 15:13:24 pooka Exp $	*/
 
 /*
  * Copyright (c) 2008 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_virt.c,v 1.21 2010/11/15 20:23:11 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_virt.c,v 1.22 2010/12/01 15:13:24 pooka Exp $);
 
 #include sys/param.h
 #include sys/condvar.h
@@ -258,8 +258,6 @@
 	pfd.fd = sc-sc_tapfd;
 	pfd.events = POLLIN;
 
-	KASSERT(rump_kernel_isbiglocked());
-
 	for (;;) {
 		m = m_gethdr(M_WAIT, MT_DATA);
 		MEXTMALLOC(m, plen, M_WAIT);



CVS commit: src

2010-12-01 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Dec  1 17:22:52 UTC 2010

Modified Files:
src/lib/librumpuser: rumpuser_pth.c
src/sys/rump/include/rump: rumpuser.h
src/sys/rump/librump/rumpkern: locks.c locks_up.c

Log Message:
implement mutex_owner()


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/librumpuser/rumpuser_pth.c
cvs rdiff -u -r1.56 -r1.57 src/sys/rump/include/rump/rumpuser.h
cvs rdiff -u -r1.43 -r1.44 src/sys/rump/librump/rumpkern/locks.c
cvs rdiff -u -r1.4 -r1.5 src/sys/rump/librump/rumpkern/locks_up.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/librumpuser/rumpuser_pth.c
diff -u src/lib/librumpuser/rumpuser_pth.c:1.5 src/lib/librumpuser/rumpuser_pth.c:1.6
--- src/lib/librumpuser/rumpuser_pth.c:1.5	Wed Dec  1 15:01:52 2010
+++ src/lib/librumpuser/rumpuser_pth.c	Wed Dec  1 17:22:51 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpuser_pth.c,v 1.5 2010/12/01 15:01:52 pooka Exp $	*/
+/*	$NetBSD: rumpuser_pth.c,v 1.6 2010/12/01 17:22:51 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007-2010 Antti Kantee.  All Rights Reserved.
@@ -27,7 +27,7 @@
 
 #include sys/cdefs.h
 #if !defined(lint)
-__RCSID($NetBSD: rumpuser_pth.c,v 1.5 2010/12/01 15:01:52 pooka Exp $);
+__RCSID($NetBSD: rumpuser_pth.c,v 1.6 2010/12/01 17:22:51 pooka Exp $);
 #endif /* !lint */
 
 #ifdef __linux__
@@ -354,8 +354,8 @@
 	free(mtx);
 }
 
-int
-rumpuser_mutex_held(struct rumpuser_mtx *mtx)
+struct lwp *
+rumpuser_mutex_owner(struct rumpuser_mtx *mtx)
 {
 
 	if (__predict_false(!mtx-iskmutex)) {
@@ -363,7 +363,7 @@
 		abort();
 	}
 
-	return mtx-owner == rumpuser_get_curlwp();
+	return mtx-owner;
 }
 
 void

Index: src/sys/rump/include/rump/rumpuser.h
diff -u src/sys/rump/include/rump/rumpuser.h:1.56 src/sys/rump/include/rump/rumpuser.h:1.57
--- src/sys/rump/include/rump/rumpuser.h:1.56	Wed Dec  1 15:02:04 2010
+++ src/sys/rump/include/rump/rumpuser.h	Wed Dec  1 17:22:51 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpuser.h,v 1.56 2010/12/01 15:02:04 pooka Exp $	*/
+/*	$NetBSD: rumpuser.h,v 1.57 2010/12/01 17:22:51 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007 Antti Kantee.  All Rights Reserved.
@@ -132,7 +132,7 @@
 int  rumpuser_mutex_tryenter(struct rumpuser_mtx *);
 void rumpuser_mutex_exit(struct rumpuser_mtx *);
 void rumpuser_mutex_destroy(struct rumpuser_mtx *);
-int  rumpuser_mutex_held(struct rumpuser_mtx *);
+struct lwp *rumpuser_mutex_owner(struct rumpuser_mtx *);
 
 struct rumpuser_rw;
 

Index: src/sys/rump/librump/rumpkern/locks.c
diff -u src/sys/rump/librump/rumpkern/locks.c:1.43 src/sys/rump/librump/rumpkern/locks.c:1.44
--- src/sys/rump/librump/rumpkern/locks.c:1.43	Wed Dec  1 14:59:38 2010
+++ src/sys/rump/librump/rumpkern/locks.c	Wed Dec  1 17:22:51 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: locks.c,v 1.43 2010/12/01 14:59:38 pooka Exp $	*/
+/*	$NetBSD: locks.c,v 1.44 2010/12/01 17:22:51 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007, 2008 Antti Kantee.  All Rights Reserved.
@@ -29,7 +29,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: locks.c,v 1.43 2010/12/01 14:59:38 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: locks.c,v 1.44 2010/12/01 17:22:51 pooka Exp $);
 
 #include sys/param.h
 #include sys/kmem.h
@@ -109,7 +109,14 @@
 mutex_owned(kmutex_t *mtx)
 {
 
-	return rumpuser_mutex_held(RUMPMTX(mtx));
+	return mutex_owner(mtx) == curlwp;
+}
+
+struct lwp *
+mutex_owner(kmutex_t *mtx)
+{
+
+	return rumpuser_mutex_owner(RUMPMTX(mtx));
 }
 
 #define RUMPRW(rw) (*(struct rumpuser_rw **)(rw))

Index: src/sys/rump/librump/rumpkern/locks_up.c
diff -u src/sys/rump/librump/rumpkern/locks_up.c:1.4 src/sys/rump/librump/rumpkern/locks_up.c:1.5
--- src/sys/rump/librump/rumpkern/locks_up.c:1.4	Mon Jun 14 21:04:56 2010
+++ src/sys/rump/librump/rumpkern/locks_up.c	Wed Dec  1 17:22:51 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: locks_up.c,v 1.4 2010/06/14 21:04:56 pooka Exp $	*/
+/*	$NetBSD: locks_up.c,v 1.5 2010/12/01 17:22:51 pooka Exp $	*/
 
 /*
  * Copyright (c) 2010 Antti Kantee.  All Rights Reserved.
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: locks_up.c,v 1.4 2010/06/14 21:04:56 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: locks_up.c,v 1.5 2010/12/01 17:22:51 pooka Exp $);
 
 #include sys/param.h
 #include sys/kernel.h
@@ -157,6 +157,13 @@
 	return upm-upm_owner == curlwp;
 }
 
+struct lwp *
+mutex_owner(kmutex_t *mtx)
+{
+
+	return upm-upm_owner;
+}
+
 struct uprw {
 	struct lwp *uprw_owner;
 	int uprw_readers;



CVS commit: src/sbin/resize_ffs

2010-12-01 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Wed Dec  1 17:33:45 UTC 2010

Modified Files:
src/sbin/resize_ffs: resize_ffs.c

Log Message:
Clean up this file:

- sync usage comment with current reality
- sort includes
- wrap lines
- use EXIT_FAILURE consistently
- make error messages consistent:  Cannot-Can't
- Remove Old FFSv1 macros in favor of system macros in ufs/ffs/fs.h .
  Leave dblksize() because it uses the on-disk dinode structure.

More cleanup is needed.
No functional changes intended.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sbin/resize_ffs/resize_ffs.c

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

Modified files:

Index: src/sbin/resize_ffs/resize_ffs.c
diff -u src/sbin/resize_ffs/resize_ffs.c:1.14 src/sbin/resize_ffs/resize_ffs.c:1.15
--- src/sbin/resize_ffs/resize_ffs.c:1.14	Mon Nov 29 19:54:10 2010
+++ src/sbin/resize_ffs/resize_ffs.c	Wed Dec  1 17:33:45 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: resize_ffs.c,v 1.14 2010/11/29 19:54:10 riz Exp $	*/
+/*	$NetBSD: resize_ffs.c,v 1.15 2010/12/01 17:33:45 riz Exp $	*/
 /* From sources sent on February 17, 2003 */
 /*-
  * As its sole author, I explicitly place this code in the public
@@ -15,9 +15,9 @@
  *
  * Resize a filesystem.  Is capable of both growing and shrinking.
  *
- * Usage: resize_ffs filesystem newsize
+ * Usage: resize_ffs [-s newsize] [-y] filesystem
  *
- * Example: resize_ffs /dev/rsd1e 29574
+ * Example: resize_ffs -s 29574 /dev/rsd1e
  *
  * newsize is in DEV_BSIZE units (ie, disk sectors, usually 512 bytes
  *  each).
@@ -41,13 +41,6 @@
  */
 
 #include sys/cdefs.h
-#include stdio.h
-#include errno.h
-#include fcntl.h
-#include stdlib.h
-#include unistd.h
-#include strings.h
-#include err.h
 #include sys/disk.h
 #include sys/disklabel.h
 #include sys/dkio.h
@@ -60,6 +53,14 @@
 #include ufs/ufs/dinode.h
 #include ufs/ufs/ufs_bswap.h	/* ufs_rw32 */
 
+#include err.h
+#include errno.h
+#include fcntl.h
+#include stdio.h
+#include stdlib.h
+#include strings.h
+#include unistd.h
+
 /* new size of filesystem, in sectors */
 static uint32_t newsize;
 
@@ -81,7 +82,8 @@
 static struct fs *oldsb;	/* before we started */
 static struct fs *newsb;	/* copy to work with */
 /* Buffer to hold the above.  Make sure it's aligned correctly. */
-static char sbbuf[2 * SBLOCKSIZE] __attribute__((__aligned__(__alignof__(struct fs;
+static char sbbuf[2 * SBLOCKSIZE]
+	__attribute__((__aligned__(__alignof__(struct fs;
 
 /* a cg's worth of brand new squeaky-clean inodes */
 static struct ufs1_dinode *zinodes;
@@ -115,25 +117,7 @@
  * block of inodes, and applies to the whole
  * block. */
 
-/* Old FFS1 macros */
-#define cg_blktot(cgp, ns) \
-(cg_chkmagic(cgp, ns) ? \
-((int32_t *)((u_int8_t *)(cgp) + ufs_rw32((cgp)-cg_old_btotoff, (ns \
-: (((struct ocg *)(cgp))-cg_btot))
-#define cg_blks(fs, cgp, cylno, ns) \
-(cg_chkmagic(cgp, ns) ? \
-((int16_t *)((u_int8_t *)(cgp) + ufs_rw32((cgp)-cg_old_boff, (ns))) + \
-	(cylno) * (fs)-fs_old_nrpos) \
-: (((struct ocg *)(cgp))-cg_b[cylno]))
-#define cbtocylno(fs, bno) \
-   (fsbtodb(fs, bno) / (fs)-fs_old_spc) 
-#define cbtorpos(fs, bno) \
-((fs)-fs_old_nrpos = 1 ? 0 : \
- (fsbtodb(fs, bno) % (fs)-fs_old_spc / \
-  (fs)-fs_old_nsect * (fs)-fs_old_trackskew + \
-  fsbtodb(fs, bno) % (fs)-fs_old_spc % \
-  (fs)-fs_old_nsect * (fs)-fs_old_interleave) %\
-(fs)-fs_old_nsect * (fs)-fs_old_nrpos / (fs)-fs_old_npsect)
+/* resize_ffs works directly on dinodes, adapt blksize() */
 #define dblksize(fs, dip, lbn) \
 (((lbn) = NDADDR || (dip)-di_size = lblktosize(fs, (lbn) + 1)) \
 ? (fs)-fs_bsize \
@@ -174,7 +158,7 @@
 {
 	/* Seek to the correct place. */
 	if (lseek(fd, blkno * DEV_BSIZE, L_SET)  0)
-		err(1, lseek failed);
+		err(EXIT_FAILURE, lseek failed);
 
 	/* See if we have to break up the transfer... */
 	if (smallio) {
@@ -190,7 +174,8 @@
 			if (rv  0)
 err(EXIT_FAILURE, read failed);
 			if (rv != n)
-errx(1, read: wanted %d, got %d, n, rv);
+errx(EXIT_FAILURE,
+read: wanted %d, got %d, n, rv);
 			bp += n;
 			left -= n;
 		}
@@ -200,7 +185,7 @@
 		if (rv  0)
 			err(EXIT_FAILURE, read failed);
 		if (rv != size)
-			errx(1, read: wanted %d, got %d, size, rv);
+			errx(EXIT_FAILURE, read: wanted %d, got %d, size, rv);
 	}
 }
 /*
@@ -227,7 +212,8 @@
 			if (rv  0)
 err(EXIT_FAILURE, write failed);
 			if (rv != n)
-errx(1, write: wanted %d, got %d, n, rv);
+errx(EXIT_FAILURE,
+write: wanted %d, got %d, n, rv);
 			bp += n;
 			left -= n;
 		}
@@ -237,7 +223,8 @@
 		if (rv  0)
 			err(EXIT_FAILURE, write failed);
 		if (rv != size)
-			errx(1, write: wanted %d, got %d, size, rv);
+			errx(EXIT_FAILURE,
+			write: wanted %d, got %d, size, rv);
 	}
 }
 /*
@@ -458,7 +445,8 @@
 	cg-cg_cgx = cgn;
 	cg-cg_old_ncyl = newsb-fs_old_cpg;
 	/* Update the cg_old_ncyl value for the last cylinder. 

CVS commit: src/sbin/resize_ffs

2010-12-01 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Wed Dec  1 17:39:21 UTC 2010

Modified Files:
src/sbin/resize_ffs: resize_ffs.c

Log Message:
Do not look for a v1 file system at SBLOCK_UFS2, as this gets the wrong
superblock (first alternate) for a file system with 64k blocks.
Spotted by mhi...@.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sbin/resize_ffs/resize_ffs.c

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

Modified files:

Index: src/sbin/resize_ffs/resize_ffs.c
diff -u src/sbin/resize_ffs/resize_ffs.c:1.15 src/sbin/resize_ffs/resize_ffs.c:1.16
--- src/sbin/resize_ffs/resize_ffs.c:1.15	Wed Dec  1 17:33:45 2010
+++ src/sbin/resize_ffs/resize_ffs.c	Wed Dec  1 17:39:21 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: resize_ffs.c,v 1.15 2010/12/01 17:33:45 riz Exp $	*/
+/*	$NetBSD: resize_ffs.c,v 1.16 2010/12/01 17:39:21 riz Exp $	*/
 /* From sources sent on February 17, 2003 */
 /*-
  * As its sole author, I explicitly place this code in the public
@@ -1910,10 +1910,10 @@
 	newsb = (struct fs *) (SBLOCKSIZE + (char *) sbbuf);
 	for (where = search[i = 0]; search[i] != -1; where = search[++i]) {
 		readat(where / DEV_BSIZE, oldsb, SBLOCKSIZE);
+		if (where == SBLOCK_UFS2  (oldsb-fs_magic == FS_UFS1_MAGIC))
+			continue;
 		if (oldsb-fs_magic == FS_UFS1_MAGIC)
 			break;
-		if (where == SBLOCK_UFS2)
-			continue;
 		if (oldsb-fs_old_flags  FS_FLAGS_UPDATED)
 			err(EXIT_FAILURE,
 			Can't resize ffsv2 format superblock!);



CVS commit: src/sbin/resize_ffs

2010-12-01 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Wed Dec  1 17:39:54 UTC 2010

Modified Files:
src/sbin/resize_ffs: TODO

Log Message:
Update TODO for resize_ffs(8), adding some stuff and removing some
ancient bits.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sbin/resize_ffs/TODO

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

Modified files:

Index: src/sbin/resize_ffs/TODO
diff -u src/sbin/resize_ffs/TODO:1.2 src/sbin/resize_ffs/TODO:1.3
--- src/sbin/resize_ffs/TODO:1.2	Sun Feb 23 00:27:51 2003
+++ src/sbin/resize_ffs/TODO	Wed Dec  1 17:39:54 2010
@@ -1,15 +1,9 @@
-Preliminary version of resize_ffs, based on der Mouse's fsresize tool.
-I didn't have time to clean it up completely before my legal status
-w.r.t. open source projects goes into limbo for a while.  Other
-developers are encouraged to play with the tool and get it into
-release-worthy shape.
+resize_ffs(8) TODO list
 
-TODO list (see TODO file)
-
-* -current; put it into release lists/etc. and src/sbin/Makefile
-  (built  tested on 1.6.1)
-* make it ask questions before doing any work (confirm)
-* create regression test suite (see discussions on tech-kern and
-  developers) and fix any bugs
-* verify conversion to ANSI C didn't break anything
-* port to UFS2
+* Determine why shrinking a v1 file system gets the free block/frag info
+  wrong, requiring a fsck.
+* Add support for swapped byte order
+* Fix support for disk blocks of size other than 512 bytes
+* Add support for plain files (primarily to ease testing)
+* Extend to support UFS2.  Probably growth first, then shrinking separately.
+* Expand the testing done in src/tests/sbin/resize_ffs



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

2010-12-01 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Wed Dec  1 17:40:08 UTC 2010

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

Log Message:
Remove unexpected t_resize_ffs.debug (t_resize_ffs is an atf-sh
script).


To generate a diff of this commit:
cvs rdiff -u -r1.165 -r1.166 src/distrib/sets/lists/tests/mi

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.165 src/distrib/sets/lists/tests/mi:1.166
--- src/distrib/sets/lists/tests/mi:1.165	Wed Dec  1 07:03:21 2010
+++ src/distrib/sets/lists/tests/mi	Wed Dec  1 17:40:08 2010
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.165 2010/12/01 07:03:21 pooka Exp $
+# $NetBSD: mi,v 1.166 2010/12/01 17:40:08 njoly Exp $
 #
 # Note: don't delete entries from here - mark them as obsolete instead.
 #
@@ -420,7 +420,6 @@
 ./usr/libdata/debug/usr/tests/rump/rumpvfs/t_p2kifs.debug		tests-syscall-debug	debug,atf
 ./usr/libdata/debug/usr/tests/sbin	tests-sbin-tests
 ./usr/libdata/debug/usr/tests/sbin/resize_ffstests-sbin-tests
-./usr/libdata/debug/usr/tests/sbin/resize_ffs/t_resize_ffs.debug	tests-sbin-tests	debug,atf
 ./usr/libdata/debug/usr/tests/syscall	tests-syscall-debug
 ./usr/libdata/debug/usr/tests/syscall/t_cmsg.debug			tests-syscall-debug	debug,atf
 ./usr/libdata/debug/usr/tests/syscall/t_timer.debug			tests-syscall-debug	debug,atf



CVS commit: src

2010-12-01 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Wed Dec  1 17:48:04 UTC 2010

Modified Files:
src/distrib/sets/lists/base: md.macppc
src/share/wscons/keymaps: Makefile
Added Files:
src/share/wscons/keymaps: ukbd.any.powerbook

Log Message:
Overlay for all Apple PowerBook keymaps, to support the special function
keys for brightness-, volume-control, num-lock, etc.
To be loaded via /etc/wscons.conf.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/distrib/sets/lists/base/md.macppc
cvs rdiff -u -r1.15 -r1.16 src/share/wscons/keymaps/Makefile
cvs rdiff -u -r0 -r1.1 src/share/wscons/keymaps/ukbd.any.powerbook

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/base/md.macppc
diff -u src/distrib/sets/lists/base/md.macppc:1.28 src/distrib/sets/lists/base/md.macppc:1.29
--- src/distrib/sets/lists/base/md.macppc:1.28	Fri Nov 27 15:37:32 2009
+++ src/distrib/sets/lists/base/md.macppc	Wed Dec  1 17:48:04 2010
@@ -1,4 +1,4 @@
-# $NetBSD: md.macppc,v 1.28 2009/11/27 15:37:32 tsutsui Exp $
+# $NetBSD: md.macppc,v 1.29 2010/12/01 17:48:04 phx Exp $
 ./sbin/pdisk	base-sysutil-root
 ./usr/mdec/bootxxbase-sysutil-bin
 ./usr/mdec/installbootbase-obsolete		obsolete
@@ -11,3 +11,4 @@
 ./usr/sbin/zzz	base-sysutil-bin
 ./usr/sbin/eeprombase-sysutil-bin
 ./usr/sbin/ofctlbase-sysutil-bin
+./usr/share/wscons/keymaps/ukbd.any.powerbook	base-util-share

Index: src/share/wscons/keymaps/Makefile
diff -u src/share/wscons/keymaps/Makefile:1.15 src/share/wscons/keymaps/Makefile:1.16
--- src/share/wscons/keymaps/Makefile:1.15	Fri Jan 30 23:12:16 2009
+++ src/share/wscons/keymaps/Makefile	Wed Dec  1 17:48:04 2010
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.15 2009/01/30 23:12:16 ghen Exp $
+# $NetBSD: Makefile,v 1.16 2010/12/01 17:48:04 phx Exp $
 
 NOOBJ=	# defined
 
@@ -14,6 +14,7 @@
 	pckbd.ru.koi8-r \
 	pckbd.sv.svascii \
 	ukbd.be.azerty \
+	ukbd.any.powerbook
 
 FILESDIR= /usr/share/wscons/keymaps
 

Added files:

Index: src/share/wscons/keymaps/ukbd.any.powerbook
diff -u /dev/null src/share/wscons/keymaps/ukbd.any.powerbook:1.1
--- /dev/null	Wed Dec  1 17:48:04 2010
+++ src/share/wscons/keymaps/ukbd.any.powerbook	Wed Dec  1 17:48:04 2010
@@ -0,0 +1,11 @@
+# $NetBSD: ukbd.any.powerbook,v 1.1 2010/12/01 17:48:04 phx Exp $
+#
+# This is an overlay for Apple PowerBook keymaps, to support the
+# NumLock key and the function keys for brightness and volume control.
+#
+keycode 209 = Cmd Cmd_BrightnessDown
+keycode 210 = Cmd Cmd_BrightnessUp
+keycode 211 = Cmd_VolumeToggle
+keycode 212 = Cmd_VolumeDown
+keycode 213 = Cmd_VolumeUp
+keycode 214 = Num_Lock



CVS commit: src/sys/rump/librump/rumpkern

2010-12-01 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Dec  1 20:29:57 UTC 2010

Modified Files:
src/sys/rump/librump/rumpkern: scheduler.c vm.c

Log Message:
If the pagedaemon cannot free any memory due to not being able to
lock any uvm objects, check if lockholders are currently on CPU
and yield to try very soon again instead of assuming deadlock.

This makes limited-memory kernels perform the same as memory-unlimited
kernels (provided there is a reasonable amount of memory available).
For example, for large file copy off of ffs where the image is
backed on host memory (i.e. no disk i/o, i.e. ideal conditions)
the figures are, per rump kernel memory limit:

3000kB: same
1000kB: 10% slower
500kB:  50% slower

(per pagedaemon code might still be able to use some tweak, though)


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/rump/librump/rumpkern/scheduler.c
cvs rdiff -u -r1.103 -r1.104 src/sys/rump/librump/rumpkern/vm.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/rump/librump/rumpkern/scheduler.c
diff -u src/sys/rump/librump/rumpkern/scheduler.c:1.22 src/sys/rump/librump/rumpkern/scheduler.c:1.23
--- src/sys/rump/librump/rumpkern/scheduler.c:1.22	Sun Nov 21 22:01:15 2010
+++ src/sys/rump/librump/rumpkern/scheduler.c	Wed Dec  1 20:29:56 2010
@@ -1,4 +1,4 @@
-/*  $NetBSD: scheduler.c,v 1.22 2010/11/21 22:01:15 pooka Exp $	*/
+/*  $NetBSD: scheduler.c,v 1.23 2010/12/01 20:29:56 pooka Exp $	*/
 
 /*
  * Copyright (c) 2010 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: scheduler.c,v 1.22 2010/11/21 22:01:15 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: scheduler.c,v 1.23 2010/12/01 20:29:56 pooka Exp $);
 
 #include sys/param.h
 #include sys/atomic.h
@@ -342,6 +342,8 @@
 	l-l_cpu = l-l_target_cpu = rcpu-rcpu_ci;
 	l-l_mutex = rcpu-rcpu_ci-ci_schedstate.spc_mutex;
 	l-l_ncsw++;
+
+	rcpu-rcpu_ci-ci_curlwp = l;
 }
 
 void
@@ -407,6 +409,7 @@
 	void *old;
 
 	ci = l-l_cpu;
+	ci-ci_curlwp = NULL;
 	l-l_cpu = NULL;
 	rcpu = rcpu_storage[ci-rump_cpus[0]];
 

Index: src/sys/rump/librump/rumpkern/vm.c
diff -u src/sys/rump/librump/rumpkern/vm.c:1.103 src/sys/rump/librump/rumpkern/vm.c:1.104
--- src/sys/rump/librump/rumpkern/vm.c:1.103	Wed Dec  1 11:19:18 2010
+++ src/sys/rump/librump/rumpkern/vm.c	Wed Dec  1 20:29:57 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm.c,v 1.103 2010/12/01 11:19:18 pooka Exp $	*/
+/*	$NetBSD: vm.c,v 1.104 2010/12/01 20:29:57 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007-2010 Antti Kantee.  All Rights Reserved.
@@ -41,7 +41,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vm.c,v 1.103 2010/12/01 11:19:18 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: vm.c,v 1.104 2010/12/01 20:29:57 pooka Exp $);
 
 #include sys/param.h
 #include sys/atomic.h
@@ -174,8 +174,9 @@
 	KASSERT(anon == NULL);
 
 	pg = pool_cache_get(pagecache, PR_NOWAIT);
-	if (__predict_false(pg == NULL))
+	if (__predict_false(pg == NULL)) {
 		return NULL;
+	}
 
 	pg-offset = off;
 	pg-uobject = uobj;
@@ -866,7 +867,7 @@
 }
 
 static bool
-processpage(struct vm_page *pg)
+processpage(struct vm_page *pg, bool *lockrunning)
 {
 	struct uvm_object *uobj;
 
@@ -882,6 +883,18 @@
 		} else {
 			mutex_exit(uobj-vmobjlock);
 		}
+	} else if (*lockrunning == false  ncpu  1) {
+		CPU_INFO_ITERATOR cii;
+		struct cpu_info *ci;
+		struct lwp *l;
+
+		l = mutex_owner(uobj-vmobjlock);
+		for (CPU_INFO_FOREACH(cii, ci)) {
+			if (ci-ci_curlwp == l) {
+*lockrunning = true;
+break;
+			}
+		}
 	}
 
 	return false;
@@ -899,6 +912,7 @@
 	int timo = 0;
 	int cleaned, skip, skipped;
 	bool succ = false;
+	bool lockrunning;
 
 	mutex_enter(pdaemonmtx);
 	for (;;) {
@@ -913,8 +927,10 @@
 		}
 		succ = false;
 
-		cv_timedwait(pdaemoncv, pdaemonmtx, timo);
-		uvmexp.pdwoke++;
+		if (pdaemon_waiters == 0) {
+			cv_timedwait(pdaemoncv, pdaemonmtx, timo);
+			uvmexp.pdwoke++;
+		}
 
 		/* tell the world that we are hungry */
 		kernel_map-flags |= VM_MAP_WANTVA;
@@ -943,6 +959,7 @@
 		 */
 		cleaned = 0;
 		skip = 0;
+		lockrunning = false;
  again:
 		mutex_enter(uvm_pageqlock);
 		while (cleaned  PAGEDAEMON_OBJCHUNK) {
@@ -958,7 +975,7 @@
 while (skipped++  skip)
 	continue;
 
-if (processpage(pg)) {
+if (processpage(pg, lockrunning)) {
 	cleaned++;
 	goto again;
 }
@@ -970,6 +987,28 @@
 		mutex_exit(uvm_pageqlock);
 
 		/*
+		 * Ok, someone is running with an object lock held.
+		 * We want to yield the host CPU to make sure the
+		 * thread is not parked on the host.  Since sched_yield()
+		 * doesn't appear to do anything on NetBSD, nanosleep
+		 * for the smallest possible time and hope we're back in
+		 * the game soon.
+		 */
+		if (cleaned == 0  lockrunning) {
+			uint64_t sec, nsec;
+
+			sec = 0;
+			nsec = 1;
+			rumpuser_nanosleep(sec, nsec, NULL);
+
+			lockrunning = false;
+			skip = 0;
+
+			/* and here 

CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib

2010-12-01 Thread Alistair G. Crooks
Module Name:src
Committed By:   agc
Date:   Wed Dec  1 22:01:41 UTC 2010

Modified Files:
src/crypto/external/bsd/netpgp/dist/src/lib: netpgp.c

Log Message:
When generating a key, set the new key's userid (last 16 bytes of
fingerprint) as an internal netpgp variable.

This can then be queried using netpgp_getvar(netpgp, userid) to find the
new key's id.


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 \
src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c

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

Modified files:

Index: src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.85 src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.86
--- src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.85	Mon Nov 29 04:20:12 2010
+++ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c	Wed Dec  1 22:01:41 2010
@@ -34,7 +34,7 @@
 
 #if defined(__NetBSD__)
 __COPYRIGHT(@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.);
-__RCSID($NetBSD: netpgp.c,v 1.85 2010/11/29 04:20:12 agc Exp $);
+__RCSID($NetBSD: netpgp.c,v 1.86 2010/12/01 22:01:41 agc Exp $);
 #endif
 
 #include sys/types.h
@@ -1156,6 +1156,7 @@
 	int 	 attempts;
 	int 	 passc;
 	int 	 fd;
+	int 	 cc;
 
 	uid = NULL;
 	io = netpgp-io;
@@ -1178,7 +1179,8 @@
 	pgp_sprint_keydata(netpgp-io, NULL, key, cp, signature , key-key.seckey.pubkey, 0);
 	(void) fprintf(stdout, %s, cp);
 	/* write public key */
-	(void) snprintf(dir, sizeof(dir), %s/%.16s, netpgp_getvar(netpgp, homedir), cp[ID_OFFSET]);
+	cc = snprintf(dir, sizeof(dir), %s/%.16s, netpgp_getvar(netpgp, homedir), cp[ID_OFFSET]);
+	netpgp_setvar(netpgp, userid, dir[cc - 16]);
 	if (mkdir(dir, 0700)  0) {
 		(void) fprintf(io-errs, can't mkdir '%s'\n, dir);
 		return 0;



CVS commit: src/etc/etc.macppc

2010-12-01 Thread David Brownlee
Module Name:src
Committed By:   abs
Date:   Wed Dec  1 22:06:19 UTC 2010

Modified Files:
src/etc/etc.macppc: MAKEDEV.conf

Log Message:
Add wd2 and wd3 to the default device set - noted by Donald Lee on port-macppc


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/etc/etc.macppc/MAKEDEV.conf

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

Modified files:

Index: src/etc/etc.macppc/MAKEDEV.conf
diff -u src/etc/etc.macppc/MAKEDEV.conf:1.8 src/etc/etc.macppc/MAKEDEV.conf:1.9
--- src/etc/etc.macppc/MAKEDEV.conf:1.8	Sat Sep 13 11:46:18 2008
+++ src/etc/etc.macppc/MAKEDEV.conf	Wed Dec  1 22:06:19 2010
@@ -1,7 +1,7 @@
-# $NetBSD: MAKEDEV.conf,v 1.8 2008/09/13 11:46:18 tsutsui Exp $
+# $NetBSD: MAKEDEV.conf,v 1.9 2010/12/01 22:06:19 abs Exp $
 
 all_md)
-	makedev wscons sd0 sd1 sd2 st0 st1 cd0 cd1 wd0 wd1
+	makedev wscons sd0 sd1 sd2 st0 st1 cd0 cd1 wd0 wd1 wd2 wd3
 	makedev ss0 ch0 uk0 uk1
 	makedev mlx0 ld0 ld1 ld2 ld3
 	makedev tty00 tty01 tty10
@@ -22,7 +22,7 @@
 
 floppy)
 	makedev std sd0 sd1 sd2 tty00 tty01 opty
-	makedev st0 st1 cd0 cd1 wd0 wd1 md0
+	makedev st0 st1 cd0 cd1 wd0 wd1 wd2 wd3 md0
 	makedev ttyE0 wsmouse0 wskbd0 ttyEcfg
 	makedev raid0 raid1 raid2 raid3 raid4 raid5 raid6 raid7
 	;;



CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib

2010-12-01 Thread Alistair G. Crooks
Module Name:src
Committed By:   agc
Date:   Wed Dec  1 22:14:52 UTC 2010

Modified Files:
src/crypto/external/bsd/netpgp/dist/src/lib: netpgp.c

Log Message:
avoid nameclash - call the generated user id variable generated userid

also keep the time of structure initialisation as an internal variable.


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 \
src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c

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

Modified files:

Index: src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.86 src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.87
--- src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.86	Wed Dec  1 22:01:41 2010
+++ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c	Wed Dec  1 22:14:52 2010
@@ -34,7 +34,7 @@
 
 #if defined(__NetBSD__)
 __COPYRIGHT(@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.);
-__RCSID($NetBSD: netpgp.c,v 1.86 2010/12/01 22:01:41 agc Exp $);
+__RCSID($NetBSD: netpgp.c,v 1.87 2010/12/01 22:14:52 agc Exp $);
 #endif
 
 #include sys/types.h
@@ -755,6 +755,7 @@
 netpgp_init(netpgp_t *netpgp)
 {
 	pgp_io_t	*io;
+	time_t		 t;
 	char		 id[MAX_ID_LENGTH];
 	char		*homedir;
 	char		*userid;
@@ -870,6 +871,8 @@
 			(void) netpgp_setvar(netpgp, userid, userid);
 		}
 	}
+	t = time(NULL);
+	netpgp_setvar(netpgp, initialised, ctime(t));
 	return 1;
 }
 
@@ -1180,7 +1183,7 @@
 	(void) fprintf(stdout, %s, cp);
 	/* write public key */
 	cc = snprintf(dir, sizeof(dir), %s/%.16s, netpgp_getvar(netpgp, homedir), cp[ID_OFFSET]);
-	netpgp_setvar(netpgp, userid, dir[cc - 16]);
+	netpgp_setvar(netpgp, generated userid, dir[cc - 16]);
 	if (mkdir(dir, 0700)  0) {
 		(void) fprintf(io-errs, can't mkdir '%s'\n, dir);
 		return 0;



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

2010-12-01 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Dec  2 02:58:29 UTC 2010

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

Log Message:
Add keymap for ukbd.any.powerbook to fix build breakage


To generate a diff of this commit:
cvs rdiff -u -r1.889 -r1.890 src/distrib/sets/lists/base/mi

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

Modified files:

Index: src/distrib/sets/lists/base/mi
diff -u src/distrib/sets/lists/base/mi:1.889 src/distrib/sets/lists/base/mi:1.890
--- src/distrib/sets/lists/base/mi:1.889	Sat Nov 27 12:11:54 2010
+++ src/distrib/sets/lists/base/mi	Thu Dec  2 02:58:28 2010
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.889 2010/11/27 12:11:54 roy Exp $
+# $NetBSD: mi,v 1.890 2010/12/02 02:58:28 pgoyette Exp $
 #
 # Note:	Don't delete entries from here - mark them as obsolete instead,
 #	unless otherwise stated below.
@@ -4105,6 +4105,7 @@
 ./usr/share/wscons/keymaps/pckbd.pl.iso8859-2	base-util-share		share
 ./usr/share/wscons/keymaps/pckbd.ru.koi8-r	base-util-share		share
 ./usr/share/wscons/keymaps/pckbd.sv.svascii	base-util-share		share
+./usr/share/wscons/keymaps/ukbd.any.powerbook	base-util-share		share
 ./usr/share/wscons/keymaps/ukbd.be.azerty	base-util-share		share
 ./usr/share/zoneinfobase-sys-share
 ./usr/share/zoneinfo/Africa			base-sys-share



CVS commit: src/lib/libedit

2010-12-01 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Thu Dec  2 04:35:17 UTC 2010

Modified Files:
src/lib/libedit: filecomplete.c

Log Message:
Fix up bodgy code for printing completion matches; it used to sometimes
skip entries, print (null), run off the end of the array, or occasionally
receive SIGSEGV, and now will, hopefully at least, do none of that.

Based in part on the patch in PR 44183 from Sergio Acereda; I also
did some tidyup and fixed it to print top-to-bottom first like ls(1).


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/lib/libedit/filecomplete.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/libedit/filecomplete.c
diff -u src/lib/libedit/filecomplete.c:1.20 src/lib/libedit/filecomplete.c:1.21
--- src/lib/libedit/filecomplete.c:1.20	Mon Nov 15 21:24:31 2010
+++ src/lib/libedit/filecomplete.c	Thu Dec  2 04:35:17 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: filecomplete.c,v 1.20 2010/11/15 21:24:31 christos Exp $	*/
+/*	$NetBSD: filecomplete.c,v 1.21 2010/12/02 04:35:17 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include config.h
 #if !defined(lint)  !defined(SCCSID)
-__RCSID($NetBSD: filecomplete.c,v 1.20 2010/11/15 21:24:31 christos Exp $);
+__RCSID($NetBSD: filecomplete.c,v 1.21 2010/12/02 04:35:17 dholland Exp $);
 #endif /* not lint  not SCCSID */
 
 #include sys/types.h
@@ -338,39 +338,45 @@
 
 /*
  * Display list of strings in columnar format on readline's output stream.
- * 'matches' is list of strings, 'len' is number of strings in 'matches',
- * 'max' is maximum length of string in 'matches'.
+ * 'matches' is list of strings, 'num' is number of strings in 'matches',
+ * 'width' is maximum length of string in 'matches'.
+ *
+ * matches[0] is not one of the match strings, so the strings are
+ * matches[1] *through* matches[num].
  */
 void
-fn_display_match_list (EditLine *el, char **matches, size_t len, size_t max)
+fn_display_match_list (EditLine *el, char **matches, size_t num, size_t width)
 {
-	size_t i, idx, limit, count;
+	size_t line, lines, col, cols, thisguy;
 	int screenwidth = el-el_term.t_size.h;
 
+	/* Ignore matches[0]. Avoid 1-based array logic below. */
+	matches++;
+
+	/*
+	 * Find out how many entries can be put on one line; count
+	 * with one space between strings the same way it's printed.
+	 */
+	cols = screenwidth / (width + 1);
+	if (cols == 0)
+		cols = 1;
+
+	/* how many lines of output, rounded up */
+	lines = (num + cols - 1) / cols;
+
+	/* Sort the items. */
+	qsort(matches, num, sizeof(char *), _fn_qsort_string_compare);
+
 	/*
-	 * Find out how many entries can be put on one line, count
-	 * with two spaces between strings.
+	 * On the ith line print elements i, i+lines, i+lines*2, etc.
 	 */
-	limit = screenwidth / (max + 2);
-	if (limit == 0)
-		limit = 1;
-
-	/* how many lines of output */
-	count = len / limit;
-	if (count * limit  len)
-		count++;
-
-	/* Sort the items if they are not already sorted. */
-	qsort(matches[1], (size_t)(len - 1), sizeof(char *),
-	_fn_qsort_string_compare);
-
-	idx = 1;
-	for(; count  0; count--) {
-		int more = limit  0  matches[0];
-		for(i = 0; more; i++, idx++) {
-			more = i  limit  matches[idx + 1];
-			(void)fprintf(el-el_outfile, %-*s%s, (int)max,
-			matches[idx], more ?   : );
+	for (line = 0; line  lines; line++) {
+		for (col = 0; col  cols; col++) {
+			thisguy = line + col * lines;
+			if (thisguy = num)
+break;
+			(void)fprintf(el-el_outfile, %s%-*s,
+			col == 0 ?  :  , (int)width, matches[thisguy]);
 		}
 		(void)fprintf(el-el_outfile, \n);
 	}
@@ -492,6 +498,7 @@
 if (match_len  maxlen)
 	maxlen = match_len;
 			}
+			/* matches[1] through matches[i-1] are available */
 			matches_num = i - 1;
 
 			/* newline to get on next line from command line */



CVS commit: src/lib/libedit

2010-12-01 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Thu Dec  2 04:42:46 UTC 2010

Modified Files:
src/lib/libedit: filecomplete.c

Log Message:
add const, from PR 44183.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/lib/libedit/filecomplete.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/libedit/filecomplete.c
diff -u src/lib/libedit/filecomplete.c:1.21 src/lib/libedit/filecomplete.c:1.22
--- src/lib/libedit/filecomplete.c:1.21	Thu Dec  2 04:35:17 2010
+++ src/lib/libedit/filecomplete.c	Thu Dec  2 04:42:46 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: filecomplete.c,v 1.21 2010/12/02 04:35:17 dholland Exp $	*/
+/*	$NetBSD: filecomplete.c,v 1.22 2010/12/02 04:42:46 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include config.h
 #if !defined(lint)  !defined(SCCSID)
-__RCSID($NetBSD: filecomplete.c,v 1.21 2010/12/02 04:35:17 dholland Exp $);
+__RCSID($NetBSD: filecomplete.c,v 1.22 2010/12/02 04:42:46 dholland Exp $);
 #endif /* not lint  not SCCSID */
 
 #include sys/types.h
@@ -59,7 +59,7 @@
 #include histedit.h
 #include filecomplete.h
 
-static Char break_chars[] = { ' ', '\t', '\n', '', '\\', '\'', '`', '@',
+static const Char break_chars[] = { ' ', '\t', '\n', '', '\\', '\'', '`', '@',
 '$', '', '', '=', ';', '|', '', '{', '(', '\0' };
 
 



CVS commit: src/sbin/cgdconfig

2010-12-01 Thread Roland Dowdeswell
Module Name:src
Committed By:   elric
Date:   Thu Dec  2 04:54:32 UTC 2010

Modified Files:
src/sbin/cgdconfig: cgdconfig.c

Log Message:
In -G, refuse to operate if KEYGEN_URANDOM is specified as we already do
for KEYGEN_RANDOMKEY.

Print a warning if such a refusal is made---this will help the user understand
why there is an error.

Patch provided by:  Taylor R Campbell campbell+net...@mumble.net.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sbin/cgdconfig/cgdconfig.c

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

Modified files:

Index: src/sbin/cgdconfig/cgdconfig.c
diff -u src/sbin/cgdconfig/cgdconfig.c:1.29 src/sbin/cgdconfig/cgdconfig.c:1.30
--- src/sbin/cgdconfig/cgdconfig.c:1.29	Sat Nov 27 17:08:36 2010
+++ src/sbin/cgdconfig/cgdconfig.c	Thu Dec  2 04:54:32 2010
@@ -1,4 +1,6 @@
-/* $NetBSD: cgdconfig.c,v 1.29 2010/11/27 17:08:36 elric Exp $ */
+#define opendisk1(x,y,z,t,u,v) opendisk(x,y,z,t,u)
+
+/* $NetBSD: cgdconfig.c,v 1.30 2010/12/02 04:54:32 elric Exp $ */
 
 /*-
  * Copyright (c) 2002, 2003 The NetBSD Foundation, Inc.
@@ -33,7 +35,7 @@
 #ifndef lint
 __COPYRIGHT(@(#) Copyright (c) 2002, 2003\
  The NetBSD Foundation, Inc.  All rights reserved.);
-__RCSID($NetBSD: cgdconfig.c,v 1.29 2010/11/27 17:08:36 elric Exp $);
+__RCSID($NetBSD: cgdconfig.c,v 1.30 2010/12/02 04:54:32 elric Exp $);
 #endif
 
 #include err.h
@@ -872,11 +874,17 @@
 
 	/* for sanity, we ensure that none of the keygens are randomkey */
 	for (kg=p-keygen; kg; kg=kg-next)
-		if (kg-kg_method == KEYGEN_RANDOMKEY)
+		if ((kg-kg_method == KEYGEN_RANDOMKEY) ||
+		(kg-kg_method == KEYGEN_URANDOMKEY)) {
+			warnx(can't preserve randomly generated key);
 			goto bail;
+		}
 	for (kg=oldp-keygen; kg; kg=kg-next)
-		if (kg-kg_method == KEYGEN_RANDOMKEY)
+		if ((kg-kg_method == KEYGEN_RANDOMKEY) ||
+		(kg-kg_method == KEYGEN_URANDOMKEY)) {
+			warnx(can't preserve randomly generated key);
 			goto bail;
+		}
 
 	if (!params_verify(oldp)) {
 		warnx(invalid old parameters file \%s\, *argv);