]>
Commit | Line | Data |
---|---|---|
76a50749 UD |
1 | /* Copyright (C) 2002 Free Software Foundation, Inc. |
2 | This file is part of the GNU C Library. | |
3 | Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. | |
4 | ||
5 | The GNU C Library is free software; you can redistribute it and/or | |
6 | modify it under the terms of the GNU Lesser General Public | |
7 | License as published by the Free Software Foundation; either | |
8 | version 2.1 of the License, or (at your option) any later version. | |
9 | ||
10 | The GNU C Library is distributed in the hope that it will be useful, | |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | Lesser General Public License for more details. | |
14 | ||
15 | You should have received a copy of the GNU Lesser General Public | |
16 | License along with the GNU C Library; if not, write to the Free | |
17 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | |
18 | 02111-1307 USA. */ | |
19 | ||
20 | #include <dlfcn.h> | |
8454830b | 21 | #include <pthreadP.h> |
76a50749 UD |
22 | #include <stdlib.h> |
23 | ||
24 | #include <shlib-compat.h> | |
3b7c07d8 | 25 | #include <atomic.h> |
76a50749 UD |
26 | |
27 | ||
8454830b UD |
28 | /* Pointers to the libc functions. */ |
29 | struct pthread_functions __libc_pthread_functions attribute_hidden; | |
76a50749 | 30 | |
76a50749 | 31 | |
8454830b UD |
32 | #if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2) |
33 | # define FORWARD3(name, rettype, decl, params, defaction, version) \ | |
76a50749 UD |
34 | rettype \ |
35 | __noexport_##name decl \ | |
36 | { \ | |
8454830b | 37 | if (__libc_pthread_functions.ptr_##name == NULL) \ |
76a50749 UD |
38 | defaction; \ |
39 | \ | |
8454830b | 40 | return __libc_pthread_functions.ptr_##name params; \ |
76a50749 UD |
41 | } \ |
42 | compat_symbol (libc, __noexport_##name, name, version) | |
43 | ||
8454830b | 44 | # define FORWARD2(name, decl, params, defretval, version) \ |
76a50749 UD |
45 | FORWARD3 (name, int, decl, params, return defretval, version) |
46 | ||
8454830b | 47 | # define FORWARD(name, decl, params, defretval) \ |
76a50749 UD |
48 | FORWARD2 (name, decl, params, defretval, GLIBC_2_0) |
49 | ||
50 | ||
51 | FORWARD (pthread_attr_destroy, (pthread_attr_t *attr), (attr), 0); | |
52 | ||
53 | FORWARD2 (pthread_attr_init, (pthread_attr_t *attr), (attr), 0, GLIBC_2_1); | |
54 | ||
55 | FORWARD (pthread_attr_getdetachstate, | |
56 | (const pthread_attr_t *attr, int *detachstate), (attr, detachstate), | |
57 | 0); | |
58 | FORWARD (pthread_attr_setdetachstate, (pthread_attr_t *attr, int detachstate), | |
59 | (attr, detachstate), 0); | |
60 | ||
61 | FORWARD (pthread_attr_getinheritsched, | |
62 | (const pthread_attr_t *attr, int *inherit), (attr, inherit), 0); | |
63 | FORWARD (pthread_attr_setinheritsched, (pthread_attr_t *attr, int inherit), | |
64 | (attr, inherit), 0); | |
65 | ||
66 | FORWARD (pthread_attr_getschedparam, | |
67 | (const pthread_attr_t *attr, struct sched_param *param), | |
68 | (attr, param), 0); | |
69 | FORWARD (pthread_attr_setschedparam, | |
70 | (pthread_attr_t *attr, const struct sched_param *param), | |
71 | (attr, param), 0); | |
72 | ||
73 | FORWARD (pthread_attr_getschedpolicy, | |
74 | (const pthread_attr_t *attr, int *policy), (attr, policy), 0); | |
75 | FORWARD (pthread_attr_setschedpolicy, (pthread_attr_t *attr, int policy), | |
76 | (attr, policy), 0); | |
77 | ||
78 | FORWARD (pthread_attr_getscope, | |
79 | (const pthread_attr_t *attr, int *scope), (attr, scope), 0); | |
80 | FORWARD (pthread_attr_setscope, (pthread_attr_t *attr, int scope), | |
81 | (attr, scope), 0); | |
82 | ||
83 | ||
84 | FORWARD (pthread_condattr_destroy, (pthread_condattr_t *attr), (attr), 0); | |
85 | FORWARD (pthread_condattr_init, (pthread_condattr_t *attr), (attr), 0); | |
86 | ||
87 | ||
88 | FORWARD (pthread_cond_broadcast, (pthread_cond_t *cond), (cond), 0); | |
89 | ||
90 | FORWARD (pthread_cond_destroy, (pthread_cond_t *cond), (cond), 0); | |
91 | ||
92 | FORWARD (pthread_cond_init, | |
93 | (pthread_cond_t *cond, const pthread_condattr_t *cond_attr), | |
94 | (cond, cond_attr), 0); | |
95 | ||
96 | FORWARD (pthread_cond_signal, (pthread_cond_t *cond), (cond), 0); | |
97 | ||
98 | FORWARD (pthread_cond_wait, (pthread_cond_t *cond, pthread_mutex_t *mutex), | |
99 | (cond, mutex), 0); | |
100 | ||
101 | ||
102 | FORWARD (pthread_equal, (pthread_t thread1, pthread_t thread2), | |
103 | (thread1, thread2), 1); | |
104 | ||
105 | ||
106 | FORWARD3 (pthread_exit, void, (void *retval), (retval), exit (EXIT_SUCCESS), | |
107 | GLIBC_2_0); | |
108 | ||
109 | ||
110 | FORWARD (pthread_getschedparam, | |
111 | (pthread_t target_thread, int *policy, struct sched_param *param), | |
112 | (target_thread, policy, param), 0); | |
113 | FORWARD (pthread_setschedparam, | |
114 | (pthread_t target_thread, int policy, | |
115 | const struct sched_param *param), (target_thread, policy, param), 0); | |
116 | ||
117 | ||
118 | FORWARD (pthread_mutex_destroy, (pthread_mutex_t *mutex), (mutex), 0); | |
119 | ||
120 | FORWARD (pthread_mutex_init, | |
121 | (pthread_mutex_t *mutex, const pthread_mutexattr_t *mutexattr), | |
122 | (mutex, mutexattr), 0); | |
123 | ||
124 | FORWARD (pthread_mutex_lock, (pthread_mutex_t *mutex), (mutex), 0); | |
125 | ||
126 | FORWARD (pthread_mutex_unlock, (pthread_mutex_t *mutex), (mutex), 0); | |
127 | ||
128 | ||
d5ed0118 | 129 | FORWARD3 (pthread_self, pthread_t, (void), (), return 0, GLIBC_2_0); |
76a50749 UD |
130 | |
131 | ||
132 | FORWARD (pthread_setcancelstate, (int state, int *oldstate), (state, oldstate), | |
133 | 0); | |
134 | ||
135 | FORWARD (pthread_setcanceltype, (int type, int *oldtype), (type, oldtype), 0); | |
136 | ||
137 | ||
138 | #endif |