(__nss_lookup_function): En/Decrypt cached function pointers.
[glibc/history.git] / nptl / tst-dlsym1.c
blob3744570c7f378956a2f3c2593f6ccb4e8de8a9f7
1 /* Test case by Hui Huang <hui.huang@sun.com>. */
2 #include <dlfcn.h>
3 #include <pthread.h>
4 #include <stdio.h>
5 #include <stdlib.h>
8 static void *
9 start_routine (void *args)
11 int i;
12 void **addrs = (void **) args;
13 for (i = 0; i < 10000; ++i)
14 addrs[i % 1024] = dlsym (NULL, "does_not_exist");
16 return addrs;
20 static int
21 do_test (void)
23 pthread_t tid1, tid2, tid3;
25 void *addrs1[1024];
26 void *addrs2[1024];
27 void *addrs3[1024];
29 if (pthread_create (&tid1, NULL, start_routine, addrs1) != 0)
31 puts ("1st create failed");
32 exit (1);
34 if (pthread_create (&tid2, NULL, start_routine, addrs2) != 0)
36 puts ("2nd create failed");
37 exit (1);
39 if (pthread_create (&tid3, NULL, start_routine, addrs3) != 0)
41 puts ("3rd create failed");
42 exit (1);
45 if (pthread_join (tid1, NULL) != 0)
47 puts ("1st join failed");
48 exit (1);
50 if (pthread_join (tid2, NULL) != 0)
52 puts ("2nd join failed");
53 exit (1);
55 if (pthread_join (tid3, NULL) != 0)
57 puts ("2rd join failed");
58 exit (1);
61 return 0;
65 #define TEST_FUNCTION do_test ()
66 #include "../test-skeleton.c"