Reading foreign process info (task_struct) in user mode

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
wreckedpc
Posts: 3
Joined: Sun Nov 25, 2007 4:14 pm

Reading foreign process info (task_struct) in user mode

Post 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.
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post 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.
iammisc
Member
Member
Posts: 269
Joined: Thu Nov 09, 2006 6:23 pm

Post 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.
wreckedpc
Posts: 3
Joined: Sun Nov 25, 2007 4:14 pm

Post 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.
User avatar
mystran
Member
Member
Posts: 670
Joined: Thu Mar 08, 2007 11:08 am

Post 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>
The real problem with goto is not with the control transfer, but with environments. Properly tail-recursive closures get both right.
Post Reply