Example #1
0
LIB_PRIVATE
void initialize_libc_wrappers()
{
  const char *warn_msg =
    "WARNING: dmtcp_wrappers_initializing is set to '0' in the call to\n"
    "         initialize_wrappers(). This may not be a good sign. \n"
    "         Please inform dmtcp-developers if you see this message.\n\n";

  if (dmtcp_wrappers_initializing == 0) {
    _real_write(STDERR_FILENO, warn_msg, strlen(warn_msg));
    sleep(1);
    abort();
  }

  if (!_libc_wrappers_initialized) {
    FOREACH_DMTCP_WRAPPER(GET_FUNC_ADDR);
#ifdef __i386__
    /* On i386 systems, there are two pthread_create symbols. We want the one
     * with GLIBC_2.1 version. On 64-bit machines, there is only one
     * pthread_create symbol (GLIBC_2.2.5), so no worries there.
     */
    _real_func_addr[ENUM(pthread_create)] = dlvsym(RTLD_NEXT, "pthread_create",
                                                   "GLIBC_2.1");
#endif

    /* On some arm machines, the newest pthread_create has version GLIBC_2.4 */
    void *addr = dlvsym(RTLD_NEXT, "pthread_create", "GLIBC_2.4");
    if (addr != NULL) {
      _real_func_addr[ENUM(pthread_create)] = addr;
    }

    _libc_wrappers_initialized = 1;
  }
}
Example #2
0
LIB_PRIVATE
void initialize_wrappers()
{
  if (!_wrappers_initialized) {
    FOREACH_DMTCP_WRAPPER(GET_FUNC_ADDR);
    _wrappers_initialized = 1;
  }
}
Example #3
0
LIB_PRIVATE
void initialize_libc_wrappers()
{
  const char *warn_msg =
    "WARNING: dmtcp_wrappers_initializing is set to '0' in the call to\n"
    "         initialize_wrappers(). This may not be a good sign. \n"
    "         Please inform dmtcp-developers if you see this message.\n\n";

  if (dmtcp_wrappers_initializing == 0) {
    _real_write(STDERR_FILENO, warn_msg, strlen(warn_msg));
    sleep(1);
    abort();
  }

  if (!_libc_wrappers_initialized) {
    FOREACH_DMTCP_WRAPPER(GET_FUNC_ADDR);
    _libc_wrappers_initialized = 1;
  }
}
Example #4
0
static void
initialize_libc_wrappers()
{
  FOREACH_DMTCP_WRAPPER(GET_FUNC_ADDR);
#ifdef __i386__

  /* On i386 systems, there are two pthread_create symbols. We want the one
   * with GLIBC_2.1 version. On 64-bit machines, there is only one
   * pthread_create symbol (GLIBC_2.2.5), so no worries there.
   */
  _real_func_addr[ENUM(pthread_create)] = dmtcp_dlvsym(RTLD_NEXT,
                                                       "pthread_create",
                                                       "GLIBC_2.1");
#endif

  /* On some arm machines, the newest pthread_create has version GLIBC_2.4 */
  void *addr = dmtcp_dlvsym(RTLD_NEXT, "pthread_create", "GLIBC_2.4");
  if (addr != NULL) {
    _real_func_addr[ENUM(pthread_create)] = addr;
  }
}