Pad each field to __syscall_slong_t in struct rusage
[platform/upstream/glibc.git] / elf / tst-tls5.c
1 #include <dlfcn.h>
2 #include <stdio.h>
3 #include <stdlib.h>
4
5 #include <tls.h>
6
7
8 #define TEST_FUNCTION do_test ()
9 static int
10 do_test (void)
11 {
12   static const char modname[] = "tst-tlsmod2.so";
13   int result = 0;
14   int *foop;
15   int *foop2;
16   int (*fp) (int, int *);
17   void *h;
18
19   h = dlopen (modname, RTLD_LAZY);
20   if (h == NULL)
21     {
22       printf ("cannot open '%s': %s\n", modname, dlerror ());
23       exit (1);
24     }
25
26   foop = dlsym (h, "foo");
27   if (foop == NULL)
28     {
29       printf ("cannot get symbol 'foo': %s\n", dlerror ());
30       exit (1);
31     }
32
33   *foop = 42;
34
35   fp = dlsym (h, "in_dso");
36   if (fp == NULL)
37     {
38       printf ("cannot get symbol 'in_dso': %s\n", dlerror ());
39       exit (1);
40     }
41
42   result |= fp (42, foop);
43
44   foop2 = dlsym (h, "foo");
45   if (foop2 == NULL)
46     {
47       printf ("cannot get symbol 'foo' the second time: %s\n", dlerror ());
48       exit (1);
49     }
50
51   if (foop != foop2)
52     {
53       puts ("address of 'foo' different the second time");
54       result = 1;
55     }
56   else if (*foop != 16)
57     {
58       puts ("foo != 16");
59       result = 1;
60     }
61
62   dlclose (h);
63
64   return result;
65 }
66
67
68 #include "../test-skeleton.c"