Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 May 2000 19:55:40 +0200
From:      "Lorenzo Iania" <l.iania@sintesi.net>
To:        <freebsd-hackers@freebsd.org>
Subject:   Re: lpr: order of print requests 
Message-ID:  <001401bfb45f$a16978c0$0500000a@sintesi.intr>

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

------=_NextPart_000_0011_01BFB470.64A5FD80
Content-Type: text/plain;
	charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

I don't know if I make any strange mistake, but I have done the =
following simple thing.


File p.c :

#include <stdio.h>

FILE    *fp             ;

main()
{
register int    i       ;

for (i=3D0;i<1000;i++)
        {
        fp=3Dpopen("lpr -Plp","w");
        fprintf(fp,"Richiesta N. %d\n",i);
        pclose(fp);
        }
}

then

cc -o p p.c

./p

the result of lpq after this is:

waiting for lp to become ready (offline?)
Rank   Owner      Job  Files                                 Total Size
1st    root       33   (standard input)                      15 bytes
2nd    root       30   (standard input)                      15 bytes
3rd    root       35   (standard input)                      15 bytes
4th    root       36   (standard input)                      15 bytes
5th    root       29   (standard input)                      15 bytes
6th    root       31   (standard input)                      15 bytes
7th    root       37   (standard input)                      15 bytes
8th    root       38   (standard input)                      15 bytes
9th    root       39   (standard input)                      16 bytes
10th   root       40   (standard input)                      16 bytes
11th   root       41   (standard input)                      16 bytes
12th   root       42   (standard input)                      16 bytes
13th   root       32   (standard input)                      15 bytes
14th   root       34   (standard input)                      15 bytes
15th   root       56   (standard input)                      16 bytes
16th   root       57   (standard input)                      16 bytes
17th   root       43   (standard input)                      16 bytes

....etc

As you can see, the first on the queue is Job 33, while the second is 30 =
and so on ....
The sizes are irrilevant because they are the same.
For this reason, and for similar problems, it is desiderable that the =
order of the requests is the same. I think that must be a chance to =
respect the order of the requests to avoid situations like this.

Thanks.



------=_NextPart_000_0011_01BFB470.64A5FD80
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>I don't know if I make any strange =
mistake, but I=20
have done the following simple thing.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>File p.c :</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>#include &lt;stdio.h&gt;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>FILE&nbsp;&nbsp;&nbsp;=20
*fp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;=20
;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>main()<BR>{<BR>register =
int&nbsp;&nbsp;&nbsp;=20
i&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>for=20
(i=3D0;i&lt;1000;i++)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fp=3Dpopen("lpr=20
-Plp","w");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
fprintf(fp,"Richiesta=20
N. %d\n",i);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
pclose(fp);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
}<BR>}<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>then</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>cc -o p p.c</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>./p</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>the result of lpq after this =
is:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>waiting for lp to become ready=20
(offline?)<BR>Rank&nbsp;&nbsp; Owner&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
Job&nbsp;=20
Files&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
Total Size<BR>1st&nbsp;&nbsp;&nbsp; =
root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
33&nbsp;&nbsp; (standard=20
input)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
15 bytes<BR>2nd&nbsp;&nbsp;&nbsp; =
root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
30&nbsp;&nbsp; (standard=20
input)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
15 bytes<BR>3rd&nbsp;&nbsp;&nbsp; =
root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
35&nbsp;&nbsp; (standard=20
input)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
15 bytes<BR>4th&nbsp;&nbsp;&nbsp; =
root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
36&nbsp;&nbsp; (standard=20
input)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
15 bytes<BR>5th&nbsp;&nbsp;&nbsp; =
root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
29&nbsp;&nbsp; (standard=20
input)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
15 bytes<BR>6th&nbsp;&nbsp;&nbsp; =
root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
31&nbsp;&nbsp; (standard=20
input)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
15 bytes<BR>7th&nbsp;&nbsp;&nbsp; =
root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
37&nbsp;&nbsp; (standard=20
input)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
15 bytes<BR>8th&nbsp;&nbsp;&nbsp; =
root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
38&nbsp;&nbsp; (standard=20
input)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
15 bytes<BR>9th&nbsp;&nbsp;&nbsp; =
root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
39&nbsp;&nbsp; (standard=20
input)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
16 bytes<BR>10th&nbsp;&nbsp; root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
40&nbsp;&nbsp; (standard=20
input)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
16 bytes<BR>11th&nbsp;&nbsp; root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
41&nbsp;&nbsp; (standard=20
input)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
16 bytes<BR>12th&nbsp;&nbsp; root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
42&nbsp;&nbsp; (standard=20
input)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
16 bytes<BR>13th&nbsp;&nbsp; root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
32&nbsp;&nbsp; (standard=20
input)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
15 bytes<BR>14th&nbsp;&nbsp; root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
34&nbsp;&nbsp; (standard=20
input)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
15 bytes<BR>15th&nbsp;&nbsp; root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
56&nbsp;&nbsp; (standard=20
input)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
16 bytes<BR>16th&nbsp;&nbsp; root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
57&nbsp;&nbsp; (standard=20
input)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
16 bytes<BR>17th&nbsp;&nbsp; root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
43&nbsp;&nbsp; (standard=20
input)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
16 bytes<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>....etc</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>As you can see, the first on the queue =
is Job 33,=20
while the second is 30 and so on ....</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>The sizes are irrilevant because they =
are the=20
same.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>For this reason, and for similar =
problems, it is=20
desiderable that the order of the requests is the same. I think that =
must be a=20
chance to respect the order of the requests to avoid situations like=20
this.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks.</DIV></FONT>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_0011_01BFB470.64A5FD80--



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?001401bfb45f$a16978c0$0500000a>