Author: emax
Date: Wed Apr 16 17:57:08 2014
New Revision: 264546
URL: http://svnweb.freebsd.org/changeset/base/264546

Log:
  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

Modified:
  stable/10/sys/kern/subr_devstat.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/subr_devstat.c
==============================================================================
--- stable/10/sys/kern/subr_devstat.c   Wed Apr 16 17:39:59 2014        
(r264545)
+++ stable/10/sys/kern/subr_devstat.c   Wed Apr 16 17:57:08 2014        
(r264546)
@@ -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_ooffse
 
        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;
        }
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to