summaryrefslogtreecommitdiffstats
path: root/sys/dev/filemon/filemon_wrapper.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/filemon/filemon_wrapper.c')
-rw-r--r--sys/dev/filemon/filemon_wrapper.c44
1 files changed, 16 insertions, 28 deletions
diff --git a/sys/dev/filemon/filemon_wrapper.c b/sys/dev/filemon/filemon_wrapper.c
index 40e09e3..28d34a9 100644
--- a/sys/dev/filemon/filemon_wrapper.c
+++ b/sys/dev/filemon/filemon_wrapper.c
@@ -80,7 +80,8 @@ filemon_output(struct filemon *filemon, char *msg, size_t len)
auio.uio_td = curthread;
auio.uio_offset = (off_t) -1;
- bwillwrite();
+ if (filemon->fp->f_type == DTYPE_VNODE)
+ bwillwrite();
fo_write(filemon->fp, &auio, curthread->td_ucred, 0, curthread);
}
@@ -100,7 +101,7 @@ filemon_pid_check(struct proc *p)
TAILQ_FOREACH(filemon, &filemons_inuse, link) {
if (p == filemon->p) {
sx_sunlock(&proctree_lock);
- filemon_filemon_lock(filemon);
+ sx_xlock(&filemon->lock);
filemon_unlock_read();
return (filemon);
}
@@ -131,8 +132,7 @@ filemon_wrapper_chdir(struct thread *td, struct chdir_args *uap)
filemon_output(filemon, filemon->msgbufr, len);
- /* Unlock the found filemon structure. */
- filemon_filemon_unlock(filemon);
+ sx_xunlock(&filemon->lock);
}
}
@@ -160,8 +160,7 @@ filemon_event_process_exec(void *arg __unused, struct proc *p,
filemon_output(filemon, filemon->msgbufr, len);
- /* Unlock the found filemon structure. */
- filemon_filemon_unlock(filemon);
+ sx_xunlock(&filemon->lock);
free(freepath, M_TEMP);
}
@@ -199,8 +198,7 @@ filemon_wrapper_open(struct thread *td, struct open_args *uap)
curproc->p_pid, filemon->fname1);
filemon_output(filemon, filemon->msgbufr, len);
- /* Unlock the found filemon structure. */
- filemon_filemon_unlock(filemon);
+ sx_xunlock(&filemon->lock);
}
}
@@ -252,8 +250,7 @@ filemon_wrapper_openat(struct thread *td, struct openat_args *uap)
curproc->p_pid, filemon->fname2, filemon->fname1);
filemon_output(filemon, filemon->msgbufr, len);
- /* Unlock the found filemon structure. */
- filemon_filemon_unlock(filemon);
+ sx_xunlock(&filemon->lock);
}
}
@@ -281,8 +278,7 @@ filemon_wrapper_rename(struct thread *td, struct rename_args *uap)
filemon_output(filemon, filemon->msgbufr, len);
- /* Unlock the found filemon structure. */
- filemon_filemon_unlock(filemon);
+ sx_xunlock(&filemon->lock);
}
}
@@ -310,8 +306,7 @@ filemon_wrapper_link(struct thread *td, struct link_args *uap)
filemon_output(filemon, filemon->msgbufr, len);
- /* Unlock the found filemon structure. */
- filemon_filemon_unlock(filemon);
+ sx_xunlock(&filemon->lock);
}
}
@@ -339,8 +334,7 @@ filemon_wrapper_symlink(struct thread *td, struct symlink_args *uap)
filemon_output(filemon, filemon->msgbufr, len);
- /* Unlock the found filemon structure. */
- filemon_filemon_unlock(filemon);
+ sx_xunlock(&filemon->lock);
}
}
@@ -369,8 +363,7 @@ filemon_wrapper_linkat(struct thread *td, struct linkat_args *uap)
filemon_output(filemon, filemon->msgbufr, len);
- /* Unlock the found filemon structure. */
- filemon_filemon_unlock(filemon);
+ sx_xunlock(&filemon->lock);
}
}
@@ -397,8 +390,7 @@ filemon_wrapper_stat(struct thread *td, struct stat_args *uap)
filemon_output(filemon, filemon->msgbufr, len);
- /* Unlock the found filemon structure. */
- filemon_filemon_unlock(filemon);
+ sx_xunlock(&filemon->lock);
}
}
@@ -426,8 +418,7 @@ filemon_wrapper_freebsd32_stat(struct thread *td,
filemon_output(filemon, filemon->msgbufr, len);
- /* Unlock the found filemon structure. */
- filemon_filemon_unlock(filemon);
+ sx_xunlock(&filemon->lock);
}
}
@@ -462,8 +453,7 @@ filemon_event_process_exit(void *arg __unused, struct proc *p)
filemon->p = NULL;
}
- /* Unlock the found filemon structure. */
- filemon_filemon_unlock(filemon);
+ sx_xunlock(&filemon->lock);
}
}
@@ -486,8 +476,7 @@ filemon_wrapper_unlink(struct thread *td, struct unlink_args *uap)
filemon_output(filemon, filemon->msgbufr, len);
- /* Unlock the found filemon structure. */
- filemon_filemon_unlock(filemon);
+ sx_xunlock(&filemon->lock);
}
}
@@ -508,8 +497,7 @@ filemon_event_process_fork(void *arg __unused, struct proc *p1,
filemon_output(filemon, filemon->msgbufr, len);
- /* Unlock the found filemon structure. */
- filemon_filemon_unlock(filemon);
+ sx_xunlock(&filemon->lock);
}
}
OpenPOWER on IntegriCloud