about summary refs log tree commit diff
path: root/elf/circleload1.c
diff options
context:
space:
mode:
Diffstat (limited to 'elf/circleload1.c')
-rw-r--r--elf/circleload1.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/elf/circleload1.c b/elf/circleload1.c
index 7ac101a799..990ff84a84 100644
--- a/elf/circleload1.c
+++ b/elf/circleload1.c
@@ -5,6 +5,8 @@
 #include <stdlib.h>
 #include <string.h>
 
+#define MAPS ((struct link_map *) _r_debug.r_map)
+
 static int
 check_loaded_objects (const char **loaded)
 {
@@ -24,10 +26,10 @@ check_loaded_objects (const char **loaded)
 
   printf("   Name\n");
   printf(" --------------------------------------------------------\n");
-  for (lm = _r_debug.r_map; lm; lm = lm->l_next)
+  for (lm = MAPS; lm; lm = lm->l_next)
     {
       if (lm->l_name && lm->l_name[0])
-	printf(" %s, count = %d\n", lm->l_name, (int) lm->l_opencount);
+	printf(" %s, count = %d\n", lm->l_name, (int) lm->l_direct_opencount);
       if (lm->l_type == lt_loaded && lm->l_name)
 	{
 	  int match = 0;
@@ -72,9 +74,9 @@ load_dso (const char **loading, int undef, int flag)
   printf ("\nThis is what is in memory now:\n");
   errors += check_loaded_objects (loaded);
 
-  printf ("Loading shared object %s: %s\n", loading [0],
+  printf ("Loading shared object %s: %s\n", loading[0],
 	 flag == RTLD_LAZY ? "RTLD_LAZY" : "RTLD_NOW");
-  obj = dlopen (loading [0], flag);
+  obj = dlopen (loading[0], flag);
   if (obj == NULL)
     {
       if (flag == RTLD_LAZY)
@@ -120,15 +122,15 @@ load_dso (const char **loading, int undef, int flag)
 	    }
 	}
 
-      loaded[0] = loading [0];
-      loaded[1] = loading [1];
-      loaded[2] = loading [2];
+      loaded[0] = loading[0];
+      loaded[1] = loading[1];
+      loaded[2] = loading[2];
     }
   errors += check_loaded_objects (loaded);
 
   if (obj)
     {
-      printf ("UnLoading shared object %s\n", loading [0]);
+      printf ("UnLoading shared object %s\n", loading[0]);
       dlclose (obj);
       loaded[0] = NULL;
       loaded[1] = NULL;
@@ -145,15 +147,15 @@ main (void)
   int errors = 0;
   const char *loading[3];
 
-  loading [0] = "circlemod1a.so";
-  loading [1] = "circlemod2a.so";
-  loading [2] = "circlemod3a.so";
+  loading[0] = "circlemod1a.so";
+  loading[1] = "circlemod2a.so";
+  loading[2] = "circlemod3a.so";
   errors += load_dso (loading, 0, RTLD_LAZY);
   errors += load_dso (loading, 0, RTLD_NOW);
 
-  loading [0] = "circlemod1.so";
-  loading [1] = "circlemod2.so";
-  loading [2] = "circlemod3.so";
+  loading[0] = "circlemod1.so";
+  loading[1] = "circlemod2.so";
+  loading[2] = "circlemod3.so";
   errors += load_dso (loading, 1, RTLD_LAZY);
   errors += load_dso (loading, 1, RTLD_NOW);