root/miscfs/procfs/procfs.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. Proot
  2. Pcurproc
  3. Pself
  4. Pproc
  5. Pfile
  6. Pmem
  7. Pregs
  8. Pfpregs
  9. Pctl
  10. Pstatus
  11. Pnote
  12. Pnotepg
  13. Pcmdline
  14. Pmeminfo
  15. Pcpuinfo
  16. pfstype

    1 /*      $OpenBSD: procfs.h,v 1.24 2007/06/22 09:38:53 jasper Exp $      */
    2 /*      $NetBSD: procfs.h,v 1.17 1996/02/12 15:01:41 christos Exp $     */
    3 
    4 /*
    5  * Copyright (c) 1993 Jan-Simon Pendry
    6  * Copyright (c) 1993
    7  *      The Regents of the University of California.  All rights reserved.
    8  *
    9  * This code is derived from software contributed to Berkeley by
   10  * Jan-Simon Pendry.
   11  *
   12  * Redistribution and use in source and binary forms, with or without
   13  * modification, are permitted provided that the following conditions
   14  * are met:
   15  * 1. Redistributions of source code must retain the above copyright
   16  *    notice, this list of conditions and the following disclaimer.
   17  * 2. Redistributions in binary form must reproduce the above copyright
   18  *    notice, this list of conditions and the following disclaimer in the
   19  *    documentation and/or other materials provided with the distribution.
   20  * 3. Neither the name of the University nor the names of its contributors
   21  *    may be used to endorse or promote products derived from this software
   22  *    without specific prior written permission.
   23  *
   24  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   25  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   26  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   27  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   28  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   29  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   30  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   31  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   33  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   34  * SUCH DAMAGE.
   35  *
   36  *      @(#)procfs.h    8.7 (Berkeley) 6/15/94
   37  */
   38 
   39 /*
   40  * The different types of node in a procfs filesystem
   41  */
   42 typedef enum {
   43         Proot,          /* the filesystem root */
   44         Pcurproc,       /* symbolic link for curproc */
   45         Pself,          /* like curproc, but this is the Linux name */
   46         Pproc,          /* a process-specific sub-directory */
   47         Pfile,          /* the executable file */
   48         Pmem,           /* the process's memory image */
   49         Pregs,          /* the process's register set */
   50         Pfpregs,        /* the process's FP register set */
   51         Pctl,           /* process control */
   52         Pstatus,        /* process status */
   53         Pnote,          /* process notifier */
   54         Pnotepg,        /* process group notifier */
   55         Pcmdline,       /* process command line args */
   56         Pmeminfo,       /* system memory info (if -o linux) */
   57         Pcpuinfo        /* CPU info (if -o linux) */
   58 } pfstype;
   59 
   60 /*
   61  * control data for the proc file system.
   62  */
   63 struct pfsnode {
   64         TAILQ_ENTRY(pfsnode)    list;
   65         struct vnode    *pfs_vnode;     /* vnode associated with this pfsnode */
   66         pfstype         pfs_type;       /* type of procfs node */
   67         pid_t           pfs_pid;        /* associated process */
   68         mode_t          pfs_mode;       /* mode bits for stat() */
   69         u_long          pfs_flags;      /* open flags */
   70         u_long          pfs_fileno;     /* unique file id */
   71 };
   72 
   73 #define PROCFS_NOTELEN  64      /* max length of a note (/proc/$pid/note) */
   74 #define PROCFS_CTLLEN   8       /* max length of a ctl msg (/proc/$pid/ctl */
   75 
   76 /*
   77  * Kernel stuff follows
   78  */
   79 #ifdef _KERNEL
   80 #define CNEQ(cnp, s, len) \
   81          ((cnp)->cn_namelen == (len) && \
   82           (bcmp((s), (cnp)->cn_nameptr, (len)) == 0))
   83 
   84 #define UIO_MX 32
   85 
   86 #define PROCFS_FILENO(pid, type) \
   87         (((type) < Pproc) ? \
   88                         ((type) + 4) : \
   89                         ((((pid)+1) << 5) + ((int) (type))))
   90 
   91 struct procfsmount {
   92         void *pmnt_exechook;
   93         int pmnt_flags;
   94 };
   95 
   96 #define VFSTOPROC(mp)   ((struct procfsmount *)(mp)->mnt_data)
   97 
   98 /*
   99  * Convert between pfsnode vnode
  100  */
  101 #define VTOPFS(vp)      ((struct pfsnode *)(vp)->v_data)
  102 #define PFSTOV(pfs)     ((pfs)->pfs_vnode)
  103 
  104 typedef struct vfs_namemap vfs_namemap_t;
  105 struct vfs_namemap {
  106         const char *nm_name;
  107         int nm_val;
  108 };
  109 
  110 int vfs_getuserstr(struct uio *, char *, int *);
  111 const vfs_namemap_t *vfs_findname(const vfs_namemap_t *, char *, int);
  112 
  113 int procfs_allocvp(struct mount *, struct vnode **, pid_t, pfstype);
  114 int procfs_doctl(struct proc *, struct proc *, struct pfsnode *pfsp, struct uio *uio);
  115 int procfs_dofpregs(struct proc *, struct proc *, struct pfsnode *pfsp, struct uio *uio);
  116 int procfs_donote(struct proc *, struct proc *, struct pfsnode *pfsp, struct uio *uio);
  117 int procfs_doregs(struct proc *, struct proc *, struct pfsnode *pfsp, struct uio *uio);
  118 int procfs_dostatus(struct proc *, struct proc *, struct pfsnode *pfsp, struct uio *uio);
  119 int procfs_docmdline(struct proc *, struct proc *, struct pfsnode *pfsp, struct uio *uio);
  120 int procfs_domeminfo(struct proc *, struct proc *, struct pfsnode *pfsp, struct uio *uio);
  121 int procfs_docpuinfo(struct proc *, struct proc *, struct pfsnode *pfsp, struct uio *uio);
  122 int procfs_domap(struct proc *, struct proc *, struct pfsnode *pfsp, struct uio *uio, int);
  123 int procfs_freevp(struct vnode *);
  124 int procfs_getcpuinfstr(char *, int *);
  125 int procfs_poll(void *);
  126 
  127 /* functions to check whether or not files should be displayed */
  128 int procfs_validfile(struct proc *, struct mount *);
  129 int procfs_validfpregs(struct proc *, struct mount *);
  130 int procfs_validregs(struct proc *, struct mount *);
  131 int procfs_validmap(struct proc *, struct mount *);
  132 
  133 int procfs_rw(void *);
  134 
  135 #define PROCFS_LOCKED   0x01
  136 #define PROCFS_WANT     0x02
  137 
  138 extern int (**procfs_vnodeop_p)(void *);
  139 extern const struct vfsops procfs_vfsops;
  140 
  141 struct vfsconf;
  142 
  143 int     procfs_init(struct vfsconf *);
  144 int     procfs_root(struct mount *, struct vnode **);
  145 
  146 #endif /* _KERNEL */

/* [<][>][^][v][top][bottom][index][help] */