summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_devstat.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/subr_devstat.c')
-rw-r--r--sys/kern/subr_devstat.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/kern/subr_devstat.c b/sys/kern/subr_devstat.c
index 40e04a0..436dbca 100644
--- a/sys/kern/subr_devstat.c
+++ b/sys/kern/subr_devstat.c
@@ -462,7 +462,6 @@ static d_mmap_t devstat_mmap;
static struct cdevsw devstat_cdevsw = {
.d_version = D_VERSION,
- .d_flags = D_NEEDGIANT,
.d_mmap = devstat_mmap,
.d_name = "devstat",
};
@@ -484,13 +483,16 @@ devstat_mmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr,
if (nprot != VM_PROT_READ)
return (-1);
+ mtx_lock(&devstat_mutex);
TAILQ_FOREACH(spp, &pagelist, list) {
if (offset == 0) {
*paddr = vtophys(spp->stat);
+ mtx_unlock(&devstat_mutex);
return (0);
}
offset -= PAGE_SIZE;
}
+ mtx_unlock(&devstat_mutex);
return (-1);
}
@@ -505,7 +507,7 @@ devstat_alloc(void)
mtx_assert(&devstat_mutex, MA_NOTOWNED);
if (!once) {
make_dev_credf(MAKEDEV_ETERNAL | MAKEDEV_CHECKNAME,
- &devstat_cdevsw, 0, NULL, UID_ROOT, GID_WHEEL, 0400,
+ &devstat_cdevsw, 0, NULL, UID_ROOT, GID_WHEEL, 0444,
DEVSTAT_DEVICE_NAME);
once = 1;
}
OpenPOWER on IntegriCloud