Back to index

glibc  2.9
Defines | Functions
tst-tls18.c File Reference
#include <dlfcn.h>
#include <stdio.h>
#include "../test-skeleton.c"

Go to the source code of this file.

Defines

#define TEST_FUNCTION   do_test ()

Functions

static int do_test (void)

Define Documentation

#define TEST_FUNCTION   do_test ()

Definition at line 36 of file tst-tls18.c.


Function Documentation

static int do_test ( void  ) [static]

Definition at line 5 of file tst-tls18.c.

{
  char modname[sizeof "tst-tlsmod18aXX.so"];
  void *h[20];
  for (int i = 0; i < 20; i++)
    {
      snprintf (modname, sizeof modname, "tst-tlsmod18a%d.so", i);
      h[i] = dlopen (modname, RTLD_LAZY);
      if (h[i] == NULL)
       {
         printf ("unexpectedly failed to open %s", modname);
         exit (1);
       }
    }

  for (int i = 0; i < 20; i++)
    {
      int (*fp) (void) = (int (*) (void)) dlsym (h[i], "test");
      if (fp == NULL)
       {
         printf ("cannot find test in tst-tlsmod18a%d.so", i);
         exit (1);
       }

      if (fp ())
       exit (1);
    }

  return 0;
}

Here is the call graph for this function: