From: "Guillermo López Alejos" <glalejos@gmail.com>
To: Linh Dang <linhd@nortel.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Environment variables inside the kernel?
Date: Thu, 18 Aug 2005 20:48:04 +0200 [thread overview]
Message-ID: <4fec73ca05081811488ec518e@mail.gmail.com> (raw)
In-Reply-To: <wn5slx75cjs.fsf@linhd-2.ca.nortel.com>
Whoa!, I did not expect so many replies. Thank you for your answers.
The thing is that the Computer Architecture area of the University I
am studying at is developing a parallel filesystem. Currently it works
as a stand-alone program (this is why it uses resources like
environment variables), and I have been told to integrate it in the
Linux kernel.
I have to justify changes on this filesystem code (like avoiding the
use of environment variables) to my tutor. In this case I needed to
find why it is not possible to use environment variables in kernel
space.
I was looking for a reference documentation which give a definition of
environment variables that exclude their use inside the kernel, or,
simply, I expected to find a design decision to justify this. But I
think I have enough information with your answers, I will be able to
elaborate a satisfactory conclusion.
Excuse me if the topic was so obvious (it was not to me) and thank you again,
On 8/18/05, Linh Dang <linhd@nortel.com> wrote:
> 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);
> }
--
Guillermo
next prev parent reply other threads:[~2005-08-18 18:48 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 [this message]
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=4fec73ca05081811488ec518e@mail.gmail.com \
--to=glalejos@gmail.com \
--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