Subject: Bug#3935: lpd doesn't use minfree

From: [email-masked]
Date: Thu, 25 Jul 96 19:05 GMT

Package: lpr
Status: install ok installed
Priority: standard
Section: net
Maintainer: D.J. Gregor <[email-masked]>
Version: 5.9-11
Depends: libc5

We can read in the manpage of lpd:

> The file minfree in each spool directory contains the number of disk
> blocks to leave free so that the line printer queue won't completely fill
> the disk.  The minfree file can be edited with your favorite text editor.

But it doesn't work, lpd ignores minfree. It's normal, because this
functionality is disabled in the file lpr-5.9/lpd/recvjob.c (the function
disabled is "checksize", there is a "#ifdef __linux__"). 
If you apply my patch, then it works. You can see that I use f_bsize
instead of f_fsize (f_fsize doesn't exist in Linux), the documentation in
"man statfs" is a little ambigous about f_bsize:
> struct statfs {
>    long    f_type;     /* type of filesystem (see below) */
>    long    f_bsize;    /* optimal transfer block size */
>    long    f_blocks;   /* total data blocks in file system */
>    long    f_bfree;    /* free blocks in fs */
>    long    f_bavail;   /* free blocks avail to non-superuser */
>    long    f_files;    /* total file nodes in file system */
>    long    f_ffree;    /* free file nodes in fs */
>    fsid_t  f_fsid;     /* file system id */
>    long    f_namelen;  /* maximum length of filenames */
>    long    f_spare[6]; /* spare for later */
> };
but when you read the source of the kernel, it's really the size of a block.

I am using Debian 1.1, kernel version 
Linux neuf 2.0.0 #1 Sat Jul 13 10:28:02 GMT 1996 i486

This is the patch to apply to lpr-5.9/lpd/recvjob.c:

-------------------------------->>>>>>> bebin
46a47,52
> #ifdef __linux__
> #include <sys/vfs.h>
> #define STATFS_BLOCK_SIZE f_bsize
> #else
> #define STATFS_BLOCK_SIZE f_fsize
> #endif
248,250d253
< #ifdef	__linux__
< 	return(1);
< #else
258c261
< 	spacefree = sfb.f_bavail * (sfb.f_fsize / 512);
---
> 	spacefree = sfb.f_bavail * (sfb.STATFS_BLOCK_SIZE / 512);
263d265
< #endif
------------------------------<<<<<<<< end
spacefree's unit is 512 bytes

-- 
Emmanuel CHANTREAU (Montpellier France)
email: [email-masked]