summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2007-05-01 12:59:20 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2007-05-01 12:59:20 +0000
commit1d776018d4ed649db1bb2816ee7bdb9908307474 (patch)
tree86a9b3b8a7f6e884ca748fba2d44b82458f9ed67
parent7555fddd8339c8692909819d3f4d73b45aa06715 (diff)
Notes
-rw-r--r--sys/fs/procfs/procfs_ioctl.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/fs/procfs/procfs_ioctl.c b/sys/fs/procfs/procfs_ioctl.c
index ec08da51110a..8f87eef127ef 100644
--- a/sys/fs/procfs/procfs_ioctl.c
+++ b/sys/fs/procfs/procfs_ioctl.c
@@ -70,7 +70,10 @@ procfs_ioctl(PFS_IOCTL_ARGS)
int ival;
#endif
- PROC_LOCK(p);
+ KASSERT(p != NULL,
+ ("%s() called without a process", __func__));
+ PROC_LOCK_ASSERT(p, MA_OWNED);
+
error = 0;
switch (cmd) {
#if defined(COMPAT_FREEBSD5) || defined(COMPAT_FREEBSD4) || defined(COMPAT_43)
@@ -124,8 +127,10 @@ procfs_ioctl(PFS_IOCTL_ARGS)
case PIOCWAIT:
while (p->p_step == 0 && (p->p_flag & P_WEXIT) == 0) {
/* sleep until p stops */
+ _PHOLD(p);
error = msleep(&p->p_stype, &p->p_mtx,
PWAIT|PCATCH, "pioctl", 0);
+ _PRELE(p);
if (error != 0)
break;
}
@@ -142,8 +147,10 @@ procfs_ioctl(PFS_IOCTL_ARGS)
case PIOCWAIT32:
while (p->p_step == 0 && (p->p_flag & P_WEXIT) == 0) {
/* sleep until p stops */
+ _PHOLD(p);
error = msleep(&p->p_stype, &p->p_mtx,
PWAIT|PCATCH, "pioctl", 0);
+ _PRELE(p);
if (error != 0)
break;
}
@@ -193,7 +200,6 @@ procfs_ioctl(PFS_IOCTL_ARGS)
default:
error = (ENOTTY);
}
- PROC_UNLOCK(p);
return (error);
}