File: plugin-init.cpp

package info (click to toggle)
dmtcp 2.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 6,496 kB
  • sloc: cpp: 33,592; ansic: 28,099; sh: 6,735; makefile: 1,950; perl: 1,690; python: 1,241; asm: 138; java: 13
file content (36 lines) | stat: -rw-r--r-- 1,042 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//File: dmtcp_init_issue.cpp
#include <iostream>
#include <sys/types.h>
#include <unistd.h>
#include "dmtcp.h"
void dmtcp_event_hook(DmtcpEvent_t event, DmtcpEventData_t* data)
{
  switch (event)
  {
    case DMTCP_EVENT_INIT:
    {
      /* This next line caused a crash in DMTCP 2.5.2 using g++-6.2.
       * The call to std::cout invokes libstdc++.so, which calls malloc(),
       * which calls the DMTCP wrapper for malloc.  The DMTCP malloc()
       * wrapper then tries to initialize DMTCP before the DmtcpWorker
       * constructor, and therefore even before libc:malloc() can
       * be initialized.  At this early stage, DMTCP:malloc() should
       * simply call libc.so:malloc(), without trying to initialize DMTCP
       * (which is fixed in DMTCP-2.6.0 and beyond).
       */
      std::cout << "DMTCP_EVENT_INIT, PID=" << getpid() << std::endl ;
      break ;
    }
    default:
    {
      break ;
    }
  }
  DMTCP_NEXT_EVENT_HOOK(event, data);
}

int main(int argc, char* argv[])
{
  // dmtcp_checkpoint() ;
  while (1);
}