summaryrefslogtreecommitdiffstats
path: root/sys/dev/filemon/filemon.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/filemon/filemon.c')
-rw-r--r--sys/dev/filemon/filemon.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/sys/dev/filemon/filemon.c b/sys/dev/filemon/filemon.c
index 352f682..ed0ead5 100644
--- a/sys/dev/filemon/filemon.c
+++ b/sys/dev/filemon/filemon.c
@@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
#include <sys/file.h>
#include <sys/systm.h>
#include <sys/buf.h>
+#include <sys/capsicum.h>
#include <sys/condvar.h>
#include <sys/conf.h>
#include <sys/fcntl.h>
@@ -52,10 +53,6 @@ __FBSDID("$FreeBSD$");
#include <sys/sysproto.h>
#include <sys/uio.h>
-#if __FreeBSD_version >= 900041
-#include <sys/capsicum.h>
-#endif
-
#include "filemon.h"
#if defined(COMPAT_IA32) || defined(COMPAT_FREEBSD32) || defined(COMPAT_ARCH32)
@@ -130,7 +127,7 @@ filemon_dtr(void *data)
/* Follow same locking order as filemon_pid_check. */
filemon_lock_write();
- filemon_filemon_lock(filemon);
+ sx_xlock(&filemon->lock);
/* Remove from the in-use list. */
TAILQ_REMOVE(&filemons_inuse, filemon, link);
@@ -143,7 +140,7 @@ filemon_dtr(void *data)
TAILQ_INSERT_TAIL(&filemons_free, filemon, link);
/* Give up write access. */
- filemon_filemon_unlock(filemon);
+ sx_xunlock(&filemon->lock);
filemon_unlock_write();
if (fp != NULL)
@@ -158,14 +155,12 @@ filemon_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag __unused,
int error = 0;
struct filemon *filemon;
struct proc *p;
-#if __FreeBSD_version >= 900041
cap_rights_t rights;
-#endif
if ((error = devfs_get_cdevpriv((void **) &filemon)) != 0)
return (error);
- filemon_filemon_lock(filemon);
+ sx_xlock(&filemon->lock);
switch (cmd) {
/* Set the output file descriptor. */
@@ -174,9 +169,7 @@ filemon_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag __unused,
fdrop(filemon->fp, td);
error = fget_write(td, *(int *)data,
-#if __FreeBSD_version >= 900041
cap_rights_init(&rights, CAP_PWRITE),
-#endif
&filemon->fp);
if (error == 0)
/* Write the file header. */
@@ -198,7 +191,7 @@ filemon_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag __unused,
break;
}
- filemon_filemon_unlock(filemon);
+ sx_xunlock(&filemon->lock);
return (error);
}
OpenPOWER on IntegriCloud