diff options
author | emax <emax@FreeBSD.org> | 2014-03-24 18:13:41 +0000 |
---|---|---|
committer | emax <emax@FreeBSD.org> | 2014-03-24 18:13:41 +0000 |
commit | 4d523456c74f0ddc517b308316bcd000a9aabab5 (patch) | |
tree | cacb755522632c9fd589cd7241a8bbe49c6b4f19 | |
parent | 28889e1895014d9f1c12cc4e1fee52f483f89a7e (diff) | |
download | FreeBSD-src-4d523456c74f0ddc517b308316bcd000a9aabab5.zip FreeBSD-src-4d523456c74f0ddc517b308316bcd000a9aabab5.tar.gz |
change defaule permissions on /dev/devstat. while i'm here remove
D_NEEDGIANT flag
Submitted by: jhb
Reviewed by: jhb, scottl, rwatson, delphij, phk
MFC after: 1 week
-rw-r--r-- | sys/kern/subr_devstat.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/kern/subr_devstat.c b/sys/kern/subr_devstat.c index 3d2492f..cb69669 100644 --- a/sys/kern/subr_devstat.c +++ b/sys/kern/subr_devstat.c @@ -460,7 +460,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", }; @@ -482,13 +481,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); } @@ -503,7 +505,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; } |