To write data to a file the unix system needs to open the file first. Once you have finished writing to that file unix will close it. In spec, as in unix, files will be opened the first time they are used and kept opened until a close instruction is executed. Nevertheless spec will control with the instructions on()
and off()
the actual output to files, while keeping them opened. This is to reduce the overhead when you are repeatedly switching writing data to a file, like while running a scan.
To see the list of files currently opened and their output status, type open()
in spec:
11.SPEC> open() "tty" is on. "null" is off. "spec.dat" (path = "/Users/specadm/data/spec.dat") is off. "another_file.dat" (path = "/Users/specadm/data/another_file.dat") is on.
If macros stop writing to a file, they must close()
that file. Otherwise output to the file may be off but the file descriptor still be opened.
There is a limit as how many files can be opened at any time by a unix process. spec will stop you from opening a new file when that limit is reached.
Solution
Standard macros will carefully open()
and close()
files as necessary. This error is often related with the handling of files by a user macro.
To solve the problem get the list of opened files by typing open()
. Then you can easily identify which files are causing the problem. You can close those files by calling close(filename)
. Eventually, correct the macro to make sure that files are closed when they are not needed anymore.