Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Mar 2014 18:13:41 +0000 (UTC)
From:      Maksim Yevmenkin <emax@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r263690 - head/sys/kern
Message-ID:  <201403241813.s2OIDfEd024721@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: emax
Date: Mon Mar 24 18:13:41 2014
New Revision: 263690
URL: http://svnweb.freebsd.org/changeset/base/263690

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

Modified:
  head/sys/kern/subr_devstat.c

Modified: head/sys/kern/subr_devstat.c
==============================================================================
--- head/sys/kern/subr_devstat.c	Mon Mar 24 15:22:22 2014	(r263689)
+++ head/sys/kern/subr_devstat.c	Mon Mar 24 18:13:41 2014	(r263690)
@@ -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_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);
 }
 
@@ -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;
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201403241813.s2OIDfEd024721>