Re: Environment variables inside the kernel?

From: Douglas McNaught
Date: Thu Aug 18 2005 - 11:37:50 EST


Guillermo López Alejos <glalejos@xxxxxxxxx> writes:

> 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.

Correct.

> 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.

Environment variables are a part of the API that Unix supplies to
userspace programs. The kernel is not a userspace program, and as far
as I know it doesn't even do most of the work of maintaining the
environment for a process--that's done by the C library and the
userspace program loader.

> Do anyone knows about the existence of such document?

No, probably because it's such an obvious concept. You might get hold
of one of the several books on Linux kernel programming and see if
they mention it.

If someone is insisting you use environment varaiables in kernel code,
challenge them to show you where they are implemented in the kernel. :)

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