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

From: linux-os (Dick Johnson)
Date: Wed May 24 2006 - 12:45:55 EST



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/
_


****************************************************************
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@xxxxxxxxxxxx - and destroy all copies of this information, including any attachments, without reading or disclosing them.

Thank you.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/