From owner-freebsd-questions@FreeBSD.ORG Wed Feb 27 11:16:24 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AA8EF1065671 for ; Wed, 27 Feb 2008 11:16:24 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from igloo.linux.gr (igloo.linux.gr [62.1.205.36]) by mx1.freebsd.org (Postfix) with ESMTP id EB5D28FC19 for ; Wed, 27 Feb 2008 11:16:23 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from kobe.laptop (vader.bytemobile-rio.ondsl.gr [83.235.57.37]) (authenticated bits=0) by igloo.linux.gr (8.14.1/8.14.1/Debian-9) with ESMTP id m1RBFvOF008342; Wed, 27 Feb 2008 13:16:03 +0200 Received: by kobe.laptop (Postfix, from userid 1000) id C812922802; Wed, 27 Feb 2008 13:15:51 +0200 (EET) Date: Wed, 27 Feb 2008 13:15:51 +0200 From: Giorgos Keramidas To: Erik Norgaard Message-ID: <20080227111551.GA2403@kobe.laptop> References: <20080227100132.G1831@wojtek.tensor.gdynia.pl> <47C52A64.5000701@locolomo.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <47C52A64.5000701@locolomo.org> X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-3.971, required 5, autolearn=not spam, ALL_TRUSTED -1.80, AWL 0.43, BAYES_00 -2.60) X-Hellug-MailScanner-From: keramida@ceid.upatras.gr X-Spam-Status: No Cc: Wojciech Puchar , freebsd-questions@freebsd.org Subject: Re: argument list too long X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Feb 2008 11:16:24 -0000 On 2008-02-27 10:16, Erik Norgaard wrote: >Wojciech Puchar wrote: >> what is a limit of amount of arguments passed to program? is it >> hardwired or can be changed. >> >> i found it to be in order of few thousands parameteres > > searching google results in an article for linux > > http://www.linuxjournal.com/article/6060 > > gives some ideas to work arounds, the most radical to recompile the > kernel. Then a sysctl -a seems to indicate it is also a kernel > limitation on FreeBSD: > > kern.argmax: 262144 > > I'm not certain that this is the limit of command line arguments, and > I haven't tried to set it. Nor is it clear to me if this is the > number of arguments or the number of characters in the argument > string. In the latter case, a "few thousand" argumenst could easily > reach that limit. sysctl -d helps here: $ sysctl -d kern.argmax kern.argmax: Maximum bytes of argument to execve(2) It is worth noting, however, that there are usually fairly easy ways to work with huge lists of command-line arguments. Instead of writing things like this, for example: for file in *.ogg ; do blah "${file}" done one can easily write: find . -name '*.ogg' | \ while read file ; do \ blah "${file}" done xargs(1) is another popular tool for processing large argument lists: find -name '*.ogg' | xargs blah