Specifications
4-30
Guide to Printers and Printing
Updating Job Status Information
The qchk command displays information about currently running jobs, including the
originator, title, number of pages to be printed, and percentage completed. All this
information comes from the status file. Most of the information is set up by the qdaemon
when the backend is first invoked, except the pages printed and percent done fields,
which must be filled in by the backend itself.
To provide this information, the backend should periodically call the libqb, see
Understanding Backend Routines in libqb on page 4-34 for the following functions:
• log_progress(pages,percent)
• log_pages(pages), for individual function
• log_percent(percent), for individual function
The backend can call these routines at any time; once at the end of each page is
recommended.
Charging for the Job
When a backend completes a job, the qdaemon reads the status file for a charge. If the
qconfig file has been set up to do so, the charge is written to a file that is eventually
processed by the accounting programs. This results in a bill (real or imaginary) for the user
issuing the print request.
The backend passes the charge back to the qdaemon with the routine
log_charge(charge). See Understanding Backend Routines in libqb on page 4-34. The
backend should call this routine on exit. It should also call the routine along with
log_progress while printing the job. For more information see Updating Job Status
Information on page 4-30. Otherwise, if the job is canceled, no charge will be made for the
pages printed up to that point.
The charge is interpreted by all current accounting programs as the number of pages
printed. However, a backend can set the charge to be based on any multiplier, whole or
fraction, of pages printed.
For more information about job accounting, see Spooler Overview on page 3-1.
Using Exit Codes
When a backend exits, the qdaemon looks at its exit code for such information as whether
the job was completed successfully and whether the device is still usable. Therefore, it is
important that backends use the same convention for their exit codes. The backend should
use #include <IN/standard.h> for the values of the codes given here.
The permissible exit codes are:
EXITOK No problems encountered.
EXITBAD The parameters could not be acted upon. Two common examples are a
flag’s not being valid or a file that could not be opened. The qdaemon
sets the state of the device (displayed by qchk) to OFF, sends a
message to the console, and does not run any further jobs on that device
until someone has explicitly set its state to ON again (with an enq
–Pqueuename –U command).
EXITERROR The backend could not finish printing the job. The qdaemon restarts the
same job from the beginning on the same device. The qdaemon
enforces a limit on the number of times the job will be restarted.