Re: kernel module to operate operate on task_structs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





> I am writing a kernel module where I am trying to access the 
> task_structs. Now I have tried this using various mathods.
>     1) Using the pidhash array.
>        Here when I do a insmod I get a unresolved symbol. 

 Modules can only use kernel symbols that are explicitly made
available to them (using EXPORT_SYMBOL()). If pidhash isn't exported,
your module can't use it.

>     2) Directly accessing the location of pidhash as seen in 
> System.map.
>    Here when the pidhash_fn hashes the supplied pid, the particular 
> location into which it indexes is NULL. I obtain the pid of the 
> process after a "ps -aux"

 Depending on System.map within a module isn't a good idea. It
breaks the control provided by EXPORT_SYMBOL and adds unnecessary
complexity (like finding the address of pidhash and passing it at the
time of insmod). And how do you make sure the System.map you are using
corresponds to the currently running kernel?


>    3) Starting from the init_task.
>   Here the next task after the init task is found to be NULL.

  Sure you are using the right headers and following the proper link?

In any case, the macro for_each_task() should get the job done for you.
It also starts from init_task and follows the linked list.

Hope this helps,
Ravi.


__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux