home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / oclsrc15.zip / OCL / Include / OProcStat.h < prev    next >
C/C++ Source or Header  |  1996-08-12  |  7KB  |  152 lines

  1. // OCL - OS/2 Class Library
  2. // (c) Cubus 1995
  3. // All Rights Reserved
  4. // OProcStat.h
  5.  
  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. Neither the name Cubus nor the name Team OCL may be used to
  13.  *    endorse or promote products derived from this software
  14.  *    without specific prior written permission.
  15.  * 3. See OCL.INF for a detailed copyright notice.
  16.  *
  17.  *              THIS SOFTWARE IS PROVIDED ``AS IS'' AND
  18.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  19.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  20.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  21.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  22.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  23.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  24.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  25.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  26.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  27.  * SUCH DAMAGE.
  28.  */
  29.  
  30. // $Header: W:/Projects/OCL/Include/rcs/OProcStat.h 1.50 1996/08/11 23:47:27 B.STEIN Release $
  31.  
  32. #ifndef OSYSTEMH_INCLUDED
  33.   #define OSYSTEMH_INCLUDED
  34.  
  35.  
  36.  
  37. #define PROCESS_END_INDICATOR   3       /* Indicates end of process structs */
  38. #define PROCSTAT_BUFFER_SIZE    65536
  39.  
  40.  
  41.  
  42. #pragma pack(1)
  43.  
  44. extern "C" 
  45. {
  46.    APIRET APIENTRY DosQuerySysState(ULONG ul1, ULONG ul2,
  47.                                     ULONG ul3, ULONG ul4,
  48.                                     PBYTE buf, ULONG bufsize);
  49. }
  50.  
  51.  
  52. typedef struct qsGrec_s {
  53.         ULONG         cThrds;    /* number of threads in use */
  54.         ULONG         cProcs;    /* number of processes */
  55.         ULONG         cModule;   /* number of modules */
  56. } qsGrec_t;
  57.  
  58. typedef struct qsTrec_s {
  59.         ULONG         RecType;        /* Record Type */
  60.                                       /* Thread rectype = 100 */
  61.         USHORT        tid;            /* thread ID */
  62.         USHORT        slot;           /* "unique" thread slot number */
  63.         ULONG         sleepid;        /* sleep id thread is sleeping on */
  64.         ULONG         priority;       /* thread priority */
  65.         ULONG         systime;        /* thread system time */
  66.         ULONG         usertime;       /* thread user time */
  67.         UCHAR         state;          /* thread state */
  68.         CHAR          pad1;
  69.         SHORT         pad2;
  70. } qsTrec_t;
  71.  
  72. typedef struct qsPrec_s {
  73.         ULONG         RecType;        /* type of record being processed */
  74.                                       /* process rectype = 1            */
  75.         qsTrec_t  FAR   *pThrdRec;    /* ptr to 1st thread rec for this prc*/
  76.         USHORT        pid;            /* process ID */
  77.         USHORT        ppid;           /* parent process ID */
  78.         ULONG         type;           /* process type */
  79.         ULONG         stat;           /* process status */
  80.         ULONG         sgid;           /* process screen group */
  81.         USHORT        hMte;           /* program module handle for process */
  82.         USHORT        cTCB;           /* # of TCBs in use in process */
  83.         ULONG         Reserved1;
  84.         void    FAR   *Reserved2;
  85.         USHORT        c16Sem;         /*# of 16 bit system sems in use by proc*/
  86.         USHORT        cLib;           /* number of runtime linked libraries */
  87.         USHORT        cShrMem;        /* number of shared memory handles */
  88.         USHORT        Reserved3;
  89.         USHORT  FAR   *p16SemRec;     /*ptr to head of 16 bit sem inf for proc*/
  90.         USHORT  FAR   *pLibRec;       /*ptr to list of runtime lib in use by  */
  91.                                       /*process*/
  92.         USHORT  FAR   *pShrMemRec;    /*ptr to list of shared mem handles in  */
  93.                                       /*use by process*/
  94.         USHORT  FAR   Reserved4;
  95. } qsPrec_t;
  96.  
  97. typedef struct qsS16Headrec_s {
  98.         ULONG         SRecType;   /* semaphore rectype = 3 */
  99.         ULONG         Reserved1;  /* overlays NextRec of 1st qsS16rec_t*/
  100.         ULONG         Reserved2;
  101.         ULONG         S16TblOff;  /* index of first semaphore,SEE PSTAT OUTPUT*/
  102.                                   /* System Semaphore Information Section     */
  103. } qsS16Headrec_t;
  104.  
  105. typedef struct qsS16rec_s {
  106.         ULONG           NextRec;          /* offset to next record in buffer*/
  107.         UINT            s_SysSemOwner ;   /* thread owning this semaphore   */
  108.         UCHAR           s_SysSemFlag ;    /* system semaphore flag bit field*/
  109.         UCHAR           s_SysSemRefCnt ;  /* number of references to this   */
  110.                                           /*   system semaphore             */
  111.         UCHAR           s_SysSemProcCnt ; /*number of requests by sem owner*/
  112.         UCHAR           Reserved1;
  113.         ULONG           Reserved2;
  114.         UINT            Reserved3;
  115.         CHAR            SemName;          /* start of semaphore name string */
  116. } qsS16rec_t;
  117.  
  118. typedef struct qsLrec_s {
  119.         qsLrec_s  FAR *pNextRec;    /* pointer to next record in buffer */
  120.         USHORT        hmte;           /* handle for this mte */
  121.         USHORT        Reserved1;      /* Reserved */
  122.         ULONG         ctImpMod;       /* # of imported modules in table */
  123.         ULONG         Reserved2;      /* Reserved */
  124.         void      FAR *Reserved3;   /* Reserved */
  125.         UCHAR     FAR *pName;         /* ptr to name string following stru*/
  126. } qsLrec_t;
  127.  
  128. typedef struct qsMrec_s {
  129.         ULONG         MemNextRec;       /* offset to next record in buffer */
  130.         USHORT        hmem;             /* handle for shared memory */
  131.         USHORT        sel;              /* shared memory selector */
  132.         USHORT        refcnt;           /* reference count */
  133.         CHAR          Memname;          /* start of shared memory name string */
  134. } qsMrec_t;
  135.  
  136. typedef struct qsPtrRec_s {
  137.         qsGrec_t        *pGlobalRec;    /* ptr to the global data section */
  138.         qsPrec_t        *pProcRec;      /* ptr to process record section  */
  139.         qsS16Headrec_t  *p16SemRec;     /* ptr to 16 bit sem section      */
  140.         ULONG           Reserved;
  141.         qsMrec_t        *pShrMemRec;    /* ptr to shared mem section      */
  142.         qsLrec_t        *pLibRec;       /*ptr to exe module record section*/
  143. } qsPtrRec_t;
  144.  
  145.  
  146. #pragma pack()
  147.  
  148.  
  149. #endif // OSYSTEMH_INCLUDED
  150.  
  151. /* end of source */
  152.