Unix Programming - Read task_struct from process VM

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > March 2006 > Read task_struct from process VM





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Read task_struct from process VM
varma

2006-03-13, 7:51 am

Hi,
I am trying to read task_struct fields from process virtual memory
using ptrace. But I am not able to do it. Can somebody tell me how can
I do it. My aim is take a process id, apply ptrace get the values of
vm_start and vm_end, and from these pages i want to read task_struct
fields of that process.

Thanks

Igmar Palsenberg

2006-03-13, 5:54 pm

varma wrote:
> Hi,
> I am trying to read task_struct fields from process virtual memory
> using ptrace. But I am not able to do it. Can somebody tell me how can
> I do it.


You can't. task_struct is something that belongs to kernelspace, and you
can't read that from userspace.

> My aim is take a process id, apply ptrace get the values of
> vm_start and vm_end, and from these pages i want to read task_struct
> fields of that process.


That won't work.



Igmar
varma

2006-03-13, 5:54 pm

Thanks. I want to trace all the processes as they started in Linux, so
that when the process exits, I will get control of the process being
traced, and using pid of that process i can get task_struct and, I can
read the process information(I/O, Mem, CPU time etc.). How can I do
this. Is it possible to do it.

I think i have to do it as kernel module, since get_task_by_pid can be
used from kernel module.

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com