Exemplo n.º 1
0
LIB_PRIVATE
void *_real_dlsym (void *handle, const char *symbol) {
  static dlsym_fnptr_t _libc_dlsym_fnptr = NULL;
  if (_libc_dlsym_fnptr == NULL) {
    _libc_dlsym_fnptr = _dmtcp_get_libc_dlsym_addr();
  }

  // Avoid calling WRAPPER_EXECUTION_DISABLE_CKPT() in calloc() wrapper. See
  // comment in miscwrappers for more details.
  dmtcp_setThreadPerformingDlopenDlsym();
  void *res = (*_libc_dlsym_fnptr) (handle, symbol);
  dmtcp_unsetThreadPerformingDlopenDlsym();
  return res;
}
Exemplo n.º 2
0
/*
 * 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;
  }
}
Exemplo n.º 3
0
LIB_PRIVATE
void *_real_dlsym (void *handle, const char *symbol) {
  static dlsym_fnptr_t _libc_dlsym_fnptr = NULL;
  if (_libc_dlsym_fnptr == NULL) {
    _libc_dlsym_fnptr = dmtcp_get_libc_dlsym_addr();
  }

#if TRACK_DLOPEN_DLSYM_FOR_LOCKS
  // Avoid calling WRAPPER_EXECUTION_DISABLE_CKPT() in calloc() wrapper. See
  // comment in miscwrappers for more details.
  // EDIT: Now that we are using pthread_getspecific trick, calloc will not be
  // called and so we do not need to disable locking for calloc.
  dmtcp_setThreadPerformingDlopenDlsym();
#endif
  void *res = (*_libc_dlsym_fnptr) (handle, symbol);
#if TRACK_DLOPEN_DLSYM_FOR_LOCKS
  dmtcp_unsetThreadPerformingDlopenDlsym();
#endif
  return res;
}