Gentoo Archives: gentoo-dev

From: "Jan Kundrát" <jkt@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Re: lastrite: dev-cpp/libherdstat and app-portage/herdstat
Date: Sun, 08 Jun 2008 22:09:09
Message-Id: 484C5875.4040801@gentoo.org
In Reply to: Re: [gentoo-dev] Re: lastrite: dev-cpp/libherdstat and app-portage/herdstat by "Alin Năstac"
1 Alin Năstac wrote:
2 > I remember that one time I had to split a command like dohtml
3 > "${S}"/something/*.{png,html} because the line was too long. At that
4 > time, bash had a limit of 32K. Now is what ... 1M?
5
6 from execve(2):
7
8 Limits on size of arguments and environment
9
10 Most Unix implementations impose some limit on the total size of the
11 command-line argument (argv) and environment (envp) strings that may be
12 passed to a new program. POSIX.1 allows an implementation to advertise
13 this limit using the ARG_MAX constant (either defined in <limits.h> or
14 available at run time using the call sysconf(_SC_ARG_MAX)).
15
16 On Linux prior to kernel 2.6.23, the memory used to store the
17 environment and argument strings was limited to 32 pages (defined by the
18 kernel constant MAX_ARG_PAGES). On architectures with a 4-kB page size,
19 this yields a maximum size of 128 kB.
20
21 On kernel 2.6.23 and later, most architectures support a size limit
22 derived from the soft RLIMIT_STACK resource limit (see getrlimit(2)).
23 For these architectures, the total size is limited to 1/4 of the allowed
24 stack size, the limit per string is 32 pages (the kernel constant
25 MAX_ARG_STRLEN), and the maximum number of strings is 0x7FFFFFFF. (This
26 change allows programs to have a much larger argument and/or environment
27 list. Imposing the 1/4-limit ensures that the new program always has
28 some stack space.) Architectures with no memory management unit are
29 excepted: they maintain the limit that was in effect before kernel 2.6.23.
30
31 Cheers,
32 -jkt
33
34 --
35 cd /local/pub && more beer > /dev/mouth

Attachments

File name MIME type
signature.asc application/pgp-signature