TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Paul Edwards
from: Patrick Haller
date: 1996-11-19 06:41:28
subject: process list

Hi Paul!

[..]
 PE> PSTAT prints a list of processes in the system.  How do I do the same
 PE> thing from my C program?  (besides system("pstat")!).  I
have looked
 PE> at GUIREF20 and can't find a suitable API (I want all system
 PE> processes, not just ones that I spawned).  BFN.  Paul.
Try to gather information on those APIs:

  DosQueryProcStat
    see PRCP.INF

  Dos32QuerySysState


Dos32QuerySysState API


Dos32QuerySysState API

DosCalls Entry point
IMPORTS
 Dos32QuerySysState = DOSCALLS.368
Calling convention
Watch out, I got it wrong the first time. This
prototype should be correct.

 rc = Dos32QuerySysState(
   ULONG func, /* pushed last */
   ULONG arg1,
   ULONG pid,
   ULONG _res_,
   PVOID buf,
   ULONG bufsz); /* pushed first */

Note
it is: Dos16QprocStatus((16:16)buf,bufsz)
   == Dos32QuerySysState(0x17,0,0,0,(0:32)buf,bufsz);

Arguments

bufsz (ULONG)
length of buffer passed
buf (PVOID) 
buffer for returning data
_res_ (ULONG)
_reserved_, not used currently
pid (ULONG)
see note 1
arg1 (ULONG)
see note 3
func (ULONG)
function code

00000001 process data
00000002 module data
00000004 process sema
00000008 file data (see note 2)
00000010 named shared memory


Notes

if pid=0, structure will
contain info for all processes in the system.
if pid != 0, print only process data for the specified process.
This is a faster operation.
WARNING: This function will work incorrectly with
kernels < fixpack 18
(fixed in PJ21173), and may hang the system with such older kernels.


This needs a kernel of fixpack 18 (or later); fix is PJ21178.

the only bit that has a function is 0x04 (bit 2) - it causes a
system crash in function SELSelToLa() in the Debug Kernel,
don't set it to anything else than 0. According to IBM, this will
be fixed by
APAR PJ21195.

in the surroundings of the _VR32SysState code, which is the actual
handler for DosQProcStatus and DosQuerySysState, a few interesting
entry points exist:

_qsDisk
_qsHWConfig
_qsNamedPipe

(the _qs* routines belong to the QuerySysState subsystem).
Unfortunately the corresponding bits in a bitmask for the func arg
are excluded and these functions currently point to a NO OP. Watch
for future kernels: there may be additional functionality.
According to IBM, these functions currently return an
error code, and this will probably never change :-(.


This page was accessed http://alcatraz.gmd.de:9422/cgi-bin/counter.pl?cnt=hv_count3&dsp=digitalr">
times since Jan 25th, 1996


Reply to: Holger.Veit{at}gmd.de





     __
     |_)
cu/2 |atrick
[Team  OS/2]

--- FleetStreet 1.18+
* Origin: OS/2 Bodensee ! (2:246/2315.18)
SEEN-BY: 50/99 270/101 620/243 625/160 711/401 409 410 413 430 808 809 934
SEEN-BY: 711/955 712/407 515 624 628 713/317 800/1
@PATH: 246/2315 2300 2340 10 240/5202 5010 2433/225 270/101 712/515 711/808
@PATH: 711/934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.