Home | History | Annotate | only in /src/usr.sbin/catman
Up to higher level directory
NameDateSize
catman.815-Aug-20213.2K
catman.c12-Oct-201915K
Makefile03-Jun-2023327
pathnames.h29-May-20161.8K
README.hardlinks29-May-20161.3K
TODO04-Apr-199929

README.hardlinks

      1 # $NetBSD: README.hardlinks,v 1.1 2016/05/29 22:32:03 dholland Exp $
      2 #
      3 
      4 catman.8 notes that this code doesn't handle hard links.
      5 
      6 To fix this, one might proceed as follows:
      7 
      8 (1) Add an additional data structure mapping (fsid_t, ino_t) pairs
      9 from stat to filenames.
     10 
     11 (2) In scanmandir(), in the readdir loop, next to the code that checks
     12 for a symlink, check if the page's linkcount > 1 (manstat.st_nlink > 1)
     13 and if so:
     14    a. Check the new data structure to see if this file's been seen before.
     15       If so, use the saved name of the page to construct a hard link in the
     16       cat directory, and continue to the next directory entry.
     17    b. If not, add to the new data structure to remember this page and
     18       process it as normal.
     19 
     20 One might clear the data structure for each mandir or not; probably
     21 for each man tree is best. The size of the structure isn't
     22 prohibitive; but the chances of ever seeing the same hardlinked page
     23 in two different man trees (e.g. in both /usr/share/man and
     24 /usr/pkg/man) are pretty well zero.
     25 
     26 All of this seems like a SMOP, but it doesn't really seem worth doing
     27 at the moment given that we don't build catpages at all by default and
     28 they aren't particularly useful to have any more except on the slowest
     29 of slow hardware. I've left this note so that someone else can take it
     30 up if they see fit.
     31 
     32  - dholland 20160529
     33