(_IO_new_file_fopen): Recognize new mode specifier 'm' to enable mmap I/O.
[glibc.git] / elf / tst-tls7.c
blob4f785fe78e19577d70a7191145dcb1386b91f1ca
1 #include <dlfcn.h>
2 #include <stdio.h>
3 #include <stdlib.h>
5 #include <link.h>
6 #include <tls.h>
9 #define TEST_FUNCTION do_test ()
10 static int
11 do_test (void)
13 #ifdef USE_TLS
14 static const char modname[] = "tst-tlsmod3.so";
15 int result = 0;
16 int (*fp) (void);
17 void *h;
18 int i;
19 int modid = -1;
21 for (i = 0; i < 10; ++i)
23 h = dlopen (modname, RTLD_LAZY);
24 if (h == NULL)
26 printf ("cannot open '%s': %s\n", modname, dlerror ());
27 exit (1);
30 /* Dirty test code here: we peek into a private data structure.
31 We make sure that the module gets assigned the same ID every
32 time. The value of the first round is used. */
33 if (modid == -1)
34 modid = ((struct link_map *) h)->l_tls_modid;
35 else if (((struct link_map *) h)->l_tls_modid != modid)
37 printf ("round %d: modid now %d, initially %d\n",
38 i, ((struct link_map *) h)->l_tls_modid, modid);
39 result = 1;
42 fp = dlsym (h, "in_dso2");
43 if (fp == NULL)
45 printf ("cannot get symbol 'in_dso2': %s\n", dlerror ());
46 exit (1);
49 result |= fp ();
51 dlclose (h);
54 return result;
55 #else
56 return 0;
57 #endif
61 #include "../test-skeleton.c"