CVS commit: src/external/gpl2/lvm2

2012-05-02 Thread Aleksey Cheusov
Module Name:src
Committed By:   cheusov
Date:   Wed May  2 13:35:04 UTC 2012

Modified Files:
src/external/gpl2/lvm2/lib/liblvm: Makefile
src/external/gpl2/lvm2/sbin/lvm: Makefile

Log Message:
Add .include  for initializing USE_SSP.
   This fixes build failure if USE_FORT=YES
   Approved by christos@


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/gpl2/lvm2/lib/liblvm/Makefile
cvs rdiff -u -r1.10 -r1.11 src/external/gpl2/lvm2/sbin/lvm/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/gpl2/lvm2/lib/liblvm/Makefile
diff -u src/external/gpl2/lvm2/lib/liblvm/Makefile:1.5 src/external/gpl2/lvm2/lib/liblvm/Makefile:1.6
--- src/external/gpl2/lvm2/lib/liblvm/Makefile:1.5	Thu May 26 12:56:26 2011
+++ src/external/gpl2/lvm2/lib/liblvm/Makefile	Wed May  2 13:35:03 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.5 2011/05/26 12:56:26 joerg Exp $
+#	$NetBSD: Makefile,v 1.6 2012/05/02 13:35:03 cheusov Exp $
 
 LIBISPRIVATE=	yes
 
@@ -14,6 +14,9 @@ CWARNFLAGS+=	-Wno-parentheses
 CPPFLAGS+=	-I${LVM2_DISTDIR}/lib -I${LVM2_DISTDIR}/include \
 		-I. 
 
+.include 
+.include  # for USE_SSP
+
 # Some parts of liblvm can't be protected because if its
 # alloca() usage.
 #

Index: src/external/gpl2/lvm2/sbin/lvm/Makefile
diff -u src/external/gpl2/lvm2/sbin/lvm/Makefile:1.10 src/external/gpl2/lvm2/sbin/lvm/Makefile:1.11
--- src/external/gpl2/lvm2/sbin/lvm/Makefile:1.10	Thu May 26 12:56:26 2011
+++ src/external/gpl2/lvm2/sbin/lvm/Makefile	Wed May  2 13:35:04 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.10 2011/05/26 12:56:26 joerg Exp $
+#	$NetBSD: Makefile,v 1.11 2012/05/02 13:35:04 cheusov Exp $
 
 USE_FORT?=	no
 NOLINT=		#defined
@@ -30,6 +30,9 @@ CPPFLAGS+=	-I${LVM2_DISTDIR}/lib -I${LVM
 
 CPPFLAGS+=	-DLVM_SHARED_PATH=\"$(BINDIR)/lvm\"
 
+.include 
+.include  # for USE_SSP
+
 # Some parts of the code can't be protected because if its
 # alloca() usage.
 #



CVS commit: src/lib/libc/gen

2012-05-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed May  2 14:36:07 UTC 2012

Modified Files:
src/lib/libc/gen: getpass.c

Log Message:
test for both NUL and _POSIX_VDISABLE, because _POSIX_VDISABLE propagation
between different daemons and OS's does not seem reliable.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/lib/libc/gen/getpass.c

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

Modified files:

Index: src/lib/libc/gen/getpass.c
diff -u src/lib/libc/gen/getpass.c:1.25 src/lib/libc/gen/getpass.c:1.26
--- src/lib/libc/gen/getpass.c:1.25	Fri Apr 13 21:33:43 2012
+++ src/lib/libc/gen/getpass.c	Wed May  2 10:36:07 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: getpass.c,v 1.25 2012/04/14 01:33:43 christos Exp $	*/
+/*	$NetBSD: getpass.c,v 1.26 2012/05/02 14:36:07 christos Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: getpass.c,v 1.25 2012/04/14 01:33:43 christos Exp $");
+__RCSID("$NetBSD: getpass.c,v 1.26 2012/05/02 14:36:07 christos Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -172,8 +172,14 @@ getpassfd(const char *prompt, char *buf,
 			(void)write(fd[2], "\a", 1); \
 	while (/*CONSTCOND*/ 0)
 #define erase() (void)write(fd[1], "\b \b", 3)
-#define C(a, b) (gt.c_cc[(a)] == _POSIX_VDISABLE ? (b) : gt.c_cc[(a)])
-
+/*
+ * We test for both _POSIX_VDISABLE and NUL here because _POSIX_VDISABLE
+ * propagation does not seem to be very consistent on multiple daemon hops
+ * between different OS's. Perhaps we should not even bother with
+ * _POSIX_VDISABLE and use ~0 and 0 directly.
+ */
+#define C(a, b) ((gt.c_cc[(a)] == _POSIX_VDISABLE || gt.c_cc[(a)] == '\0') ? \
+(b) : gt.c_cc[(a)])
 		if (lnext) {
 			lnext = false;
 			goto add;



CVS commit: src/sys/dev/sun

2012-05-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed May  2 14:54:26 UTC 2012

Modified Files:
src/sys/dev/sun: kbd.c

Log Message:
make this compile again.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/dev/sun/kbd.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/sun/kbd.c
diff -u src/sys/dev/sun/kbd.c:1.65 src/sys/dev/sun/kbd.c:1.66
--- src/sys/dev/sun/kbd.c:1.65	Fri Apr 27 05:30:13 2012
+++ src/sys/dev/sun/kbd.c	Wed May  2 10:54:26 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: kbd.c,v 1.65 2012/04/27 09:30:13 martin Exp $	*/
+/*	$NetBSD: kbd.c,v 1.66 2012/05/02 14:54:26 christos Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -47,7 +47,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kbd.c,v 1.65 2012/04/27 09:30:13 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kbd.c,v 1.66 2012/05/02 14:54:26 christos Exp $");
 
 #include 
 #include 
@@ -154,10 +154,6 @@ static void	kbd_input_wskbd(struct kbd_s
 /* firm events input */
 static void	kbd_input_event(struct kbd_softc *, int);
 
-#if NSYSMON_ENVSYS
-static void	kbd_powerbutton(void *);
-#endif
-
 /
  *  Entry points for /dev/kbd
  *  (open,close,read,write,...)
@@ -901,6 +897,17 @@ kbd_bell(int on)
 }
 
 #if NWSKBD > 0
+
+#if NSYSMON_ENVSYS
+static void
+kbd_powerbutton(void *cookie)
+{
+	struct kbd_softc *k = cookie;
+
+	sysmon_pswitch_event(&k->k_sm_pbutton, k->k_ev);
+}
+#endif
+
 static void
 kbd_input_wskbd(struct kbd_softc *k, int code)
 {
@@ -935,7 +942,8 @@ kbd_input_wskbd(struct kbd_softc *k, int
 	k->k_ev = KEY_UP(code) ?
 	PSWITCH_EVENT_RELEASED :
 	PSWITCH_EVENT_PRESSED;
-	sysmon_task_queue_sched(0, kbd_powerbutton, k);
+	sysmon_task_queue_sched(0,
+	kbd_powerbutton, k);
 #endif
 return;
 		}
@@ -1091,15 +1099,4 @@ kbd_wskbd_attach(struct kbd_softc *k, in
 	}
 	config_interrupts(k->k_dev, kbd_enable);
 }
-
-#if NSYSMON_ENVSYS
-static void
-kbd_powerbutton(void *cookie)
-{
-	struct kbd_softc *k = cookie;
-
-	sysmon_pswitch_event(&k->k_sm_pbutton, k->k_ev);
-}
-#endif
-
 #endif



CVS commit: src/sbin/gpt

2012-05-02 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed May  2 15:42:58 UTC 2012

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

Log Message:
Bump date to date of previous change.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sbin/gpt/gpt.8

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

Modified files:

Index: src/sbin/gpt/gpt.8
diff -u src/sbin/gpt/gpt.8:1.10 src/sbin/gpt/gpt.8:1.11
--- src/sbin/gpt/gpt.8:1.10	Fri Mar  9 12:30:28 2012
+++ src/sbin/gpt/gpt.8	Wed May  2 15:42:58 2012
@@ -1,4 +1,4 @@
-.\" $NetBSD: gpt.8,v 1.10 2012/03/09 12:30:28 drochner Exp $
+.\" $NetBSD: gpt.8,v 1.11 2012/05/02 15:42:58 jakllsch Exp $
 .\"
 .\" Copyright (c) 2002 Marcel Moolenaar
 .\" All rights reserved.
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD: src/sbin/gpt/gpt.8,v 1.17 2006/06/22 22:22:32 marcel Exp $
 .\"
-.Dd November 11, 2011
+.Dd March 9, 2012
 .Dt GPT 8
 .Os
 .Sh NAME



CVS commit: src

2012-05-02 Thread Tracy Di Marco White
Module Name:src
Committed By:   gendalia
Date:   Wed May  2 15:57:15 UTC 2012

Modified Files:
src/etc/rc.d: staticroute
src/share/man/man5: route.conf.5

Log Message:
Add the ability for staticroute to evaluate lines from /etc/route.conf
as shell script fragments, add example to the route.conf man page of
evaluating variables.

Remove route.conf man page statement that staticroute is enabled in
rc.conf since that's incorrect.

Wrap the staticroute while in parens, per  & , and
quote all the arguments for the evals.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/etc/rc.d/staticroute
cvs rdiff -u -r1.3 -r1.4 src/share/man/man5/route.conf.5

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

Modified files:

Index: src/etc/rc.d/staticroute
diff -u src/etc/rc.d/staticroute:1.5 src/etc/rc.d/staticroute:1.6
--- src/etc/rc.d/staticroute:1.5	Wed Oct  7 08:06:11 2009
+++ src/etc/rc.d/staticroute	Wed May  2 15:57:15 2012
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: staticroute,v 1.5 2009/10/07 08:06:11 tron Exp $
+# $NetBSD: staticroute,v 1.6 2012/05/02 15:57:15 gendalia Exp $
 #
 
 # PROVIDE: staticroute
@@ -20,26 +20,29 @@ staticroute_doit() {
 
 	if [ -s /etc/route.conf ]; then
 		echo "$1 static routes."
-		while read args; do
+		( while read args; do
 			[ -z "$args" ] && continue
 			case "$args" in
 			"#"*)
 ;;
 			"+"*)
 if [ $2 = "add" ]; then
-	eval ${args#*+} || retval=1
+	eval "${args#*+}" || retval=1
 fi
 ;;
 			"-"*)
 if [ $2 = "delete" ]; then
-	eval ${args#*-} || retval=1
+	eval "${args#*-}" || retval=1
 fi
 ;;
+			"!"*)
+eval "${args#*!}" || retval=1
+;;
 			*)
-route -q $2 -$args || retval=1
+eval "route -q $2 -$args" || retval=1
 ;;
 			esac
-		done < /etc/route.conf
+		done < /etc/route.conf )
 	fi
 
 	return $retval

Index: src/share/man/man5/route.conf.5
diff -u src/share/man/man5/route.conf.5:1.3 src/share/man/man5/route.conf.5:1.4
--- src/share/man/man5/route.conf.5:1.3	Thu May  8 15:34:39 2008
+++ src/share/man/man5/route.conf.5	Wed May  2 15:57:15 2012
@@ -1,4 +1,4 @@
-.\"$NetBSD: route.conf.5,v 1.3 2008/05/08 15:34:39 wiz Exp $
+.\"$NetBSD: route.conf.5,v 1.4 2012/05/02 15:57:15 gendalia Exp $
 .\"
 .\" Copyright (c) 2004 Thomas Klausner
 .\" All rights reserved.
@@ -23,7 +23,7 @@
 .\" 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 June 24, 2004
+.Dd May 1, 2012
 .Dt ROUTE.CONF 5
 .Os
 .Sh NAME
@@ -46,6 +46,9 @@ are run during start-up,
 while lines starting with a minus sign
 .Pq Sq \-
 are run during system shutdown.
+If a line starts with a
+.Sq \&! ,
+the rest of the line will get evaluated as a shell script fragment.
 All other lines are passed to
 .Xr route 8 .
 During start-up, they are passed behind a
@@ -66,10 +69,17 @@ script that parses
 .Nm .
 .El
 .Sh EXAMPLES
-In this example, if the
-.Pa staticroute
-script is enabled in
-.Xr rc.conf 5 ,
+In this example, the interface for the desired routing changes is set,
+the IP address on that interface is determined, and a route is added
+during startup, or deleted during system shutdown.
+.Bd -literal -offset indent 
+# Set interface and determine current IP address for added route.
+!ifname=bnx0
+!ipaddr=$(/sbin/ifconfig ${ifname} | awk '$1 == "inet" {print $2}')
+net 10.10.1 -interface ${ipaddr}
+.Ed
+.Pp
+In this example,
 IP forwarding is turned on during
 start-up, and a static route added for 192.168.2.0.
 During system shutdown, the route is removed



CVS commit: src/sys/coda

2012-05-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed May  2 16:51:02 UTC 2012

Modified Files:
src/sys/coda: coda_vnops.c

Log Message:
Instead of sharing the coda vnode lock with the ffs vnode lock, share the
ffs vnode lock with coda.


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/sys/coda/coda_vnops.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/coda/coda_vnops.c
diff -u src/sys/coda/coda_vnops.c:1.84 src/sys/coda/coda_vnops.c:1.85
--- src/sys/coda/coda_vnops.c:1.84	Sat Apr 28 16:15:07 2012
+++ src/sys/coda/coda_vnops.c	Wed May  2 12:51:01 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_vnops.c,v 1.84 2012/04/28 20:15:07 christos Exp $	*/
+/*	$NetBSD: coda_vnops.c,v 1.85 2012/05/02 16:51:01 christos Exp $	*/
 
 /*
  *
@@ -46,7 +46,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: coda_vnops.c,v 1.84 2012/04/28 20:15:07 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coda_vnops.c,v 1.85 2012/05/02 16:51:01 christos Exp $");
 
 #include 
 #include 
@@ -1808,10 +1808,9 @@ coda_grab_vnode(vnode_t *uvp, dev_t dev,
 	(unsigned long long)dev, (unsigned long long)ino, *vpp, error));
 	return(ENOENT);
 }
-/* share the lock with the underlying vnode */
-mutex_obj_hold(uvp->v_interlock);
-uvm_obj_setlock(&(*vpp)->v_uobj, uvp->v_interlock);
-
+/* share the underlying vnode lock with the coda vnode */
+mutex_obj_hold((*vpp)->v_interlock);
+uvm_obj_setlock(&uvp->v_uobj, (*vpp)->v_interlock);
 return(0);
 }
 



CVS commit: src/sys/kern

2012-05-02 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Wed May  2 20:48:29 UTC 2012

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

Log Message:
do_open: move pathbuf destruction to the callers, thus simplify and fix a
memory leak on error path.


To generate a diff of this commit:
cvs rdiff -u -r1.454 -r1.455 src/sys/kern/vfs_syscalls.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/vfs_syscalls.c
diff -u src/sys/kern/vfs_syscalls.c:1.454 src/sys/kern/vfs_syscalls.c:1.455
--- src/sys/kern/vfs_syscalls.c:1.454	Mon Apr 30 10:05:12 2012
+++ src/sys/kern/vfs_syscalls.c	Wed May  2 20:48:29 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls.c,v 1.454 2012/04/30 10:05:12 manu Exp $	*/
+/*	$NetBSD: vfs_syscalls.c,v 1.455 2012/05/02 20:48:29 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.454 2012/04/30 10:05:12 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.455 2012/05/02 20:48:29 rmind Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_fileassoc.h"
@@ -1496,9 +1496,9 @@ do_open(lwp_t *l, struct pathbuf *pb, in
 		return EINVAL;
 
 	if ((error = fd_allocfile(&fp, &indx)) != 0) {
-		pathbuf_destroy(pb);
 		return error;
 	}
+
 	/* We're going to read cwdi->cwdi_cmask unlocked here. */
 	cmode = ((open_mode &~ cwdi->cwdi_cmask) & ALLPERMS) &~ S_ISTXT;
 	NDINIT(&nd, LOOKUP, FOLLOW | TRYEMULROOT, pb);
@@ -1510,18 +1510,15 @@ do_open(lwp_t *l, struct pathbuf *pb, in
 		(error =
 			fd_dupopen(l->l_dupfd, &indx, flags, error)) == 0) {
 			*fd = indx;
-			pathbuf_destroy(pb);
-			return (0);
+			return 0;
 		}
 		if (error == ERESTART)
 			error = EINTR;
-		pathbuf_destroy(pb);
 		return error;
 	}
 
 	l->l_dupfd = 0;
 	vp = nd.ni_vp;
-	pathbuf_destroy(pb);
 
 	if ((error = open_setfp(l, fp, vp, indx, flags)))
 		return error;
@@ -1536,7 +1533,7 @@ int
 fd_open(const char *path, int open_flags, int open_mode, int *fd)
 {
 	struct pathbuf *pb;
-	int oflags;
+	int error, oflags;
 
 	oflags = FFLAGS(open_flags);
 	if ((oflags & (FREAD | FWRITE)) == 0)
@@ -1546,7 +1543,10 @@ fd_open(const char *path, int open_flags
 	if (pb == NULL)
 		return ENOMEM;
 
-	return do_open(curlwp, pb, open_flags, open_mode, fd);
+	error = do_open(curlwp, pb, open_flags, open_mode, fd);
+	pathbuf_destroy(pb);
+
+	return error;
 }
 
 /*
@@ -1566,18 +1566,17 @@ sys_open(struct lwp *l, const struct sys
 
 	flags = FFLAGS(SCARG(uap, flags));
 	if ((flags & (FREAD | FWRITE)) == 0)
-		return (EINVAL);
+		return EINVAL;
 
 	error = pathbuf_copyin(SCARG(uap, path), &pb);
 	if (error)
 		return error;
 
 	error = do_open(l, pb, SCARG(uap, flags), SCARG(uap, mode), &result);
-	if (error)
-		return error;
+	pathbuf_destroy(pb);
 
 	*retval = result;
-	return 0;
+	return error;
 }
 
 int



CVS commit: src/share/man/man5

2012-05-02 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed May  2 22:38:31 UTC 2012

Modified Files:
src/share/man/man5: route.conf.5

Log Message:
Remove trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/share/man/man5/route.conf.5

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/man5/route.conf.5
diff -u src/share/man/man5/route.conf.5:1.4 src/share/man/man5/route.conf.5:1.5
--- src/share/man/man5/route.conf.5:1.4	Wed May  2 15:57:15 2012
+++ src/share/man/man5/route.conf.5	Wed May  2 22:38:31 2012
@@ -1,4 +1,4 @@
-.\"$NetBSD: route.conf.5,v 1.4 2012/05/02 15:57:15 gendalia Exp $
+.\"$NetBSD: route.conf.5,v 1.5 2012/05/02 22:38:31 wiz Exp $
 .\"
 .\" Copyright (c) 2004 Thomas Klausner
 .\" All rights reserved.
@@ -72,7 +72,7 @@ script that parses
 In this example, the interface for the desired routing changes is set,
 the IP address on that interface is determined, and a route is added
 during startup, or deleted during system shutdown.
-.Bd -literal -offset indent 
+.Bd -literal -offset indent
 # Set interface and determine current IP address for added route.
 !ifname=bnx0
 !ipaddr=$(/sbin/ifconfig ${ifname} | awk '$1 == "inet" {print $2}')



CVS commit: src/sys

2012-05-02 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Wed May  2 23:33:11 UTC 2012

Modified Files:
src/sys/compat/netbsd32: netbsd32_execve.c
src/sys/kern: kern_exec.c
src/sys/sys: exec.h

Log Message:
Revert posix_spawn() clean up for now, there are some bugs.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/compat/netbsd32/netbsd32_execve.c
cvs rdiff -u -r1.351 -r1.352 src/sys/kern/kern_exec.c
cvs rdiff -u -r1.136 -r1.137 src/sys/sys/exec.h

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

Modified files:

Index: src/sys/compat/netbsd32/netbsd32_execve.c
diff -u src/sys/compat/netbsd32/netbsd32_execve.c:1.35 src/sys/compat/netbsd32/netbsd32_execve.c:1.36
--- src/sys/compat/netbsd32/netbsd32_execve.c:1.35	Mon Apr 30 21:19:58 2012
+++ src/sys/compat/netbsd32/netbsd32_execve.c	Wed May  2 23:33:11 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_execve.c,v 1.35 2012/04/30 21:19:58 rmind Exp $	*/
+/*	$NetBSD: netbsd32_execve.c,v 1.36 2012/05/02 23:33:11 rmind Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_execve.c,v 1.35 2012/04/30 21:19:58 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_execve.c,v 1.36 2012/05/02 23:33:11 rmind Exp $");
 
 #include 
 #include 
@@ -178,6 +178,7 @@ netbsd32_posix_spawn(struct lwp *l,
 	struct posix_spawn_file_actions *fa = NULL;
 	struct posix_spawnattr *sa = NULL;
 	pid_t pid;
+	bool child_ok = false;
 
 	error = check_posix_spawn(l);
 	if (error) {
@@ -190,7 +191,7 @@ netbsd32_posix_spawn(struct lwp *l,
 		error = netbsd32_posix_spawn_fa_alloc(&fa,
 		SCARG_P32(uap, file_actions));
 		if (error)
-			goto fail;
+			goto error_exit;
 	}
 
 	/* copyin posix_spawnattr struct */
@@ -198,17 +199,17 @@ netbsd32_posix_spawn(struct lwp *l,
 		sa = kmem_alloc(sizeof(*sa), KM_SLEEP);
 		error = copyin(SCARG_P32(uap, attrp), sa, sizeof(*sa));
 		if (error)
-			goto fail;
+			goto error_exit;
 	}
 
 	/*
 	 * Do the spawn
 	 */
-	error = do_posix_spawn(l, &pid, SCARG_P32(uap, path), fa,
+	error = do_posix_spawn(l, &pid, &child_ok, SCARG_P32(uap, path), fa,
 	sa, SCARG_P32(uap, argv), SCARG_P32(uap, envp),
 	netbsd32_execve_fetch_element);
 	if (error)
-		goto fail;
+		goto error_exit;
 
 	if (error == 0 && SCARG_P32(uap, pid) != NULL)
 		error = copyout(&pid, SCARG_P32(uap, pid), sizeof(pid));
@@ -216,14 +217,17 @@ netbsd32_posix_spawn(struct lwp *l,
 	*retval = error;
 	return 0;
 
-fail:
-	(void)chgproccnt(kauth_cred_getuid(l->l_cred), -1);
-	atomic_dec_uint(&nprocs);
-
-	if (sa)
-		kmem_free(sa, sizeof(*sa));
-	if (fa)
-		posix_spawn_fa_free(fa, fa->len);
+ error_exit:
+ 	if (!child_ok) {
+		(void)chgproccnt(kauth_cred_getuid(l->l_cred), -1);
+		atomic_dec_uint(&nprocs);
+
+		if (sa)
+			kmem_free(sa, sizeof(*sa));
+		if (fa)
+			posix_spawn_fa_free(fa, fa->len);
+	}
+
 	*retval = error;
 	return 0;
 }

Index: src/sys/kern/kern_exec.c
diff -u src/sys/kern/kern_exec.c:1.351 src/sys/kern/kern_exec.c:1.352
--- src/sys/kern/kern_exec.c:1.351	Mon Apr 30 21:19:58 2012
+++ src/sys/kern/kern_exec.c	Wed May  2 23:33:11 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_exec.c,v 1.351 2012/04/30 21:19:58 rmind Exp $	*/
+/*	$NetBSD: kern_exec.c,v 1.352 2012/05/02 23:33:11 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.351 2012/04/30 21:19:58 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.352 2012/05/02 23:33:11 rmind Exp $");
 
 #include "opt_exec.h"
 #include "opt_ktrace.h"
@@ -211,8 +211,9 @@ struct emul emul_netbsd = {
  * Exec lock. Used to control access to execsw[] structures.
  * This must not be static so that netbsd32 can access it, too.
  */
-krwlock_t		exec_lock	__cacheline_aligned;
-static kmutex_t		sigobject_lock	__cacheline_aligned;
+krwlock_t exec_lock;
+
+static kmutex_t sigobject_lock;
 
 /*
  * Data used between a loadvm and execve part of an "exec" operation
@@ -295,6 +296,7 @@ static struct pool_allocator exec_palloc
  *			exec header unmodified.
  */
 int
+/*ARGSUSED*/
 check_exec(struct lwp *l, struct exec_package *epp, struct pathbuf *pb)
 {
 	int		error, i;
@@ -500,7 +502,7 @@ sys_execve(struct lwp *l, const struct s
 	SCARG(uap, envp), execve_fetch_element);
 }
 
-int
+int   
 sys_fexecve(struct lwp *l, const struct sys_fexecve_args *uap,
 register_t *retval)
 {
@@ -562,43 +564,6 @@ exec_autoload(void)
 #endif
 }
 
-static void
-execve_free_vmspace(struct execve_data *ed)
-{
-
-	/*
-	 * Free the vmspace-creation commands and release their references.
-	 */
-	kill_vmcmds(&ed->ed_pack.ep_vmcmds);
-
-	/* Kill any opened file descriptor, if necessary. */
-	if (ed->ed_pack.ep_flags & EXEC_HASFD) {
-		ed->ed_pack.ep_flags &= ~EXEC_HASFD;
-		fd_close(ed->ed_pack.ep_fd);
-	}
-
-	/* Close and put the executed file. */
-	vn_lock(ed->ed_pack.ep_vp, LK_EXCLUSIVE