1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org">
<title>Submitting Jobs and Service Requests</title>
<meta name="GENERATOR" content=
"Modular DocBook HTML Stylesheet Version 1.71 ">
<link rel="HOME" title=" LPRng-HOWTO" href="index.htm">
<link rel="UP" title="Job Processing" href="jobsteps.htm">
<link rel="PREVIOUS" title="Job Processing" href=
"jobsteps.htm">
<link rel="NEXT" title="Spool Queue Processing " href=
"spoolq.htm">
</head>
<body class="SECT1" bgcolor="#FFFFFF" text="#000000" link=
"#0000FF" vlink="#840084" alink="#0000FF">
<div class="NAVHEADER">
<table summary="Header navigation table" width="100%" border=
"0" cellpadding="0" cellspacing="0">
<tr>
<th colspan="3" align="center">LPRng-HOWTO: 1 Apr 2002
(For LPRng-3.8.10)</th>
</tr>
<tr>
<td width="10%" align="left" valign="bottom"><a href=
"jobsteps.htm" accesskey="P">Prev</a></td>
<td width="80%" align="center" valign="bottom">Chapter
15. Job Processing</td>
<td width="10%" align="right" valign="bottom"><a href=
"spoolq.htm" accesskey="N">Next</a></td>
</tr>
</table>
<hr align="LEFT" width="100%">
</div>
<div class="SECT1">
<h1 class="SECT1"><a name="SUBMITTING">15.2. Submitting Jobs
and Service Requests</a></h1>
<p>Options used:</p>
<ul>
<li>
<p><tt class="LITERAL">lpd_port=</tt><i class=
"EMPHASIS">Listening Port for <b class=
"APPLICATION">lpd</b></i></p>
</li>
</ul>
<br>
<br>
<p>After the <b class="APPLICATION">lpd</b> server has done
its initialization, it will attempt to bind to the <b class=
"APPLICATION">lpd</b> listening port specified by the <tt
class="LITERAL">lpd_port</tt> value. This value has the
format <tt class="LITERAL">[ipaddr%]port</tt>. If the <tt
class="LITERAL">ipaddr</tt> 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 <tt class="LITERAL">printer</tt>
services port is 515. If the port binding operation is
successful and the server has not been request to run in <i
class="EMPHASIS">foreground</i> mode by the <tt class=
"LITERAL">-F</tt> 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.</p>
<p>The main <b class="APPLICATION">lpd</b> process will then
start a <i class="EMPHASIS">queue checking</i> 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 <b class="APPLICATION">lpd</b> process requesting
that it start a service process for this queue.</p>
<p>The <b class="APPLICATION">lpd</b> process will then sit
in a loop waiting for one of the following events:</p>
<ol type="1">
<li>
<p>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.</p>
</li>
<li>
<p>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.</p>
</li>
<li>
<p>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.</p>
</li>
<li>
<p>A timeout alarm for the queue rescanning operation.
This is discussed in the next section in detail.</p>
</li>
</ol>
<p>When connection is accepted by the <b class=
"APPLICATION">lpd</b> spooler, the following steps are taken
to processes the job.</p>
<ol type="1">
<li>
<p>First, a timeout is established for the transfer of
the information from client to the <b class=
"APPLICATION">lpd</b> server. This is done to prevent a
denial of service attack by processes that do not close
connections in a timely manner.</p>
</li>
<li>
<p>A single line is read into an internal buffer. This
line must be terminated with a <tt class=
"LITERAL">NEWLINE</tt> character.</p>
</li>
<li>
<p>The input line is parsed and the actions required are
determined.</p>
</li>
<li>
<p>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.</p>
</li>
<li>
<p>If the processing requires starting a spool queue
server process, a message is sent to the main <b class=
"APPLICATION">lpd</b> 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.</p>
</li>
<li>
<p>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.</p>
</li>
</ol>
</div>
<div class="NAVFOOTER">
<hr align="LEFT" width="100%">
<table summary="Footer navigation table" width="100%" border=
"0" cellpadding="0" cellspacing="0">
<tr>
<td width="33%" align="left" valign="top"><a href=
"jobsteps.htm" accesskey="P">Prev</a></td>
<td width="34%" align="center" valign="top"><a href=
"index.htm" accesskey="H">Home</a></td>
<td width="33%" align="right" valign="top"><a href=
"spoolq.htm" accesskey="N">Next</a></td>
</tr>
<tr>
<td width="33%" align="left" valign="top">Job
Processing</td>
<td width="34%" align="center" valign="top"><a href=
"jobsteps.htm" accesskey="U">Up</a></td>
<td width="33%" align="right" valign="top">Spool Queue
Processing</td>
</tr>
</table>
</div>
</body>
</html>
|