Received: From KL.SRI.COM by CRVAX.SRI.COM with TCP; Thu, 10 NOV 88 22:24:32 PDT Received: from oberon.usc.edu by KL.SRI.COM with TCP; Thu, 10 Nov 88 19:53:28 PST Received: from bufo.usc.edu by oberon.usc.edu (5.59/5.5) id AA03368; Thu, 10 Nov 88 19:53:15 PST Received: by bufo.usc.edu (3.2/SMI-3.0DEV3) id AA06403; Thu, 10 Nov 88 19:53:06 PST Date: Thu, 10 Nov 88 19:53:06 PST From: vorbrueg%bufo.usc.edu@oberon.usc.edu (Jan Vorbrueggen) Message-Id: <8811110353.AA06403@bufo.usc.edu> To: info-vax@kl.sri.com Subject: Forcing code to be executed when logging out Reply-To: vorbrueg%bufo.usc.edu@oberon.usc.edu (Jan Vorbrueggen) Organization: University of Southern California, Los Angeles, CA There is a mostly undocumented hook (at least with V4.x) in VMS for having code executed when a process is deleted. (If you're not interested in VMS internals, skip the rest!) SYS$DELPRC calls SYS$RUNDWN which in turn (after doing some small things) executes the following: MOVL @#CTL$GL_USRUNDWN,R5 BEQL 10$ JSB (R5) 10$: MOVL @#EXE$GL_USRUNDWN,R5 BEQL 20$ JSB (R5) 20$: Some remarks: The non-zero value in CTL$GL_USRUNDWN gets there when an image is linked with a priviledged shareable image (i.e., user system services) and this image has specified a rundown routine. This information is deleted at image rundown. SYS$EXAMPLES:USSDISP.MAR contains a sample file for such a beast with a lot of comments; it also describes the environment for a rundown routine (with a simple example). The non-zero value in EXE$GL_USRUNDWN gets there when the system manager (or some such with CMKRNL) loads the code into (non)paged pool and writes it's address into that cell. I.e., no support from VMS for this feature. The rundown routine is also called for image and DCL rundown, so if you want to do something only when the process is deleted, you should check that R7, which contains the access mode, is 1 (exec mode) or less. As I have never tried this out, I can't tell you what you're allowed to do and what not. So you're on your own. Fortunately, access violations and such in exec mode only cause the process to be deleted, not the system :-) Incidentally, something analogous exists for user system services. The cells are called EXE$GL_USRCHM. This is described in some detail in I&DS. Jan Vorbrueggen (visiting USC, usually at the Max-Planck-Institute for Brain Research, Frankfurt)