support ld.so.conf.d directry listing
authorHajime Tazaki <tazaki@nict.go.jp>
Thu, 27 Sep 2012 14:03:57 +0900
changeset 638 d10cea06dc85
parent 637 cf4e616c56d5
child 639 0b95311bb3b6
support ld.so.conf.d directry listing
extract-system-config.py
i386/machine.c
x86_64/machine.c
--- a/extract-system-config.py	Thu Sep 27 13:59:17 2012 +0900
+++ b/extract-system-config.py	Thu Sep 27 14:03:57 2012 +0900
@@ -151,6 +151,17 @@
             return file
     
     raise CouldNotFindFile ()
+
+def list_lib_path():
+    paths = ""
+    re_lib = re.compile ('(?<=^#)')
+    for filename in os.listdir("/etc/ld.so.conf.d/"):
+        for line in open ("/etc/ld.so.conf.d/" + filename, 'r'):
+            if re_lib.search (line) is not None:
+                continue
+            paths += (":" + line.rstrip ())
+
+    return paths
         
 def usage():
     print ''
@@ -230,6 +241,8 @@
         sys.exit (1)
     config.write ('#define CONFIG_TCB_STACK_GUARD ' + str(data.data) + '\n')
 
+    config.write ('#define CONFIG_SYSTEM_LDSO_LIBRARY_PATH \"' + list_lib_path () + '\"\n')
+
 if __name__ == "__main__":
     main(sys.argv[1:])
 
--- a/i386/machine.c	Thu Sep 27 13:59:17 2012 +0900
+++ b/i386/machine.c	Thu Sep 27 14:03:57 2012 +0900
@@ -337,7 +337,9 @@
     "/usr/lib:"
     "/usr/lib32:"
     "/usr/lib/i386-linux-gnu:"
-    "/lib/i386-linux-gnu";
+    "/lib/i386-linux-gnu"
+    CONFIG_SYSTEM_LDSO_LIBRARY_PATH
+    ;
   return dirs;
 }
 
--- a/x86_64/machine.c	Thu Sep 27 13:59:17 2012 +0900
+++ b/x86_64/machine.c	Thu Sep 27 14:03:57 2012 +0900
@@ -7,6 +7,7 @@
 #include "local-elf.h"
 #include "syscall.h"
 #include "vdl-file.h"
+#include "vdl-config.h"
 #include <sys/mman.h>
 #include <sys/mman.h>
 #include <asm/prctl.h> // for ARCH_SET_FS
@@ -255,6 +256,7 @@
     "/lib/x86_64-linux-gnu:"
     "/usr/lib64:"
     "/usr/lib/x86_64-linux-gnu:"
+    CONFIG_SYSTEM_LDSO_LIBRARY_PATH
     ;
   return dirs;
 }