Re: Dynamic linking on Linux

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

 



On Sat, Apr 26, 2008 at 12:45:12PM +0530, Pranav Peshwe wrote:
> How does the kernel figure out that a particular file/library is already
> opened and mmaped to a particular address ? Does it scan through the list of
> open files or is there any information kept in the inode for the file or is
> there some other way ?

When it tries to open a file it will first look up the path, then
figure out which inode belongs to that file. Next it will look up if
that particular inode is already opened by scanning the list of open
files (which basically is a list of in-memory inodes) and if it is, it
will increase the refcount for that inode. Because all references to
files are done by inode and not by path, it will even work when you
have hardlinked files. The in-memory inode has a refcount, the on-disk
inode will not change when a file is merely opened.


Erik

-- 
Erik Mouw -- mouw@xxxxxxxxxxxx

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