環境変数の長さの最大値

/usr/src/lib/libc/stdlib/setenv.c を見ると、制限はないような感じ。POSIX は知らない。


[追記:2007-03-14]
POSIX によると、環境変数の長さと使える文字に制限はない(ヌル文字を除く)。

The values that the environment variables may be assigned are not restricted except that they are considered to end with a null byte and the total space used to store the environment and the arguments to the process is limited to {ARG_MAX} bytes.

http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap08.html


[追記:2008-01-12]
起動時の環境変数の長さは ARG_MAX によって制限されるので注意。