[an error occurred while processing this directive]

HP OpenVMS Systems

ask the wizard
Content starts here

API for listing all open files on a disk?

» close window

The Question is:

 
Is it possible in C to find all open files on a disk?  Similar to "show
device/files".
 


The Answer is :

 
  Please consider including a general problem statement when asking the
  OpenVMS Wiizard, as there may be alternative approaches available for
  the particular problem(s) you are looking to solve.
 
  As for this case, consider system() or lib$spawn().
 
  There is no documented way for a program to access the information
  returned by the SHOW DEVICE/FILES DCL command, short of sequentially
  trying to open each file on the disk for exclusive access.  (And this
  approach will not detect files not accessable via the disk directory
  structure.)
 
  The SHOW DEVICE/FILES command uses kernel-mode code to traverse the
  File Control Block (FCB) and Window Control Block (WCB) data structures.
 
  If you are simply looking to dismount a disk, you can catch failures
  that might arise from a call to the sys$dismount system service.

answer written or last revised on ( 2-AUG-1999 )

» close window