home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ocl150a.zip / OCL / Include / OProcStat.h < prev    next >
C/C++ Source or Header  |  1996-09-22  |  10KB  |  222 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. #ifdef INCL_OCLDOSGETINFOSEG
  147.  
  148. // 16-Bit DosGetInfoSeg 
  149.  
  150. typedef struct _GINFOSEG {
  151.    ULONG   time;               /* time in seconds */
  152.    ULONG   msecs;              /* milliseconds    */
  153.    UCHAR   hour;               /* hours */
  154.    UCHAR   minutes;            /* minutes */
  155.    UCHAR   seconds;            /* seconds */
  156.    UCHAR   hundredths;         /* hundredths */
  157.    USHORT  timezone;           /* minutes from UTC */
  158.    USHORT  cusecTimerInterval; /* timer interval (units = 0.0001 seconds) */
  159.    UCHAR   day;                /* day */
  160.    UCHAR   month;              /* month */
  161.    USHORT  year;               /* year */
  162.    UCHAR   weekday;            /* day of week */
  163.    UCHAR   uchMajorVersion;    /* major version number */
  164.    UCHAR   uchMinorVersion;    /* minor version number */
  165.    UCHAR   chRevisionLetter;   /* revision letter */
  166.    UCHAR   sgCurrent;          /* current foreground session */
  167.    UCHAR   sgMax;              /* maximum number of sessions */
  168.    UCHAR   cHugeShift;         /* shift count for huge elements */
  169.    UCHAR   fProtectModeOnly;   /* protect mode only indicator */
  170.    USHORT  pidForeground;      /* pid of last process in foreground session */
  171.    UCHAR   fDynamicSched;      /* dynamic variation flag */
  172.    UCHAR   csecMaxWait;        /* max wait in seconds */
  173.    USHORT  cmsecMinSlice;      /* minimum timeslice (milliseconds) */
  174.    USHORT  cmsecMaxSlice;      /* maximum timeslice (milliseconds) */
  175.    USHORT  bootdrive;          /* drive from which the system was booted */
  176.    UCHAR   amecRAS[32];        /* system trace major code flag bits */
  177.    UCHAR   csgWindowableVioMax;/* maximum number of VIO windowable sessions */
  178.    UCHAR   csgPMMax;           /* maximum number of pres. services sessions */
  179. } GINFOSEG;
  180.  
  181. typedef GINFOSEG *PGINFOSEG;
  182.  
  183. typedef struct _LINFOSEG {
  184.    PID     pidCurrent;        /* current process id */
  185.    PID     pidParent;         /* process id of parent */
  186.    USHORT  prtyCurrent;       /* priority of current thread */
  187.    TID     tidCurrent;        /* thread ID of current thread */
  188.    USHORT  sgCurrent;         /* session */
  189.    UCHAR   rfProcStatus;      /* process status */
  190.    UCHAR   dummy1;
  191.    BOOL    fForeground;       /* current process has keyboard focus */
  192.    UCHAR   typeProcess;       /* process type */
  193.    UCHAR   dummy2;
  194.    SEL     selEnvironment;    /* environment selector */
  195.    USHORT  offCmdLine;        /* command line offset */
  196.    USHORT  cbDataSegment;     /* length of data segment */
  197.    USHORT  cbStack;           /* stack size */
  198.    USHORT  cbHeap;            /* heap size */
  199.    HMODULE hmod;              /* module handle of the application */
  200.    SEL     selDS;             /* data segment handle of the application */
  201. } LINFOSEG;
  202.   
  203. typedef LINFOSEG *PLINFOSEG;
  204.  
  205. #define MAKEPGINFOSEG(sel) ((PGINFOSEG)MAKEP(sel, 0))
  206. #define MAKEPLINFOSEG(sel) ((PLINFOSEG)MAKEP(sel, 0))
  207. #define DosGetInfoSeg Dos16GetInfoSeg
  208.  
  209. extern "C" 
  210. {
  211.  APIRET16 APIENTRY16 DosGetInfoSeg(PSEL GlobalSeg, PSEL LocalSeg);
  212.  
  213. #endif // INCL_OCLDOSGETINFOSEG
  214.  
  215. #pragma pack()
  216.  
  217.  
  218. #endif // OSYSTEMH_INCLUDED
  219.  
  220. /* end of source */
  221.