static int daemonStartup(int, const char**) { CSystemLogger sysLogger(DAEMON_NAME); return realMain(); }
int APIENTRY WinMain(HINSTANCE inst, HINSTANCE junk, char *args, int junk2) { appInst = inst; winService = new MprWinService(APPWEB_SERVICE_NAME); // // Only talk to the windows service dispatcher if running as a service. // This will block if we are a service and are being started by the // service control manager. While blocked, the svcMain will be called // which becomes the effective main program. // if (strstr(args, "-b") == 0 || winService->startDispatcher(svcMainEntry) < 0) { MprCmdLine *cmdLine = new MprCmdLine(args, cmdSpec); if (realMain(cmdLine) < 0) { delete cmdLine; return FALSE; } delete cmdLine; delete winService; mprMemClose(); return 0; } else { delete winService; mprMemClose(); return FALSE; } }
// // UNIX main program // int main(int argc, char *argv[]) { MprCmdLine cmdLine(argc, argv, cmdSpec); int rc; rc = realMain(&cmdLine); mprMemClose(); return 0; }
int APIENTRY WinMain(HINSTANCE inst, HINSTANCE junk, char *args, int junk2) { MprCmdLine *cmdLine = new MprCmdLine(args, cmdSpec); if (realMain(cmdLine) < 0) { delete cmdLine; return FALSE; } delete cmdLine; mprMemClose(); return 0; }
int main(int argc, char * argv[]) { int ncores = 0; if (argc == 4) ncores = atoi(argv[3]); SetMaxThreads(ncores); realMain(argc, argv); exit(0); }
static void svcThread(void *data) { MprCmdLine *cmdLine; int rc; cmdLine = (MprCmdLine*) data; if (winService->registerService(threadHandle, serviceWaitEvent) < 0) { // Should never happen, but try to keep going anyway. rc = realMain(cmdLine); ExitThread(rc); return; } // // Call the real main // isService++; winService->updateStatus(SERVICE_RUNNING, 0); rc = realMain(cmdLine); winService->updateStatus(SERVICE_STOPPED, rc); ExitThread(rc); }
static void WINAPI svcMainEntry(ulong argc, char **argv) { MprCmdLine *cmdLine; char keyPath[80], *argBuf, *cp; int threadId; // // Read the command line from the windows registry // argBuf = 0; mprSprintf(keyPath, sizeof(keyPath), "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\%s", APPWEB_SERVICE_NAME); mprReadRegistry(keyPath, "ImagePath", &argBuf, MPR_MAX_STRING); // // The program name may be in quotes and may have spaces in it // if (argBuf[0] == '\"') { if ((cp = strchr(&argBuf[1], '\"')) == 0) { cp = argBuf; } else { cp++; } } else { cp = argBuf; } while (isspace((uchar) *cp) || *cp == '\v') { cp++; } cmdLine = new MprCmdLine(cp, cmdSpec); serviceWaitEvent = CreateEvent(0, TRUE, FALSE, 0); threadHandle = CreateThread(0, 0, (LPTHREAD_START_ROUTINE) svcThread, (void*) cmdLine, 0, (ulong*) &threadId); if (threadHandle == 0) { // Should never happen, but try to keep going anyway. realMain(cmdLine); } WaitForSingleObject(serviceWaitEvent, INFINITE); CloseHandle(serviceWaitEvent); delete cmdLine; mprFree(argBuf); }
int main(int argc, char** argv) { CArch arch; CLOG; CArgs args; // get program name ARG->m_pname = ARCH->getBasename(argv[0]); // make the task bar receiver. the user can control this app // through the task bar. s_taskBarReceiver = new CXWindowsClientTaskBarReceiver; s_taskBarReceiver->setQuitJob(new CQuitJob(CThread::getCurrentThread())); // parse command line parse(argc, argv); // daemonize if requested int result; if (ARG->m_daemon) { try { result = ARCH->daemonize(DAEMON_NAME, &daemonStartup); } catch (XArchDaemon&) { LOG((CLOG_CRIT "failed to daemonize")); result = kExitFailed; } } else { result = realMain(); } // done with task bar receiver delete s_taskBarReceiver; return result; }
int main(int argc, char * argv[]) { int ncores = 0; if (argc == 4) ncores = atoi(argv[3]); SetMaxThreads(ncores); DDSInfo info; GetDDSInfo(&info); printf("%s", info.systemString); printf("%-12s %20s\n\n", "Version", info.versionString); fflush(stdout); realMain(argc, argv); #ifdef DDS_SCHEDULER scheduler.PrintTiming(); #endif FreeMemory(); exit(0); }
// // UNIX main program // int appwebMain(int argc, char *argv[]) { MprCmdLine cmdLine("appweb -r . -f appweb.conf", cmdSpec); return realMain(&cmdLine); }
static int padMain(int argc, char **argv) { char pad[512]; return realMain(argc, argv, pad); }
static void realMainEntry(void* vresult) { *reinterpret_cast<int*>(vresult) = realMain(); }