rtld: Add two special directives to libmap.conf
authorJohn Marino <draco@marino.st>
Fri, 4 May 2012 16:54:27 +0000 (18:54 +0200)
committerJohn Marino <draco@marino.st>
Sat, 5 May 2012 07:33:18 +0000 (09:33 +0200)
commit51b1ba8e5aac0e71bb9bfd9b3779a4e683ffc3c7
tree866acb73768dbd35882c5738b41f848ea1fb82e9
parent8ffc528ee0622d23fbf7e7026cee9c8568757070
rtld: Add two special directives to libmap.conf

include <file>:
    Parse the contents of file before continuing with the current file.

includedir <dir>:
    Parse the contents of every file in dir that ends in .conf before
    continuing with the current file.

Any file or directory encountered while processing include or includedir
directives will be parsed exactly once, even if it is encountered multiple
times.

Taken from FreeBSD SVN 234851 (30 APR 2012) with modification:

1) DragonFly realpath works differently than FreeBSD's and doesn't
   accept a null value for the resolved_path argument.
2) FreeBSD's debug lines reflect the wrong function, lm_init, instead
   of lmc_parse_file.  lmc_parse_dir also calls lmc_parse_file, so
   the debug message is definitely wrong and was corrected.
3) FreeBSD keeps using path even after determining realpath and putting
   the result in the rpath variable.  It uses path for debug messages
   and opening a file descriptor.  DragonFly doesn't use path again and
   only uses rpath after it is determined.
4) FreeBSD's lmc_parse_file code had a bug in the linked list used to
   track which conf files had already been parsed.  Memory for the
   filename was allocated so it wouldn't get overwritten after multiple
   passes, which is standard for the includedir functionality.
libexec/rtld-elf/libmap.c
share/man/man5/libmap.conf.5