Re: 4096 byte limit to /proc/PID/environ ?

linux-os (Dick Johnson)
2006-05-24T16:46:42Z

On Wed, 24 May 2006, James Pearson wrote:

> It appears that /proc/PID/environ only returns the first 4096 bytes of a
> processes' environment.
>
> Is there any other way via userland to get the whole environment for a
> process?
>
> Thanks
>
> James Pearson

I think that /proc/PID/environ just returns the environment that
existed when the process was created, irrespective of size. You
can check this as:

#include <stdio.h>

main()
{
setenv("FOO=", "1234", 1);
printf("%d\n", getpid());
pause();
}

Variable "FOO" will not appear in /proc. It you set the environment
in non-standard ways, overwriting the original, you can see it in
/proc.

Cheers,
Dick Johnson
Penguin : Linux version 2.6.16.4 on an i686 machine (5592.89 BogoMips).
New book: http://www.AbominableFirebug.com/
_
\x1a\x04

****************************************************************
The information transmitted in this message is confidential and may be privileged. Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited. If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to DeliveryErrors@analogic.com - and destroy all copies of this information, including any attachments, without reading or disclosing them.

Thank you.