2 * InspIRCd -- Internet Relay Chat Daemon
4 * Copyright (C) 2012 William Pitcock <nenolod@dereferenced.org>
5 * Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>
6 * Copyright (C) 2003-2008 Craig Edwards <craigedwards@brainbox.cc>
7 * Copyright (C) 2008 Uli Schlachter <psychon@znc.in>
8 * Copyright (C) 2006-2008 Robin Burchell <robin+git@viroteck.net>
9 * Copyright (C) 2006-2007 Oliver Lupton <oliverlupton@gmail.com>
10 * Copyright (C) 2007 Dennis Friis <peavey@inspircd.org>
11 * Copyright (C) 2007 Burlex <???@???>
12 * Copyright (C) 2003 Craig McLure <craig@chatspike.net>
13 * Copyright (C) 2003 randomdan <???@???>
15 * This file is part of InspIRCd. InspIRCd is free software: you can
16 * redistribute it and/or modify it under the terms of the GNU General Public
17 * License as published by the Free Software Foundation, version 2.
19 * This program is distributed in the hope that it will be useful, but WITHOUT
20 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
21 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
24 * You should have received a copy of the GNU General Public License
25 * along with this program. If not, see <http://www.gnu.org/licenses/>.
31 #include "inspircd_version.h"
37 #include <sys/resource.h>
41 /* Some systems don't define RUSAGE_SELF. This should fix them. */
46 #include <pwd.h> // setuid
47 #include <grp.h> // setgid
49 WORD g_wOriginalColors;
50 WORD g_wBackgroundColor;
58 #include "socketengine.h"
60 #include "command_parse.h"
61 #include "exitcodes.h"
63 #include "testsuite.h"
65 InspIRCd* ServerInstance = NULL;
68 /** Seperate from the other casemap tables so that code *can* still exclusively rely on RFC casemapping
71 * This is provided as a pointer so that modules can change it to their custom mapping tables,
72 * e.g. for national character support.
74 unsigned const char *national_case_insensitive_map = rfc_case_insensitive_map;
77 /* Moved from exitcodes.h -- due to duplicate symbols -- Burlex
78 * XXX this is a bit ugly. -- w00t
80 const char* ExitCodes[] =
83 "DIE command", /* 1 */
84 "execv() failed", /* 2 */
85 "Internal error", /* 3 */
86 "Config file error", /* 4 */
87 "Logfile error", /* 5 */
88 "POSIX fork failed", /* 6 */
89 "Bad commandline parameters", /* 7 */
90 "No ports could be bound", /* 8 */
91 "Can't write PID file", /* 9 */
92 "SocketEngine could not initialize", /* 10 */
93 "Refusing to start up as root", /* 11 */
94 "Found a <die> tag!", /* 12 */
95 "Couldn't load module on startup", /* 13 */
96 "Could not create windows forked process", /* 14 */
97 "Received SIGTERM", /* 15 */
98 "Bad command handler loaded", /* 16 */
99 "RegisterServiceCtrlHandler failed", /* 17 */
100 "UpdateSCMStatus failed", /* 18 */
101 "CreateEvent failed" /* 19 */
104 template<typename T> static void DeleteZero(T*&n)
111 void InspIRCd::Cleanup()
113 for (unsigned int i = 0; i < ports.size(); i++)
115 /* This calls the constructor and closes the listening socket */
121 /* Close all client sockets, or the new process inherits them */
122 LocalUserList::reverse_iterator i = Users->local_users.rbegin();
123 while (i != this->Users->local_users.rend())
126 Users->QuitUser(u, "Server shutdown");
130 Modules->UnloadAll();
132 /* Delete objects dynamically allocated in constructor (destructor would be more appropriate, but we're likely exiting) */
133 /* Must be deleted before modes as it decrements modelines */
138 DeleteZero(this->FakeClient);
139 DeleteZero(this->Users);
140 DeleteZero(this->Modes);
141 DeleteZero(this->XLines);
142 DeleteZero(this->Parser);
143 DeleteZero(this->stats);
144 DeleteZero(this->Modules);
145 DeleteZero(this->BanCache);
146 DeleteZero(this->SNO);
147 DeleteZero(this->Config);
148 DeleteZero(this->Res);
149 DeleteZero(this->chanlist);
150 DeleteZero(this->PI);
151 DeleteZero(this->Threads);
152 DeleteZero(this->Timers);
153 DeleteZero(this->SE);
155 this->Logs->CloseLogs();
156 DeleteZero(this->Logs);
159 void InspIRCd::Restart(const std::string &reason)
161 /* SendError flushes each client's queue,
162 * regardless of writeability state
164 this->SendError(reason);
166 /* Figure out our filename (if theyve renamed it, we're boned) */
169 char** argv = Config->cmdline.argv;
172 char module[MAX_PATH];
173 if (GetModuleFileNameA(NULL, module, MAX_PATH))
181 if (execv(me.c_str(), argv) == -1)
183 /* Will raise a SIGABRT if not trapped */
184 throw CoreException(std::string("Failed to execv()! error: ") + strerror(errno));
188 void InspIRCd::ResetMaxBans()
190 for (chan_hash::const_iterator i = chanlist->begin(); i != chanlist->end(); i++)
191 i->second->ResetMaxBans();
194 /** Because hash_map doesn't free its buckets when we delete items, we occasionally
195 * recreate the hash to free them up.
196 * We do this by copying the entries from the old hash to a new hash, causing all
197 * empty buckets to be weeded out of the hash.
198 * Since this is quite expensive, it's not done very often.
200 void InspIRCd::RehashUsersAndChans()
202 user_hash* old_users = Users->clientlist;
203 Users->clientlist = new user_hash;
204 for (user_hash::const_iterator n = old_users->begin(); n != old_users->end(); n++)
205 Users->clientlist->insert(*n);
208 user_hash* old_uuid = Users->uuidlist;
209 Users->uuidlist = new user_hash;
210 for (user_hash::const_iterator n = old_uuid->begin(); n != old_uuid->end(); n++)
211 Users->uuidlist->insert(*n);
214 chan_hash* old_chans = chanlist;
215 chanlist = new chan_hash;
216 for (chan_hash::const_iterator n = old_chans->begin(); n != old_chans->end(); n++)
217 chanlist->insert(*n);
220 // Reset the already_sent IDs so we don't wrap it around and drop a message
221 LocalUser::already_sent_id = 0;
222 for (LocalUserList::const_iterator i = Users->local_users.begin(); i != Users->local_users.end(); i++)
224 (**i).already_sent = 0;
225 (**i).RemoveExpiredInvites();
229 void InspIRCd::SetSignals()
232 signal(SIGALRM, SIG_IGN);
233 signal(SIGHUP, InspIRCd::SetSignal);
234 signal(SIGPIPE, SIG_IGN);
235 signal(SIGCHLD, SIG_IGN);
236 /* We want E2BIG not a signal! */
237 signal(SIGXFSZ, SIG_IGN);
239 signal(SIGTERM, InspIRCd::SetSignal);
242 void InspIRCd::QuickExit(int status)
247 bool InspIRCd::DaemonSeed()
250 std::cout << "InspIRCd Process ID: " << con_green << GetCurrentProcessId() << con_reset << std::endl;
253 signal(SIGTERM, InspIRCd::QuickExit);
256 if ((childpid = fork ()) < 0)
258 else if (childpid > 0)
260 /* We wait here for the child process to kill us,
261 * so that the shell prompt doesnt come back over
263 * Sending a kill with a signal of 0 just checks
264 * if the child pid is still around. If theyre not,
265 * they threw an error and we should give up.
267 while (kill(childpid, 0) != -1)
272 std::cout << "InspIRCd Process ID: " << con_green << getpid() << con_reset << std::endl;
274 signal(SIGTERM, InspIRCd::SetSignal);
277 if (getrlimit(RLIMIT_CORE, &rl) == -1)
279 this->Logs->Log("STARTUP",DEFAULT,"Failed to getrlimit()!");
282 rl.rlim_cur = rl.rlim_max;
284 if (setrlimit(RLIMIT_CORE, &rl) == -1)
285 this->Logs->Log("STARTUP",DEFAULT,"setrlimit() failed, cannot increase coredump size.");
291 void InspIRCd::WritePID(const std::string &filename)
294 std::string fname(filename);
296 fname = DATA_PATH "/inspircd.pid";
297 std::ofstream outfile(fname.c_str());
298 if (outfile.is_open())
305 std::cout << "Failed to write PID-file '" << fname << "', exiting." << std::endl;
306 this->Logs->Log("STARTUP",DEFAULT,"Failed to write PID-file '%s', exiting.",fname.c_str());
307 Exit(EXIT_STATUS_PID);
312 InspIRCd::InspIRCd(int argc, char** argv) :
313 ConfigFileName(CONFIG_PATH "/inspircd.conf"),
315 /* Functor pointer initialisation.
317 * THIS MUST MATCH THE ORDER OF DECLARATION OF THE FUNCTORS, e.g. the methods
318 * themselves within the class.
320 NICKForced("NICKForced", NULL),
321 OperQuit("OperQuit", NULL),
322 GenRandom(&HandleGenRandom),
323 IsChannel(&HandleIsChannel),
324 Rehash(&HandleRehash),
325 IsNick(&HandleIsNick),
326 IsIdent(&HandleIsIdent),
327 OnCheckExemption(&HandleOnCheckExemption)
329 ServerInstance = this;
331 Extensions.Register(&NICKForced);
332 Extensions.Register(&OperQuit);
335 int do_version = 0, do_nofork = 0, do_debug = 0,
336 do_nolog = 0, do_root = 0, do_testsuite = 0; /* flag variables */
339 // Initialize so that if we exit before proper initialization they're not deleted
355 this->ConfigThread = NULL;
356 this->FakeClient = NULL;
359 this->startup_time = TIME.tv_sec;
361 // This must be created first, so other parts of Insp can use it while starting up
362 this->Logs = new LogManager;
364 SE = CreateSocketEngine();
366 this->Threads = new ThreadEngine;
368 /* Default implementation does nothing */
369 this->PI = new ProtocolInterface;
373 // Create base manager classes early, so nothing breaks
374 this->Users = new UserManager;
376 this->Users->unregistered_count = 0;
378 this->Users->clientlist = new user_hash();
379 this->Users->uuidlist = new user_hash();
380 this->chanlist = new chan_hash();
382 this->Config = new ServerConfig;
383 this->SNO = new SnomaskManager;
384 this->BanCache = new BanCacheManager;
385 this->Modules = new ModuleManager();
386 this->stats = new serverstats();
387 this->Timers = new TimerManager;
388 this->Parser = new CommandParser;
389 this->XLines = new XLineManager;
391 this->Config->cmdline.argv = argv;
392 this->Config->cmdline.argc = argc;
395 srand(TIME.tv_nsec ^ TIME.tv_sec);
397 // Initialize the console values
398 g_hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
399 CONSOLE_SCREEN_BUFFER_INFO bufinf;
400 if(GetConsoleScreenBufferInfo(g_hStdout, &bufinf))
402 g_wOriginalColors = bufinf.wAttributes & 0x00FF;
403 g_wBackgroundColor = bufinf.wAttributes & 0x00F0;
407 g_wOriginalColors = FOREGROUND_RED|FOREGROUND_BLUE|FOREGROUND_GREEN;
408 g_wBackgroundColor = 0;
411 srandom(TIME.tv_nsec ^ TIME.tv_sec);
414 struct option longopts[] =
416 { "nofork", no_argument, &do_nofork, 1 },
417 { "logfile", required_argument, NULL, 'f' },
418 { "config", required_argument, NULL, 'c' },
419 { "debug", no_argument, &do_debug, 1 },
420 { "nolog", no_argument, &do_nolog, 1 },
421 { "runasroot", no_argument, &do_root, 1 },
422 { "version", no_argument, &do_version, 1 },
423 { "testsuite", no_argument, &do_testsuite, 1 },
428 while ((c = getopt_long(argc, argv, ":c:f:", longopts, &index)) != -1)
433 /* Log filename was set */
434 Config->cmdline.startup_log = optarg;
437 /* Config filename was set */
438 ConfigFileName = optarg;
441 /* getopt_long_only() set an int variable, just keep going */
444 /* Unknown parameter */
446 /* Fall through to handle other weird values too */
447 std::cout << "Unknown parameter '" << argv[optind-1] << "'" << std::endl;
448 std::cout << "Usage: " << argv[0] << " [--nofork] [--nolog] [--debug] [--logfile <filename>] " << std::endl <<
449 std::string(static_cast<int>(8+strlen(argv[0])), ' ') << "[--runasroot] [--version] [--config <config>] [--testsuite]" << std::endl;
450 Exit(EXIT_STATUS_ARGV);
456 do_nofork = do_debug = true;
460 std::cout << std::endl << VERSION << " r" << REVISION << std::endl;
461 Exit(EXIT_STATUS_NOERROR);
467 WSAStartup(MAKEWORD(2,2), &wsadata);
470 /* Set the finished argument values */
471 Config->cmdline.nofork = (do_nofork != 0);
472 Config->cmdline.forcedebug = (do_debug != 0);
473 Config->cmdline.writelog = (!do_nolog != 0);
474 Config->cmdline.TestSuite = (do_testsuite != 0);
478 FileWriter* fw = new FileWriter(stdout);
479 FileLogStream* fls = new FileLogStream(RAWIO, fw);
480 Logs->AddLogTypes("*", fls, true);
482 else if (!this->OpenLog(argv, argc))
484 std::cout << "ERROR: Could not open initial logfile " << Config->cmdline.startup_log << ": " << strerror(errno) << std::endl << std::endl;
485 Exit(EXIT_STATUS_LOG);
488 if (!ServerConfig::FileExists(ConfigFileName.c_str()))
491 /* Windows can (and defaults to) hide file extensions, so let's play a bit nice for windows users. */
492 std::string txtconf = this->ConfigFileName;
493 txtconf.append(".txt");
495 if (ServerConfig::FileExists(txtconf.c_str()))
497 ConfigFileName = txtconf;
502 std::cout << "ERROR: Cannot open config file: " << ConfigFileName << std::endl << "Exiting..." << std::endl;
503 this->Logs->Log("STARTUP",DEFAULT,"Unable to open config file %s", ConfigFileName.c_str());
504 Exit(EXIT_STATUS_CONFIG);
508 std::cout << con_green << "Inspire Internet Relay Chat Server" << con_reset << ", compiled on " __DATE__ " at " __TIME__ << std::endl;
509 std::cout << con_green << "(C) InspIRCd Development Team." << con_reset << std::endl << std::endl;
510 std::cout << "Developers:" << std::endl;
511 std::cout << con_green << "\tBrain, FrostyCoolSlug, w00t, Om, Special, peavey" << std::endl;
512 std::cout << "\taquanight, psychon, dz, danieldg, jackmcbarn" << con_reset << std::endl << std::endl;
513 std::cout << "Others:\t\t\t" << con_green << "See /INFO Output" << con_reset << std::endl;
515 this->Modes = new ModeParser;
522 std::cout << "* WARNING * WARNING * WARNING * WARNING * WARNING *" << std::endl
\r
523 << "YOU ARE RUNNING INSPIRCD AS ROOT. THIS IS UNSUPPORTED" << std::endl
\r
524 << "AND IF YOU ARE HACKED, CRACKED, SPINDLED OR MUTILATED" << std::endl
\r
525 << "OR ANYTHING ELSE UNEXPECTED HAPPENS TO YOU OR YOUR" << std::endl
\r
526 << "SERVER, THEN IT IS YOUR OWN FAULT. IF YOU DID NOT MEAN" << std::endl
\r
527 << "TO START INSPIRCD AS ROOT, HIT CTRL+C NOW AND RESTART" << std::endl
\r
528 << "THE PROGRAM AS A NORMAL USER. YOU HAVE BEEN WARNED!" << std::endl << std::endl
\r
529 << "InspIRCd starting in 20 seconds, ctrl+c to abort..." << std::endl;
\r
536 if (!Config->cmdline.nofork)
538 if (!this->DaemonSeed())
540 std::cout << "ERROR: could not go into daemon mode. Shutting down." << std::endl;
541 Logs->Log("STARTUP", DEFAULT, "ERROR: could not go into daemon mode. Shutting down.");
542 Exit(EXIT_STATUS_FORK);
546 SE->RecoverFromFork();
548 /* During startup we don't actually initialize this
549 * in the thread engine.
551 this->Config->Read();
552 this->Config->Apply(NULL, "");
553 Logs->OpenFileLogs();
555 this->Res = new DNS();
558 * Initialise SID/UID.
559 * For an explanation as to exactly how this works, and why it works this way, see GetUID().
562 if (Config->sid.empty())
565 unsigned int sid = 0;
568 for (const char* x = Config->ServerName.c_str(); *x; ++x)
570 for (const char* y = Config->ServerDesc.c_str(); *y; ++y)
572 sprintf(sidstr, "%03d", sid % 1000);
574 Config->sid = sidstr;
577 /* set up fake client again this time with the correct uid */
578 this->FakeClient = new FakeUser(Config->sid, Config->ServerName);
580 // Get XLine to do it's thing.
581 this->XLines->CheckELines();
582 this->XLines->ApplyLines();
584 int bounditems = BindPorts(pl);
586 std::cout << std::endl;
588 this->Modules->LoadAll();
590 /* Just in case no modules were loaded - fix for bug #101 */
591 this->BuildISupport();
592 Config->ApplyDisabledCommands(Config->DisabledCommands);
596 std::cout << std::endl << "WARNING: Not all your client ports could be bound -- " << std::endl << "starting anyway with " << bounditems
597 << " of " << bounditems + (int)pl.size() << " client ports bound." << std::endl << std::endl;
598 std::cout << "The following port(s) failed to bind:" << std::endl << std::endl;
600 for (FailedPortList::iterator i = pl.begin(); i != pl.end(); i++, j++)
602 std::cout << j << ".\tAddress: " << (i->first.empty() ? "<all>" : i->first) << " \tReason: " << i->second << std::endl;
605 std::cout << std::endl << "Hint: Try using a public IP instead of blank or *" << std::endl;
608 std::cout << "InspIRCd is now running as '" << Config->ServerName << "'[" << Config->GetSID() << "] with " << SE->GetMaxFds() << " max open sockets" << std::endl;
611 if (!Config->cmdline.nofork)
613 if (kill(getppid(), SIGTERM) == -1)
615 std::cout << "Error killing parent process: " << strerror(errno) << std::endl;
616 Logs->Log("STARTUP", DEFAULT, "Error killing parent process: %s",strerror(errno));
620 /* Explicitly shut down stdio's stdin/stdout/stderr.
622 * The previous logic here was to only do this if stdio was connected to a controlling
623 * terminal. However, we must do this always to avoid information leaks and other
624 * problems related to stdio.
626 * The only exception is if we are in debug mode.
630 if ((!do_nofork) && (!do_testsuite) && (!Config->cmdline.forcedebug))
632 int fd = open("/dev/null", O_RDWR);
638 if (dup2(fd, STDIN_FILENO) < 0)
639 Logs->Log("STARTUP", DEFAULT, "Failed to dup /dev/null to stdin.");
640 if (dup2(fd, STDOUT_FILENO) < 0)
641 Logs->Log("STARTUP", DEFAULT, "Failed to dup /dev/null to stdout.");
642 if (dup2(fd, STDERR_FILENO) < 0)
643 Logs->Log("STARTUP", DEFAULT, "Failed to dup /dev/null to stderr.");
648 Logs->Log("STARTUP", DEFAULT,"Keeping pseudo-tty open as we are running in the foreground.");
651 /* Set win32 service as running, if we are running as a service */
660 QueryPerformanceFrequency(&stats->QPFrequency);
663 Logs->Log("STARTUP", DEFAULT, "Startup complete as '%s'[%s], %d max open sockets", Config->ServerName.c_str(),Config->GetSID().c_str(), SE->GetMaxFds());
666 std::string SetUser = Config->ConfValue("security")->getString("runasuser");
667 std::string SetGroup = Config->ConfValue("security")->getString("runasgroup");
668 if (!SetGroup.empty())
673 ret = setgroups(0, NULL);
677 this->Logs->Log("SETGROUPS", DEFAULT, "setgroups() failed (wtf?): %s", strerror(errno));
685 g = getgrnam(SetGroup.c_str());
689 this->Logs->Log("SETGUID", DEFAULT, "getgrnam() failed (bad user?): %s", strerror(errno));
693 ret = setgid(g->gr_gid);
697 this->Logs->Log("SETGUID", DEFAULT, "setgid() failed (bad user?): %s", strerror(errno));
702 if (!SetUser.empty())
708 u = getpwnam(SetUser.c_str());
712 this->Logs->Log("SETGUID", DEFAULT, "getpwnam() failed (bad user?): %s", strerror(errno));
716 int ret = setuid(u->pw_uid);
720 this->Logs->Log("SETGUID", DEFAULT, "setuid() failed (bad user?): %s", strerror(errno));
725 this->WritePID(Config->PID);
729 void InspIRCd::UpdateTime()
735 TIME.tv_sec = time(NULL);
736 TIME.tv_nsec = st.wMilliseconds;
738 #ifdef HAS_CLOCK_GETTIME
739 clock_gettime(CLOCK_REALTIME, &TIME);
742 gettimeofday(&tv, NULL);
743 TIME.tv_sec = tv.tv_sec;
744 TIME.tv_nsec = tv.tv_usec * 1000;
751 /* See if we're supposed to be running the test suite rather than entering the mainloop */
752 if (Config->cmdline.TestSuite)
754 TestSuite* ts = new TestSuite;
760 time_t OLDTIME = TIME.tv_sec;
768 /* Check if there is a config thread which has finished executing but has not yet been freed */
769 if (this->ConfigThread && this->ConfigThread->IsDone())
771 /* Rehash has completed */
772 this->Logs->Log("CONFIG",DEBUG,"Detected ConfigThread exiting, tidying up...");
774 this->ConfigThread->Finish();
776 ConfigThread->join();
783 /* Run background module timers every few seconds
784 * (the docs say modules shouldnt rely on accurate
785 * timing using this event, so we dont have to
786 * time this exactly).
788 if (TIME.tv_sec != OLDTIME)
791 getrusage(RUSAGE_SELF, &ru);
792 stats->LastSampled = TIME;
793 stats->LastCPU = ru.ru_utime;
795 if(QueryPerformanceCounter(&stats->LastSampled))
797 FILETIME CreationTime;
801 GetProcessTimes(GetCurrentProcess(), &CreationTime, &ExitTime, &KernelTime, &UserTime);
802 stats->LastCPU.dwHighDateTime = KernelTime.dwHighDateTime + UserTime.dwHighDateTime;
803 stats->LastCPU.dwLowDateTime = KernelTime.dwLowDateTime + UserTime.dwLowDateTime;
807 /* Allow a buffer of two seconds drift on this so that ntpdate etc dont harass admins */
808 if (TIME.tv_sec < OLDTIME - 2)
810 SNO->WriteToSnoMask('d', "\002EH?!\002 -- Time is flowing BACKWARDS in this dimension! Clock drifted backwards %lu secs.", (unsigned long)OLDTIME-TIME.tv_sec);
812 else if (TIME.tv_sec > OLDTIME + 2)
814 SNO->WriteToSnoMask('d', "\002EH?!\002 -- Time is jumping FORWARDS! Clock skipped %lu secs.", (unsigned long)TIME.tv_sec - OLDTIME);
817 OLDTIME = TIME.tv_sec;
819 if ((TIME.tv_sec % 3600) == 0)
821 this->RehashUsersAndChans();
822 FOREACH_MOD(I_OnGarbageCollect, OnGarbageCollect());
825 Timers->TickTimers(TIME.tv_sec);
826 this->DoBackgroundUserStuff();
828 if ((TIME.tv_sec % 5) == 0)
830 FOREACH_MOD(I_OnBackgroundTimer,OnBackgroundTimer(TIME.tv_sec));
831 SNO->FlushSnotices();
835 /* Call the socket engine to wait on the active
836 * file descriptors. The socket engine has everything's
837 * descriptors in its list... dns, modules, users,
838 * servers... so its nice and easy, just one call.
839 * This will cause any read or write events to be
840 * dispatched to their handlers.
842 this->SE->DispatchTrialWrites();
843 this->SE->DispatchEvents();
845 /* if any users were quit, take them out */
851 this->SignalHandler(s_signal);
859 /**********************************************************************************/
862 * An ircd in five lines! bwahahaha. ahahahahaha. ahahah *cough*.
865 /* this returns true when all modules are satisfied that the user should be allowed onto the irc server
866 * (until this returns true, a user will block in the waiting state, waiting to connect up to the
867 * registration timeout maximum seconds)
869 bool InspIRCd::AllModulesReportReady(LocalUser* user)
872 FIRST_MOD_RESULT(OnCheckReady, res, (user));
873 return (res == MOD_RES_PASSTHRU);
876 void InspIRCd::SetSignal(int signal)
881 /* On posix systems, the flow of the program starts right here, with
882 * ENTRYPOINT being a #define that defines main(). On Windows, ENTRYPOINT
883 * defines smain() and the real main() is in the service code under
884 * win32service.cpp. This allows the service control manager to control
885 * the process where we are running as a windows service.
889 new InspIRCd(argc, argv);
890 mysig = &ServerInstance->s_signal;
891 ServerInstance->Run();
892 delete ServerInstance;