summaryrefslogtreecommitdiff
path: root/pthread
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2015-03-01 20:23:52 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2015-03-01 20:23:52 +0100
commit8dc97a5e7ca62b98aba02883724fd58a91f9a32e (patch)
tree385705c2c9cb1210c4bc62e2ed746e084e916493 /pthread
parent3410beff94994edf971dd634c56156d70c7cf215 (diff)
Forward lockfile calls from libc to dynamically loaded libpthread
* forward.c: (__libc_pthread_functions_init): Add variable (FORWARD2): Use __libc_pthread_functions_init instead of testing __libc_pthread_functions.ptr_##name value. (FORWARD_NORETURN): Add macro. (pthread_exit): Use FORWARD_NORETURN instead of FORWARD2. * libc_pthread_init.c (__libc_pthread_init): Set __libc_pthread_functions_init to 1. * pthread/pthread-functions.h (__pthread_once, __pthread_rwlock_rdlock, __pthread_rwlock_wrlock, __pthread_rwlock_unlock, __pthread_key_create, __pthread_getspecific, __pthread_setspecific, _cthreads_flockfile, _cthreads_funlockfile, _cthreads_ftrylockfile): Add prototypes. (pthread_functions): Add ptr_pthread_once, ptr_pthread_rwlock_rdlock, ptr_pthread_rwlock_wrlock, ptr_pthread_rwlock_unlock, ptr_pthread_key_create, ptr_pthread_getspecific, ptr_pthread_setspecific, ptr__IO_flockfile, ptr__IO_funlockfile, ptr__IO_ftrylockfile. (__libc_pthread_functions_init): Add variable declaration. (PTHFCT_CALL): Add macro. * pthread/pt-initialize.c (pthread_functions): Initialize ptr_pthread_once, ptr_pthread_rwlock_rdlock, ptr_pthread_rwlock_wrlock, pthread_rwlock_unlock, ptr_ptr_pthread_key_create, pthread_getspecific, ptr_pthread_setspecific, ptr_ptr__IO_flockfile, _IO_funlockfile, ptr__IO_ftrylockfile. * sysdeps/generic/pt-once.c (pthread_once): Rename to __pthread_once (pthread_once): Add strong alias. * sysdeps/generic/pt-rwlock-rdlock.c (pthread_rwlock_rdlock): Rename to __pthread_rwlock_rdlock (pthread_rwlock_rdlock): Add strong alias. * sysdeps/generic/pt-rwlock-wrlock.c (pthread_rwlock_wrlock): Rename to __pthread_rwlock_wrlock (pthread_rwlock_wrlock): Add strong alias. * sysdeps/generic/pt-rwlock-unlock.c (pthread_rwlock_unlock): Rename to __pthread_rwlock_unlock (pthread_rwlock_unlock): Add strong alias. * sysdeps/generic/pt-getspecific.c (pthread_getspecific): Rename to __pthread_getspecific (pthread_getspecific): Add strong alias. * sysdeps/generic/pt-setspecific.c (pthread_setspecific): Rename to __pthread_setspecific (pthread_setspecific): Add strong alias. * sysdeps/pthread/flockfile.c: Add file. * sysdeps/pthread/ftrylockfile.c: Add file. * sysdeps/pthread/funlockfile.c: Add file.
Diffstat (limited to 'pthread')
-rw-r--r--pthread/pt-initialize.c10
-rw-r--r--pthread/pthread-functions.h25
2 files changed, 35 insertions, 0 deletions
diff --git a/pthread/pt-initialize.c b/pthread/pt-initialize.c
index a99cc59..aa3cf82 100644
--- a/pthread/pt-initialize.c
+++ b/pthread/pt-initialize.c
@@ -64,6 +64,16 @@ static const struct pthread_functions pthread_functions =
.ptr_pthread_setcancelstate = __pthread_setcancelstate,
.ptr_pthread_setcanceltype = __pthread_setcanceltype,
.ptr___pthread_get_cleanup_stack = __pthread_get_cleanup_stack,
+ .ptr_pthread_once = __pthread_once,
+ .ptr_pthread_rwlock_rdlock = __pthread_rwlock_rdlock,
+ .ptr_pthread_rwlock_wrlock = __pthread_rwlock_wrlock,
+ .ptr_pthread_rwlock_unlock = __pthread_rwlock_unlock,
+ .ptr_pthread_key_create = __pthread_key_create,
+ .ptr_pthread_getspecific = __pthread_getspecific,
+ .ptr_pthread_setspecific = __pthread_setspecific,
+ .ptr__IO_flockfile = _cthreads_flockfile,
+ .ptr__IO_funlockfile = _cthreads_funlockfile,
+ .ptr__IO_ftrylockfile = _cthreads_ftrylockfile,
};
#endif /* IS_IN (libpthread) */
diff --git a/pthread/pthread-functions.h b/pthread/pthread-functions.h
index c0ba858..d236822 100644
--- a/pthread/pthread-functions.h
+++ b/pthread/pthread-functions.h
@@ -61,6 +61,17 @@ pthread_t __pthread_self (void);
int __pthread_setcancelstate (int, int *);
int __pthread_setcanceltype (int, int *);
struct __pthread_cancelation_handler **__pthread_get_cleanup_stack (void);
+int __pthread_once (pthread_once_t *, void (*) (void));
+int __pthread_rwlock_rdlock (pthread_rwlock_t *);
+int __pthread_rwlock_wrlock (pthread_rwlock_t *);
+int __pthread_rwlock_unlock (pthread_rwlock_t *);
+int __pthread_key_create (pthread_key_t *, void (*) (void *));
+void *__pthread_getspecific (pthread_key_t);
+int __pthread_setspecific (pthread_key_t, const void *);
+
+void _cthreads_flockfile (FILE *);
+void _cthreads_funlockfile (FILE *);
+int _cthreads_ftrylockfile (FILE *);
/* Data type shared with libc. The libc uses it to pass on calls to
the thread functions. Wine pokes directly into this structure,
@@ -106,11 +117,25 @@ struct pthread_functions
int (*ptr_pthread_setcancelstate) (int, int *);
int (*ptr_pthread_setcanceltype) (int, int *);
struct __pthread_cancelation_handler **(*ptr___pthread_get_cleanup_stack) (void);
+ int (*ptr_pthread_once) (pthread_once_t *, void (*) (void));
+ int (*ptr_pthread_rwlock_rdlock) (pthread_rwlock_t *);
+ int (*ptr_pthread_rwlock_wrlock) (pthread_rwlock_t *);
+ int (*ptr_pthread_rwlock_unlock) (pthread_rwlock_t *);
+ int (*ptr_pthread_key_create) (pthread_key_t *, void (*) (void *));
+ void *(*ptr_pthread_getspecific) (pthread_key_t);
+ int (*ptr_pthread_setspecific) (pthread_key_t, const void *);
+ void (*ptr__IO_flockfile) (FILE *);
+ void (*ptr__IO_funlockfile) (FILE *);
+ int (*ptr__IO_ftrylockfile) (FILE *);
};
/* Variable in libc.so. */
extern struct pthread_functions __libc_pthread_functions attribute_hidden;
+extern int __libc_pthread_functions_init attribute_hidden;
void __libc_pthread_init (const struct pthread_functions *functions);
+# define PTHFCT_CALL(fct, params) \
+ __libc_pthread_functions.fct params
+
#endif /* pthread-functions.h */