Add compatibility symbol maps. libpthread (.so.1 and .so.2)

used LIBTHREAD_1_0 as its version definition, but now needs
to define its symbols in the same namespace used by libc.
The compatibility hooks allows you to use libraries and
binaries built and linked to libpthread before libc was
built with symbol versioning.  The shims can be removed if
libpthread is given a version bump.

Reviewed by:	davidxu
This commit is contained in:
Daniel Eischen 2006-03-13 00:59:51 +00:00
parent 855761d5db
commit e62165c8b0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=156611
207 changed files with 1363 additions and 19 deletions

View file

@ -31,10 +31,13 @@ CFLAGS+=-D_LOCK_DEBUG
# however it is no longer strictly conformed to POSIX
# CFLAGS+=-DSYSTEM_SCOPE_ONLY
LDFLAGS= -Wl,--version-script=${.CURDIR}/pthread.map
LDFLAGS= -Wl,--version-script=${.CURDIR}/pthread.map -Wl,-zmuldefs
# enable extra internal consistancy checks
CFLAGS+=-D_PTHREADS_INVARIANTS -Wall
.if defined(SYMVER_ENABLED)
CFLAGS+=-DSYMBOL_VERSIONING
.endif
PRECIOUSLIB=

View file

@ -40,6 +40,8 @@
#undef errno
extern int errno;
LT10_COMPAT_DEFAULT(__error);
int *
__error(void)
{

View file

@ -32,6 +32,9 @@ __FBSDID("$FreeBSD$");
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(__accept);
LT10_COMPAT_DEFAULT(accept);
__weak_reference(__accept, accept);
int

View file

@ -33,6 +33,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_aio_suspend);
LT10_COMPAT_DEFAULT(aio_suspend);
__weak_reference(_aio_suspend, aio_suspend);
int

View file

@ -31,6 +31,9 @@
#include <sys/queue.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_atfork);
LT10_COMPAT_DEFAULT(pthread_atfork);
__weak_reference(_pthread_atfork, pthread_atfork);
int

View file

@ -36,6 +36,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_attr_destroy);
LT10_COMPAT_DEFAULT(pthread_attr_destroy);
__weak_reference(_pthread_attr_destroy, pthread_attr_destroy);
int

View file

@ -31,6 +31,9 @@
#include <pthread_np.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_attr_get_np);
LT10_COMPAT_DEFAULT(pthread_attr_get_np);
__weak_reference(_pthread_attr_get_np, pthread_attr_get_np);
int

View file

@ -35,6 +35,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_attr_getdetachstate);
LT10_COMPAT_DEFAULT(pthread_attr_getdetachstate);
__weak_reference(_pthread_attr_getdetachstate, pthread_attr_getdetachstate);
int

View file

@ -33,6 +33,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_attr_getguardsize);
LT10_COMPAT_DEFAULT(pthread_attr_getguardsize);
__weak_reference(_pthread_attr_getguardsize, pthread_attr_getguardsize);
int

View file

@ -35,6 +35,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_attr_getinheritsched);
LT10_COMPAT_DEFAULT(pthread_attr_getinheritsched);
__weak_reference(_pthread_attr_getinheritsched, pthread_attr_getinheritsched);
int

View file

@ -35,6 +35,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_attr_getschedparam);
LT10_COMPAT_DEFAULT(pthread_attr_getschedparam);
__weak_reference(_pthread_attr_getschedparam, pthread_attr_getschedparam);
int

View file

@ -35,6 +35,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_attr_getschedpolicy);
LT10_COMPAT_DEFAULT(pthread_attr_getschedpolicy);
__weak_reference(_pthread_attr_getschedpolicy, pthread_attr_getschedpolicy);
int

View file

@ -35,6 +35,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_attr_getscope);
LT10_COMPAT_DEFAULT(pthread_attr_getscope);
__weak_reference(_pthread_attr_getscope, pthread_attr_getscope);
int

View file

@ -35,6 +35,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_attr_getstack);
LT10_COMPAT_DEFAULT(pthread_attr_getstack);
__weak_reference(_pthread_attr_getstack, pthread_attr_getstack);
int

View file

@ -35,6 +35,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_attr_getstackaddr);
LT10_COMPAT_DEFAULT(pthread_attr_getstackaddr);
__weak_reference(_pthread_attr_getstackaddr, pthread_attr_getstackaddr);
int

View file

@ -35,6 +35,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_attr_getstacksize);
LT10_COMPAT_DEFAULT(pthread_attr_getstacksize);
__weak_reference(_pthread_attr_getstacksize, pthread_attr_getstacksize);
int

View file

@ -37,6 +37,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_attr_init);
LT10_COMPAT_DEFAULT(pthread_attr_init);
__weak_reference(_pthread_attr_init, pthread_attr_init);
int

View file

@ -35,6 +35,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_attr_setcreatesuspend_np);
LT10_COMPAT_DEFAULT(pthread_attr_setcreatesuspend_np);
__weak_reference(_pthread_attr_setcreatesuspend_np, pthread_attr_setcreatesuspend_np);
int

View file

@ -35,6 +35,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_attr_setdetachstate);
LT10_COMPAT_DEFAULT(pthread_attr_setdetachstate);
__weak_reference(_pthread_attr_setdetachstate, pthread_attr_setdetachstate);
int

View file

@ -34,6 +34,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_attr_setguardsize);
LT10_COMPAT_DEFAULT(pthread_attr_setguardsize);
__weak_reference(_pthread_attr_setguardsize, pthread_attr_setguardsize);
int

View file

@ -35,6 +35,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_attr_setinheritsched);
LT10_COMPAT_DEFAULT(pthread_attr_setinheritsched);
__weak_reference(_pthread_attr_setinheritsched, pthread_attr_setinheritsched);
int

View file

@ -35,6 +35,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_attr_setschedparam);
LT10_COMPAT_DEFAULT(pthread_attr_setschedparam);
__weak_reference(_pthread_attr_setschedparam, pthread_attr_setschedparam);
int

View file

@ -35,6 +35,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_attr_setschedpolicy);
LT10_COMPAT_DEFAULT(pthread_attr_setschedpolicy);
__weak_reference(_pthread_attr_setschedpolicy, pthread_attr_setschedpolicy);
int

View file

@ -35,6 +35,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_attr_setscope);
LT10_COMPAT_DEFAULT(pthread_attr_setscope);
__weak_reference(_pthread_attr_setscope, pthread_attr_setscope);
int

View file

@ -35,6 +35,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_attr_setstack);
LT10_COMPAT_DEFAULT(pthread_attr_setstack);
__weak_reference(_pthread_attr_setstack, pthread_attr_setstack);
int

View file

@ -35,6 +35,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_attr_setstackaddr);
LT10_COMPAT_DEFAULT(pthread_attr_setstackaddr);
__weak_reference(_pthread_attr_setstackaddr, pthread_attr_setstackaddr);
int

View file

@ -35,6 +35,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_attr_setstacksize);
LT10_COMPAT_DEFAULT(pthread_attr_setstacksize);
__weak_reference(_pthread_attr_setstacksize, pthread_attr_setstacksize);
int

View file

@ -33,6 +33,13 @@
#include "un-namespace.h"
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_barrier_init);
LT10_COMPAT_DEFAULT(pthread_barrier_init);
LT10_COMPAT_PRIVATE(_pthread_barrier_wait);
LT10_COMPAT_DEFAULT(pthread_barrier_wait);
LT10_COMPAT_PRIVATE(_pthread_barrier_destroy);
LT10_COMPAT_DEFAULT(pthread_barrier_destroy);
__weak_reference(_pthread_barrier_init, pthread_barrier_init);
__weak_reference(_pthread_barrier_wait, pthread_barrier_wait);
__weak_reference(_pthread_barrier_destroy, pthread_barrier_destroy);

View file

@ -33,6 +33,15 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_barrierattr_destroy);
LT10_COMPAT_DEFAULT(pthread_barrierattr_destroy);
LT10_COMPAT_PRIVATE(_pthread_barrierattr_init);
LT10_COMPAT_DEFAULT(pthread_barrierattr_init);
LT10_COMPAT_PRIVATE(_pthread_barrierattr_setpshared);
LT10_COMPAT_DEFAULT(pthread_barrierattr_setpshared);
LT10_COMPAT_PRIVATE(_pthread_barrierattr_getpshared);
LT10_COMPAT_DEFAULT(pthread_barrierattr_getpshared);
__weak_reference(_pthread_barrierattr_destroy, pthread_barrierattr_destroy);
__weak_reference(_pthread_barrierattr_init, pthread_barrierattr_init);
__weak_reference(_pthread_barrierattr_setpshared,

View file

@ -6,6 +6,15 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_cancel);
LT10_COMPAT_DEFAULT(pthread_cancel);
LT10_COMPAT_PRIVATE(_pthread_setcancelstate);
LT10_COMPAT_DEFAULT(pthread_setcancelstate);
LT10_COMPAT_PRIVATE(_pthread_setcanceltype);
LT10_COMPAT_DEFAULT(pthread_setcanceltype);
LT10_COMPAT_PRIVATE(_pthread_testcancel);
LT10_COMPAT_DEFAULT(pthread_testcancel);
__weak_reference(_pthread_cancel, pthread_cancel);
__weak_reference(_pthread_setcancelstate, pthread_setcancelstate);
__weak_reference(_pthread_setcanceltype, pthread_setcanceltype);

View file

@ -37,6 +37,11 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_cleanup_push);
LT10_COMPAT_DEFAULT(pthread_cleanup_push);
LT10_COMPAT_PRIVATE(_pthread_cleanup_pop);
LT10_COMPAT_DEFAULT(pthread_cleanup_pop);
__weak_reference(_pthread_cleanup_push, pthread_cleanup_push);
__weak_reference(_pthread_cleanup_pop, pthread_cleanup_pop);

View file

@ -39,6 +39,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(__close);
LT10_COMPAT_DEFAULT(close);
__weak_reference(__close, close);
int

View file

@ -33,6 +33,11 @@
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_getconcurrency);
LT10_COMPAT_DEFAULT(pthread_getconcurrency);
LT10_COMPAT_PRIVATE(_pthread_setconcurrency);
LT10_COMPAT_DEFAULT(pthread_setconcurrency);
/*#define DEBUG_CONCURRENCY */
#ifdef DEBUG_CONCURRENCY
#define DBG_MSG stdout_debug

View file

@ -37,6 +37,21 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(__pthread_cond_wait);
LT10_COMPAT_PRIVATE(_pthread_cond_wait);
LT10_COMPAT_DEFAULT(pthread_cond_wait);
LT10_COMPAT_PRIVATE(__pthread_cond_timedwait);
LT10_COMPAT_PRIVATE(_pthread_cond_timedwait);
LT10_COMPAT_DEFAULT(pthread_cond_timedwait);
LT10_COMPAT_PRIVATE(_pthread_cond_init);
LT10_COMPAT_DEFAULT(pthread_cond_init);
LT10_COMPAT_PRIVATE(_pthread_cond_destroy);
LT10_COMPAT_DEFAULT(pthread_cond_destroy);
LT10_COMPAT_PRIVATE(_pthread_cond_signal);
LT10_COMPAT_DEFAULT(pthread_cond_signal);
LT10_COMPAT_PRIVATE(_pthread_cond_broadcast);
LT10_COMPAT_DEFAULT(pthread_cond_broadcast);
#define THR_IN_CONDQ(thr) (((thr)->sflags & THR_FLAGS_IN_SYNCQ) != 0)
#define THR_CONDQ_SET(thr) (thr)->sflags |= THR_FLAGS_IN_SYNCQ
#define THR_CONDQ_CLEAR(thr) (thr)->sflags &= ~THR_FLAGS_IN_SYNCQ

View file

@ -36,6 +36,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_condattr_destroy);
LT10_COMPAT_DEFAULT(pthread_condattr_destroy);
__weak_reference(_pthread_condattr_destroy, pthread_condattr_destroy);
int

View file

@ -37,6 +37,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_condattr_init);
LT10_COMPAT_DEFAULT(pthread_condattr_init);
__weak_reference(_pthread_condattr_init, pthread_condattr_init);
int

View file

@ -32,6 +32,9 @@ __FBSDID("$FreeBSD$");
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(__connect);
LT10_COMPAT_DEFAULT(connect);
__weak_reference(__connect, connect);
int

View file

@ -33,6 +33,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(___creat);
LT10_COMPAT_DEFAULT(creat);
extern int __creat(const char *, mode_t);
__weak_reference(___creat, creat);

View file

@ -44,6 +44,9 @@
#include "thr_private.h"
#include "libc_private.h"
LT10_COMPAT_PRIVATE(_pthread_create);
LT10_COMPAT_DEFAULT(pthread_create);
static void free_thread(struct pthread *curthread, struct pthread *thread);
static int create_stack(struct pthread_attr *pattr);
static void free_stack(struct pthread_attr *pattr);

View file

@ -37,6 +37,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_detach);
LT10_COMPAT_DEFAULT(pthread_detach);
__weak_reference(_pthread_detach, pthread_detach);
int

View file

@ -34,6 +34,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_equal);
LT10_COMPAT_DEFAULT(pthread_equal);
__weak_reference(_pthread_equal, pthread_equal);
int

View file

@ -34,6 +34,9 @@
#include <unistd.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_execve);
LT10_COMPAT_DEFAULT(execve);
__weak_reference(_execve, execve);
int

View file

@ -40,6 +40,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_exit);
LT10_COMPAT_DEFAULT(pthread_exit);
void _pthread_exit(void *status);
__weak_reference(_pthread_exit, pthread_exit);

View file

@ -38,6 +38,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(__fcntl);
LT10_COMPAT_DEFAULT(fcntl);
__weak_reference(__fcntl, fcntl);
int

View file

@ -43,6 +43,9 @@
#include "libc_private.h"
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_fork);
LT10_COMPAT_DEFAULT(fork);
__weak_reference(_fork, fork);
pid_t

View file

@ -35,6 +35,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(__fsync);
LT10_COMPAT_DEFAULT(fsync);
__weak_reference(__fsync, fsync);
int

View file

@ -35,6 +35,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_getprio);
LT10_COMPAT_DEFAULT(pthread_getprio);
__weak_reference(_pthread_getprio, pthread_getprio);
int

View file

@ -35,6 +35,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_getschedparam);
LT10_COMPAT_DEFAULT(pthread_getschedparam);
__weak_reference(_pthread_getschedparam, pthread_getschedparam);
int

View file

@ -44,6 +44,9 @@
#define NELEMENTS(arr) (sizeof(arr) / sizeof(arr[0]))
#endif
LT10_COMPAT_PRIVATE(_pthread_set_name_np);
LT10_COMPAT_DEFAULT(pthread_set_name_np);
static void dump_thread(int fd, pthread_t pthread, int long_version);
__weak_reference(_pthread_set_name_np, pthread_set_name_np);

View file

@ -69,6 +69,11 @@
#include "libc_private.h"
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_libkse_debug);
LT10_COMPAT_PRIVATE(_thread_activated);
LT10_COMPAT_PRIVATE(_thread_active_threads);
LT10_COMPAT_PRIVATE(_thread_list);
int __pthread_cond_wait(pthread_cond_t *, pthread_mutex_t *);
int __pthread_mutex_lock(pthread_mutex_t *);
int __pthread_mutex_trylock(pthread_mutex_t *);

View file

@ -35,6 +35,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_join);
LT10_COMPAT_DEFAULT(pthread_join);
__weak_reference(_pthread_join, pthread_join);
int

View file

@ -36,6 +36,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_kill);
LT10_COMPAT_DEFAULT(pthread_kill);
__weak_reference(_pthread_kill, pthread_kill);
int

View file

@ -31,6 +31,9 @@
#include <pthread_np.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_main_np);
LT10_COMPAT_DEFAULT(pthread_main_np);
__weak_reference(_pthread_main_np, pthread_main_np);
/*

View file

@ -37,6 +37,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_mutexattr_init);
LT10_COMPAT_DEFAULT(pthread_mutexattr_init);
__weak_reference(_pthread_mutexattr_init, pthread_mutexattr_init);
int

View file

@ -35,6 +35,15 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_mutexattr_setkind_np);
LT10_COMPAT_DEFAULT(pthread_mutexattr_setkind_np);
LT10_COMPAT_PRIVATE(_pthread_mutexattr_getkind_np);
LT10_COMPAT_DEFAULT(pthread_mutexattr_getkind_np);
LT10_COMPAT_PRIVATE(_pthread_mutexattr_gettype);
LT10_COMPAT_DEFAULT(pthread_mutexattr_gettype);
LT10_COMPAT_PRIVATE(_pthread_mutexattr_settype);
LT10_COMPAT_DEFAULT(pthread_mutexattr_settype);
__weak_reference(_pthread_mutexattr_setkind_np, pthread_mutexattr_setkind_np);
__weak_reference(_pthread_mutexattr_getkind_np, pthread_mutexattr_getkind_np);
__weak_reference(_pthread_mutexattr_gettype, pthread_mutexattr_gettype);

View file

@ -11,6 +11,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(__msync);
LT10_COMPAT_DEFAULT(msync);
__weak_reference(__msync, msync);
int

View file

@ -34,6 +34,11 @@
#include <pthread.h>
#include <pthread_np.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_multi_np);
LT10_COMPAT_DEFAULT(pthread_multi_np);
__weak_reference(_pthread_multi_np, pthread_multi_np);
int

View file

@ -91,6 +91,23 @@ static struct pthread_mutex_attr static_mutex_attr =
PTHREAD_MUTEXATTR_STATIC_INITIALIZER;
static pthread_mutexattr_t static_mattr = &static_mutex_attr;
LT10_COMPAT_PRIVATE(__pthread_mutex_init);
LT10_COMPAT_PRIVATE(_pthread_mutex_init);
LT10_COMPAT_DEFAULT(pthread_mutex_init);
LT10_COMPAT_PRIVATE(__pthread_mutex_lock);
LT10_COMPAT_PRIVATE(_pthread_mutex_lock);
LT10_COMPAT_DEFAULT(pthread_mutex_lock);
LT10_COMPAT_PRIVATE(__pthread_mutex_timedlock);
LT10_COMPAT_PRIVATE(_pthread_mutex_timedlock);
LT10_COMPAT_DEFAULT(pthread_mutex_timedlock);
LT10_COMPAT_PRIVATE(__pthread_mutex_trylock);
LT10_COMPAT_PRIVATE(_pthread_mutex_trylock);
LT10_COMPAT_DEFAULT(pthread_mutex_trylock);
LT10_COMPAT_PRIVATE(_pthread_mutex_destroy);
LT10_COMPAT_DEFAULT(pthread_mutex_destroy);
LT10_COMPAT_PRIVATE(_pthread_mutex_unlock);
LT10_COMPAT_DEFAULT(pthread_mutex_unlock);
/* Single underscore versions provided for libc internal usage: */
__weak_reference(__pthread_mutex_init, pthread_mutex_init);
__weak_reference(__pthread_mutex_lock, pthread_mutex_lock);

View file

@ -37,6 +37,15 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_mutexattr_getprioceiling);
LT10_COMPAT_DEFAULT(pthread_mutexattr_getprioceiling);
LT10_COMPAT_PRIVATE(_pthread_mutexattr_setprioceiling);
LT10_COMPAT_DEFAULT(pthread_mutexattr_setprioceiling);
LT10_COMPAT_PRIVATE(_pthread_mutex_getprioceiling);
LT10_COMPAT_DEFAULT(pthread_mutex_getprioceiling);
LT10_COMPAT_PRIVATE(_pthread_mutex_setprioceiling);
LT10_COMPAT_DEFAULT(pthread_mutex_setprioceiling);
__weak_reference(_pthread_mutexattr_getprioceiling, pthread_mutexattr_getprioceiling);
__weak_reference(_pthread_mutexattr_setprioceiling, pthread_mutexattr_setprioceiling);
__weak_reference(_pthread_mutex_getprioceiling, pthread_mutex_getprioceiling);

View file

@ -37,6 +37,11 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_mutexattr_getprotocol);
LT10_COMPAT_DEFAULT(pthread_mutexattr_getprotocol);
LT10_COMPAT_PRIVATE(_pthread_mutexattr_setprotocol);
LT10_COMPAT_DEFAULT(pthread_mutexattr_setprotocol);
__weak_reference(_pthread_mutexattr_getprotocol, pthread_mutexattr_getprotocol);
__weak_reference(_pthread_mutexattr_setprotocol, pthread_mutexattr_setprotocol);

View file

@ -36,6 +36,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_mutexattr_destroy);
LT10_COMPAT_DEFAULT(pthread_mutexattr_destroy);
__weak_reference(_pthread_mutexattr_destroy, pthread_mutexattr_destroy);
int

View file

@ -36,6 +36,10 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(__nanosleep);
LT10_COMPAT_PRIVATE(_nanosleep);
LT10_COMPAT_DEFAULT(nanosleep);
__weak_reference(__nanosleep, nanosleep);
int

View file

@ -36,6 +36,9 @@
#include "un-namespace.h"
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_once);
LT10_COMPAT_DEFAULT(pthread_once);
__weak_reference(_pthread_once, pthread_once);
#define ONCE_NEVER_DONE PTHREAD_NEEDS_INIT

View file

@ -40,6 +40,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(__open);
LT10_COMPAT_DEFAULT(open);
__weak_reference(__open, open);
int

View file

@ -35,6 +35,9 @@
extern int __pause(void);
LT10_COMPAT_PRIVATE(_pause);
LT10_COMPAT_DEFAULT(pause);
__weak_reference(_pause, pause);
int

View file

@ -41,6 +41,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(__poll);
LT10_COMPAT_DEFAULT(poll);
__weak_reference(__poll, poll);
int

View file

@ -59,6 +59,40 @@
#include "pthread_md.h"
#endif
/*
* Unfortunately, libpthread had symbol versioning before libc.
* But now libc has symbol versioning, we need to occupy the
* same version namespace in order to override some libc functions.
* So in order to avoid breaking binaries requiring symbols from
* LIBTHREAD_1_0, we need to provide a compatible interface for
* those symbols.
*/
#if defined(SYMBOL_VERSIONING) && defined(PIC)
#define SYM_LT10(sym) __CONCAT(sym, _lt10)
#define SYM_FB10(sym) __CONCAT(sym, _fb10)
#define SYM_FBP10(sym) __CONCAT(sym, _fbp10)
#define WEAK_REF(sym, alias) __weak_reference(sym, alias)
#define SYM_COMPAT(sym, impl, ver) __sym_compat(sym, impl, ver)
#define SYM_DEFAULT(sym, impl, ver) __sym_default(sym, impl, ver)
#define LT10_COMPAT(sym) \
WEAK_REF(sym, SYM_LT10(sym)); \
SYM_COMPAT(sym, SYM_LT10(sym), LIBTHREAD_1_0)
#define LT10_COMPAT_DEFAULT(sym) \
LT10_COMPAT(sym); \
WEAK_REF(sym, SYM_FB10(sym)); \
SYM_DEFAULT(sym, SYM_FB10(sym), FBSD_1.0)
#define LT10_COMPAT_PRIVATE(sym) \
LT10_COMPAT(sym); \
WEAK_REF(sym, SYM_FBP10(sym)); \
SYM_DEFAULT(sym, SYM_FBP10(sym), FBSDprivate)
#else
#define LT10_COMPAT_DEFAULT(sym)
#define LT10_COMPAT_PRIVATE(sym)
#endif
/*
* Evaluate the storage class specifier.
*/

View file

@ -40,6 +40,9 @@ __FBSDID("$FreeBSD$");
extern int __pselect(int count, fd_set *rfds, fd_set *wfds, fd_set *efds,
const struct timespec *timo, const sigset_t *mask);
LT10_COMPAT_PRIVATE(_pselect);
LT10_COMPAT_DEFAULT(pselect);
__weak_reference(_pselect, pselect);
int

View file

@ -37,6 +37,17 @@
#define SPIN_COUNT 10000
LT10_COMPAT_PRIVATE(_pthread_spin_init);
LT10_COMPAT_DEFAULT(pthread_spin_init);
LT10_COMPAT_PRIVATE(_pthread_spin_destroy);
LT10_COMPAT_DEFAULT(pthread_spin_destroy);
LT10_COMPAT_PRIVATE(_pthread_spin_trylock);
LT10_COMPAT_DEFAULT(pthread_spin_trylock);
LT10_COMPAT_PRIVATE(_pthread_spin_lock);
LT10_COMPAT_DEFAULT(pthread_spin_lock);
LT10_COMPAT_PRIVATE(_pthread_spin_unlock);
LT10_COMPAT_DEFAULT(pthread_spin_unlock);
__weak_reference(_pthread_spin_init, pthread_spin_init);
__weak_reference(_pthread_spin_destroy, pthread_spin_destroy);
__weak_reference(_pthread_spin_trylock, pthread_spin_trylock);

View file

@ -33,6 +33,9 @@
#include <errno.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_raise);
LT10_COMPAT_DEFAULT(raise);
__weak_reference(_raise, raise);
int

View file

@ -40,6 +40,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(__read);
LT10_COMPAT_DEFAULT(read);
__weak_reference(__read, read);
ssize_t

View file

@ -40,6 +40,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(__readv);
LT10_COMPAT_DEFAULT(readv);
__weak_reference(__readv, readv);
ssize_t

View file

@ -37,6 +37,11 @@
static struct kse_mailbox *resume_common(struct pthread *);
LT10_COMPAT_PRIVATE(_pthread_resume_np);
LT10_COMPAT_DEFAULT(pthread_resume_np);
LT10_COMPAT_PRIVATE(_pthread_resume_all_np);
LT10_COMPAT_DEFAULT(pthread_resume_all_np);
__weak_reference(_pthread_resume_np, pthread_resume_np);
__weak_reference(_pthread_resume_all_np, pthread_resume_all_np);

View file

@ -38,6 +38,25 @@
/* maximum number of times a read lock may be obtained */
#define MAX_READ_LOCKS (INT_MAX - 1)
LT10_COMPAT_PRIVATE(_pthread_rwlock_destroy);
LT10_COMPAT_DEFAULT(pthread_rwlock_destroy);
LT10_COMPAT_PRIVATE(_pthread_rwlock_init);
LT10_COMPAT_DEFAULT(pthread_rwlock_init);
LT10_COMPAT_PRIVATE(_pthread_rwlock_rdlock);
LT10_COMPAT_DEFAULT(pthread_rwlock_rdlock);
LT10_COMPAT_PRIVATE(_pthread_rwlock_timedrdlock);
LT10_COMPAT_DEFAULT(pthread_rwlock_timedrdlock);
LT10_COMPAT_PRIVATE(_pthread_rwlock_tryrdlock);
LT10_COMPAT_DEFAULT(pthread_rwlock_tryrdlock);
LT10_COMPAT_PRIVATE(_pthread_rwlock_trywrlock);
LT10_COMPAT_DEFAULT(pthread_rwlock_trywrlock);
LT10_COMPAT_PRIVATE(_pthread_rwlock_unlock);
LT10_COMPAT_DEFAULT(pthread_rwlock_unlock);
LT10_COMPAT_PRIVATE(_pthread_rwlock_wrlock);
LT10_COMPAT_DEFAULT(pthread_rwlock_wrlock);
LT10_COMPAT_PRIVATE(_pthread_rwlock_timedwrlock);
LT10_COMPAT_DEFAULT(pthread_rwlock_timedwrlock);
__weak_reference(_pthread_rwlock_destroy, pthread_rwlock_destroy);
__weak_reference(_pthread_rwlock_init, pthread_rwlock_init);
__weak_reference(_pthread_rwlock_rdlock, pthread_rwlock_rdlock);

View file

@ -32,6 +32,15 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_rwlockattr_destroy);
LT10_COMPAT_DEFAULT(pthread_rwlockattr_destroy);
LT10_COMPAT_PRIVATE(_pthread_rwlockattr_getpshared);
LT10_COMPAT_DEFAULT(pthread_rwlockattr_getpshared);
LT10_COMPAT_PRIVATE(_pthread_rwlockattr_init);
LT10_COMPAT_DEFAULT(pthread_rwlockattr_init);
LT10_COMPAT_PRIVATE(_pthread_rwlockattr_setpshared);
LT10_COMPAT_DEFAULT(pthread_rwlockattr_setpshared);
__weak_reference(_pthread_rwlockattr_destroy, pthread_rwlockattr_destroy);
__weak_reference(_pthread_rwlockattr_getpshared, pthread_rwlockattr_getpshared);
__weak_reference(_pthread_rwlockattr_init, pthread_rwlockattr_init);

View file

@ -43,6 +43,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(__select);
LT10_COMPAT_DEFAULT(select);
__weak_reference(__select, select);
int

View file

@ -34,6 +34,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_self);
LT10_COMPAT_DEFAULT(pthread_self);
__weak_reference(_pthread_self, pthread_self);
pthread_t

View file

@ -43,6 +43,14 @@
#include "libc_private.h"
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_sem_init);
LT10_COMPAT_DEFAULT(sem_init);
LT10_COMPAT_PRIVATE(_sem_wait);
LT10_COMPAT_DEFAULT(sem_wait);
LT10_COMPAT_PRIVATE(_sem_timedwait);
LT10_COMPAT_DEFAULT(sem_timedwait);
LT10_COMPAT_PRIVATE(_sem_post);
LT10_COMPAT_DEFAULT(sem_post);
extern int pthread_cond_wait(pthread_cond_t *, pthread_mutex_t *);
extern int pthread_cond_timedwait(pthread_cond_t *, pthread_mutex_t *,

View file

@ -34,6 +34,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_setprio);
LT10_COMPAT_DEFAULT(pthread_setprio);
__weak_reference(_pthread_setprio, pthread_setprio);
int

View file

@ -36,6 +36,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_setschedparam);
LT10_COMPAT_DEFAULT(pthread_setschedparam);
__weak_reference(_pthread_setschedparam, pthread_setschedparam);
int

View file

@ -36,6 +36,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_sigaction);
LT10_COMPAT_DEFAULT(sigaction);
__weak_reference(_sigaction, sigaction);
int

View file

@ -31,6 +31,9 @@ __FBSDID("$FreeBSD$");
#include <signal.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_sigaltstack);
LT10_COMPAT_DEFAULT(sigaltstack);
__weak_reference(_sigaltstack, sigaltstack);
int

View file

@ -40,6 +40,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_sigmask);
LT10_COMPAT_DEFAULT(pthread_sigmask);
__weak_reference(_pthread_sigmask, pthread_sigmask);
int

View file

@ -39,6 +39,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_sigpending);
LT10_COMPAT_DEFAULT(sigpending);
__weak_reference(_sigpending, sigpending);
int

View file

@ -39,6 +39,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_sigprocmask);
LT10_COMPAT_DEFAULT(sigprocmask);
__weak_reference(_sigprocmask, sigprocmask);
int

View file

@ -41,6 +41,10 @@
#include "thr_private.h"
LT10_COMPAT_PRIVATE(__sigsuspend);
LT10_COMPAT_PRIVATE(_sigsuspend);
LT10_COMPAT_DEFAULT(sigsuspend);
__weak_reference(__sigsuspend, sigsuspend);
int

View file

@ -39,6 +39,16 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(__sigwait);
LT10_COMPAT_PRIVATE(_sigwait);
LT10_COMPAT_DEFAULT(sigwait);
LT10_COMPAT_PRIVATE(__sigtimedwait);
LT10_COMPAT_PRIVATE(_sigtimedwait);
LT10_COMPAT_DEFAULT(sigtimedwait);
LT10_COMPAT_PRIVATE(__sigwaitinfo);
LT10_COMPAT_PRIVATE(_sigwaitinfo);
LT10_COMPAT_DEFAULT(sigwaitinfo);
__weak_reference(__sigwait, sigwait);
__weak_reference(__sigtimedwait, sigtimedwait);
__weak_reference(__sigwaitinfo, sigwaitinfo);

View file

@ -34,6 +34,11 @@
#include <pthread.h>
#include <pthread_np.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_single_np);
LT10_COMPAT_DEFAULT(pthread_single_np);
__weak_reference(_pthread_single_np, pthread_single_np);
int _pthread_single_np()

View file

@ -36,6 +36,11 @@
extern unsigned int __sleep(unsigned int);
extern int __usleep(useconds_t);
LT10_COMPAT_PRIVATE(_sleep);
LT10_COMPAT_DEFAULT(sleep);
LT10_COMPAT_PRIVATE(_usleep);
LT10_COMPAT_DEFAULT(usleep);
__weak_reference(_sleep, sleep);
__weak_reference(_usleep, usleep);

View file

@ -36,11 +36,27 @@
#include <string.h>
#include <errno.h>
#include <pthread.h>
#include "thr_private.h"
/* Static variables: */
struct pthread_key _thread_keytable[PTHREAD_KEYS_MAX];
/*
* XXX - This breaks the linker if LT10_COMPAT_DEFAULT doesn't
* also include a weak reference to the default symbol.
*/
LT10_COMPAT_PRIVATE(_thread_keytable);
LT10_COMPAT_PRIVATE(_pthread_key_create);
LT10_COMPAT_DEFAULT(pthread_key_create);
LT10_COMPAT_PRIVATE(_pthread_key_delete);
LT10_COMPAT_DEFAULT(pthread_key_delete);
LT10_COMPAT_PRIVATE(_pthread_getspecific);
LT10_COMPAT_DEFAULT(pthread_getspecific);
LT10_COMPAT_PRIVATE(_pthread_setspecific);
LT10_COMPAT_DEFAULT(pthread_setspecific);
__weak_reference(_pthread_key_create, pthread_key_create);
__weak_reference(_pthread_key_delete, pthread_key_delete);
__weak_reference(_pthread_getspecific, pthread_getspecific);

View file

@ -58,6 +58,10 @@ static struct spinlock_extra extra[MAX_SPINLOCKS];
static int spinlock_count = 0;
static int initialized = 0;
LT10_COMPAT_PRIVATE(_spinlock);
LT10_COMPAT_PRIVATE(_spinlock_debug);
LT10_COMPAT_PRIVATE(_spinunlock);
/*
* These are for compatability only. Spinlocks of this type
* are deprecated.

View file

@ -37,6 +37,11 @@
static void suspend_common(struct pthread *thread);
LT10_COMPAT_PRIVATE(_pthread_suspend_np);
LT10_COMPAT_DEFAULT(pthread_suspend_np);
LT10_COMPAT_PRIVATE(_pthread_suspend_all_np);
LT10_COMPAT_DEFAULT(pthread_suspend_all_np);
__weak_reference(_pthread_suspend_np, pthread_suspend_np);
__weak_reference(_pthread_suspend_all_np, pthread_suspend_all_np);

View file

@ -36,6 +36,10 @@
#include <pthread_np.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_pthread_switch_add_np);
LT10_COMPAT_DEFAULT(pthread_switch_add_np);
LT10_COMPAT_PRIVATE(_pthread_switch_delete_np);
LT10_COMPAT_DEFAULT(pthread_switch_delete_np);
__weak_reference(_pthread_switch_add_np, pthread_switch_add_np);
__weak_reference(_pthread_switch_delete_np, pthread_switch_delete_np);

View file

@ -39,6 +39,24 @@
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_thread_off_tcb);
LT10_COMPAT_PRIVATE(_thread_off_tmbx);
LT10_COMPAT_PRIVATE(_thread_off_next);
LT10_COMPAT_PRIVATE(_thread_off_attr_flags);
LT10_COMPAT_PRIVATE(_thread_off_kse);
LT10_COMPAT_PRIVATE(_thread_off_kse_locklevel);
LT10_COMPAT_PRIVATE(_thread_off_thr_locklevel);
LT10_COMPAT_PRIVATE(_thread_off_linkmap);
LT10_COMPAT_PRIVATE(_thread_off_tlsindex);
LT10_COMPAT_PRIVATE(_thread_size_key);
LT10_COMPAT_PRIVATE(_thread_off_key_allocated);
LT10_COMPAT_PRIVATE(_thread_off_key_destructor);
LT10_COMPAT_PRIVATE(_thread_max_keys);
LT10_COMPAT_PRIVATE(_thread_off_dtv);
LT10_COMPAT_PRIVATE(_thread_off_state);
LT10_COMPAT_PRIVATE(_thread_state_running);
LT10_COMPAT_PRIVATE(_thread_state_zoombie);
/* A collection of symbols needed by debugger */
/* int _libkse_debug */

View file

@ -35,6 +35,9 @@
extern int __system(const char *);
LT10_COMPAT_PRIVATE(_system);
LT10_COMPAT_DEFAULT(system);
__weak_reference(_system, system);
int

View file

@ -35,6 +35,9 @@
extern int __tcdrain(int);
LT10_COMPAT_PRIVATE(_tcdrain);
LT10_COMPAT_DEFAULT(tcdrain);
__weak_reference(_tcdrain, tcdrain);
int

View file

@ -3,6 +3,11 @@
*/
#include <unistd.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_vfork);
LT10_COMPAT_DEFAULT(vfork);
__weak_reference(_vfork, vfork);
int

View file

@ -34,6 +34,9 @@
extern int __wait(int *);
LT10_COMPAT_PRIVATE(_wait);
LT10_COMPAT_DEFAULT(wait);
__weak_reference(_wait, wait);
pid_t

View file

@ -41,6 +41,9 @@
#include "thr_private.h"
LT10_COMPAT_PRIVATE(__wait4);
LT10_COMPAT_DEFAULT(wait4);
__weak_reference(__wait4, wait4);
pid_t

View file

@ -34,6 +34,9 @@
#include <pthread.h>
#include "thr_private.h"
LT10_COMPAT_PRIVATE(_waitpid);
LT10_COMPAT_DEFAULT(waitpid);
extern int __waitpid(pid_t, int *, int);
__weak_reference(_waitpid, waitpid);

Some files were not shown because too many files have changed in this diff Show more