Re: Killing another process from C code
From: Kasper Dupont (kasperd_at_daimi.au.dk)
Date: 03/17/04
- Next message: j.munk_at_XremoveXthisXmaccor.com: "Re: Killing another process from C code"
- Previous message: Basile Starynkevitch [news]: "Re: Killing another process from C code"
- In reply to: Basile Starynkevitch [news]: "Re: Killing another process from C code"
- Next in thread: Basile Starynkevitch [news]: "Re: Killing another process from C code"
- Reply: Basile Starynkevitch [news]: "Re: Killing another process from C code"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 17 Mar 2004 13:48:50 +0100
"Basile Starynkevitch [news]" wrote:
>
> The application should remember forked pids. The parent process
> should, when fork()-ing, remember the child pid and then kill it
> appropriately.
Yes, when you know the pid there is no point in
using other unreliable ways to try guessing which
process is the right one to kill.
> Hence the parent is able to use the kill system call
> kill(pid,SIGTERM) and then kill(pid, SIGKILL).
That is the way to do it. You should add a delay
between the two calls so the process have a chance
to shut down cleanly (if by any means possible).
I'm not sure what is the right way to wait for a
process to terminate with a timeout. Neither
select nor waitpid seems obvious. I have seen
scripts looking a few times starting with short
intervals and graduately increasing the interval.
-- Kasper Dupont -- der bruger for meget tid paa usenet. For sending spam use mailto:aaarep@daimi.au.dk /* Would you like fries with that? */
- Next message: j.munk_at_XremoveXthisXmaccor.com: "Re: Killing another process from C code"
- Previous message: Basile Starynkevitch [news]: "Re: Killing another process from C code"
- In reply to: Basile Starynkevitch [news]: "Re: Killing another process from C code"
- Next in thread: Basile Starynkevitch [news]: "Re: Killing another process from C code"
- Reply: Basile Starynkevitch [news]: "Re: Killing another process from C code"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|