home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s053 / 8.ddi / usr / include / sys / kmacct.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-08  |  2.7 KB  |  89 lines

  1. /*    Copyright (c) 1990 UNIX System Laboratories, Inc.    */
  2. /*    Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T    */
  3. /*      All Rights Reserved      */
  4.  
  5. /*    THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF         */
  6. /*    UNIX System Laboratories, Inc.                         */
  7. /*    The copyright notice above does not evidence any       */
  8. /*    actual or intended publication of such source code.    */
  9.  
  10. #ident    "@(#)/usr/include/sys/kmacct.h.sl 1.1 4.0 12/08/90 23559 AT&T-USL"
  11. /*
  12.  * Kernel Memory Allocator accounting package
  13.  */
  14.  
  15. /*
  16.  * Command types for KMACCT ioctl()
  17.  */
  18.  
  19. #define    KMACCT_ON    1    /* Turn KMEM accounting on */
  20. #define    KMACCT_OFF    2    /* Turn KMEM accounting off */
  21. #define    KMACCT_ZERO    3    /* Zero the counters */
  22. #define    KMACCT_SIZE    4    /* Return size of accounting data */
  23. #define    KMACCT_NDICT    5    /* Return number of dictionary entries */
  24. #define    KMACCT_DEPTH    6    /* Return depth of trace stack */
  25. #define    KMACCT_STATE    7    /* Return state of accounting (on or off) */
  26.  
  27. /*
  28.  * The kernel text start address and kernel text length parameters should
  29.  * agree with the kernel text origin and length values given in the
  30.  * kernel ifile.  These are used to detect when we traced back out of
  31.  * the kernel stack.
  32.  */
  33.  
  34. #define    KTXTSTRT    KVSBASE
  35. #define    KTXTLEN        0x00400000
  36.  
  37. /*
  38.  * The number of different sizes to track should agree with the 
  39.  * number of sizes allocatable by KMEM; in 4.0 this includes all
  40.  * sizes in powers of 2 from 16 to 4096, plus outsize requests
  41.  * greater than 4096 bytes.
  42.  */
  43.  
  44. #define    KMSIZES        10
  45.  
  46. /*
  47.  * MAXDEPTH is the maximum amount of stack that we can trace back through.
  48.  * The master.d tunable must be no greater than MAXDEPTH.
  49.  */
  50.  
  51. #define    MAXDEPTH    10    
  52.  
  53. /*
  54.  * Calling sequence symbol table structure.
  55.  * Note: if this structure changes, so must master.d/kmacct.  Also, *next
  56.  * pointer must be first item in structure so hash chain will work.
  57.  */
  58.  
  59. struct    kmasym {
  60.     struct kmasym    *next;        /* Next structure on hash chain */
  61.     caddr_t        *pc;        /* Pointer to pc calling sequence */
  62.     ulong        reqa[KMSIZES];    /* Requests to allocate in each class */
  63.     ulong        reqf[KMSIZES];    /* Requests to free in each class */
  64.     };
  65.  
  66. typedef    struct kmasym    kmasym_t;
  67.  
  68. /*
  69.  * Header for allocated buffers.  Each buffer that has been allocated while
  70.  * accounting is enabled has a buffer header associated with it.
  71.  */
  72.  
  73. struct    kmabuf    {
  74.     struct    kmabuf    *next;    /* Next header in hash chain or free list */
  75.     struct    kmabuf    *prev;    /* Previous header in hash chain */
  76.     caddr_t        *addr;    /* Address of this buffer */
  77.     kmasym_t    *kp;    /* Pointer to  dictionary entry */
  78.     };
  79.  
  80. typedef    struct kmabuf    kmabuf_t;
  81.  
  82. /*
  83.  * Calls to kmaccount() must identify whether they are allocating
  84.  * or freeing space.
  85.  */
  86.  
  87. #define    KMACCT_ALLOC    0x0100
  88. #define    KMACCT_FREE    0x0200
  89.