· Nov 5, 2019

Is there a way to see which process has a device open?

I'm having trouble with a server printer where nobody can open a particular device. I've seen all over documentation that you can't open a device if another process already has it open, but I haven't been able to find out what process has a device opened already.

Discussion (13)1
Log in or sign up to continue

You may want to use some kind of print spooling to avoid the situations of monopolization such a device as printer. Take a look at CUPS; there is a brief notes how to use lp or lpr commands in Caché/IRIS: Using Pipes to Communicate with Processes.

On Windows we just used OS printer name for opening the device in Caché, and it was enough to spool the jobs to printer queue; no other tricks were needed.

Open devices for a process can be seen in the Processes section of the portal.  The initial process list shows the principal or current device and in the individual process page it shows all open devices, this can also be found using the %SYS.ProcessQuery OpenDevices
 method so you could write code that goes through all processes checking.

What these show may depend on how you open the device in the first place.