LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices

Reply
 
Search this Thread
Old 01-03-2012, 02:02 PM   #1
qinqin
LQ Newbie
 
Registered: Dec 2011
Posts: 7

Rep: Reputation: Disabled
Kernel driver to register for a process exit notification?


Is there a way for a kernel driver to register for a specified process exit notification?

Our scenario is that the kernel driver allocates certain resources for the process and in the event of abnormal termination of the process, we'd like to release the resources allocated by the kernel driver.

Any suggestions on how process exit notification can be propagated to the kernel driver?

Thanks in advance!
 
Old 01-03-2012, 03:51 PM   #2
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,057

Rep: Reputation: 88
You can monitor user terminator signal.
 
Old 01-04-2012, 07:20 AM   #3
sundialsvcs
Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 5,452

Rep: Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172
If you implemented your driver as a "device," and used e.g. ioctl() to talk to it, it would be automatically closed.
 
Old 01-04-2012, 01:50 PM   #4
qinqin
LQ Newbie
 
Registered: Dec 2011
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by sundialsvcs View Post
If you implemented your driver as a "device," and used e.g. ioctl() to talk to it, it would be automatically closed.
Hi sundialsvcs,
what if multiple processes use this device, and there is certain resource allocated for each process. When the process dies unexpectedly, how does the kernel device to be notified in order to clean-up the resource allocated for this particular process?
 
Old 01-04-2012, 01:51 PM   #5
qinqin
LQ Newbie
 
Registered: Dec 2011
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by nini09 View Post
You can monitor user terminator signal.
Hi nini09,
Could you please elaborate the signal? Which signal to monitor? When the process dies unexpectedly, how does the kernel device to be notified in order to clean-up the resource allocated for this particular process?
 
Old 01-04-2012, 05:04 PM   #6
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,057

Rep: Reputation: 88
SIGKILL 9 Kill signal -- when process dies unexpectedly and is kiiled.
SIGTERM 15 Termination signal -- when process is terminated normally.
 
Old 04-18-2013, 04:29 PM   #7
govikes
LQ Newbie
 
Registered: Mar 2013
Posts: 5

Rep: Reputation: Disabled
qinqin, I'm curious to know how you solved your issue - did you implement monitoring of the process termination in the device driver?
 
Old 04-19-2013, 07:22 AM   #8
SIG_SEGV
Member
 
Registered: Jul 2012
Location: Banglore, INDIA
Distribution: Fedora-Core
Posts: 70

Rep: Reputation: 11
@qiqin
Well you are actually advising to write a handler for SIGKILL signal which is impossible. Coz, Two signals in Linux cannot be caught, blocked or monitored. And they are SIGKILL and SIGSTOP
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to wait for the process and know if the exit code of the sub process williamhomanchun Linux - General 10 08-11-2008 02:32 PM
scheduler invocation, process selected, process entry and exit linuxdoniv Programming 1 03-14-2008 09:37 AM
scheduler invocation, process selected, process entry and exit linuxdoniv Programming 1 03-14-2008 04:48 AM


All times are GMT -5. The time now is 01:23 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration