2 * Copyright (c) 1993 Jan-Simon Pendry
4 * The Regents of the University of California. All rights reserved.
6 * This code is derived from software contributed to Berkeley by
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3. All advertising materials mentioning features or use of this software
18 * must display the following acknowledgement:
19 * This product includes software developed by the University of
20 * California, Berkeley and its contributors.
21 * 4. Neither the name of the University nor the names of its contributors
22 * may be used to endorse or promote products derived from this software
23 * without specific prior written permission.
25 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 * @(#)procfs.h 8.9 (Berkeley) 5/14/95
43 * The different types of node in a procfs filesystem
46 Proot, /* the filesystem root */
47 Pself, /* symbolic link for curproc */
48 Pproc, /* a process-specific sub-directory */
49 Pexe, /* the executable file */
50 Pmem, /* the process's memory image */
56 * control data for the proc file system.
59 struct pfsnode *pfs_next; /* next on list */
60 struct vnode *pfs_vnode; /* vnode associated with this pfsnode */
61 pfstype pfs_type; /* type of procfs node */
62 pid_t pfs_pid; /* associated process */
63 u_short pfs_mode; /* mode bits for stat() */
64 u_long pfs_flags; /* open flags */
65 u_long pfs_fileno; /* unique file id */
66 pid_t pfs_lockowner; /* pfs lock owner */
69 #define PROCFS_NAMELEN 8 /* max length of a filename component */
72 * Kernel stuff follows
75 #define CNEQ(cnp, s, len) \
76 ((cnp)->cn_namelen == (len) && \
77 (bcmp((s), (cnp)->cn_nameptr, (len)) == 0))
81 #define PROCFS_FILENO(pid, type) \
84 ((((pid)+1) << 4) + ((int) (type))))
87 * Convert between pfsnode vnode
89 #define VTOPFS(vp) ((struct pfsnode *)(vp)->v_data)
90 #define PFSTOV(pfs) ((pfs)->pfs_vnode)
92 typedef struct vfs_namemap vfs_namemap_t;
98 int vfs_getuserstr __P((struct uio *, char *, int *));
99 vfs_namemap_t *vfs_findname __P((vfs_namemap_t *, char *, int));
101 /* <machine/reg.h> */
106 #define PFIND(pid) ((pid) ? pfind(pid) : &proc0)
108 void linprocfs_exit __P((struct proc *));
109 int linprocfs_freevp __P((struct vnode *));
110 int linprocfs_allocvp __P((struct mount *, struct vnode **, long, pfstype));
111 struct vnode *linprocfs_findtextvp __P((struct proc *));
112 int linprocfs_sstep __P((struct proc *));
113 void linprocfs_fix_sstep __P((struct proc *));
115 int linprocfs_read_regs __P((struct proc *, struct reg *));
116 int linprocfs_write_regs __P((struct proc *, struct reg *));
117 int linprocfs_read_fpregs __P((struct proc *, struct fpreg *));
118 int linprocfs_write_fpregs __P((struct proc *, struct fpreg *));
119 int linprocfs_read_dbregs __P((struct proc *, struct dbreg *));
120 int linprocfs_write_dbregs __P((struct proc *, struct dbreg *));
122 int linprocfs_domeminfo __P((struct proc *, struct proc *, struct pfsnode *pfsp, struct uio *uio));
123 int linprocfs_docpuinfo __P((struct proc *, struct proc *, struct pfsnode *pfsp, struct uio *uio));
125 /* functions to check whether or not files should be displayed */
126 int linprocfs_validfile __P((struct proc *));
128 #define PROCFS_LOCKED 0x01
129 #define PROCFS_WANT 0x02
131 extern vop_t **linprocfs_vnodeop_p;
133 int linprocfs_root __P((struct mount *, struct vnode **));
134 int linprocfs_rw __P((struct vop_read_args *));