The Design and Implementation of the FreeBSD Operating System, Second Edition
[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/sys/kinfo.h

Version: -  FREEBSD  -  FREEBSD10  -  FREEBSD9  -  FREEBSD92  -  FREEBSD91  -  FREEBSD90  -  FREEBSD8  -  FREEBSD82  -  FREEBSD81  -  FREEBSD80  -  FREEBSD7  -  FREEBSD74  -  FREEBSD73  -  FREEBSD72  -  FREEBSD71  -  FREEBSD70  -  FREEBSD6  -  FREEBSD64  -  FREEBSD63  -  FREEBSD62  -  FREEBSD61  -  FREEBSD60  -  FREEBSD5  -  FREEBSD55  -  FREEBSD54  -  FREEBSD53  -  FREEBSD52  -  FREEBSD51  -  FREEBSD50  -  FREEBSD4  -  FREEBSD3  -  FREEBSD22  -  cheribsd  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1  -  FREEBSD-LIBC  -  FREEBSD8-LIBC  -  FREEBSD7-LIBC  -  FREEBSD6-LIBC  -  GLIBC27 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * Copyright (c) 2004 The DragonFly Project.  All rights reserved.
    3  * 
    4  * This code is derived from software contributed to The DragonFly Project
    5  * by Joerg Sonnenberger <joerg@bec.de>.
    6  * 
    7  * Redistribution and use in source and binary forms, with or without
    8  * modification, are permitted provided that the following conditions
    9  * are met:
   10  * 
   11  * 1. Redistributions of source code must retain the above copyright
   12  *    notice, this list of conditions and the following disclaimer.
   13  * 2. Redistributions in binary form must reproduce the above copyright
   14  *    notice, this list of conditions and the following disclaimer in
   15  *    the documentation and/or other materials provided with the
   16  *    distribution.
   17  * 3. Neither the name of The DragonFly Project nor the names of its
   18  *    contributors may be used to endorse or promote products derived
   19  *    from this software without specific, prior written permission.
   20  * 
   21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   22  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
   24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
   25  * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
   26  * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
   27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
   28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
   29  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   30  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   31  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   32  * SUCH DAMAGE.
   33  */
   34 
   35 #ifndef _SYS_KINFO_H_
   36 #define _SYS_KINFO_H_
   37 
   38 #ifndef _KERNEL_STRUCTURES
   39 #define _KERNEL_STRUCTURES
   40 #endif
   41 
   42 #ifndef _SYS_TYPES_H_
   43 #include <sys/types.h>
   44 #endif
   45 #ifndef _SYS_PARAM_H_
   46 #include <sys/param.h>
   47 #endif
   48 #include <sys/resource.h>
   49 #include <sys/rtprio.h>
   50 #include <sys/proc.h>
   51 
   52 struct kinfo_file {
   53         size_t   f_size;        /* size of struct kinfo_file */
   54         pid_t    f_pid;         /* owning process */
   55         uid_t    f_uid;         /* effective uid of owning process */
   56         int      f_fd;          /* descriptor number */
   57         void    *f_file;        /* address of struct file */
   58         short    f_type;        /* descriptor type */
   59         int      f_count;       /* reference count */
   60         int      f_msgcount;    /* references from message queue */
   61         off_t    f_offset;      /* file offset */
   62         void    *f_data;        /* file descriptor specific data */
   63         u_int    f_flag;        /* flags (see fcntl.h) */
   64 };
   65 
   66 /*
   67  * CPU time statistics
   68  */
   69 struct kinfo_cputime {
   70         uint64_t        cp_user;
   71         uint64_t        cp_nice;
   72         uint64_t        cp_sys;
   73         uint64_t        cp_intr;
   74         uint64_t        cp_idle;
   75         uint64_t        cp_unused01;
   76         uint64_t        cp_unused02;
   77         uint64_t        cp_unused03;
   78         uint64_t        cp_stallpc;     /* code stall address */
   79         char            cp_msg[32];     /* code stall token or mplock */
   80 };
   81 
   82 /*
   83  * CPU system/interrupt program counter sampler
   84  */
   85 #define PCTRACK_ARYSIZE 32      /* must be a power of 2 */
   86 #define PCTRACK_ARYMASK (PCTRACK_ARYSIZE - 1)
   87 
   88 struct kinfo_pcheader {
   89         int             pc_ntrack;      /* number of tracks per cpu (2) */
   90         int             pc_arysize;     /* size of storage array (32) */
   91 };
   92 
   93 struct kinfo_pctrack {
   94         int             pc_index;
   95         void            *pc_array[PCTRACK_ARYSIZE];
   96 };
   97 
   98 #define PCTRACK_SYS     0
   99 #define PCTRACK_INT     1
  100 #define PCTRACK_SIZE    2
  101 
  102 struct kinfo_clockinfo {
  103         int     ci_hz;          /* clock frequency */
  104         int     ci_tick;        /* micro-seconds per hz tick */
  105         int     ci_tickadj;     /* clock skew rate for adjtime() */
  106         int     ci_stathz;      /* statistics clock frequency */
  107         int     ci_profhz;      /* profiling clock frequency */
  108 };
  109 
  110 /*
  111  * Structure definition for the lwp-specific data in struct kinfo_proc.
  112  */
  113 struct kinfo_lwp {
  114         pid_t           kl_pid;         /* PID of our associated proc */
  115         lwpid_t         kl_tid;         /* thread id */
  116 
  117         int             kl_flags;       /* LWP_ flags */
  118         enum lwpstat    kl_stat;        /* LS* lwp status */
  119         int             kl_lock;        /* lwp lock (prevent destruct) count */
  120         int             kl_tdflags;     /* thread flags */
  121         int             kl_mpcount;     /* MP lock held count */
  122         int             kl_prio;        /* scheduling priority */
  123         int             kl_tdprio;      /* lwkt sched priority */
  124         struct rtprio   kl_rtprio;      /* real-time scheduling prio */
  125 
  126         /* accounting */
  127         uint64_t        kl_uticks;      /* time accounting */
  128         uint64_t        kl_sticks;
  129         uint64_t        kl_iticks;
  130         uint64_t        kl_cpticks;     /* sched quantums used */
  131         u_int           kl_pctcpu;      /* percentage cputime */
  132         u_int           kl_slptime;     /* time since last blocked */
  133         int             kl_origcpu;     /* originally scheduled on cpu */
  134         int             kl_estcpu;
  135         int             kl_cpuid;       /* CPU this lwp was last scheduled on */
  136 
  137         struct rusage   kl_ru;          /* resource usage stats */
  138 
  139         sigset_t        kl_siglist;     /* pending signals */
  140         sigset_t        kl_sigmask;     /* masked signals */
  141 #define WMESGLEN 8
  142         uintptr_t       kl_wchan;       /* waiting channel */
  143         char            kl_wmesg[WMESGLEN+1];   /* waiting message */
  144 };
  145 
  146 /*
  147  * KERN_PROC subtype ops return arrays of normalized proc structures:
  148  */
  149 struct kinfo_proc {
  150         uintptr_t       kp_paddr;       /* address of this proc */
  151 
  152         /* proc information */
  153         int             kp_flags;
  154         enum procstat   kp_stat;
  155         int             kp_lock;
  156         int             kp_acflag;      /* accounting flags */
  157         int             kp_traceflag;
  158 
  159         uintptr_t       kp_fd;          /* address of the proc's files */
  160 
  161         sigset_t        kp_siglist;
  162         sigset_t        kp_sigignore;
  163         sigset_t        kp_sigcatch;
  164         int             kp_sigflag;     /* from ps_flag */
  165         struct timeval  kp_start;
  166 
  167         char            kp_comm[MAXCOMLEN+1];
  168 
  169         /* cred information */
  170         uid_t           kp_uid;
  171         short           kp_ngroups;
  172         gid_t           kp_groups[NGROUPS];
  173         uid_t           kp_ruid;
  174         uid_t           kp_svuid;
  175         gid_t           kp_rgid;
  176         gid_t           kp_svgid;
  177 
  178         pid_t           kp_pid; /* process id */
  179         pid_t           kp_ppid;        /* parent process id */
  180         pid_t           kp_pgid;        /* process group id */
  181         int             kp_jobc;        /* job control counter */
  182         pid_t           kp_sid; /* session id */
  183         char            kp_login[roundup(MAXLOGNAME, sizeof(long))];    /* setlogin() name */
  184         dev_t           kp_tdev;        /* controlling tty dev */
  185         pid_t           kp_tpgid;       /* tty process group id */
  186         pid_t           kp_tsid;        /* tty session id */
  187 
  188         u_short         kp_exitstat;    /* exit status information */
  189         int             kp_nthreads;
  190         int             kp_nice;
  191         unsigned int    kp_swtime;
  192 
  193         vm_size_t       kp_vm_map_size; /* vmmap virtual size in bytes */
  194         segsz_t         kp_vm_rssize;           /* resident set size in pages */
  195         segsz_t         kp_vm_swrss;            /* rss before last swap in pages */
  196         segsz_t         kp_vm_tsize;            /* text size in pages */
  197         segsz_t         kp_vm_dsize;            /* data size in pages */
  198         segsz_t         kp_vm_ssize;            /* stack size in pages */
  199         u_int           kp_vm_prssize;          /* proportional rss in pages */
  200 
  201         int             kp_jailid;
  202 
  203         struct rusage   kp_ru;
  204         struct rusage   kp_cru;
  205 
  206         int             kp_auxflags;    /* generated flags */
  207 #define KI_CTTY 1
  208 #define KI_SLEADER      2
  209 
  210         struct kinfo_lwp kp_lwp;
  211 
  212         int             kp_spare[4];
  213 };
  214 
  215 struct proc;
  216 struct lwp;
  217 struct thread;
  218 
  219 void fill_kinfo_proc(struct proc *, struct kinfo_proc *);
  220 void fill_kinfo_lwp(struct lwp *, struct kinfo_lwp *);
  221 void fill_kinfo_proc_kthread(struct thread *, struct kinfo_proc *);
  222 
  223 #define KINFO_NEXT(kp)  ((union kinfo *)((uintptr_t)kp + kp->gen.len))
  224 #define KINFO_END(kp)   (kp->gen.type == KINFO_TYPE_END)
  225 
  226 #if defined(_KERNEL)
  227 #define cpu_time        cputime_percpu[mycpuid]
  228 #endif
  229 
  230 #if defined(_KERNEL)
  231 extern struct kinfo_cputime cputime_percpu[MAXCPU];
  232 #endif
  233 
  234 #endif /* !_SYS_KINFO_H_ */

Cache object: b26133dd42a0d34837b9ae83385a07ed


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.