Hi,

I am trying to make user space task control from the following piece of code.

here I am searching the userspace task with the name and as soon as I find it I am trying to shange its state using set_task_state(), but I did not see the task is getting stopped even after the execution of this statement.


void AcessTaskStruct()
{
struct task_struct *task, *parent;
struct cfs_rq *cfs_rq;
struct rq *oRq;
char *str;
char *str1= "exe";


for_each_process(task)
{

printk("state = %d priority= %d [%d]\n",task->state ,task->prio, task->pid);
printk("Executable Name =%s\n", task->comm);
str = task->comm;

if(!strncmp(str, str1, 3))
{

parent = task->parent;

printk("The Parents PID =%d\n", parent->pid);
printk("PID = %d\n", task->pid);
printk("The Task State is =%d\n", task->state);



set_task_state(task, __TASK_STOPPED);
set_current_state(__TASK_STOPPED); This Line not working
//current->state = __TASK_STOPPED;





}
}


}

Please suggest me whats wrong here.