Re: Printing environment variables for a process

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Jan 30, 2008 11:21 AM, arshad hussain <arshad.super@xxxxxxxxx> wrote:
>
>
>
> 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.
> >
> > I tried looking at task_struct to see which member holds the
> > environment, but cudnt get much. Any help appreciated.
> >
> > --
> > Thanks & Regards,
>
> Hi Manish,
>
> It is not possiable to access environment variable
> of a process, even if the kernel is running in that
>  process context. getenv() and friends are userspace
> buddys only as you have already pointed out.
>

Hi Arshad,

But since parents environment variables are copied into childs address
space, I was expecting do_fork to copy some environment related field
too of task_struct. Also If I am not wrong this behaviour is also
governed by whether you have passed CLONE_VM flag to do_fork or not.
So there must be something which checks this flag and does the copy.

Gurus please correct if I am wrong.

Thanks
> Thanks
>
>
>
>



-- 
Thanks & Regards,
********************************************
Manish Katiyar  ( http://mkatiyar.googlepages.com )
3rd Floor, Fair Winds Block
EGL Software Park
Off Intermediate Ring Road
Bangalore 560071, India
***********************************************

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux