From: "Linh Dang" <linhd@nortel.com>
To: linux-kernel@vger.kernel.org
Subject: Re: Environment variables inside the kernel?
Date: Thu, 18 Aug 2005 14:23:51 -0400 [thread overview]
Message-ID: <wn5slx75cjs.fsf@linhd-2.ca.nortel.com> (raw)
In-Reply-To: <m2ek8r5hhh.fsf@Douglas-McNaughts-Powerbook.local> (Douglas McNaught's message of "Thu, 18 Aug 2005 12:37:14 -0400")
Douglas McNaught <doug@mcnaught.org> wrote:
>
> If someone is insisting you use environment varaiables in kernel
> code, challenge them to show you where they are implemented in the
> kernel. :)
>
> -Doug
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);
access_process_vm(current, mm->env_start, env,
env_len, 0);
/* env is now a big buffer containing null-terminated
strings representing evironment variables */
mmput(mm);
}
--
Linh Dang
next prev parent reply other threads:[~2005-08-18 18:23 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 [this message]
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
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=wn5slx75cjs.fsf@linhd-2.ca.nortel.com \
--to=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