[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: stopping a process temporarily
Hi Vamsi,
You can do this by just having the task_struct for
the task you want to make to sleep.
You can use the macros predefined in linux/sched.h
like set_task_state(....) or set_current_state(..) by
the different states in the same file. Set the state
to TASK_INTERRUPTIBLE, etc.Call schedule() after that.
You can even use interruptible_sleep_on(..) for making
the process sleep.
To find out the task_struct, use the function
find_task_by_pid(..).
You can easily do this. This has worked out in my
code.
Hope this helps,
Pooja.
--- "Vamsi Krishna S ." <vamsi@in.ibm.com> wrote: >
Hello,
>
> I need to stop a process temporarily from the
> context of a different process.
>
> I can't send it SIGKILL, I need to stop it
> _temporarily_.
> I can't send it SIGSTOP (I think); if the process is
> being ptrace'd the parent
> will get control, not what we want.
>
> I suspect we should be able to achieve this by
> fiddling with task->state bits
> but not sure, especially considering that the target
> process could be in
> any state (running/blocked/readytorun ...) when we
> want to do this.
>
> Any ideas/help greatly appreciated.
>
> Thanks,
> --
>
> Vamsi Krishna S.
> Linux Technology Center,
> IBM Software Lab, Bangalore.
> Ph: +91 80 5262355 Extn: 3959
> Internet: vamsi@in.ibm.com
________________________________________________________________________
Looking for a job? Visit Yahoo! India Careers
Visit http://in.careers.yahoo.com
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
IRC Channel: irc.openprojects.net / #kernelnewbies
Web Page: http://www.kernelnewbies.org/