Re: finding out another process's default directory?

Assuming this is not a discussion of SYS$LOGIN or SYS$LOGIN_DEVICE, the RMS parsing defaults are process-private AFAIK.

This information is maintained within some process logical names and within a system service, and AFAIK there are no related APIs to access the associated SYS$DISK logical name and the SYS$SETDDIR system service directory information across processes.

Accordingly, the best approach is to have a cooperating application communicate that setting as needed.

To confirm this, made a quick pass through the sys$getjpi itemcodes for OpenVMS V8.3, and see nothing relevant listed. This service would be the logical spot to implement this.

Re: finding out another process's default directory?

If this is required purely for informational purposes then the answer is that VMS itself does not provide that functionality.

If this is required because the application design really needs this then I would suggest changing the application design.

Regardless of the above, bear in mind that the current default directory can be a rather ornery beast, depending as it does on any number of process private logical names, particularly where the default directory is set to a search list.

Re: finding out another process's default directory?

{{{Regardless of the above, bear in mind that the current default directory can be a rather ornery beast, depending as it does on any number of process private logical names, particularly where the default directory is set to a search list.}}}

Re: finding out another process's default directory?

Some server processes on our systems sometimes start writing temporary files to a directory that should never be used for temporary files. The program that is writing the file uses the current default directory (instead of SYS$SCRATCH like it should, but it's not our code and it probably just uses a C RTL call, TMPNAM or TMPFILE).

I can identify the process that wrote the files *after* the fact from security audits. But I would like to identify when one of these server processes actually changes their default directory by monitoring this important process attribute somehow.

I know there is no $GETJPI item code or other API for it. I can find out the current default device by getting the tranlation of SYS$DISK via ANALYZE/SYSTEM and CLUE PROCESS/LOGICAL. So I was looking for a SDA method or a kernel-mode program that could return the current directory. (On my VAX 6.2 systems we have a program called "P" that can do this.)

Re: finding out another process's default directory?

Re Hein.

Yeah, that DOES get you the -directory-; but _NOT_ the device on which to search that directory. Which might be a Concealed Device, and/or a searchlist. Both are already demonstrated by [SYSEXE] ; which normally should reside in SYS$SYSROOT: , which is both.

Re: finding out another process's default directory?

Regarding Hein's mention of queueing kernel-mode ASTs, VMS made this a lot easier and safer on Alpha and Integrity by providing the kernel-level routine EXE$READ_PROCESS. It does the AST queueing to fetch data from another process's context. It still has to be called from kernel-mode, but it wouldn't be very hard to write a kernel-mode routine that will get the PIO$GT_DDSTRING value for another process using EXE$READ_PROCESS.