On Wed, Oct 21, 2009 at 3:07 PM, Leonidas . <[email protected]> wrote:
> On Thu, Oct 22, 2009 at 12:26 AM, Leonidas . <[email protected]> wrote:
>> What would be an ideal way to check if a process/thread is running or
>> sleeping
>> or it is dead from kernel space?
>>
>> Basically, check whether a process is alive, then determine its status.
>>
>> -Leo.
>>
>
> E.g. My module wants to do some cleanup after a thread exits after calling
> pthread_exit(). The only way my module can know about it by looking in to list
> of processes but this is not a foolproof since the pid can be recycled.
>
>
> -Leo.
>
Hi Leo,
I never did this, but I found it on the internets, so it must be ok ...
<quote>
task_t *p;
read_lock(&tasklist_lock);
for_each_process(p) {
if ( strcmp (p->comm, $your-daemon-name) == 0)
break;
}
read_unlock(&tasklist_lock);
sounds not a good idea. Smile
</quote>
But, maybe it gives you some ideas?
-bob
--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to [email protected]
Please read the FAQ at http://kernelnewbies.org/FAQ