Avoid double init of tty_lock if rumpkern_tty is included. LOCKDEBUG

does not tolerate double inits.

pointed out by njoly
This commit is contained in:
pooka 2011-01-07 15:10:22 +00:00
parent a3eac7b0e8
commit 3a382dc397
3 changed files with 17 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: component.c,v 1.1 2010/06/14 14:45:47 pooka Exp $ */
/* $NetBSD: component.c,v 1.2 2011/01/07 15:10:22 pooka Exp $ */
/*
* Copyright (c) 2010 Antti Kantee. All Rights Reserved.
@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: component.c,v 1.1 2010/06/14 14:45:47 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: component.c,v 1.2 2011/01/07 15:10:22 pooka Exp $");
#include <sys/param.h>
#include <sys/conf.h>
@ -68,4 +68,6 @@ RUMP_COMPONENT(RUMP_COMPONENT_KERN_VFS)
ttyldisc_init();
ptyattach(1);
rump_ttycomponent = true;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: rump.c,v 1.217 2011/01/06 13:09:17 pooka Exp $ */
/* $NetBSD: rump.c,v 1.218 2011/01/07 15:10:22 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.217 2011/01/06 13:09:17 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.218 2011/01/07 15:10:22 pooka Exp $");
#include <sys/systm.h>
#define ELFSIZE ARCH_ELFSIZE
@ -109,6 +109,7 @@ const int rump_lockdebug = 1;
#else
const int rump_lockdebug = 0;
#endif
bool rump_ttycomponent = false;
static void
rump_aiodone_worker(struct work *wk, void *dummy)
@ -307,7 +308,6 @@ rump__init(int rump_version)
l->l_fd = &filedesc0;
rumpuser_set_curlwp(l);
mutex_init(&tty_lock, MUTEX_DEFAULT, IPL_NONE);
rumpuser_mutex_init(&rump_giantlock);
ksyms_init();
uvm_init();
@ -411,6 +411,13 @@ rump__init(int rump_version)
rump_component_init(RUMP_COMPONENT_KERN_VFS);
/*
* if we initialized the tty component above, the tyttymtx is
* now initialized. otherwise, we need to initialize it.
*/
if (!rump_ttycomponent)
mutex_init(&tty_lock, MUTEX_DEFAULT, IPL_VM);
cold = 0;
/* aieeeedondest */

View File

@ -1,4 +1,4 @@
/* $NetBSD: rump_private.h,v 1.65 2010/12/01 14:59:38 pooka Exp $ */
/* $NetBSD: rump_private.h,v 1.66 2011/01/07 15:10:22 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@ -94,6 +94,8 @@ extern rump_proc_vfs_release_fn rump_proc_vfs_release;
extern struct cpu_info *rump_cpu;
extern bool rump_ttycomponent;
struct lwp * rump__lwproc_alloclwp(struct proc *);
void rump_cpus_bootstrap(int *);