procfs.c (184652) | procfs.c (188677) |
---|---|
1/*- 2 * Copyright (c) 2001 Dag-Erling Sm�rgrav 3 * Copyright (c) 1993 Jan-Simon Pendry 4 * Copyright (c) 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * This code is derived from software contributed to Berkeley by 8 * Jan-Simon Pendry. --- 23 unchanged lines hidden (view full) --- 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)procfs_vfsops.c 8.7 (Berkeley) 5/10/95 39 * | 1/*- 2 * Copyright (c) 2001 Dag-Erling Sm�rgrav 3 * Copyright (c) 1993 Jan-Simon Pendry 4 * Copyright (c) 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * This code is derived from software contributed to Berkeley by 8 * Jan-Simon Pendry. --- 23 unchanged lines hidden (view full) --- 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)procfs_vfsops.c 8.7 (Berkeley) 5/10/95 39 * |
40 * $FreeBSD: head/sys/fs/procfs/procfs.c 184652 2008-11-04 19:04:01Z jhb $ | 40 * $FreeBSD: head/sys/fs/procfs/procfs.c 188677 2009-02-16 15:17:26Z des $ |
41 */ 42 43#include <sys/param.h> 44#include <sys/queue.h> 45#include <sys/exec.h> 46#include <sys/lock.h> 47#include <sys/kernel.h> 48#include <sys/malloc.h> --- 45 unchanged lines hidden (view full) --- 94} 95 96/* 97 * Adjust mode for some nodes that need it 98 */ 99int 100procfs_attr(PFS_ATTR_ARGS) 101{ | 41 */ 42 43#include <sys/param.h> 44#include <sys/queue.h> 45#include <sys/exec.h> 46#include <sys/lock.h> 47#include <sys/kernel.h> 48#include <sys/malloc.h> --- 45 unchanged lines hidden (view full) --- 94} 95 96/* 97 * Adjust mode for some nodes that need it 98 */ 99int 100procfs_attr(PFS_ATTR_ARGS) 101{ |
102 PROC_LOCK_ASSERT(p, MA_OWNED); | |
103 104 /* XXX inefficient, split into separate functions */ 105 if (strcmp(pn->pn_name, "ctl") == 0 || 106 strcmp(pn->pn_name, "note") == 0 || 107 strcmp(pn->pn_name, "notepg") == 0) 108 vap->va_mode = 0200; 109 else if (strcmp(pn->pn_name, "mem") == 0 || 110 strcmp(pn->pn_name, "regs") == 0 || 111 strcmp(pn->pn_name, "dbregs") == 0 || 112 strcmp(pn->pn_name, "fpregs") == 0) 113 vap->va_mode = 0600; 114 | 102 103 /* XXX inefficient, split into separate functions */ 104 if (strcmp(pn->pn_name, "ctl") == 0 || 105 strcmp(pn->pn_name, "note") == 0 || 106 strcmp(pn->pn_name, "notepg") == 0) 107 vap->va_mode = 0200; 108 else if (strcmp(pn->pn_name, "mem") == 0 || 109 strcmp(pn->pn_name, "regs") == 0 || 110 strcmp(pn->pn_name, "dbregs") == 0 || 111 strcmp(pn->pn_name, "fpregs") == 0) 112 vap->va_mode = 0600; 113 |
115 if ((p->p_flag & P_SUGID) && pn->pn_type != pfstype_procdir) 116 vap->va_mode = 0; | 114 if (p != NULL) { 115 PROC_LOCK_ASSERT(p, MA_OWNED); |
117 | 116 |
118 vap->va_uid = p->p_ucred->cr_uid; 119 vap->va_gid = p->p_ucred->cr_gid; | 117 if ((p->p_flag & P_SUGID) && pn->pn_type != pfstype_procdir) 118 vap->va_mode = 0; 119 } |
120 121 return (0); 122} 123 124/* 125 * Visibility: some files only exist for non-system processes 126 * Non-static because linprocfs uses it. 127 */ --- 79 unchanged lines hidden --- | 120 121 return (0); 122} 123 124/* 125 * Visibility: some files only exist for non-system processes 126 * Non-static because linprocfs uses it. 127 */ --- 79 unchanged lines hidden --- |