Re: nlink



On Tue, 08 Jan 2013 09:40:24 +0000 frank wrote:
do the following: let nlink show up in MC, then set a (soft) symlink

softlink and symlink are synonyms.

to any regular file: its nlink is incremented by 1.

That's impossible.

[andrew myhost tmp]$ cd /tmp
[andrew myhost tmp]$ touch zzzz
[andrew myhost tmp]$ ls -l zzzz
-rw-r--r-- 1 andrew andrew 0 Jan  8 14:31 zzzz
[andrew myhost tmp]$ ln -s -f zzzz zzzz_symlink     
[andrew myhost tmp]$ ls -l zzz*
-rw-r--r-- 1 andrew andrew 0 Jan  8 14:31 zzzz
lrwxrwxrwx 1 andrew andrew 4 Jan  8 14:31 zzzz_symlink -> zzzz

Thus nlink counts all links soft and hard, that's for sure.

No. File itself doesn't know anything about symlinks point to it.

In my opinion, those minimum links for regular files and directories should
actually not be counted by MC. MC should deduct them from the count reported
by stat.

For local file systems, MC gets nlink value directly from stat(2):

              nlink_t   st_nlink;   /* number of hard links */

-- 
Andrew



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