Re: Environment variables inside the kernel?
From: linux-os (Dick Johnson)
Date: Thu Aug 18 2005 - 11:03:49 EST
On Thu, 18 Aug 2005, [iso-8859-1] Guillermo López Alejos wrote:
> Hi,
>
> I have a piece of code which uses environment variables. I have been
> told that it is not going to work in kernel space because the concept
> of environment is not applicable inside the kernel.
>
> I belive that, but I need to demonstrate it. I do not know how to
> proof this, perhaps referring to a solid reference about Linux design
> that points to the idea that it has no sense to use environment
> variables in kernel space.
>
> Do anyone knows about the existence of such document?
>
> Thank you,
>
> --
> Guillermo
You have to ask yourself, "What environment?". And, what it would
be used for.
Environment variables are some strings that exist in a processes'
name-space. The kernel is not a process. There are some strings
in the kernel, mostly relating to error messages, but there is
no conceptual use for an 'environment'. Since the kernel performs
functions on behalf of calling tasks, at that time, its environment
is the environment of the caller.
Now, there are environment strings set up for the very first
task by the kernel. This environment normally becomes the
environment of 'init'. (/usr/src/linux-`uname -r`/init/main.c)
This is just a "place-holder" and currently contains "HOME=/"
and "TERM=linux".
Cheers,
Dick Johnson
Penguin : Linux version 2.6.12.5 on an i686 machine (5537.79 BogoMips).
Warning : 98.36% of all statistics are fiction.
****************************************************************
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/