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

[-- Attachment #1 --]
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=0;i<1000;i++)
        {
        fp=popen("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.



[-- Attachment #2 --]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=windows-1252" http-equiv=Content-Type>
<META content="MSHTML 5.00.2919.6307" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>I don't know if I make any strange mistake, but I 
have done the following simple thing.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>File p.c :</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>#include &lt;stdio.h&gt;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>FILE&nbsp;&nbsp;&nbsp; 
*fp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>main()<BR>{<BR>register int&nbsp;&nbsp;&nbsp; 
i&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>for 
(i=0;i&lt;1000;i++)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fp=popen("lpr 
-Plp","w");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fprintf(fp,"Richiesta 
N. %d\n",i);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
pclose(fp);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
}<BR>}<BR></FONT></DIV>
<DIV><FONT face=Arial size=2>then</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>cc -o p p.c</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>./p</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>the result of lpq after this is:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>waiting for lp to become ready 
(offline?)<BR>Rank&nbsp;&nbsp; Owner&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Job&nbsp; 
Files&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
Total Size<BR>1st&nbsp;&nbsp;&nbsp; root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
33&nbsp;&nbsp; (standard 
input)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
15 bytes<BR>2nd&nbsp;&nbsp;&nbsp; root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
30&nbsp;&nbsp; (standard 
input)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
15 bytes<BR>3rd&nbsp;&nbsp;&nbsp; root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
35&nbsp;&nbsp; (standard 
input)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
15 bytes<BR>4th&nbsp;&nbsp;&nbsp; root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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p;&nbsp;&nbsp;&nbsp; 
15 bytes<BR>14th&nbsp;&nbsp; root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
34&nbsp;&nbsp; (standard 
input)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
15 bytes<BR>15th&nbsp;&nbsp; root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
56&nbsp;&nbsp; (standard 
input)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
16 bytes<BR>16th&nbsp;&nbsp; root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
57&nbsp;&nbsp; (standard 
input)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
16 bytes<BR>17th&nbsp;&nbsp; root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
43&nbsp;&nbsp; (standard 
input)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
16 bytes<BR></FONT></DIV>
<DIV><FONT face=Arial size=2>....etc</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>As you can see, the first on the queue is Job 33, 
while the second is 30 and so on ....</FONT></DIV>
<DIV><FONT face=Arial size=2>The sizes are irrilevant because they are the 
same.</FONT></DIV>
<DIV><FONT face=Arial size=2>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.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Thanks.</DIV></FONT>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV></BODY></HTML>

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