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.
Reading process info (task_struct) in user mode(LINUX)
Hi,
AFAIK, you can't do this from user mode (ring 3). You need to be a privileged process. One way to get around this would be to write your program as a driver rather than an application. Does writing a driver(/module) fit in with whatever you are trying to do?
If Linux were to let you directly run that kernel code from application-space, any program (think virusses etc...) could execute kernel code and compromise system security and stability.
Disclaimer: I am speaking from the point of view of someone who is programming an OS and am not a Linux expert.
HTH
Adam
AFAIK, you can't do this from user mode (ring 3). You need to be a privileged process. One way to get around this would be to write your program as a driver rather than an application. Does writing a driver(/module) fit in with whatever you are trying to do?
If Linux were to let you directly run that kernel code from application-space, any program (think virusses etc...) could execute kernel code and compromise system security and stability.
Disclaimer: I am speaking from the point of view of someone who is programming an OS and am not a Linux expert.
HTH
Adam
Well not quite. You can gives read access without giving write access, but it is true that confidentiality would be violated. Then again, root can already do whatever he pleases, so... well..AJ wrote: If Linux were to let you directly run that kernel code from application-space, any program (think virusses etc...) could execute kernel code and compromise system security and stability.
Anyway, there's a simple way: run ps with the relevant option, grep for the process you're interested, awk the signal masks if you want to get rid of the other stuff in the listing. No need to do any programming
The real problem with goto is not with the control transfer, but with environments. Properly tail-recursive closures get both right.