13.07.2015 Views

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

170Chapter 6The IBM Developer Kit for <strong>Linux</strong>, Java 2 Technology Editi<strong>on</strong>drwxrwxr-x 2 mschwarz mschwarz 4096 Jul 8 10:13 .drwx------ 50 mschwarz mschwarz 4096 Jul 8 10:11 ..-rw-rw---- 2 mschwarz mschwarz 45 Jul 8 10:11 example-rw-rw---- 2 mschwarz mschwarz 45 Jul 8 10:11 sample$As you can see, a file can have <strong>on</strong>ly <strong>on</strong>e set of owners and permissi<strong>on</strong>s, nomatter how many links are made to it. Changing the owner or permissi<strong>on</strong>s of<strong>on</strong>e link changes all hard links at the same time. In other words, the securityof a file is like its data: A change to <strong>on</strong>e link is a change to them all.A link need not be in the same directory as the original name.$ ln example /tmp/sample$ ls -latotal 16drwxrwxr-x 2 mschwarz mschwarz 4096 Jul 8 10:13 .drwx------ 50 mschwarz mschwarz 4096 Jul 8 10:11 ..-rw-rw---- 3 mschwarz mschwarz 45 Jul 8 10:11 example-rw-rw---- 3 mschwarz mschwarz 45 Jul 8 10:11 sample$ ls -la /tmptotal 132drwxrwxr-x 2 mschwarz mschwarz 4096 Jul 8 10:23 .drwx------ 50 mschwarz mschwarz 4096 Jul 8 10:11 ..-rw-rw-r-- 1 mschwarz mschwarz 118081 Jun 3 18:51 jLin.tar.gz-rw-rw---- 3 mschwarz mschwarz 45 Jul 8 10:11 sample$Here we made a third link in a different directory; /tmp/sample is a thirdname for the same data file. Note that we made it from the example link, notthe original filename. In fact, as far as the <strong>Linux</strong> filesystem is c<strong>on</strong>cerned, thereis no “original” name. N<strong>on</strong>e of these names is more significant than any other.When you remove a filename, the link is destroyed and the file’s link count isdecremented. If the link count goes to zero, the file is removed. That’s it.Nothing else.Hard links have a couple of drawbacks. One of them is a genuine technicallimitati<strong>on</strong> and the other is more of a usability problem. The technical limitati<strong>on</strong>is that a hard link cannot be made across mounted filesystems. In the simplest

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!