Page 1 of 1

Reading foreign process info (task_struct) in user mode

Posted: Mon Nov 26, 2007 11:36 am
by wreckedpc
Hello All,

I am completely new to Kernel Programming. Hence I will explain my requirements. I will greatly appreciate if anyone of you can help me out.

OS : Linux

Problem : To read signal information (Signal Mask , pending signals etc) of a particular process. We know pid of that process. This will be done from user mode.

My Approach: To read another process' task_struct structure (which contains essential information related to particular process) from kernel and use this information.

Roadblock: I checked /linux/sched.h . I saw a function find_task_by_pid. This function takes pid as an argument and returns task_struct of that process. But merely inclusion of this file(#include) in my code gave me millions of errors.

I will be grateful if you help me out with this. Pardon me if I have missed details , but I will be glad to provide more.

Posted: Mon Nov 26, 2007 1:02 pm
by JamesM
Hi,

this isn't a forum for questions about linux kernel programming. This is for designing and implementing hobby OSs. You have the wrong forum.

Posted: Mon Nov 26, 2007 8:05 pm
by iammisc
This is kind of basic C isn't it.

That function is in the kernel. The kernel is a separate binary file not a library. You have to use a wrapper library that will communicate with the kernel in another way(e.g. interrupts, the syscall instruction). Since that function is in kernel-space and not user-space of course you can't use it.

Posted: Mon Nov 26, 2007 9:38 pm
by wreckedpc
Mr Einstein , thanks for pointing out that my question is very basic. No doubt with your advanced knowledge , one day you will receive nothing less than Ig Nobel prize.

Posted: Wed Dec 05, 2007 6:40 am
by mystran
Besides checking process signal information in Linux has nothing to do with kernel programming.. a simple shell onliner solves the problem..

hint: ps <someflags> | grep <pid>