Re: Notification on exit of process

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

 



There could be two way of doing it.
One is from the process you want to be notified, use ptrace. (man ptrace)
One is the from the process you itself (the one getting exited), use
atexit system call. Inside this you need to specify a function. If you
know the pid of the process that need to be notified - then inside the
function (one specified in atexit function) send a signal to the
process using kill system call.

Hope that helps.

On 4/23/05, Arjan van de Ven <arjan@xxxxxxxxxxxxx> wrote:
> On Sat, 2005-04-23 at 12:13 +0300, Razvan DEACONESCU wrote:
> >
> > On Fri, 22 Apr 2005, Usman S. Ansari wrote:
> >
> > > Is there a way (without modifying kernel sources) in 2.4 and/or 2.6 to
> > > be notified when process exit ?
> > >
> > > I found "profile_event_register", but on registering, I get 38
> > > (function not implemented).
> > >
> > > Usman
> >
> > Hi,
> >
> > if you want to be notified when a process exits when in kernel space, you
> > could intercept the exit system call; as i recall, you should use
> > __NR_exit_group instead of __NR_exit (declared in asm/unistd.h);
> > if you are using kernel 2.6 you have to modify the sources, as the kernel
> > no longer exports sys_call_table.
> 
> it's also broken to do this because you don't capture the cases where
> processes involuntarily exit (eg the kernel kills them) only the cases
> where apps themselves say they want to die.
> 
> 
> --
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive:       http://mail.nl.linux.org/kernelnewbies/
> FAQ:           http://kernelnewbies.org/faq/
> 
> 


-- 
-----------
S K T
-----------

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



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux