/* * WARNING: By using this method to initialize libpthread wrappers (direct * dlopen()/dlsym()) we are are overriding any user wrappers for these * functions. If this is a problem in the future we need to think of a new way * to do this. */ LIB_PRIVATE void initialize_libpthread_wrappers() { if (!_libpthread_wrappers_initialized) { FOREACH_LIBPTHREAD_WRAPPERS(GET_LIBPTHREAD_FUNC_ADDR); _libpthread_wrappers_initialized = 1; } }
/* * WARNING: By using this method to initialize libpthread wrappers (direct * dlopen()/dlsym()) we are are overriding any user wrappers for these * functions. If this is a problem in the future we need to think of a new way * to do this. * EDIT: On some ARM machines, the symbol version is 2.4. Try that first and * fallback to 2.3.4 on failure. */ static void initialize_libpthread_wrappers() { const char *ver_2_4 = "GLIBC_2.4"; const char *ver_2_3_2 = "GLIBC_2.3.2"; const char *pthread_sym_ver = NULL; void *addr = dmtcp_dlvsym(RTLD_NEXT, "pthread_cond_signal", (char*)ver_2_4); if (addr != NULL) { pthread_sym_ver = ver_2_4; } else { pthread_sym_ver = ver_2_3_2; } FOREACH_LIBPTHREAD_WRAPPERS(GET_LIBPTHREAD_FUNC_ADDR); }
/* * WARNING: By using this method to initialize libpthread wrappers (direct * dlopen()/dlsym()) we are are overriding any user wrappers for these * functions. If this is a problem in the future we need to think of a new way * to do this. * EDIT: On some ARM machines, the symbol version is 2.4. Try that first and * fallback to 2.3.4 on failure. */ LIB_PRIVATE void initialize_libpthread_wrappers() { if (!_libpthread_wrappers_initialized) { const char *ver_2_4 = "GLIBC_2.4"; const char *ver_2_3_2 = "GLIBC_2.3.2"; const char *pthread_sym_ver = NULL; void *addr = dlvsym(RTLD_NEXT, "pthread_cond_signal", ver_2_4); if (addr != NULL) { pthread_sym_ver = ver_2_4; } else { pthread_sym_ver = ver_2_3_2; } FOREACH_LIBPTHREAD_WRAPPERS(GET_LIBPTHREAD_FUNC_ADDR); _libpthread_wrappers_initialized = 1; } }
/* * WARNING: By using this method to initialize libpthread wrappers (direct * dlopen()/dlsym()) we are are overriding any user wrappers for these * functions. If this is a problem in the future we need to think of a new way * to do this. */ LIB_PRIVATE void initialize_libpthread_wrappers() { if (!_libpthread_wrappers_initialized) { dmtcp_setThreadPerformingDlopenDlsym(); void *pthread_handle = _real_dlopen(LIBPTHREAD_FILENAME, RTLD_NOW); dmtcp_unsetThreadPerformingDlopenDlsym(); if (pthread_handle == NULL) { fprintf(stderr, "*** DMTCP: Error: could not open libpthread shared " "library. Aborting.\n"); abort(); } FOREACH_LIBPTHREAD_WRAPPERS(GET_LIBPTHREAD_FUNC_ADDR); _real_dlclose(pthread_handle); _libpthread_wrappers_initialized = 1; } }