Status file

Each queue and its associated queue has a status file.

When the qdaemon process invokes a backend (see the qdaemon for more information), it passes the following parameters, in order:

  1. The parameters appearing in the /etc/qconfig file. See the /etc/qconfig file for more information.
  2. The flags that the enq command (see the enq for more information) did not recognize, in the order they were given. These flags will be preceded by the -o option on the command line.
  3. The names of one or more files to be printed.

There is a status file for each device and its associated queue. These files are found in the /var/spool/lpd/stat directory.

The status file provides a means of communication for the qdaemon process and the backend. The qdaemon passes information such as the date of the file, whether to print burst pages, and the number of copies to be printed. The backend passes back the charge for the job it has just finished running. In addition, the backend periodically updates the number of pages it has printed and what percent of the job is finished. This information is read by the qchk command. See the qchk for more information.

Note: Backends should never explicitly write into their status file. They should call the libqb library routines to do this.

The routines are called for the following reasons:

  • The backend is spared the trouble of accessing the status file directly.
  • The format of the status file can be changed without requiring backends to be rewritten. Should the format of the status file change, the backend only needs to be re-linked.

To initialize certain data common to the library routines, the backend must call the routine log_init. For more information see Back-end routines in libqb. The call is as follows:

log_init();

This routine should be called to initialize the status file interface. The log_init routine, like all log_ routines in the library, returns a value of -1 if it fails.