lkml.org 
[lkml]   [1999]   [Jan]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjecthow to read the process environment in a module

I need to read the process environment in a module.

In the 2.0 kernels, I used (successfully):

unsigned long i;
char c;

printk("Environment: ");
for (i=current->mm->env_start; i<current->mm->env_end; i++) {
c=get_fs_byte(i);
printk("%c", c);
}
printk("\n");

I tried to make this work for the 2.2.0 kernel:

unsigned long i;
char c;

printk("Environment:");
for (i=current->mm->env_start; i<current->mm->env_end; i++) {
get_user(c, (char *)i);
printk("%c", c);
}
printk("\n");

but I get only a (small) part of the environment, starting and ending at a
random position...

What is the correct way to do this?

PS1. I looked at drivers/block/floppy.c and I found the same method, used
when the floppy module parameters are passed by the environment. Anyone
use this method with succes?

PS2. In fs/proc/array.c a different, much more complex, method is used,
but I was unable to do the same in a _module_ (seems to work only when
compiled into the kernel).

Thanks.

---
Stelian Pop <spop@captimark.fr>| Too many things happened today
Captimark | Too many words I don't wanna say
Paris, France | I wanna be cool but the heat's coming up
| I'm ready to kill 'cause enough is enough
PGP key available on request | (Accept - "Up To The Limit")


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:50    [W:0.028 / U:0.216 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site