Re: close doesn't call release?

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

 




>       Hey there David,
>
>       I am very unexperienced with the kernel, but this is what LDD
> says (chapter 3).
>
> <snip>
> Not every close system call causes the release method to be invoked. 
Only
> the ones that actually release the device data  structure invoke the
> method -- hence its name. The kernel keeps a counter of how many
> times a file structure is being used. Neither fork nor dup creates a new
> file structure (only open does that); they just increment the counter in
> the existing structure.
>
>      The  close  system  call executes the release method only when the
> counter for the file structure drops to zero, which happens when the
> structure is destroyed. This relationship between the release method
> and the close system call guarantees that the usage count for modules is
> always consistent.
>
> </snip>
>
>       Sorry I cant answer the rest of your question, but I hoped that
> helped at least a bit. This was extreme luck as just before I read your
> email I had just  happened to be reading some stuff about that topic a
> couple of hours before. :)
>
>
>  Anyways, happy coding
>
> -Dan Erickson-
> -ColdOneKnight@rogers.com-

On Mon, 20 May 2002, David Stroupe wrote:

> During my driver development I noticed that even when there is but one 
> open call made to a device, the release function in the driver is not 
> called until the application exits.  Why is it not called when I call 
> close(whatever)?
> 
> My test is on a 4 line program with a single open and close.  The 
> release function is not called until the main()function exits.
> 
> If I want to have the ability to reset the device during operation a 
> call to close followed by a new open would be ideal.  How can I 
> accomplish this?
> 
> TIA
> 
> 
> 

--
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