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 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>
--- 54 unchanged lines hidden (view full) ---
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
114 if (p != NULL) {
115 PROC_LOCK_ASSERT(p, MA_OWNED);
116
117 if ((p->p_flag & P_SUGID) && pn->pn_type != pfstype_procdir)
118 vap->va_mode = 0;
119 }
--- 61 unchanged lines hidden (view full) ---
181 pfs_create_file(dir, "notepg", procfs_doprocnote,
182 procfs_attr, procfs_candebug, NULL, PFS_WR);
183 pfs_create_file(dir, "regs", procfs_doprocregs,
184 procfs_attr, procfs_candebug, NULL, PFS_RDWR|PFS_RAW);
185 pfs_create_file(dir, "rlimit", procfs_doprocrlimit,
186 NULL, NULL, NULL, PFS_RD);
187 pfs_create_file(dir, "status", procfs_doprocstatus,
188 NULL, NULL, NULL, PFS_RD);
189
190 pfs_create_link(dir, "file", procfs_doprocfile,
191 NULL, procfs_notsystem, NULL, 0);
192
193 return (0);
194}
195
196/*
197 * Destructor
198 */
199static int
200procfs_uninit(PFS_INIT_ARGS)
201{
202 /* nothing to do, pseudofs will GC */
203 return (0);
204}
205
206PSEUDOFS(procfs, 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 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>
--- 54 unchanged lines hidden (view full) ---
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
114 if (p != NULL) {
115 PROC_LOCK_ASSERT(p, MA_OWNED);
116
117 if ((p->p_flag & P_SUGID) && pn->pn_type != pfstype_procdir)
118 vap->va_mode = 0;
119 }
--- 61 unchanged lines hidden (view full) ---
181 pfs_create_file(dir, "notepg", procfs_doprocnote,
182 procfs_attr, procfs_candebug, NULL, PFS_WR);
183 pfs_create_file(dir, "regs", procfs_doprocregs,
184 procfs_attr, procfs_candebug, NULL, PFS_RDWR|PFS_RAW);
185 pfs_create_file(dir, "rlimit", procfs_doprocrlimit,
186 NULL, NULL, NULL, PFS_RD);
187 pfs_create_file(dir, "status", procfs_doprocstatus,
188 NULL, NULL, NULL, PFS_RD);
189
190 pfs_create_link(dir, "file", procfs_doprocfile,
191 NULL, procfs_notsystem, NULL, 0);
192
193 return (0);
194}
195
196/*
197 * Destructor
198 */
199static int
200procfs_uninit(PFS_INIT_ARGS)
201{
202 /* nothing to do, pseudofs will GC */
203 return (0);
204}
205
206PSEUDOFS(procfs, 1);