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

Re: task pointer



hello....

> wake_up_process(task_ptr);
> Now, sometime it is possible that the process is already dead, e.g.
> user to ctrl-c on console. In this case, I get:
> Unable to handle kernel paging request at virtual address d29dbdb4
> Is there a way, where I can very efficiently check for existence of
> process ?

Maybe the easiest check is making sure task_ptr is not NULL (task_ptr is 
actually a pointer to a task_struct, right?).

there is also a chance that the process is still on Z (zombie) state, so 
check for this one too. task_ptr->state is the you are looking for.

You can also check fork task_ptr->flags is equal to PF_EXITING. Maybe 
there are other...so please check the actual implementation of 
do_exit() (kernel/sched.c I think) for complete insight on how process 
termination works...

regards

Mulyadi


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/