[Search for users]
[Overall Top Noters]
[List of all Conferences]
[Download this site]
Title: | -={ H A C K E R S }=- |
Notice: | Write locked - see NOTED::HACKERS |
Moderator: | DIEHRD::MORRIS |
|
Created: | Thu Feb 20 1986 |
Last Modified: | Mon Aug 03 1992 |
Last Successful Update: | Fri Jun 06 1997 |
Number of topics: | 680 |
Total number of notes: | 5456 |
188.0. "How to find job logical table?" by PENNSY::CANTOR () Fri Jan 03 1986 07:00
I have a DCL command file which, given an RT device name, and if run with
sufficient privilege, tells the user from what node and remote id the connection
originated.
I wrote this back in VMS V3 days before the existence of the logical names
SYS$REM_NODE and SYS$REM_ID. The command file uses SDA to get a snapshot
of the system and then finds the appropriate strings from the target process's
P1 space.
Now, with the existence of the two logical names, I would like to eliminate
the necessity of using SDA. Short of writing a program which examines system
tables in kernel mode, is there any way in DCL that I can find out the address
of the JIB given the terminal name or the process id? (The JIB can be used
to construct the name of logical name table in which the two logical names
of interest are resident.) Is there any other way I can find the name of
the correct table, given the terminal name or the PID?
The current version of the command file is posted here, after a couple of
form feeds, in case you're interested.
Dave C.
$ vfy = f$verify('debug'+0)
$ if f$cvui(1,1,'debug'+0) then -
write sys$error "File GETREM.COM, 27-Jun-1985"
$!
$! Gets node and userid from which a SET HOST was done.
$!
$! P1 is a list of terminal numbers, each assumed to be on "unit" RTA
$! If blank, RTA1: thru RTA20: are assumed.
$!
$ set noon
$ req_priv = "cmkrnl"
$ old_priv = f$setprv(req_priv)
$ if .not. f$priv(req_priv) then goto exit
$!
$ mypid = f$getjpi("","pid")
$ filespec = f$parse("SYS$SCRATCH:G"+mypid+".TMP")
$ filespec2 = f$parse("SYS$SCRATCH:H"+mypid+".TMP")
$!
$ system_type_list = -
"|6|RSX,Task|8|VMS,PID|12|VMS,Username|9|TOPS-20,Username|"
$ len_type_list = f$length(system_type_list)
$!
$ terminal_list = p1
$ if terminal_list .eqs. "" then -
terminal_list = "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20"
$ elemno = -1
$!
$get_next_terminal:
$ elemno = elemno + 1
$ next_terminal = f$edit(f$element(elemno,",",terminal_list),"trim,upcase")
$ if next_terminal .eqs. "," then goto exit
$ next_terminal = next_terminal - "_" - "_" - ":" - "RTA"
$ terminal = f$fao("RTA!ZB:",f$integer(next_terminal))
$ if f$getdvi(terminal,"exists") then goto exists
$nsd: write sys$error "No such device, ",terminal,"."
$ goto end_terminal_loop
$!
$exists:
$ pid = f$getdvi(terminal,"pid")
$ if .not. $status then goto nsd
$ if pid .eqs. "" then goto nsd
$ index = f$extract(4,4,pid)
$ open/write x.tmp 'filespec'
$ write x.tmp "$ define/user sys$output ",filespec2
$ write x.tmp "$ anal/syst
$ write x.tmp "set proc/index=",index
$ write x.tmp "exam ctl$t_nodeaddr;^D5"
$ write x.tmp "exam ctl$t_nodename;^D7"
$ write x.tmp "exam ctl$t_remoteid;^D13"
$ write x.tmp "$ exit
$ close x.tmp
$ @'filespec'
$ pid_check = f$getdvi(terminal,"pid")
$ if pid_check .nes. pid then goto exit
$ username := 'f$getjpi(pid,"username")'
$!
$ open/read y.tmp 'filespec2'
$ read y.tmp x
$ read y.tmp x
$ read y.tmp x
$ nodeaddrlen = f$integer("%X"+f$extract(33,2,x))
$ nodeaddr[0,8*nodeaddrlen] = %x'f$extract(30-nodeaddrlen,nodeaddrlen,x-" "-" "-" ")'
$ areanumber = f$cvui(10,6,nodeaddr)
$ nodenumber = f$cvui(0,10,nodeaddr)
$ nodenum = f$fao("!ZL.!ZL",areanumber,nodenumber)
$ read y.tmp x
$ nodenamelen = f$integer("%X"+f$extract(33,2,x))
$ nodename = f$extract(38,nodenamelen,x)
$ read y.tmp x
$ remoteidlen = f$integer("%X"+f$extract(33,2,x))
$ remoteid = f$extract(38,remoteidlen,x)
$ close y.tmp
$ search_string = f$fao("|!ZL|",remoteidlen)
$ temp = -
f$extract(f$locate(search_string,system_type_list),72,system_type_list) -
- search_string
$ if temp .eqs. "" then temp = "unknown,unknown"
$ system_type = f$element(0,",",temp)
$ id_type = f$element(0,"|",f$element(1,",",temp))
$ msg = f$fao("!AS (!AS) from !AS node !AS:: (!AS), !AS !AS",-
terminal,username,system_type,nodename,nodenum,id_type,remoteid)
$ write sys$output msg
$!
$end_terminal_loop:
$ goto get_next_terminal
$!
$exit:
$ x = f$setprv(old_priv)
$ if f$search(filespec) .nes. "" then dele/nolog 'filespec'*
$ if f$search(filespec2) .nes. "" then dele/nolog 'filespec2'*
$ exit 1+0*f$verify(vfy)
T.R | Title | User | Personal Name | Date | Lines |
---|
188.1 | | VAXUUM::DYER | | Fri Jan 03 1986 15:14 | 9 |
| You don't need to know the "xxx" in "LNM$JOB_xxx" to use the
job logical name table. If you specify "LNM$JOB" all by itself,
DCL will figure the rest out for you. In other words,
f$trnlnm("LOGICAL,"LNM$JOB")
will work just fine. RTL stuff does, too.
But was that the question?
<_Jym_>
|
188.2 | | PENNSY::CANTOR | | Fri Jan 03 1986 15:44 | 5 |
| Obviously, I didn't make my meaning clear. I need the job logical name
table of ANOTHER PROCESS, in order to get the translations of SYS$REM_NODE
and SYS$REM_ID in that table.
Dave C.
|
188.3 | | KOBAL::GILBERT | | Fri Jan 03 1986 17:45 | 13 |
| If you don't mind some occasional ambiguity, you could just get
*all* the exec-mode SYS$REM_* logical names defined in all the
job-wide logical name tables, and try to 'match them up', perhaps
based on SYS$LOGIN.
However, the only 'supported' way to find all the LNM$JOB_xxx
tables on the system is with DCL's SHOW LOGICALS command. If
you want a .COM solution, fine. If you want a .EXE solution,
that's rough, *regardless*.
If I had to solve this, I'd approach it from getting the JIB,
just as you have. A toy that lets you read part of another
process' address space (to get the JIB,...) would be ideal.
|
188.4 | | ERIE::CANTOR | | Wed Jan 08 1986 00:09 | 8 |
| Re .3
Thanks. That's what I thought. I'm already using a toy (SDA) to get another
process's P1 space and extracting the actual data I want with symbolic offsets
anyway. If I have to do the same kind of munging to get the JIB address
in order to find the right logical name table, there's no advantage.
Dave C.
|