User`s guide
4-30
Guide to Printers and Printing
EXITFATAL The job could not be finished because of a problem in the device
that requires manual intervention. 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).
EXITSIGNAL The backend was interrupted by a SIGTERM signal (#include
<signal.h>).
EXITWARN The backend has issued a warning to the qdaemon. The job may or
may not be completed successfully, but in either case, when the
qdaemon receives an EXITWARN from the backend, qdaemon
returns a message explaining the problem.
Returning Error Messages
When an error event occurs, the backend should send a message to the user. Before
sending a message, the backend should check the PIO_IPCWRITEFD environment
variable. If it is set, the message is sent to a print supervisor by way of a pipe. The print
supervisor interprets the message and sends it to the user. If the PIO_IPCWRITEFD
environment variable is not set, the backend sends the message to the user with the sysnot
routine.
The qdaemon print spooler always uses the sysnot routine to send messages. Non–AIX
print spoolers can use sysnot routine or the pipe to send messages.
Using the sysnot Routine
The backend can send messages directly to the user with the sysnot routine. The sysnot
routine can either mail the message to the user or write the message to the user’s terminal.
The sysnot routine is called with the following syntax:
sysnot(user, host, message, pref )
char *user;
char *host;
char *message;
unsigned int *pref;
The value of the pref parameter should be DOMAIL or DOWRITE. DOMAIL mails the error
message to the user. DOWRITE writes the message to the user’s terminal if the user is
logged on. If the user is not logged on, the message is mailed to the user. The DOMAIL and
DOWRITE constants are defined in the /usr/include/IN/backend.h file.
Using a Pipe
The backend can send messages to the user by sending the message to a print supervisor
by way of a pipe. This mechanism provides a one–way communication path between the
printer backend and the print supervisor.
The print supervisor must open an unnamed pipe and obtain two file descriptors, one for
read operations and one for write operations. The print supervisor must export the write end
in the PIO_IPCWRITEFD environment variable before calling the printer backend with the
fork and exec subroutines. If the PIO_IPCWRITEFD environment variable is set, the printer
backend writes any messages to the write end of the pipe.
The print supervisor typically calls the select subroutine to poll the read side of the pipe for
incoming messages. In addition to checking for exit status of the printer backend using the
waitpid subroutine, the print supervisor polls for I/O on the pipe. The print supervisor sets
up a signal handler for the SIGCHLD signal and performs a block read on the pipe. The
signal handler examines the exit status of the printer backend and performs any action
necessary. When no unread messages remain on the pipe, the print supervisor closes the
pipe and proceeds to other cleanup work.