Re: how to implement close

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

 



On Sun, Dec 19, 2004 at 22:00:30 +0000, Cristina Rivera wrote:
> Hi everybody,
> 
> I need to implement a specific close syscall for a driver that I've 
> created, but I'm searching for the interface that I have to put in the C 
> source of the driver to include my code in and I can't find it. Is there a 
> routine that depends on the driver executed in close?
> 
> A few days ago I implemented ioctl and in this case I found that interface  
> --> int ioctl ( struct inode *inode,struct file *file,unsigned int 
> cmd,unsigned long arg)
> but with close I've not found any clue that lets me implement my specific 
> close.

File handles are reference counted and the syscall close acts only as
a dereference. Just trace the sys_close function. It's really short and
simple.

In sys_close, if f_error is non-zero, it will be the return value -- to
report asynchronous errors.

In sys_close (each time), flush method is called.

When the last reference to the file goes away and it is about to be
garbage-collected, the release method is called.

Note: There may be more than one filehandle for one filedescriptor if
dup was used or after fork.

-------------------------------------------------------------------------------
						 Jan 'Bulb' Hudec <bulb@xxxxxx>

Attachment: signature.asc
Description: Digital signature


[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