public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: Linh Dang <linhd@nortel.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Environment variables inside the kernel?
Date: Fri, 19 Aug 2005 00:12:28 +0100	[thread overview]
Message-ID: <1124406748.20755.14.camel@localhost.localdomain> (raw)
In-Reply-To: <wn5slx75cjs.fsf@linhd-2.ca.nortel.com>

On Iau, 2005-08-18 at 14:23 -0400, Linh Dang wrote:
> They're in current process's vm. You just have to parse it yourself.
> 
> something along the (untested) lines:
> 
>         struct mm_struct *mm = current ? get_task_mm(current) : NULL;
> 
>         if (mm) {
>                 unsigned env_len = mm->env_end - mm->env_start;
>                 char* env = kmalloc(env_len, GFP_KERNEL);


That is the environment passed to the application, not the environment
it is running with. Only the application knows where that is, and once
you do things like putenv() it becomes rather relevant.

Essentially environment is user space business and you can't get at it
from the kernel.


  parent reply	other threads:[~2005-08-18 22:44 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-18 15:44 Environment variables inside the kernel? Guillermo López Alejos
2005-08-18 16:02 ` linux-os (Dick Johnson)
2005-08-18 16:03 ` jerome lacoste
2005-08-18 16:12 ` Ingo Oeser
2005-08-18 17:27   ` Christoph Lameter
2005-08-18 16:37 ` Douglas McNaught
2005-08-18 18:23   ` Linh Dang
2005-08-18 18:48     ` Guillermo López Alejos
2005-08-18 19:43       ` Emilio Jesús Gallego Arias
2005-08-21 22:12       ` Eric W. Biederman
2005-08-22  9:05         ` Guillermo López Alejos
2005-08-22  9:18           ` Eric W. Biederman
2005-08-25  8:59             ` Guillermo López Alejos
2005-08-22 20:38       ` Helge Hafting
2005-08-18 23:12     ` Alan Cox [this message]
2005-08-18 22:55       ` Peter M. Groen
2005-08-19 10:28         ` Guillermo López Alejos

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1124406748.20755.14.camel@localhost.localdomain \
    --to=alan@lxorguk.ukuu.org.uk \
    --cc=linhd@nortel.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox