Created
August 18, 2009 20:45
-
-
Save mheffner/169951 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #define _GNU_SOURCE | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <dlfcn.h> | |
| #include <pthread.h> | |
| static int (*condwait_internal_225)(pthread_cond_t *cond, | |
| pthread_mutex_t *mutex); | |
| static int (*condwait_internal_232)(pthread_cond_t *cond, | |
| pthread_mutex_t *mutex); | |
| void __attribute__ ((constructor)) init(void); | |
| /* Library constructor */ | |
| void | |
| init(void) | |
| { | |
| condwait_internal_225 = dlvsym(RTLD_NEXT, "pthread_cond_wait", "GLIBC_2.2.5"); | |
| condwait_internal_232 = dlvsym(RTLD_NEXT, "pthread_cond_wait", "GLIBC_2.3.2"); | |
| } | |
| int | |
| pthread_cond_wait_225(pthread_cond_t *cond, pthread_mutex_t *mutex) | |
| { | |
| int ret; | |
| printf("Calling condwait v. 2.2.5 with cond: %p, mutex: %p...", | |
| cond, mutex); | |
| fflush(stdout); | |
| ret = condwait_internal_225(cond, mutex); | |
| printf("..got it!\n"); | |
| return ret; | |
| } | |
| int | |
| pthread_cond_wait_232(pthread_cond_t *cond, pthread_mutex_t *mutex) | |
| { | |
| int ret; | |
| printf("Calling condwait v. 2.3.2 with cond: %p, mutex: %p...", | |
| cond, mutex); | |
| fflush(stdout); | |
| ret = condwait_internal_232(cond, mutex); | |
| printf("..got it!\n"); | |
| return ret; | |
| } | |
| __asm__(".symver pthread_cond_wait_225, pthread_cond_wait@GLIBC_2.2.5"); | |
| __asm__(".symver pthread_cond_wait_232, pthread_cond_wait@@GLIBC_2.3.2"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment