Hi... On 1/29/08, Manish Katiyar <mkatiyar@xxxxxxxxx> wrote: > Hi, > > Is it possible to print or access the environment variables of a > process from kernel module. I know it can be done from userspace, but > if there is a running process I don't know if there is any way to > access/print the environment of a process from userspace. So I thought > if it is possible to write a module which accepts a pid during load > and then prints its environment variables. So you want to access environment variables? let's see: $ ltrace -f -n 4 -o test.txt printenv $ cat test.txt 3310 __libc_start_main(0x8048daa, 1, 0xbffd0ad4, 0x804a318, 0x804a36c <unfinished ...> 3310 setlocale(6, "") = "en_US.UTF-8" 3310 bindtextdomain("coreutils", "/usr/share/locale") = "/usr/share/locale" 3310 textdomain("coreutils") = "coreutils" 3310 __cxa_atexit(0x8048fc1, 0, 0, 0x804bcc0, 0xbffd0a48) = 0 3310 getopt_long(1, 0xbffd0ad4, "", 0x804a428, NULL) = -1 ^^^^^^^^^^^^ 3310 puts("SSH_AGENT_PID=3077") = 19 from man getopt_long: int getopt_long(int argc, char * const argv[], const char *optstring, const struct option *longopts, int *longindex); thus, 0xbffd0ad4 should be the location of environment variables. remember that this is user space address. regards, Mulyadi. -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ