Submitting Jobs and Service Requests

LPRng Reference Manual: 24 Sep 2004 (For LPRng-3.8.28)
Prev | Chapter 15. Job Processing | Next

# 15.2. Submitting Jobs and Service Requests

Options used:

- lpd_port=Listening Port for lpd

- unix_socket_path=Unix socket for lpd connections

After the lpd server has done its initialization, it will attempt to bind to the lpd listening port specified by the lpd_port value. This value has the format [ipaddr%]port. If the ipaddr is specified then the lpd server binds to the interface with the specified address otherwise it binds to all interfaces. The port value can be a number or name the name of a service; The port corresponding to the service name is used. The printer services port is 515. If the port binding operation is successful and the server has not been request to run in foreground mode by the -F command line option, then a child process is forked and the parent process will exit. The child process then takes steps to disconnect itself from the control terminal of the process that started it.

The unix_socket_path option specifies the pathname of a fifo socket that local processes can use instead of the TCP/IP port.

The main lpd process will then start a queue checking process that will check all of the spool queues used by the server for queues that have pending jobs. This process sends a message to the main lpd process requesting that it start a service process for this queue.

The lpd process will then sit in a loop waiting for one of the following events:

1. An incoming connection request. If the maximum number of children has not been exceeded, then a new process will be forked to handle this connection.

2. A child process exiting. The server will check to see if there is a pending request to start a server for a queue that could not be accommodated due to too many processes running.

3. A request to start a service process for a queue. If the number of active processes is less than the maximum allowed a service process will be started, otherwise the request will be placed on a list for service when the number of processes active decreases.

4. A timeout alarm for the queue rescanning operation. This is discussed in the next section in detail.

When connection is accepted by the lpd spooler, the following steps are taken to processes the job.

1. First, a timeout is established for the transfer of the information from client to the lpd server. This is done to prevent a denial of service attack by processes that do not close connections in a timely manner.

2. A single line is read into an internal buffer. This line must be terminated with a NEWLINE character.

3. The input line is parsed and the actions required are determined.

4. If the activity requires access to the spool queue information, then the current directory of the process is changed to the spool directory. This allows all file accesses to then be relative to this directory.

5. If the processing requires starting a spool queue server process, a message is sent to the main lpd server process to start a spool queue server process. By having all the processes serving spool queues children of the main server process it is possible to monitor and limit the total number of active processes. This is important on systems with a very large number of queues.

6. After the processing of the original request has been completed, the process with then check to see if the Spool Queue for the printer should be processed.

Prev | Home | Next
Job Processing | Up | Job Reception