home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 11 Util
/
11-Util.zip
/
RUNNING2.ZIP
/
RUNNING2.DOC
next >
Wrap
Text File
|
1992-07-16
|
6KB
|
130 lines
RUNNING2: Shows Processes Running in OS/2
----------------------------------------
** Version 2.00 is for OS/2 2.00 **
This program is released to the public domain and may be distributed
freely by any means.
I have included the source code to RUNNING2 and to SLAY. Please feel
free to use them as long as the code is not used for commercial
profit. I would appreciate receiving copies of modifications at any
of the below addresses.
RUNNING2 is a simple program which provides a listing of all processes
currently being used by OS/2. It provides information about the
processes such as their PID, their PARENT PID, the internal module ID
#, the number of children processes, the number of threads currently
running in each process, and optionally a tree view of the process
hierarchy.
Here is a sample of a listing of processes:
┌──────── Threads ────────┐
┌────── Threads ──────┐
PID PPID Mod# Process Name Chld Run Ready Block Other
---- ---- ---- ------------------------- ---- ----- ----- ----- -----
03e9 0009 0004 CMD.EXE 1 1
0009 0002 0004 FSHL.EXE 1 1 1
000b 0002 0005 FSHL.EXE 0 2
000d 0002 0006 FSHL.EXE 1 1
000f 0002 0007 FSHL.EXE 1 1
0013 0002 0008 FSHL.EXE 1 1
0003 0002 0000 HARDERR.EXE 0 3
0002 0001 0001 PMSHELL.EXE 7 3 15
0005 0002 0011 PMSHELL.EXE 0 12
03ea 03e9 0004 RUNNING2.EXE 0 1
001b 0013 0008 STARTBBS.EXE 0 3
0018 000d 0006 TE2.EXE 0 1 2
0019 000f 0007 TE2.EXE 0 1 2
The PID is the process ID which might be used by a program such as
SLAY (Included with RUNNING2) or KILL (Copyright (c) 1988, Ed Braaten and
available on many BBSs - inconvenient because it accepts PIDs in
decimal format instead of my hexadecimal format) to totally remove a
process from the system. The PPID is the parent process' PID and
the module # is a number used internally to identify the process.
The process name is the name of the executable. The number of child
processes are followed by the number of threads categorized by state
(Running/Ready/Blocked/Other).
If you invoke RUNNING2 with the -p flag, you will get a listing of the
complete pathname that invoked the process. The -t flag produces a
tree view of the processes. Here is an example with both flags.
┌────── Threads ──────┐
PID PPID Mod# Process Name Chld Run Ready Block Other
---- ---- ---- ------------------------- ---- ----- ----- ----- -----
03ed 0009 0004 CMD.EXE 1 1
L:\OS2\CMD.EXE
0009 0002 0004 FSHL.EXE 1 2
D:\BIN2\FSHL.EXE
000b 0002 0005 FSHL.EXE 0 2
D:\BIN2\FSHL.EXE
000d 0002 0006 FSHL.EXE 1 1
D:\BIN2\FSHL.EXE
000f 0002 0007 FSHL.EXE 1 1
D:\BIN2\FSHL.EXE
0013 0002 0008 FSHL.EXE 1 1
D:\BIN2\FSHL.EXE
0003 0002 0000 HARDERR.EXE 0 3
L:\OS2\SYSTEM\HARDERR.EXE
0002 0001 0001 PMSHELL.EXE 7 3 15
L:\OS2\PMSHELL.EXE
0005 0002 0011 PMSHELL.EXE 0 12
L:\OS2\PMSHELL.EXE
03ee 03ed 0004 RUNNING2.EXE 0 1
H:\OS2\RUNNING2\RUNNING2.EXE
001b 0013 0008 STARTBBS.EXE 0 2 1
J:\HOST\STARTBBS.EXE
0018 000d 0006 TE2.EXE 0 2 1
D:\BIN2\TE2.EXE
0019 000f 0007 TE2.EXE 0 1 2
D:\BIN2\TE2.EXE
PID 0001
└─── PMSHELL.EXE (PID=0002)
├─── FSHL.EXE (PID=0009)
│ └─── CMD.EXE (PID=03ed)
│ └─── RUNNING2.EXE (PID=03ee)
├─── FSHL.EXE (PID=000b)
├─── FSHL.EXE (PID=000d)
│ └─── TE2.EXE (PID=0018)
├─── FSHL.EXE (PID=000f)
│ └─── TE2.EXE (PID=0019)
├─── FSHL.EXE (PID=0013)
│ └─── STARTBBS.EXE (PID=001b)
├─── HARDERR.EXE (PID=0003)
└─── PMSHELL.EXE (PID=0005)
RUNNING2 has the following command line flags:
-n means do not sort list by name
-p means include path names
-t means draw tree of processes
-? shows the options (as does -h)
SLAY is a program which simply attempts to kill the process that you
indicate on the command line. The PID that you pass to SLAY MUST BE
HEXIDECIMAL (e.g. slay b3 or slay 18d) NOT DECIMAL!
RUNNING2 uses the undocumented function DosQProcStatus() which is
used by the programs PSTAT.EXE and PS.EXE which are provided with
OS/2. This function was brought to my attention by Franz Krainer in
a message in the OS2 echo (10-19-89), and helped fulfil a need that I
have had for a long time (since I moved over to OS/2 from QNX) to
know what exactly is running in my system at any moment. The
function works with OS/2 1.1 and should also work with version 1.2.
OS/2 2.0 keeps the function but changes the format from version 1.xx,
a format which is documented by Rick Fishman in his PD program PROCS.
If you have questions or comments, you can send them to me Netmail at
my BBSes, The Programmer's Oases (1:3644/1 or 1:3644/2). You can also call
the BBSes at 919/226-6984 or 919/226-7136 (North Carolina). You can drop
me a line through BIX (ID=laforet) or through Compuserve (ID 76120,110).
July 16, 1992.