home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / sd386v50.zip / sd386src.zip / QPROC.H < prev    next >
Text File  |  1994-10-19  |  30KB  |  426 lines

  1. /*****************************************************************************/
  2. /* File:                                                                     */
  3. /*   qproc.h                                                                 */
  4. /*                                                                           */
  5. /* Description:                                                              */
  6. /*                                                                           */
  7. /*   Header file for the undocumented(currently) DosQProcStatus() call.      */
  8. /*                                                                           */
  9. /* History:                                                                  */
  10. /*                                                                           */
  11. /*   03/08/94 Created                                                        */
  12. /*                                                                           */
  13. /*...                                                                        */
  14. /*... 05/05/94  919   Joe   Add child process support.                       */
  15. /*...                                                                        */
  16. /*****************************************************************************/
  17.  
  18. /*****************************************************************************/
  19. /* DosQProcStatus() prototype.                                               */
  20. /*                                                                           */
  21. /*       buffer - is a pointer to a buffer that will be filled with system   */
  22. /*                resource summary information records                       */
  23. /*                                                                           */
  24. /*                                                                           */
  25. /*  buffer_size - is the size of the buffer in bytes (the maximum value of   */
  26. /*                64KB is typically the safest sized buffer to use since     */
  27. /*                it is impossible to predict how much information a         */
  28. /*                DosQProcStatus call will return)                           */
  29. /*                                                                           */
  30. /*****************************************************************************/
  31. APIRET16 APIENTRY16 DosQProcStatus(ULONG *buffer , USHORT buffer_size );
  32.  
  33. /*---------------------------------------------------------------------------*/
  34. /* Pointer Record Section                                                    */
  35. /*                                                                           */
  36. /* The following pointer record structure is the first section in the        */
  37. /* buffer.  It contains pointers to the heads of the system resource         */
  38. /* information sections.                                                     */
  39. /*****************************************************************************/
  40. typedef struct qsPtrRec_s
  41. {
  42.  struct qsGrec_t        *pGlobalRec;    /* ptr to the global data section    */
  43.  struct qsPrec_t        *pProcRec;      /* ptr to process record section     */
  44.  struct qsS16Headrec_t  *p16SemRec;     /* ptr to 16 bit sem section         */
  45.  ULONG  reserved;
  46.  struct qsMrec_t        *pShrMemRec;    /* ptr to shared mem section         */
  47.  struct qsLrec_t        *pLibRec;       /* ptr to exe module recrd section   */
  48. } qsPtrRec_t;
  49.  
  50. /*---------------------------------------------------------------------------*/
  51. /* Global Data Section                                                       */
  52. /*                                                                           */
  53. /* The following C language structure defines the information contained      */
  54. /* within the global data section that describes global system information.  */
  55. /*****************************************************************************/
  56. typedef struct qsGrec_s
  57. {
  58.  ULONG         cThrds;                     /* number of threads in use       */
  59.  ULONG         Reserved1;
  60.  ULONG         Reserved2;
  61. }qsGrec_t;
  62.  
  63. /*---------------------------------------------------------------------------*/
  64. /* Process Data Section                                                      */
  65. /*                                                                           */
  66. /* The following C language declarations define the information contained    */
  67. /* within the system resource summary information record that describes an   */
  68. /* OS/2 process.  Each process record is immediately followed by one or      */
  69. /* more thread records for the given process.  The pointer qsTrec_t points   */
  70. /* to the first thread record structure for the process.                     */
  71. /*                                                                           */
  72. /*                                                                           */
  73. /* Process Record structure                                                  */
  74. /*      Holds all per process information.                                   */
  75. /*      ________________________________                                     */
  76. /*      |       RecType  (=0x00000001)  |                                    */
  77. /*      |-------------------------------|                                    */
  78. /*      |       pThrdRec                |----|                               */
  79. /*      |-------------------------------|    |                               */
  80. /*      |       pid                     |    |                               */
  81. /*      |-------------------------------|    |                               */
  82. /*      |       ppid                    |    |                               */
  83. /*      |-------------------------------|    |                               */
  84. /*      |       type                    |    |                               */
  85. /*      |-------------------------------|    |                               */
  86. /*      |       stat                    |    |                               */
  87. /*      |-------------------------------|    |                               */
  88. /*      |       sgid                    |    |                               */
  89. /*      |-------------------------------|    |                               */
  90. /*      |       hMte                    |    |                               */
  91. /*      |-------------------------------|    |                               */
  92. /*      |       cTCB                    |    |                               */
  93. /*      |-------------------------------|    |                               */
  94. /*      |       c16Sem                  |    |                               */
  95. /*      |-------------------------------|    |                               */
  96. /*      |       cLib                    |    |                               */
  97. /*      |-------------------------------|    |                               */
  98. /*      |       cShrMem                 |    |                               */
  99. /*      |-------------------------------|    |                               */
  100. /*      |       p16SemRec               |----|--------|                      */
  101. /*      |-------------------------------|    |        |                      */
  102. /*      |       pLibRec                 |----|--------|------|               */
  103. /*      |-------------------------------|    |        |      |               */
  104. /*      |       pShrMemRec              |----|--------|------|----|          */
  105. /*      |-------------------------------|    |        |      |    |          */
  106. /*      |       16SemIndxì0┘            |<---|--------|      |    |          */
  107. /*      |          .                    |    |               |    |          */
  108. /*      |          .                    |    |               |    |          */
  109. /*      |          .                    |    |               |    |          */
  110. /*      |       16SemIndxìc16Sem-1┘     |    |               |    |          */
  111. /*      |-------------------------------|    |               |    |          */
  112. /*      |       hmteì0┘ (or "name str") |<---|---------------|    |          */
  113. /*      |          .                    |    |                    |          */
  114. /*      |          .                    |    |                    |          */
  115. /*      |          .                    |    |                    |          */
  116. /*      |       hmteìcLib-1┘            |    |                    |          */
  117. /*      |-------------------------------|    |                    |          */
  118. /*      |       hshmemì0┘               |<---|--------------------|          */
  119. /*      |          .                    |    |                               */
  120. /*      |          .                    |    |                               */
  121. /*      |          .                    |    |                               */
  122. /*      |       hshmemìcShrMem-1┘       |    |                               */
  123. /*      |-------------------------------|    |                               */
  124. /*       * refer to thread rec structure<-----                               */
  125. /*                                                                           */
  126. /*                                                                           */
  127. /* The pLibRec value points to an array of mte handles that                  */
  128. /* indicate the DLL modules that are directly referred to by the             */
  129. /* process (.EXE) program file module.  The cLib value indicates             */
  130. /* how many dynamic link library module handles are in the array.            */
  131. /*                                                                           */
  132. /* The pShrMemRec value points to an array of shared memory                  */
  133. /* handles that indicate the shared memory segments that are being           */
  134. /* used by the process.  The cShrMem value indicates how many                */
  135. /* shared memory segment handles are in the array.                           */
  136. /*                                                                           */
  137. /* The p16SemRec value points to an array of 16 bit system                   */
  138. /* semaphore indices that indicate the 16 bit system semaphores              */
  139. /* that are being used by the process.  The c16Sem value indicates           */
  140. /* how many 16 bit system semaphore indices are in the array.                */
  141. /*                                                                           */
  142. /* The status flag gives an indication of the current status of a            */
  143. /* process.  The following list defines the possible values for              */
  144. /* the status flag:                                                          */
  145. /*                                                                           */
  146. /*    0x01 - Doing ExitList Processing                                       */
  147. /*    0x02 - Exiting thread 1                                                */
  148. /*    0x04 - The whole process is exiting                                    */
  149. /*    0x10 - Parent cares about termination                                  */
  150. /*    0x20 - Parent did an exec-and-wait                                     */
  151. /*    0x40 - Process is dying                                                */
  152. /*    0x80 - Process in embryonic state                                      */
  153. /*                                                                           */
  154. /*****************************************************************************/
  155. typedef struct qsPrec_s
  156. {
  157.  ULONG                RecType;          /* type of record being processed    */
  158.                                         /* process rectype = 1               */
  159.  struct qsTrec_t FAR *pThrdRec;         /* ptr to 1st thread rec for this prc*/
  160.  USHORT               pid;              /* process ID                        */
  161.  USHORT               ppid;             /* parent process ID                 */
  162.  ULONG                type;             /* process type                      */
  163.  ULONG                stat;             /* process status                    */
  164.  ULONG                sgid;             /* process screen group              */
  165.  USHORT               hMte;             /* program module handle for process */
  166.  USHORT               cTCB;             /* # of TCBs in use in process       */
  167.  ULONG                Reserved1;
  168.  ULONG                Reserved2;
  169.  USHORT               c16Sem;           /*# of 16 bit system sems in use     */
  170.  USHORT               cLib;             /* number of runtime linked libs     */
  171.  USHORT               cShrMem;          /* number of shared memory handles   */
  172.  USHORT               Reserved3;
  173.  USHORT   FAR        *p16SemRec;        /*ptr to head of 16 bit sem inf      */
  174.  USHORT   FAR        *pLibRec;          /*ptr to list of runtime libs        */
  175.  USHORT   FAR        *pShrMemRec;       /*ptr to list of shared mem handles  */
  176.  USHORT   FAR         Reserved4;
  177. }qsPrec_t;
  178.  
  179. /*---------------------------------------------------------------------------*/
  180. /* Thread Data Section                                                       */
  181. /*                                                                           */
  182. /* The following C language declarations define the information contained    */
  183. /* within the system resource summary information record that describes an   */
  184. /* OS/2 thread:                                                              */
  185. /*                                                                           */
  186. /*     Thread Record Structure                                               */
  187. /*     ________________________________                                      */
  188. /*     |       RecType  (=0x00000100)  |----|                                */
  189. /*     |-------------------------------|    |                                */
  190. /*     |       tid                     |    |                                */
  191. /*     |-------------------------------|    |                                */
  192. /*     |       slot                    |    |                                */
  193. /*     |-------------------------------|    |                                */
  194. /*     |       sleepid                 |    |                                */
  195. /*     |-------------------------------|    |                                */
  196. /*     |       priority                |    |                                */
  197. /*     |-------------------------------|    |                                */
  198. /*     |       systime                 |    |                                */
  199. /*     |-------------------------------|    |                                */
  200. /*     |       usertime                |    |                                */
  201. /*     |-------------------------------|    |                                */
  202. /*     |       state                   |    |                                */
  203. /*     |-------------------------------|    |                                */
  204. /*                                 <--------|                                */
  205. /*                                                                           */
  206. /*                                                                           */
  207. /* The thread slot number is an internal OS/2 thread identifier.             */
  208. /* OS/2 must uniquely identify all threads within the system.                */
  209. /*                                                                           */
  210. /* The state value gives an indication of the current state of a             */
  211. /* thread.                                                                   */
  212. /*                                                                           */
  213. /* The following list defines some typical thread state values:              */
  214. /*                                                                           */
  215. /*    1 - Ready to run                                                       */
  216. /*    2 - Blocked                                                            */
  217. /*    5 - Running                                                            */
  218. /*                                                                           */
  219. /*****************************************************************************/
  220. typedef struct qsTrec_t
  221. {
  222.  ULONG    RecType;                      /* Record Type                       */
  223.                                         /* Thread rectype = 100              */
  224.  USHORT   tid;                          /* thread ID                         */
  225.  USHORT   slot;                         /* "unique" thread slot number       */
  226.  ULONG    sleepid;                      /* sleep id thread is sleeping on    */
  227.  ULONG    priority;                     /* thread priority                   */
  228.  ULONG    systime;                      /* thread system time                */
  229.  ULONG    usertime;                     /* thread user time                  */
  230.  UCHAR    state;                        /* thread state                      */
  231.  CHAR     pad1;
  232.  SHORT    pad2;
  233. }qsTrec_t;
  234.  
  235. /*---------------------------------------------------------------------------*/
  236. /* 16 Bit Semaphore Section                                                  */
  237. /*                                                                           */
  238. /* The following C language declarations define the information contained    */
  239. /* within the system resource summary information record that is the first   */
  240. /* record in the 16 bit system semaphore record section of the DosQProcStatus*/
  241. /* buffer.                                                                   */
  242. /*                                                                           */
  243. /*    16 bit System Semaphore Header Record Structure                        */
  244. /*      ________________________________                                     */
  245. /*      |       qsS16Headrec            |                                    */
  246. /*      |-------------------------------|                                    */
  247. /*      |       qsS16rec_s              |____                                */
  248. /*      |_______________________________|    |                               */
  249. /*      |                               |<---|                               */
  250. /*      |       qsS16rec_s              |----                                */
  251. /*      |______________________________ |   |                                */
  252. /*      |                               |<--|                                */
  253. /*      |       qsS16rec_s              |____                                */
  254. /*      |_______________________________|   |                                */
  255. /*      |            .                  |<--|                                */
  256. /*      |-------------------------------|                                    */
  257. /*                                                                           */
  258. /*                                                                           */
  259. /*                                                                           */
  260. /*                                                                           */
  261. /* The following C language declarations define the 16 bit system            */
  262. /* semaphore records:                                                        */
  263. /*                                                                           */
  264. /*    16 bit System Semaphore Record Structure                               */
  265. /*      ________________________________                                     */
  266. /*      |       pNextRec                |----|                               */
  267. /*      |-------------------------------|    |                               */
  268. /*      |                               |    |                               */
  269. /*      |       SysSemOwner             |    |                               */
  270. /*      |       SysSemFlag              |    |                               */
  271. /*      |       SysSemRecCnt            |    |                               */
  272. /*      |       SysSemProcCnt           |    |                               */
  273. /*      |                               |    |                               */
  274. /*      |-------------------------------|    |                               */
  275. /*      |SemName:                       |    |                               */
  276. /*      |       "pathname"              |    |                               */
  277. /*      |-------------------------------|    |                               */
  278. /*                                      <-----                               */
  279. /*                                                                           */
  280. /*                                                                           */
  281. /* The s_SysSemOwner is the slot ID of the semaphore's owner                 */
  282. /*                                                                           */
  283. /* The s_SysSemFlag is the system semaphore flag bit field which             */
  284. /* describes the type or action the semaphore is performing.                 */
  285. /*                                                                           */
  286. /* The s_SysSemRecCnt is the number of references to a specific              */
  287. /* semaphore.                                                                */
  288. /*                                                                           */
  289. /* The SemName value is actually the first byte of an ASCIIZ                 */
  290. /* string that is the complete pathname of the 16 bit system                 */
  291. /* semaphore.                                                                */
  292. /*                                                                           */
  293. /*****************************************************************************/
  294. typedef struct qsS16Headrec_s
  295. {
  296.  ULONG SRecType;                        /* semaphore rectype = 3             */
  297.  ULONG Reserved1;                       /* overlays NextRec of 1st qsS16rec_t*/
  298.  ULONG Reserved2;
  299.  ULONG S16TblOff;                       /* index of first semaphore,         */
  300.                                         /* SEE PSTAT OUTPUT                  */
  301.                                         /* System Semaphore Info Section     */
  302. }qsS16Headrec_t;
  303.  
  304. typedef struct qsS16rec_s
  305. {
  306.  ULONG  NextRec;                        /* offset to next record in buffer   */
  307.  USHORT s_SysSemOwner;                  /* thread owning this semaphore      */
  308.  UCHAR  s_SysSemFlag;                   /* system semaphore flag bit field   */
  309.  UCHAR  s_SysSemRefCnt;                 /* number of references to this      */
  310.                                         /*   system semaphore                */
  311.  UCHAR  s_SysSemProcCnt;                /*number of requests by sem owner    */
  312.  UCHAR  Reserved1;
  313.  UCHAR  Reserved2;
  314.  UCHAR  Reserved3;
  315.  union
  316.  {
  317.   USHORT SemIndex;                      /* start of semaphore index.         */
  318.   struct
  319.   {
  320.    UCHAR  DontCare;
  321.    UCHAR  SemName;                      /* start of semaphore name string.   */
  322.   }SemName;
  323.  }s_SysSemNameIndex;
  324. } qsS16rec_t;
  325.  
  326. /*---------------------------------------------------------------------------*/
  327. /* Executable Module Section                                                 */
  328. /*                                                                           */
  329. /* The following C language declarations define the information contained    */
  330. /* within the system resource summary information record that describes an   */
  331. /* OS/2 DLL module:                                                          */
  332. /*                                                                           */
  333. /*      System wide MTE information                                          */
  334. /*      ________________________________                                     */
  335. /*      |       pNextRec                |----|                               */
  336. /*      |-------------------------------|    |                               */
  337. /*      |       hmte                    |    |                               */
  338. /*      |-------------------------------|    |                               */
  339. /*      |       ctImpMod                |    |                               */
  340. /*      |-------------------------------|    |                               */
  341. /*      |       Reserved                |    |                               */
  342. /*      |-------------------------------|    |                               */
  343. /*      |       Reserved                |    |                               */
  344. /*      |-------------------------------|    |                               */
  345. /*      |       pName                   |----|----|                          */
  346. /*      |-------------------------------|    |    |                          */
  347. /*      |       imported module handles |    |    |                          */
  348. /*      |          .                    |    |    |                          */
  349. /*      |          .                    |    |    |                          */
  350. /*      |          .                    |    |    |                          */
  351. /*      |-------------------------------| <--|----|                          */
  352. /*      |       "pathname"              |    |                               */
  353. /*      |_______________________________|    |                               */
  354. /*                                      <-----                               */
  355. /*                                                                           */
  356. /*                                                                           */
  357. /*                                                                           */
  358. /*                                                                           */
  359. /* The hmte value is a unique identifier that identifies this DLL            */
  360. /* module.                                                                   */
  361. /*                                                                           */
  362. /* The ctImpMod value indicates how many other DLL's this module             */
  363. /* statically references.  The ctImpMod value does not take into             */
  364. /* account any DLL's that were dynamically linked at run time.               */
  365. /*                                                                           */
  366. /* The pName value is a 16 bit pointer that points to an ASCIIZ              */
  367. /* string that follows the DLL module record.  The string contains           */
  368. /* the pathname of the DLL module.                                           */
  369. /*                                                                           */
  370. /*****************************************************************************/
  371. typedef struct qsLrec_s
  372. {
  373.  void   FAR   *pNextRec;                /* pointer to next record in buffer  */
  374.  USHORT        hmte;                    /* handle for this mte               */
  375.  USHORT        Reserved;                /* Reserved                          */
  376.  ULONG         ctImpMod;                /* # of imported modules in table    */
  377.  ULONG         Reserved1;               /* Reserved                          */
  378.  ULONG         Reserved2;               /* Reserved                          */
  379.  UCHAR  FAR   *pName;                   /* ptr to name string following stru */
  380.  USHORT        ImpModTable;             /* first imported module handle.     */
  381. } qsLrec_t;
  382.  
  383. /*---------------------------------------------------------------------------*/
  384. /* Executable Module Section                                                 */
  385. /*                                                                           */
  386. /* The following C language declarations define the information contained    */
  387. /* within the system resource summary information record that describes an   */
  388. /* OS/2 shared memory segment:                                               */
  389. /*                                                                           */
  390. /*     Shared Mem Record Structure                                           */
  391. /*     ________________________________                                      */
  392. /*     |       pNextRec                |----                                 */
  393. /*     |-------------------------------|    |                                */
  394. /*     |       hmem                    |    |                                */
  395. /*     |-------------------------------|    |                                */
  396. /*     |       sel                     |    |                                */
  397. /*     |-------------------------------|    |                                */
  398. /*     |       refcnt                  |    |                                */
  399. /*     |-------------------------------|    |                                */
  400. /*     |       Memname                 |    |                                */
  401. /*     |_______________________________|    |                                */
  402. /*                                     <----                                 */
  403. /*                                                                           */
  404. /*                                                                           */
  405. /* Like the 16 bit system semaphore record, the shared memory segment record */
  406. /* contains its full ASCIIZ string pathname at the end of the record.        */
  407. /*****************************************************************************/
  408. typedef struct qsMrec_s
  409. {
  410.  ULONG  pNextRec;                       /* offset to next record in buffer   */
  411.  USHORT hmem;                           /* handle for shared memory          */
  412.  USHORT sel;                            /* shared memory selector            */
  413.  USHORT refcnt;                         /* reference count                   */
  414.  CHAR   Memname;                        /* start of shared memory name string*/
  415. } qsMrec_t;
  416.  
  417. /*****************************************************************************/
  418. /* Process status message structure.                                         */
  419. /*****************************************************************************/
  420. typedef struct
  421. {
  422.  ULONG  stat;
  423.  char  *statmsg;
  424. }STATUS;
  425.  
  426.