Notes |
(0004774)
dannyniu (reporter)
2020-02-07 11:55
edited on: 2020-02-07 11:56
|
I suggest make the note indicate st_nlink as undefined, as $(st_nlink * count(mount points)) is not the actual behavior as I've observed on FreeBSD with nullfs:
$ mount -l
/dev/ada0s1a on / (ufs, local, journaled soft-updates)
devfs on /dev (devfs, local, multilabel)
/usr/home/dannyniu/sandbox on /usr/home/dannyniu/glassbox (nullfs, local)
$ ls -l sandbox glassbox
glassbox:
total 4
-rwxr-xr-x 1 dannyniu dannyniu 246 Dec 10 10:24 data2url.php
sandbox:
total 4
-rwxr-xr-x 1 dannyniu dannyniu 246 Dec 10 10:24 data2url.php
$
|
|
(0004775)
dannyniu (reporter)
2020-02-07 12:27
|
Okay, I might've mis-interpreted the "note", but nonetheless I suggest make it clearer by saying:
Note: ... in which case the actual number of hard links to the file throughout the file hierarchy is st_nlink times the number of mount points for that file system (which is greater than st_nlink). |
|
(0004776)
stephane (reporter)
2020-02-07 13:24
|
I'd rather say "in which case the number of hard links to the file throughout the file hierarchy could be greater than st_nlink" as systems allow mounting *parts* of a FS (like in bind-mounts) and part of a FS can be masked by another FS (like FS2 is mounted on a non-empty directory of FS1), in which case, it could even be less than st_nlink. |
|
(0004777)
geoffclare (manager)
2020-02-07 14:27
|
Seems I was fixated on the multiple-mount-points case and hadn't thought about other situations affecting the number of links that can be "found". The less-than-st_nlink case could happen even on ancient systems that don't have modern functionality like bind mounts, etc. You just need to mount another file system over the top of a non-empty directory. I'll add a note with a revised proposal. |
|
(0004778)
geoffclare (manager)
2020-02-07 14:41
|
On page 392 line 13342 section <sys/stat.h> add a new paragraph:The st_nlink value shall be the number of hard links to the file within the file system in which the file resides.
Note: The number of links to the file that can be found by traversing the file hierarchy can differ from st_nlink. For example, it can be less than st_nlink if a link to the file cannot be reached because it is below a directory that has been overlaid with a mount point for a different file system, and it can be greater than st_nlink on implementations that allow a file system (or part of one) to be duplicated at additional mount points. |
|
(0004779)
shware_systems (reporter)
2020-02-07 18:22
|
I agree with the clarification here, just feel what is in the Note is better as an App Usage paragraph of its own, rather than in the normative part. |
|