Trapping process termination.

Trapping process termination.

Post by Chris Ranki » Tue, 12 Nov 1996 04:00:00



Hello all,

I am attempting to patch a UNIX network-server program so that it will
restrict the number of times a user can login. To this end, I have
implemented
a memory-resident list. However the server is basically an endless loop
that listens for packets on the network, and the only way to remove the
program
is to kill its process. This immediately destroys the information in
memory...

Is there any way of trapping the "kill" signal (there *must* be, I would
think)
so that I can tell the process to write the memory structure to disk before
it is lost? I need to either cover this eventuality, or force everyone to
logout.

Thanks,
Chris.

 
 
 

Trapping process termination.

Post by Roger L. Cordes, Jr » Wed, 13 Nov 1996 04:00:00



> Is there any way of trapping the "kill" signal (there *must* be, I would
> think) so that I can tell the process to write the memory structure to
> disk before it is lost?

By definition, SIGKILL (historically, 9) cannot be caught or ignored.
You
could, however, kill(1) your server with a different signal (e.g.,
SIGTERM) and implement a handler for that.

Maybe,
R.

 
 
 

1. Q: Notify device driver about process termination

Hi All,

I'm writing a character dev.driver that provides services to processes.
The process calls open(), then several ioctl()s and finally close().
The driver is supposed to allow several processes to have it open at the
same time. The driver allocates some resources on behalf of the process
and then frees those resources when the process calls close(). The problem
is that the driver's close routine is only called when _the last_ process
calls close(). Thus, no cleanup is possible until the last file descriptor
is closed.

I hoped to use struct proc* parameter of driver ioctl() and close()    
functions to "tag" and then free the resources but run into the problem.

What is it possible to do to receive a notification on each process
termination? Did I make a design error when I had planned to do it this
way? If so, what is the "official" way to achieve an automatic
process-specific cleanup?

Thank you,
Stan

2. FreeBSD 5.0 and local console

3. blocked process resists termination

4. Is the HP Colorado tape drive compatible with Linux?

5. How do I suppress bkg. process termination messages?

6. Terminal Servers

7. BASH Process termination

8. How to direct cron output to a tty or pty ?

9. signal of begining and termination of a runing process

10. Catching termination of child process and system() call

11. Driver driver peculiarity on process termination

12. Notification of process termination

13. Process Termination and Shared Memory Access