lkml.org 
[lkml]   [2011]   [Jul]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: how to find a task through name faster?
On 07/13/2011 09:55 AM, loody wrote:
> hi:
>
> 2011/7/12 Jiri Slaby <jirislaby@gmail.com>:
>> On 07/11/2011 06:52 PM, loody wrote:
>>> hi all:
>>> I found a way to find a task I need by name, test, as below:
>>> for_each_process(task) {
>>> if(strcmp(task->comm, "test")
>>> printk(“%s[%d]\n”, task->comm, task->pid);
>>> }
>>>
>>> But it is time-consuming to do so if I periodically want to know
>>> whether "test" exist or not.
>>> is there better way to do so?
>>
>> It depends on what you are trying to achieve. Maybe process accounting
>> is what you want?
> Would you mind to explain what is "process accounting"?

http://lmgtfy.com/?q=process+accounting+linux

> I ask this question cause I need to do something in my kernel driver
> when a thread starting running.

No, it doesn't work that way. You have to explain what exactly you want
to do (i.e. show sources and describe) so that people can actually help you.

regards,
--
js
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2011-07-13 11:23    [W:0.048 / U:0.636 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site