Is it possible ?
F-MR$ sh log /table=lnm$job
(LNM$JOB_80FF5500)
"SYS$LOGIN" = "USER_DISK:[ROXBURGHM]"
"SYS$LOGIN_DEVICE" = "USER_DISK:"
"SYS$REM_ID" = "TELNET_0A21014E"
"SYS$REM_NODE" = "169935182::"
"SYS$REM_NODE_FULLNAME" = "169935182::"
"SYS$SCRATCH" = "USER_DISK:[ROXBURGHM]"
F-MR$ wr sys$output f$getjpi("","PID")
00001C7D
F-MR$ wr sys$output f$getjpi("","master_PID")
00001C7D
Thanks
Matt Roxburgh
Systems Development
Carphone Warehouse U.K / Dublin / France
-----------------------------------------------------------------------
"SPAM" or "Junk" E-mail will be accepted if the sender agrees to a 100
UK pounds per e-mail reading cost. By sending e-mail the sender is
agreeing to these terms & conditions. E&OE
-----------------------------------------------------------------------
Yes, it's possible, but not directly from DCL. The value after the underscore
seems to be the address of the JIB (job information block) of the process. One
of the fields of the JIB is the IPID of the master PID. From this IPID, you
could look in the PCB for the EPID, which is what you're looking for.
Remember, this is the "master PID" you will be finding, not the PID of the
current process. Since all of your subprocess share this job table as well,
all of the subprocesses will come up with the same answer.
However, accessing these sections of system virtual memory for read requires
that your process be at least in executive mode, so you won't be able to use
the DCL EXAMINE command since it requires that the memory be readable from user
mode.
So you have either two choices: use SDA or write a program in the language of
your choice to do the work for you.
Here's the SDA version:
$ sho log /job *
(LNM$JOB_986A51C0)
[....]
$ write sys$output f$getjpi("","PID")
21200F00
$ anal/sys
SDA> read sys$system:sysdef
SDA> exam 986A51C0+JIB$L_MPID
986A5214: 00070100 "...."
Take the low 16 bits... the value is 0100.
Put it after the "4*".
SDA> exam @(@SCH$GL_PCBVEC + (4*100)) + PCB$L_EPID
9889DC24: 21200F00 ".. !"
Here's another...
$ sho log/job *
(LNM$JOB_985D0A00)
[...]
$ write sys$output f$getjpi("","PID")
212010FA
$ anal/sys
OpenVMS (TM) VAX System analyzer
SDA> read sys$system:sysdef
%SDA-I-READSYM, reading symbol table SYS$COMMON:[SYSEXE]SYSDEF.STB;1
SDA> exam 985D0A00+JIB$L_MPID
JIB+00054: 000800FA "ú..."
SDA> exam @(@SCH$GL_PCBVEC + (4*fa)) + PCB$L_EPID
PCB+00064: 212010FA "ú. !"
SDA> exit
$
-Ryan Moore
rmo...@san.rr.com
You know... I previously answered the question how to go from job table name to
PID. You wanted to know from PID to job table name. Ooops.
Well, again, you can't do this directly from DCL since it requires reading
parts of system virtual space protected by read at executive mode and write at
kernel mode.
You must write either a program that calls a routine with sys$cmexec() to look
it up or use SDA to do it.
from SDA:
$ anal/sys
SDA> show process
or
SDA> read sys$system:sysdef
SDA> exam @CTL$GL_PCB + PCB$L_JIB
Look at the JIB address. That's what the hex digits are after the underscore
on the job logical name table.
-Ryan
rmo...@san.rr.com