Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Jan 2009 17:37:43 +0000
From:      Andrew Brampton <brampton+freebsd-fs@gmail.com>
To:        freebsd-fs@freebsd.org, =?UTF-8?Q?Dag=2DErling_Sm=C3=B8rgrav?= <des@des.no>
Subject:   Re: Pseudofs and pfs_attr_t for non-process based files
Message-ID:  <d41814900901210937y390cdff3pf6a9551df2c4bcd3@mail.gmail.com>
In-Reply-To: <868wp4pqwm.fsf@ds4.des.no>
References:  <d41814900901181701n7928e40cv2aa1dc4dff582fda@mail.gmail.com> <868wp4pqwm.fsf@ds4.des.no>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
2009/1/21 Dag-Erling Smørgrav <des@des.no>:
> Sounds sensible, but your patches are mangled.  Could you please
> regenerate them using 'svn diff -x-p' on a non-Windows machine?

When you say mangled, did you just mean they had windows new lines?
Regardless I've reattached the patches (with unix new lines), and
using the -x-p command. I wasn't aware of -x-p but it looks useful.

Enjoy
Andrew

[-- Attachment #2 --]
Index: sys/fs/pseudofs/pseudofs_vnops.c
===================================================================
--- sys/fs/pseudofs/pseudofs_vnops.c	(revision 187415)
+++ sys/fs/pseudofs/pseudofs_vnops.c	(working copy)
@@ -226,14 +226,17 @@ pfs_getattr(struct vop_getattr_args *va)
 	if (proc != NULL) {
 		vap->va_uid = proc->p_ucred->cr_ruid;
 		vap->va_gid = proc->p_ucred->cr_rgid;
-		if (pn->pn_attr != NULL)
-			error = pn_attr(curthread, proc, pn, vap);
-		PROC_UNLOCK(proc);
 	} else {
 		vap->va_uid = 0;
 		vap->va_gid = 0;
 	}
 
+	if (pn->pn_attr != NULL)
+		error = pn_attr(curthread, proc, pn, vap);
+
+	if(proc != NULL)
+		PROC_UNLOCK(proc);
+
 	PFS_RETURN (error);
 }
 

[-- Attachment #3 --]
Index: sys/fs/procfs/procfs.c
===================================================================
--- sys/fs/procfs/procfs.c	(revision 187415)
+++ sys/fs/procfs/procfs.c	(working copy)
@@ -99,7 +99,6 @@ procfs_docurproc(PFS_FILL_ARGS)
 int
 procfs_attr(PFS_ATTR_ARGS)
 {
-	PROC_LOCK_ASSERT(p, MA_OWNED);
 
 	/* XXX inefficient, split into separate functions */
 	if (strcmp(pn->pn_name, "ctl") == 0 ||
@@ -112,12 +111,16 @@ procfs_attr(PFS_ATTR_ARGS)
 	    strcmp(pn->pn_name, "fpregs") == 0)
 		vap->va_mode = 0600;
 
-	if ((p->p_flag & P_SUGID) && pn->pn_type != pfstype_procdir)
-		vap->va_mode = 0;
+	if (p != NULL) {
+		PROC_LOCK_ASSERT(p, MA_OWNED);
 
-	vap->va_uid = p->p_ucred->cr_uid;
-	vap->va_gid = p->p_ucred->cr_gid;
+		if ((p->p_flag & P_SUGID) && pn->pn_type != pfstype_procdir)
+			vap->va_mode = 0;
 
+		vap->va_uid = p->p_ucred->cr_uid;
+		vap->va_gid = p->p_ucred->cr_gid;
+	}
+
 	return (0);
 }
 

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