summaryrefslogtreecommitdiff
path: root/sys/miscfs/procfs
diff options
context:
space:
mode:
authorOwain Ainsworth <oga@cvs.openbsd.org>2009-08-10 14:55:12 +0000
committerOwain Ainsworth <oga@cvs.openbsd.org>2009-08-10 14:55:12 +0000
commit957854cccd8496e3db20cb6a1a631cc89a25ba3e (patch)
treefcb9657938d0c6606f0dd8e6500b6423fb422c78 /sys/miscfs/procfs
parentc18591804d872f983c8028c326acb6e428da9d4f (diff)
lockmgr -> rwlock
same diff as before, with the uninitalized variable fixed. ok toby@
Diffstat (limited to 'sys/miscfs/procfs')
-rw-r--r--sys/miscfs/procfs/procfs_subr.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/sys/miscfs/procfs/procfs_subr.c b/sys/miscfs/procfs/procfs_subr.c
index 9e3cec1802d..9bbe103393b 100644
--- a/sys/miscfs/procfs/procfs_subr.c
+++ b/sys/miscfs/procfs/procfs_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: procfs_subr.c,v 1.30 2009/04/22 18:57:56 deraadt Exp $ */
+/* $OpenBSD: procfs_subr.c,v 1.31 2009/08/10 14:55:11 oga Exp $ */
/* $NetBSD: procfs_subr.c,v 1.15 1996/02/12 15:01:42 christos Exp $ */
/*
@@ -43,19 +43,19 @@
#include <sys/proc.h>
#include <sys/vnode.h>
#include <sys/malloc.h>
+#include <sys/rwlock.h>
#include <sys/stat.h>
#include <sys/ptrace.h>
#include <miscfs/procfs/procfs.h>
static TAILQ_HEAD(, pfsnode) pfshead;
-struct lock pfs_vlock;
+struct rwlock pfs_vlock = RWLOCK_INITIALIZER("procfsl");
/*ARGSUSED*/
int
procfs_init(struct vfsconf *vfsp)
{
- lockinit(&pfs_vlock, PVFS, "procfsl", 0, 0);
TAILQ_INIT(&pfshead);
return (0);
}
@@ -92,14 +92,12 @@ procfs_allocvp(struct mount *mp, struct vnode **vpp, pid_t pid, pfstype pfs_type
struct proc *p = curproc;
struct pfsnode *pfs;
struct vnode *vp;
- int error;
+ int error = 0;
/*
* Lock the vp list, getnewvnode can sleep.
*/
- error = lockmgr(&pfs_vlock, LK_EXCLUSIVE, NULL);
- if (error)
- return (error);
+ rw_enter_write(&pfs_vlock);
loop:
TAILQ_FOREACH(pfs, &pfshead, list) {
vp = PFSTOV(pfs);
@@ -175,7 +173,7 @@ loop:
TAILQ_INSERT_TAIL(&pfshead, pfs, list);
uvm_vnp_setsize(vp, 0);
out:
- lockmgr(&pfs_vlock, LK_RELEASE, NULL);
+ rw_exit_write(&pfs_vlock);
return (error);
}