| 217 | |
| 218 | // Initialize remaining components. |
| 219 | extern "C" void __attribute__((constructor(101))) |
| 220 | dmtcp_initialize_entry_point() |
| 221 | { |
| 222 | if (dmtcp_initialized) { |
| 223 | return; |
| 224 | } |
| 225 | |
| 226 | dmtcp_initialized = true; |
| 227 | |
| 228 | dmtcp_initialize(); |
| 229 | |
| 230 | initializeJalib(); |
| 231 | dmtcp_prepare_atfork(); |
| 232 | |
| 233 | WorkerState::setCurrentState(WorkerState::RUNNING); |
| 234 | |
| 235 | PluginManager::initialize(); |
| 236 | |
| 237 | prepareLogAndProcessdDataFromSerialFile(); |
| 238 | |
| 239 | JTRACE("libdmtcp.so: Running ") |
| 240 | (jalib::Filesystem::GetProgramName()) (getenv("LD_PRELOAD")); |
| 241 | |
| 242 | if (getenv("DMTCP_SEGFAULT_HANDLER") != NULL) { |
| 243 | // Install a segmentation fault handler (for debugging). |
| 244 | installSegFaultHandler(); |
| 245 | } |
| 246 | |
| 247 | // This is called for side effect only. Force this function to call |
| 248 | // getenv(ENV_VAR_SIGCKPT) now and cache it to avoid getenv calls later. |
| 249 | DmtcpWorker::determineCkptSignal(); |
| 250 | |
| 251 | // Also cache programName and arguments |
| 252 | string programName = jalib::Filesystem::GetProgramName(); |
| 253 | |
| 254 | JASSERT(programName != "dmtcp_coordinator" && |
| 255 | programName != "dmtcp_launch" && |
| 256 | programName != "dmtcp_nocheckpoint" && |
| 257 | programName != "dmtcp_comand" && |
| 258 | programName != "dmtcp_restart" && |
| 259 | programName != "mtcp_restart" && |
| 260 | programName != "rsh" && |
| 261 | programName != "ssh") |
| 262 | (programName).Text("This program should not be run under ckpt control"); |
| 263 | |
| 264 | restoreUserLDPRELOAD(); |
| 265 | |
| 266 | // Initialize data-structures related to motherofall thread. |
| 267 | ThreadSync::initMotherOfAll(); |
| 268 | ThreadList::init(); |
| 269 | |
| 270 | // In libdmtcp.so, notify this event for each plugin. |
| 271 | PluginManager::eventHook(DMTCP_EVENT_INIT, NULL); |
| 272 | |
| 273 | // Initialize the timezone. |
| 274 | // tzset() requires a malloc during initialization. We want to do it here to |
| 275 | // avoid a later malloc during gmtime_r/localtime_r. |
| 276 | tzset(); |
no test coverage detected