Int32 main(Int32 argc, char **argv) { dovers(argc, argv); IdentifyMyself::SetMyName(I_AM_ESP); msg_debug_hook("arkesp", "esp.hook"); try { file_init(&argc, &argv); } catch (SB_Fatal_Excep &e) { exit(1); } try { file_mon_process_startup(true); // setup log4cpp, need to be done here so initLog4cpp can have access to // process information since it is needed to compose the log name // the log name for the ESP should be based on the master process information // since the master and all its subordinate processes log to the same // log4cpp file QRLogger::instance().setModule(QRLogger::QRL_ESP); QRLogger::instance().initLog4cpp("log4cpp.trafodion.masterexe.config"); } catch (SB_Fatal_Excep &e) { SQLMXLoggingArea::logExecRtInfo(__FILE__, __LINE__, e.what(), 0); exit(1); } atexit(my_mpi_fclose); // Leave this commented out unless you need to debug the argument // cracking code below and can't rely on the -debug option. This // allows the esp to put up a dialog box and then you can manually // force the esp into debug. if (getenv("SQL_MSGBOX_PROCESS") != NULL) { MessageBox( NULL, "Server: Process Launched", "tdm_arkesp", MB_OK|MB_ICONINFORMATION );}; NABoolean fastStart = TRUE; Int32 currArg = 1; while (currArg < argc && fastStart == TRUE) { if (strcmp("-noespfaststart", argv[currArg]) == 0) fastStart = FALSE; currArg++; } short retCode; if (fastStart) { GuaReceiveFastStart *guaReceiveFastStart = new GuaReceiveFastStart(); retCode = runESP(argc,argv,guaReceiveFastStart); } else retCode = runESP(argc,argv); ENDTRANSACTION(); return retCode; }
Int32 main(Int32 argc, char **argv) { dovers(argc, argv); IdentifyMyself::SetMyName(I_AM_ESP); msg_debug_hook("arkesp", "esp.hook"); try { file_init(&argc, &argv); } catch (SB_Fatal_Excep &e) { exit(1); } try { file_mon_process_startup(true); // Initialize log4cxx QRLogger::initLog4cxx(QRLogger::QRL_ESP); } catch (SB_Fatal_Excep &e) { SQLMXLoggingArea::logExecRtInfo(__FILE__, __LINE__, e.what(), 0); exit(1); } atexit(my_mpi_fclose); // Leave this commented out unless you need to debug the argument // cracking code below and can't rely on the -debug option. This // allows the esp to put up a dialog box and then you can manually // force the esp into debug. if (getenv("SQL_MSGBOX_PROCESS") != NULL) { MessageBox( NULL, "Server: Process Launched", "tdm_arkesp", MB_OK|MB_ICONINFORMATION );}; NABoolean fastStart = TRUE; Int32 currArg = 1; while (currArg < argc && fastStart == TRUE) { if (strcmp("-noespfaststart", argv[currArg]) == 0) fastStart = FALSE; currArg++; } short retCode; if (fastStart) { GuaReceiveFastStart *guaReceiveFastStart = new GuaReceiveFastStart(); retCode = runESP(argc,argv,guaReceiveFastStart); } else retCode = runESP(argc,argv); ENDTRANSACTION(); return retCode; }
Int32 main(Int32 argc, char *argv[]) { dovers(argc, argv); try { file_init_attach(&argc, &argv, TRUE, (char *)""); sq_fs_dllmain(); msg_debug_hook("tdm_arkqms", "tdm_arkqms.hook"); file_mon_process_startup(true); atexit(my_mpi_fclose); } // LCOV_EXCL_START :rfi catch (...) { cerr << "Error while initializing messaging system. Exiting..." << endl; exit(1); } // LCOV_EXCL_STOP NABoolean performSMDInit = FALSE; NABoolean performXMLInit = FALSE; // Uncomment to allow time to attach debugger before initialization. The // MessageBox thing below uses an env var and won't work unless QMS is run // from a command-line in the shell that defines the env var. //Sleep(30000); QRLogger::instance().setModule(QRLogger::QRL_QMS); QRLogger::instance().initLog4cxx("log4cxx.qms.config"); QRLogger::log(CAT_QMS_MAIN, LL_INFO, "================================================="); QRLogger::log(CAT_QMS_MAIN, LL_INFO, "================================================="); QRLogger::log(CAT_QMS_MAIN, LL_INFO, "================================================="); QRLogger::log(CAT_QMS_MAIN, LL_INFO, "QMS process was started."); QRLogger::log(CAT_QMS_MAIN, LL_INFO, "QMS invoked with %d arguments.", argc); for (Int32 i=0; i<argc; i++) QRLogger::log(CAT_QMS_MAIN, LL_DEBUG, " argument %d = %s", i, argv[i]); IpcEnvironment* env = NULL; QmsGuaReceiveControlConnection* conn = NULL; // If invoked via the message interface, -oss will be the program // parameter after the program name. NABoolean commandLineInterface = (strncmp(argv[1], "-guardian", 9) != 0); // For message interface, initialize IPC so it will return to qmm from the // process creation code before we begin qms initialization. if (!commandLineInterface) { conn = initializeIPC(env); QRLogger::log(CAT_QMS_MAIN, LL_DEBUG, "QMS invoked via messaging interface."); } else QRLogger::log(CAT_QMS_MAIN, LL_DEBUG, "QMS invoked via command-line interface."); // Create the singleton instances of Qms and QmsInitializer. NAHeap qmsHeap("QMS Heap", NAMemory::DERIVED_FROM_SYS_HEAP, (Lng32)131072); Qms& qms = *Qms::getInstance(&qmsHeap); QmsInitializer& qmsInitializer = *QmsInitializer::getInstance(&qms); // If the command line interface was used, batch process the set of requests // specified in the input file. if (commandLineInterface) { try { return QRCommandLineRequest::processCommandLine(argc, argv); } catch (QRException e) { // Ignore exceptions for now. QRLogger::log(CAT_QMS_MAIN, LL_ERROR, "QMS aborted."); return -1; } } cout << "Waiting for messages..." << endl; while (TRUE) { conn->wait(); //env->getAllConnections()->waitOnAll(IpcInfiniteTimeout, FALSE); } } // End of mainline
Int32 main(Int32 argc, char **argv) { dovers(argc, argv); msg_debug_hook("mxsscp", "mxsscp.hook"); try { file_init_attach(&argc, &argv, TRUE, (char *)""); } catch (SB_Fatal_Excep &e) { SQLMXLoggingArea::logExecRtInfo(__FILE__, __LINE__, e.what(), 0); exit(1); } try { file_mon_process_startup(true); } catch (SB_Fatal_Excep &e) { SQLMXLoggingArea::logExecRtInfo(__FILE__, __LINE__, e.what(), 0); exit(1); } atexit(my_mpi_fclose); // setup log4cxx, need to be done here so initLog4cxx can have access to // process information since it is needed to compose the log name // the log4cxx log name for this ssmp process will be // based on this process' node number sscp_<nid>.log QRLogger::instance().setModule(QRLogger::QRL_SSCP); QRLogger::instance().initLog4cxx("log4cxx.trafodion.sscp.config"); // Synchronize C and C++ output streams ios::sync_with_stdio(); #ifdef _DEBUG // Redirect stdout and stderr to files named in environment // variables const char *stdOutFile = getenv("SQ_SSCP_STDOUT"); const char *stdErrFile = getenv("SQ_SSCP_STDERR"); Int32 fdOut = -1; Int32 fdErr = -1; if (stdOutFile && stdOutFile[0]) { fdOut = open(stdOutFile, O_WRONLY | O_APPEND | O_CREAT | O_SYNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); if (fdOut >= 0) { fprintf(stderr, "[Redirecting MXSSCP stdout to %s]\n", stdOutFile); fflush(stderr); dup2(fdOut, fileno(stdout)); } else { fprintf(stderr, "*** WARNING: could not open %s for redirection: %s.\n", stdOutFile, strerror(errno)); } } if (stdErrFile && stdErrFile[0]) { fdErr = open(stdErrFile, O_WRONLY | O_APPEND | O_CREAT | O_SYNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); if (fdErr >= 0) { fprintf(stderr, "[Redirecting MXUDR stderr to %s]\n", stdErrFile); fflush(stderr); dup2(fdErr, fileno(stderr)); } else { fprintf(stderr, "*** WARNING: could not open %s for redirection: %s.\n", stdErrFile, strerror(errno)); } } runServer(argc, argv); if (fdOut >= 0) { close(fdOut); } if (fdErr >= 0) { close(fdErr); } #else runServer(argc, argv); #endif return 0; }
Int32 main (Int32 argc, char *argv[]) { dovers(argc, argv); // check this before file_init_attach overwrites the user env NABoolean sync_with_stdio = (getenv("NO_SYNC_WITH_STDIO") == NULL); try { file_init_attach(&argc, &argv, TRUE, (char *)""); msg_debug_hook("sqlci", "sqlci.hook"); file_mon_process_startup2(true, false); atexit(my_mpi_fclose); } catch (...) { cerr << "Error while initializing messaging system. Please make sure Trafodion is started and up. Exiting..." << endl; exit(1); } if (sync_with_stdio) ios::sync_with_stdio(); // Establish app user id from the current NT process user identity. // This must be done explicitly until the "shadow-process" mechanism // is fully implemented. (It is done too late in cli/Context.cpp.) // FX: I'm not sure whether the following code applies // to NT only. // process command line options char * in_filename = NULL; char * input_string = NULL; char * out_filename = NULL; char * sock_port = NULL; NAString user_name(""); Int32 i = 1; for (; i < argc; i++) processOption(argc, argv, i, (const char *&)in_filename, (const char *&)input_string, (const char *&)out_filename, (char *&)sock_port, user_name ); if (sock_port) { } // create a SQLCI object SqlciEnv * sqlci = new SqlciEnv(); global_sqlci_env = sqlci; if (user_name.length() > 0) sqlci->setUserNameFromCommandLine(user_name); if (setjmp(ExportJmpBuf)) { printf("\nSQLCI terminating due to assertion failure"); delete sqlci; exit(1); // NAExit(1); } ExportJmpBufPtr = &ExportJmpBuf; if ((!in_filename) && (out_filename)) { sqlci->setNoBanner(TRUE); // create a logfile with the name out_filename. // Do not do that if an in_filename is specified. Users should // put the log command in the input file. char * logf = new char[strlen("LOG ") + strlen(out_filename) + strlen(" clear;") + 1]; sprintf(logf, "LOG %s clear;", out_filename); sqlci->run(NULL, logf); delete logf; sqlci->get_logfile()->setNoDisplay(TRUE); } // setup log4cxx, need to be done here so initLog4cxx can have access to // process information since it is needed to compose the log name QRLogger::initLog4cxx(QRLogger::QRL_MXEXE); // run it -- this is where the action is! if (in_filename || input_string) sqlci->run(in_filename, input_string); else sqlci->run(); if ((!in_filename) && (out_filename)) { sqlci->run(NULL, (char *)"LOG;"); } // Now we are done, delete SQLCI object delete sqlci; #ifdef _DEBUG_RTS removeProcess(); #endif #ifdef _DEBUG // Delete all contexts GetCliGlobals()->deleteContexts(); #endif // _DEBUG return 0; }