On Mon, Oct 19, 2009 at 4:08 PM, Leena M. <kernmonk@xxxxxxxxx> wrote: > Hi All , > I have sprinkled printk's in each and every function in VFS and > Filesystem which I want to understand. > I want to trace the functions which are executed when I execute a system > call in user space for my process. > I want to print the trace only for my process , so i want to somehow pass > the the pid from the user space and > use struct task_struct . Can I do it though the proc filesystem or is there > any other idea to do this. A quick idea would be to implement something like /proc/tracethispid which read integer. Then you do i.e "echo 1111 > /proc/tracethispid" and store this integer in a kernel variable. Use this variable inside a condition checking: (not sure if "current" is still called like 2.6.x used to be) if unlikely(current->pid = target_pid) { printk("tracing function xyz"); /* FIXME: I forgot the gcc function to print current functio name, maybe it's __function__ } here, "unlikely" is used to accelerate the whole function call, because IMHO not all the time your we hit the function when the backing process's pid is our target pid, right? just 2 cents idea... -- regards, Mulyadi Santosa Freelance Linux trainer and consultant blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ