The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: 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/resourcevar.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*      $NetBSD: resourcevar.h,v 1.24 2005/02/03 19:20:02 perry Exp $   */
    2 
    3 /*
    4  * Copyright (c) 1991, 1993
    5  *      The Regents of the University of California.  All rights reserved.
    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  * 1. Redistributions of source code must retain the above copyright
   11  *    notice, this list of conditions and the following disclaimer.
   12  * 2. Redistributions in binary form must reproduce the above copyright
   13  *    notice, this list of conditions and the following disclaimer in the
   14  *    documentation and/or other materials provided with the distribution.
   15  * 3. Neither the name of the University nor the names of its contributors
   16  *    may be used to endorse or promote products derived from this software
   17  *    without specific prior written permission.
   18  *
   19  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   20  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   22  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   23  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   24  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   25  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   27  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   28  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   29  * SUCH DAMAGE.
   30  *
   31  *      @(#)resourcevar.h       8.4 (Berkeley) 1/9/95
   32  */
   33 
   34 #ifndef _SYS_RESOURCEVAR_H_
   35 #define _SYS_RESOURCEVAR_H_
   36 
   37 /*
   38  * Kernel per-process accounting / statistics
   39  * (not necessarily resident except when running).
   40  */
   41 struct pstats {
   42 #define pstat_startzero p_ru
   43         struct  rusage p_ru;            /* stats for this proc */
   44         struct  rusage p_cru;           /* sum of stats for reaped children */
   45 #define pstat_endzero   pstat_startcopy
   46 
   47 #define pstat_startcopy p_timer
   48         struct  itimerval p_timer[3];   /* virtual-time timers */
   49 
   50         struct uprof {                  /* profile arguments */
   51                 caddr_t pr_base;        /* buffer base */
   52                 size_t  pr_size;        /* buffer size */
   53                 u_long  pr_off;         /* pc offset */
   54                 u_int   pr_scale;       /* pc scaling */
   55                 u_long  pr_addr;        /* temp storage for addr until AST */
   56                 u_long  pr_ticks;       /* temp storage for ticks until AST */
   57         } p_prof;
   58 #define pstat_endcopy   p_start
   59         struct  timeval p_start;        /* starting time */
   60 };
   61 
   62 /*
   63  * Kernel shareable process resource limits.  Because this structure
   64  * is moderately large but changes infrequently, it is normally
   65  * shared copy-on-write after forks.  If a group of processes
   66  * ("threads") share modifications, the PL_SHAREMOD flag is set,
   67  * and a copy must be made for the child of a new fork that isn't
   68  * sharing modifications to the limits.
   69  */
   70 struct plimit {
   71         struct  rlimit pl_rlimit[RLIM_NLIMITS];
   72         char    *pl_corename;
   73 #define PL_SHAREMOD     0x01            /* modifications are shared */
   74         int     p_lflags;
   75         int     p_refcnt;               /* number of references */
   76         struct simplelock p_slock;      /* mutex for p_refcnt */
   77 };
   78 
   79 /* add user profiling from AST */
   80 #define ADDUPROF(p)                                                     \
   81         do {                                                            \
   82                 addupc_task(p,                                          \
   83                     (p)->p_stats->p_prof.pr_addr,                       \
   84                     (p)->p_stats->p_prof.pr_ticks);                     \
   85                 (p)->p_stats->p_prof.pr_ticks = 0;                      \
   86         } while (/* CONSTCOND */ 0)
   87 
   88 #ifdef _KERNEL
   89 /*
   90  * Structure associated with user caching.
   91  */
   92 struct uidinfo {
   93         LIST_ENTRY(uidinfo) ui_hash;
   94         uid_t   ui_uid;
   95         long    ui_proccnt;     /* Number of processes */
   96         rlim_t  ui_sbsize;      /* socket buffer size */
   97 
   98 };
   99 #define UIHASH(uid)     (&uihashtbl[(uid) & uihash])
  100 extern LIST_HEAD(uihashhead, uidinfo) *uihashtbl;
  101 extern u_long uihash;           /* size of hash table - 1 */
  102 int       chgproccnt(uid_t, int);
  103 int       chgsbsize(uid_t, u_long *, u_long, rlim_t);
  104 
  105 extern char defcorename[];
  106 void     addupc_intr(struct proc *, u_long);
  107 void     addupc_task(struct proc *, u_long, u_int);
  108 void     calcru(struct proc *, struct timeval *, struct timeval *,
  109             struct timeval *);
  110 struct plimit *limcopy(struct plimit *);
  111 void limfree(struct plimit *);
  112 void    ruadd(struct rusage *, struct rusage *);
  113 struct  pstats *pstatscopy(struct pstats *);
  114 void    pstatsfree(struct pstats *);
  115 extern rlim_t maxdmap;
  116 extern rlim_t maxsmap;
  117 #endif
  118 #endif  /* !_SYS_RESOURCEVAR_H_ */

Cache object: 54df7885be6bf34d1847c181c2eeb47f


[ 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.