Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 May 2000 17:49:01 +0200
From:      "Lorenzo Iania" <l.iania@sintesi.net>
To:        <freebsd-hackers@freebsd.org>
Subject:   Re: lpr: order of print requests 
Message-ID:  <047901bfb44d$f0173f00$0500000a@sintesi.intr>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.

------=_NextPart_000_0476_01BFB45E.B33B59C0
Content-Type: text/plain;
	charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

Konrad Heuer wrote
                              =20
> Hmm, I've never seen such a strange behaviour. Lpd should do FIFO. =
Could
> you give some more infos about your environment (os release, input =
filter
> program, printer type)?

Yes, I think it's a very strange behaviour.
In effect in the file /usr/src/usr.sbin/lpr/common_source/common.c there =
is:

.....
/*
 * Scan the current directory and make a list of daemon files sorted by
 * creation time.
 * Return the number of entries and a pointer to the list.
 */
int
getq(pp, namelist)
        const struct printer *pp;
        struct queue *(*namelist[]);
{
.....

However I had the problem in more than one installation of the os from =
2.2.7 to 3.4.
The printers are used in a very simple way,

...
lp|local line printer:\
        :sh:sf:mx#0:\
        =
:lp=3D/dev/lpt0:sd=3D/usr/spool/output/lpd:lf=3D/var/log/lpd-errs:
....

but the order is wrong. The problem occur when the number of consecutive =
requests grows, i. e. when I have to print requests from 1 to 100 (from =
tha same process), the first 40 are in the right order, then are printed =
those from 50 to 100 in the right order and at last those from 41 to 49.
All I do is simply open a pipe by a call to=20

fp=3Dpopen("lpr -Plp","a");
fprintf(fp,XXXXX);
....
.
..
.
fclose(fp);

The contents are almost the same for each request, simply characters; I =
don't use any input filter. The printer is always a character printer =
like IBM, EPSON ...

So I don't understand why this happens.

Any suggestions??








------=_NextPart_000_0476_01BFB45E.B33B59C0
Content-Type: text/html;
	charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Dwindows-1252" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2919.6307" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Konrad Heuer&nbsp;wrote</FONT></DIV>
<DIV><FONT face=3DArial=20
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&gt; Hmm, I've never seen such a =
strange behaviour.=20
Lpd should do FIFO. Could<BR>&gt; you give some more infos about your=20
environment (os release, input filter<BR>&gt; program, printer=20
type)?<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Yes, I think it's a very strange=20
behaviour.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>In effect in the file=20
/usr/src/usr.sbin/lpr/common_source/common.c there is:</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>.....</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>/*<BR>&nbsp;* Scan the current =
directory and make a=20
list of daemon files sorted by<BR>&nbsp;* creation time.<BR>&nbsp;* =
Return the=20
number of entries and a pointer to the =
list.<BR>&nbsp;*/<BR>int<BR>getq(pp,=20
namelist)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const struct =
printer=20
*pp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; struct queue=20
*(*namelist[]);<BR>{<BR>.....</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>However I had the problem in more than =
one=20
installation of the os from 2.2.7 to 3.4.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>The printers are used in a very simple=20
way,</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>...</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>lp|local line=20
printer:\<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
:sh:sf:mx#0:\<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
:lp=3D/dev/lpt0:sd=3D/usr/spool/output/lpd:lf=3D/var/log/lpd-errs:<BR>...=
.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>but the order is wrong. The problem =
occur when the=20
number of consecutive requests grows, i. e. when I have to print =
requests from 1=20
to 100 (from tha same process), the first 40 are in the right order, =
then are=20
printed those from 50 to 100 in the right order and at last those from =
41 to=20
49.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>All I do is simply open a pipe by a =
call to=20
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>fp=3Dpopen("lpr =
-Plp","a");</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>fprintf(fp,XXXXX);</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>....</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>..</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>fclose(fp);</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>The contents are almost the same for =
each request,=20
simply characters;&nbsp;I don't use any input filter. The printer is =
always a=20
character printer like IBM, EPSON ...</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>So I don't understand why this=20
happens.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Any suggestions??</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><BR>&nbsp;</DIV></FONT></BODY></HTML>

------=_NextPart_000_0476_01BFB45E.B33B59C0--



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?047901bfb44d$f0173f00$0500000a>