[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference noted::hackers_v1

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

623.0. "Subprocess MBX input state?" by JENEVR::MEAGHER (W. C. Fields Forever) Mon Dec 07 1987 07:51

If this question has been asked and/or answered before, please
forgive me -- and point me to the answer!

Anyway...

I have a program that creates 2 mailboxes, then creates a subprocess
with SYS$INPUT and SYS$OUTPUT equated to the mailboxes. Fine, now
I can send commands to the subprocess and receive the output. But...
how can my program sense whether a read hung on SYS$INPUT was done from
DCL or from an image running in the subprocess? In other words, how
can my program tell whether the subprocess is in DCL "$" state?

Obviously I can do a $GETJPI to see if there's an image running, but
if at DCL, my subprocess might be executing a command procedure which
might have issued a "$ READ SYS$INPUT FOO" or an "$ INQUIRE". Is there
a magic bit I can check?

Thanks,

bob
T.RTitleUserPersonal
Name
DateLines
623.1May be worth a trySQM::HALLYBKhan or bust!Mon Dec 07 1987 17:092
    Check the subprocess' PSL bits 24:25.  If ^B10, then DCL.
    (PSL is in PHD$L_PSL).
623.2Is there a less-priv'ed way?32288::MEAGHERToo good to be trueSun Dec 20 1987 16:324
Thanks, but is there any way to do this without CMKRNL (or any other
god-like) privilege?

b
623.3PSW::WINALSKIPaul S. WinalskiSun Dec 20 1987 16:519
RE: .2

No, there is not.

Note also that the mode field in the PSL won't let you distinguish DCL trying
to read a command ("$" state) from DCL reading on behalf of a user command
procedure ("$ READ SYS$INPUT FOO", "$ INQUIRE").

--PSW
623.4Oh well...32288::MEAGHERToo good to be trueMon Dec 21 1987 07:0912
Well, thanks for trying...

I wonder how ALL-IN-1 is able to know when its subprocess is in a "$"
state, particularly when the user presses RETURN. At that point,
ALL-IN-1 assumes control of the terminal again. ALL-IN-1 does not, I
believe, need to be run with CMKRNL privilege. Does anyone know how
that mechanism works, offhand?

If not, I guess I'll post this question in the ALL-IN-1 notes file.
Or read the fiche, if I can get 'em.

b
623.5How its done...CHOVAX::YOUNGBack from the Shadows Again,Mon Dec 21 1987 09:0123
    Well as I recall from having written some ALL-IN-1 applications
    during its V1 days, it does it pretty much the same way that the
    infamous TELL.COM does it.
    
    Both TELL and ALL-IN-1 take no chances when they do this, they use
    a command procedure in the slave process to explicitly prompt for
    input.  Thus, ALL-IN-1 creates a subprocess with output, say,
    A1_MBX_OUT, and input A1_MBX_IN, and error A1_MBX_ERR (I forget
    how it actually goes so I am improvising).   The first command it
    puts in A1_MBX_IN is "@A1_SUB_CTRL.COM".
    
    This subprocess would then do something like this:
    
	$ LOOP:
    	$   Write sys$input "~WAITING FOR INPUT$"
    	$   Read  sys$input COMMAND_STRING
    	$   COMMAND_STRING
    	$ goto LOOP

    Whenever the Master process saw the string "~WAITING FOR INPUT$"
    it knew that it could send another command.
    
    --  Barry
623.6PSW::WINALSKIPaul S. WinalskiTue Jan 05 1988 16:329
RE: .5, .4

Yup, .5 has it more or less right.  This is how SCOPE tool cooperation did it,
and how MMS does it, as well.  You send a command down SYS$INPUT to the
subprocess that does a DCL WRITE of a known string to SYS$OUTPUT, then you
know that once you see your string back again, DCL is ready for another
command.

--PSW
623.7Thanx!JENEVR::MEAGHERComfortably NumbWed Jan 06 1988 08:288
	Thanks, all.

	I got spoiled early on by RSTS pseudo-keyboards, which could
	tell the controlling program whether the process was in a system
	command wait state. I was hoping for a similar or equivalent
	mechanism to be hidden somewhere in VMS. Oh well...

bob
623.8CHOVAX::YOUNGBack from the Shadows Again,Thu Jan 07 1988 23:326
    Re .7:
    
    	Yeah, Bob.  That's what we get for leaving a sophisticated
    Operating System like RSTS/E for something primitive like VMS.
    
    --  Barry