summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_devstat.c
diff options
context:
space:
mode:
authoremax <emax@FreeBSD.org>2014-04-16 17:57:08 +0000
committeremax <emax@FreeBSD.org>2014-04-16 17:57:08 +0000
commit13d344e5ca522ba75cd119fe0c59cc076f815ca9 (patch)
tree6546495a7581ac22cbef5336cfa8fae6bd957a6b /sys/kern/subr_devstat.c
parent71409ea2b1129ef27f869776eb6c227300afbb10 (diff)
downloadFreeBSD-src-13d344e5ca522ba75cd119fe0c59cc076f815ca9.zip
FreeBSD-src-13d344e5ca522ba75cd119fe0c59cc076f815ca9.tar.gz
MFC r263690
change defaule permissions on /dev/devstat. while i'm here remove D_NEEDGIANT flag Submitted by: jhb Reviewed by: jhb, scottl, rwatson, delphij, phk
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