Driver driver peculiarity on process termination

Driver driver peculiarity on process termination

Post by khug.. » Thu, 14 Sep 2000 01:52:32

I can't find a better place to ask this, so if someone could suggest a
different forum please e-mail me.

This question relates to device driver development in the 2.0.x and
2.2.x kernels.

I've written a device driver for a home-built interface card.  When
the device is opened, it sends a command to the hardware to activate
the device (in the *_open() driver call) and when the device is
released (in the *_release() driver call) it deactivates the device.

When a program which use this driver terminates normally, the device
is deactivated.  If a program using this driver is terminated
abnormally (such as with a control-c from the shell), the device is
not deactivated.  Using printk() in the _release procedure shows that
it is called in each case; however, the status codes returned from
the hardware after sending the deactivation sequence is different.

I can't figure out what could be different.  Could someone suggest
a starting point?

Ken Hughes


Sent via
Before you buy.


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,

2. Confused ?? about X setup

3. Process Termination Indication in the Device Driver

4. How to obtain pixel coordinates with xv?

5. Drivers, Drivers, Drivers!

6. Question about dhcpd.leases time

7. SIS7012/K7S5A: ALSA, Kernel driver, SIS's driver... best driver choice?

8. Slackware 1.1.1 syslogd/klogd woes ...

9. Drivers, Drivers, Drivers

10. blocked process resists termination

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

12. BASH Process termination

13. signal of begining and termination of a runing process