]> sourceware.org Git - glibc.git/blame - nptl/forward.c
Update.
[glibc.git] / nptl / forward.c
CommitLineData
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>
21#include <pthread.h>
22#include <stdlib.h>
23
24#include <shlib-compat.h>
25
26
27#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
28static void *libpthread_handle;
29
30
31static void
32test_loaded (void)
33{
400d6c51
UD
34 /* While we are getting the result set the handle to (void *) -1 to
35 avoid recursive calls. */
36 libpthread_handle = (void *) -1l;
37
76a50749
UD
38 void *h = __libc_dlopen_mode ("libpthread.so.0", RTLD_LAZY | RTLD_NOLOAD);
39
40 libpthread_handle = h ?: (void *) -1l;
41}
42
43
44#define FORWARD3(name, rettype, decl, params, defaction, version) \
45rettype \
46__noexport_##name decl \
47{ \
48 if (libpthread_handle == NULL) \
49 test_loaded (); \
50 \
51 if (libpthread_handle == (void *) -1l) \
52 defaction; \
53 \
54 static __typeof (name) *p; \
55 p = __libc_dlsym (libpthread_handle, #name); \
56 \
57 return p params; \
58} \
59compat_symbol (libc, __noexport_##name, name, version)
60
61#define FORWARD2(name, decl, params, defretval, version) \
62 FORWARD3 (name, int, decl, params, return defretval, version)
63
64#define FORWARD(name, decl, params, defretval) \
65 FORWARD2 (name, decl, params, defretval, GLIBC_2_0)
66
67
68FORWARD (pthread_attr_destroy, (pthread_attr_t *attr), (attr), 0);
69
70FORWARD2 (pthread_attr_init, (pthread_attr_t *attr), (attr), 0, GLIBC_2_1);
71
72FORWARD (pthread_attr_getdetachstate,
73 (const pthread_attr_t *attr, int *detachstate), (attr, detachstate),
74 0);
75FORWARD (pthread_attr_setdetachstate, (pthread_attr_t *attr, int detachstate),
76 (attr, detachstate), 0);
77
78FORWARD (pthread_attr_getinheritsched,
79 (const pthread_attr_t *attr, int *inherit), (attr, inherit), 0);
80FORWARD (pthread_attr_setinheritsched, (pthread_attr_t *attr, int inherit),
81 (attr, inherit), 0);
82
83FORWARD (pthread_attr_getschedparam,
84 (const pthread_attr_t *attr, struct sched_param *param),
85 (attr, param), 0);
86FORWARD (pthread_attr_setschedparam,
87 (pthread_attr_t *attr, const struct sched_param *param),
88 (attr, param), 0);
89
90FORWARD (pthread_attr_getschedpolicy,
91 (const pthread_attr_t *attr, int *policy), (attr, policy), 0);
92FORWARD (pthread_attr_setschedpolicy, (pthread_attr_t *attr, int policy),
93 (attr, policy), 0);
94
95FORWARD (pthread_attr_getscope,
96 (const pthread_attr_t *attr, int *scope), (attr, scope), 0);
97FORWARD (pthread_attr_setscope, (pthread_attr_t *attr, int scope),
98 (attr, scope), 0);
99
100
101FORWARD (pthread_condattr_destroy, (pthread_condattr_t *attr), (attr), 0);
102FORWARD (pthread_condattr_init, (pthread_condattr_t *attr), (attr), 0);
103
104
105FORWARD (pthread_cond_broadcast, (pthread_cond_t *cond), (cond), 0);
106
107FORWARD (pthread_cond_destroy, (pthread_cond_t *cond), (cond), 0);
108
109FORWARD (pthread_cond_init,
110 (pthread_cond_t *cond, const pthread_condattr_t *cond_attr),
111 (cond, cond_attr), 0);
112
113FORWARD (pthread_cond_signal, (pthread_cond_t *cond), (cond), 0);
114
115FORWARD (pthread_cond_wait, (pthread_cond_t *cond, pthread_mutex_t *mutex),
116 (cond, mutex), 0);
117
118
119FORWARD (pthread_equal, (pthread_t thread1, pthread_t thread2),
120 (thread1, thread2), 1);
121
122
123FORWARD3 (pthread_exit, void, (void *retval), (retval), exit (EXIT_SUCCESS),
124 GLIBC_2_0);
125
126
127FORWARD (pthread_getschedparam,
128 (pthread_t target_thread, int *policy, struct sched_param *param),
129 (target_thread, policy, param), 0);
130FORWARD (pthread_setschedparam,
131 (pthread_t target_thread, int policy,
132 const struct sched_param *param), (target_thread, policy, param), 0);
133
134
135FORWARD (pthread_mutex_destroy, (pthread_mutex_t *mutex), (mutex), 0);
136
137FORWARD (pthread_mutex_init,
138 (pthread_mutex_t *mutex, const pthread_mutexattr_t *mutexattr),
139 (mutex, mutexattr), 0);
140
141FORWARD (pthread_mutex_lock, (pthread_mutex_t *mutex), (mutex), 0);
142
143FORWARD (pthread_mutex_unlock, (pthread_mutex_t *mutex), (mutex), 0);
144
145
d5ed0118 146FORWARD3 (pthread_self, pthread_t, (void), (), return 0, GLIBC_2_0);
76a50749
UD
147
148
149FORWARD (pthread_setcancelstate, (int state, int *oldstate), (state, oldstate),
150 0);
151
152FORWARD (pthread_setcanceltype, (int type, int *oldtype), (type, oldtype), 0);
153
154
155#endif
This page took 0.053496 seconds and 5 git commands to generate.