A hardlink is marginally more work because it could require walking
the directory chain more than once. A hardlink has an inode pointer in
it already, so once you've found the file and have permission to it,
you don't need to look anymore. For a symlink, you have to walk the
path again to find the "real" file referred to in the symlink.
As long as the tool that updates a file doesn't unlink one of the
hardlinked members, a change to one would be reflected in the others.
However, most compilers do just that on the final step to create the
binary which would break the connection.
A snippet from strace -f gives:
26090 stat64("myexec", {st_mode=S_IFREG|0755, st_size=14773, ...}) = 0
26090 lstat64("myexec", {st_mode=S_IFREG|0755, st_size=14773, ...}) = 0
26090 unlink("myexec") = 0
26090 open("myexec", O_RDWR|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 3
A symlink would be blissfully unaware of the file changing underneath it.
On Mon, Jan 4, 2010 at 4:22 PM, McKown, John
<[email protected]> wrote:
> I just noticed something on my Linux desktop that is "different" from the way
> that I do things. When I want to be able to run a command which acts
> differently depending on the command name which invoked it, I always use a
> symlink for the alternate names. I just noticed that Fedora 11 doesn't. I
> curious if a hardlink is that much more efficient than a symlink when it
> comes to loading a program. Or is there some other reason to use a hardlink
> rather than a symlink. I use a symlink because I can then modify the program
> and all the other names are automatically using the new version of my program.
----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390