[net.bugs.usg] Why does xargs limit argument-sizes to 470 bytes?

gam@amdahl.UUCP (G A Moffett) (02/02/86)

I recently wrote a simple public domain version of xargs(1),
using the arbitrary limit of BUFSIZ (from stdio.h) as the
size of the collected arguments passed to whatever command
xargs is to do.

In looking on the SVR2 source, I find it uses 470 bytes
(with a 100-byte buffer) for the args.

I'm amazed.  I felt that using BUFSIZ was rather conservative,
considering that the standard limit of the size of arguments passed
to exec(2) (which xargs uses) is 5120 bytes, and this limit
appears to be universal (from 512-byte blocks * 10 direct i-nodes,
where the 512 is the minimum -- original? -- Unix file block size).

Why then such a ridiculously small limit?  (And what is so magic about
the number 570, anyway?).

Can anyone explain this, or have I mis-seen something?
-- 
Gordon A. Moffett		...!{ihnp4,cbosgd,seismo,hplabs}!amdahl!gam

~ You tell me it's the institution...
~ Well, you better free your mind instead (shoo-be-do-wap ...) ~

ka@hropus.UUCP (Kenneth Almquist) (02/06/86)

The reason that xargs uses such a small limit is undoubtedly that is
was never changed when the maximum arg list size that exec would handle
was changed from 512 to 5120.  One of the reasons that xargs was written
was to deal with the 512 byte limitation.  I very rarely hit the 5120
byte limit.
				Kenneth Almquist
				ihnp4!houxm!hropus!ka	(official name)
				ihnp4!opus!ka		(shorter path)