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),
325 Rehash(&HandleRehash),
326 IsNick(&HandleIsNick),
327 IsIdent(&HandleIsIdent),
328 OnCheckExemption(&HandleOnCheckExemption)
330 ServerInstance = this;
332 Extensions.Register(&NICKForced);
333 Extensions.Register(&OperQuit);
336 int do_version = 0, do_nofork = 0, do_debug = 0,
337 do_nolog = 0, do_root = 0, do_testsuite = 0; /* flag variables */
340 // Initialize so that if we exit before proper initialization they're not deleted
356 this->ConfigThread = NULL;
357 this->FakeClient = NULL;
360 this->startup_time = TIME.tv_sec;
362 // This must be created first, so other parts of Insp can use it while starting up
363 this->Logs = new LogManager;
365 SE = CreateSocketEngine();
367 this->Threads = new ThreadEngine;
369 /* Default implementation does nothing */
370 this->PI = new ProtocolInterface;
374 // Create base manager classes early, so nothing breaks
375 this->Users = new UserManager;
377 this->Users->unregistered_count = 0;
379 this->Users->clientlist = new user_hash();
380 this->Users->uuidlist = new user_hash();
381 this->chanlist = new chan_hash();
383 this->Config = new ServerConfig;
384 this->SNO = new SnomaskManager;
385 this->BanCache = new BanCacheManager;
386 this->Modules = new ModuleManager();
387 this->stats = new serverstats();
388 this->Timers = new TimerManager;
389 this->Parser = new CommandParser;
390 this->XLines = new XLineManager;
392 this->Config->cmdline.argv = argv;
393 this->Config->cmdline.argc = argc;
396 srand(TIME.tv_nsec ^ TIME.tv_sec);
398 // Initialize the console values
399 g_hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
400 CONSOLE_SCREEN_BUFFER_INFO bufinf;
401 if(GetConsoleScreenBufferInfo(g_hStdout, &bufinf))
403 g_wOriginalColors = bufinf.wAttributes & 0x00FF;
404 g_wBackgroundColor = bufinf.wAttributes & 0x00F0;
408 g_wOriginalColors = FOREGROUND_RED|FOREGROUND_BLUE|FOREGROUND_GREEN;
409 g_wBackgroundColor = 0;
412 srandom(TIME.tv_nsec ^ TIME.tv_sec);
415 struct option longopts[] =
417 { "nofork", no_argument, &do_nofork, 1 },
418 { "logfile", required_argument, NULL, 'f' },
419 { "config", required_argument, NULL, 'c' },
420 { "debug", no_argument, &do_debug, 1 },
421 { "nolog", no_argument, &do_nolog, 1 },
422 { "runasroot", no_argument, &do_root, 1 },
423 { "version", no_argument, &do_version, 1 },
424 { "testsuite", no_argument, &do_testsuite, 1 },
429 while ((c = getopt_long(argc, argv, ":c:f:", longopts, &index)) != -1)
434 /* Log filename was set */
435 Config->cmdline.startup_log = optarg;
438 /* Config filename was set */
439 ConfigFileName = optarg;
442 /* getopt_long_only() set an int variable, just keep going */
445 /* Unknown parameter */
447 /* Fall through to handle other weird values too */
448 std::cout << "Unknown parameter '" << argv[optind-1] << "'" << std::endl;
449 std::cout << "Usage: " << argv[0] << " [--nofork] [--nolog] [--debug] [--logfile <filename>] " << std::endl <<
450 std::string(static_cast<int>(8+strlen(argv[0])), ' ') << "[--runasroot] [--version] [--config <config>] [--testsuite]" << std::endl;
451 Exit(EXIT_STATUS_ARGV);
457 do_nofork = do_debug = true;
461 std::cout << std::endl << VERSION << " r" << REVISION << std::endl;
462 Exit(EXIT_STATUS_NOERROR);
468 WSAStartup(MAKEWORD(2,2), &wsadata);
471 /* Set the finished argument values */
472 Config->cmdline.nofork = (do_nofork != 0);
473 Config->cmdline.forcedebug = (do_debug != 0);
474 Config->cmdline.writelog = (!do_nolog != 0);
475 Config->cmdline.TestSuite = (do_testsuite != 0);
479 FileWriter* fw = new FileWriter(stdout);
480 FileLogStream* fls = new FileLogStream(RAWIO, fw);
481 Logs->AddLogTypes("*", fls, true);
483 else if (!this->OpenLog(argv, argc))
485 std::cout << "ERROR: Could not open initial logfile " << Config->cmdline.startup_log << ": " << strerror(errno) << std::endl << std::endl;
486 Exit(EXIT_STATUS_LOG);
489 if (!ServerConfig::FileExists(ConfigFileName.c_str()))
492 /* Windows can (and defaults to) hide file extensions, so let's play a bit nice for windows users. */
493 std::string txtconf = this->ConfigFileName;
494 txtconf.append(".txt");
496 if (ServerConfig::FileExists(txtconf.c_str()))
498 ConfigFileName = txtconf;
503 std::cout << "ERROR: Cannot open config file: " << ConfigFileName << std::endl << "Exiting..." << std::endl;
504 this->Logs->Log("STARTUP",DEFAULT,"Unable to open config file %s", ConfigFileName.c_str());
505 Exit(EXIT_STATUS_CONFIG);
509 std::cout << con_green << "Inspire Internet Relay Chat Server" << con_reset << ", compiled on " __DATE__ " at " __TIME__ << std::endl;
510 std::cout << con_green << "(C) InspIRCd Development Team." << con_reset << std::endl << std::endl;
511 std::cout << "Developers:" << std::endl;
512 std::cout << con_green << "\tBrain, FrostyCoolSlug, w00t, Om, Special, peavey" << std::endl;
513 std::cout << "\taquanight, psychon, dz, danieldg, jackmcbarn" << con_reset << std::endl << std::endl;
514 std::cout << "Others:\t\t\t" << con_green << "See /INFO Output" << con_reset << std::endl;
516 this->Modes = new ModeParser;
523 std::cout << "* WARNING * WARNING * WARNING * WARNING * WARNING *" << std::endl
\r
524 << "YOU ARE RUNNING INSPIRCD AS ROOT. THIS IS UNSUPPORTED" << std::endl
\r
525 << "AND IF YOU ARE HACKED, CRACKED, SPINDLED OR MUTILATED" << std::endl
\r
526 << "OR ANYTHING ELSE UNEXPECTED HAPPENS TO YOU OR YOUR" << std::endl
\r
527 << "SERVER, THEN IT IS YOUR OWN FAULT. IF YOU DID NOT MEAN" << std::endl
\r
528 << "TO START INSPIRCD AS ROOT, HIT CTRL+C NOW AND RESTART" << std::endl
\r
529 << "THE PROGRAM AS A NORMAL USER. YOU HAVE BEEN WARNED!" << std::endl << std::endl
\r
530 << "InspIRCd starting in 20 seconds, ctrl+c to abort..." << std::endl;
\r
537 if (!Config->cmdline.nofork)
539 if (!this->DaemonSeed())
541 std::cout << "ERROR: could not go into daemon mode. Shutting down." << std::endl;
542 Logs->Log("STARTUP", DEFAULT, "ERROR: could not go into daemon mode. Shutting down.");
543 Exit(EXIT_STATUS_FORK);
547 SE->RecoverFromFork();
549 /* During startup we don't actually initialize this
550 * in the thread engine.
552 this->Config->Read();
553 this->Config->Apply(NULL, "");
554 Logs->OpenFileLogs();
556 this->Res = new DNS();
559 * Initialise SID/UID.
560 * For an explanation as to exactly how this works, and why it works this way, see GetUID().
563 if (Config->sid.empty())
566 unsigned int sid = 0;
569 for (const char* x = Config->ServerName.c_str(); *x; ++x)
571 for (const char* y = Config->ServerDesc.c_str(); *y; ++y)
573 sprintf(sidstr, "%03d", sid % 1000);
575 Config->sid = sidstr;
578 /* set up fake client again this time with the correct uid */
579 this->FakeClient = new FakeUser(Config->sid, Config->ServerName);
581 // Get XLine to do it's thing.
582 this->XLines->CheckELines();
583 this->XLines->ApplyLines();
585 int bounditems = BindPorts(pl);
587 std::cout << std::endl;
589 this->Modules->LoadAll();
591 /* Just in case no modules were loaded - fix for bug #101 */
592 this->BuildISupport();
593 Config->ApplyDisabledCommands(Config->DisabledCommands);
597 std::cout << std::endl << "WARNING: Not all your client ports could be bound -- " << std::endl << "starting anyway with " << bounditems
598 << " of " << bounditems + (int)pl.size() << " client ports bound." << std::endl << std::endl;
599 std::cout << "The following port(s) failed to bind:" << std::endl << std::endl;
601 for (FailedPortList::iterator i = pl.begin(); i != pl.end(); i++, j++)
603 std::cout << j << ".\tAddress: " << (i->first.empty() ? "<all>" : i->first) << " \tReason: " << i->second << std::endl;
606 std::cout << std::endl << "Hint: Try using a public IP instead of blank or *" << std::endl;
609 std::cout << "InspIRCd is now running as '" << Config->ServerName << "'[" << Config->GetSID() << "] with " << SE->GetMaxFds() << " max open sockets" << std::endl;
612 if (!Config->cmdline.nofork)
614 if (kill(getppid(), SIGTERM) == -1)
616 std::cout << "Error killing parent process: " << strerror(errno) << std::endl;
617 Logs->Log("STARTUP", DEFAULT, "Error killing parent process: %s",strerror(errno));
621 /* Explicitly shut down stdio's stdin/stdout/stderr.
623 * The previous logic here was to only do this if stdio was connected to a controlling
624 * terminal. However, we must do this always to avoid information leaks and other
625 * problems related to stdio.
627 * The only exception is if we are in debug mode.
631 if ((!do_nofork) && (!do_testsuite) && (!Config->cmdline.forcedebug))
633 int fd = open("/dev/null", O_RDWR);
639 if (dup2(fd, STDIN_FILENO) < 0)
640 Logs->Log("STARTUP", DEFAULT, "Failed to dup /dev/null to stdin.");
641 if (dup2(fd, STDOUT_FILENO) < 0)
642 Logs->Log("STARTUP", DEFAULT, "Failed to dup /dev/null to stdout.");
643 if (dup2(fd, STDERR_FILENO) < 0)
644 Logs->Log("STARTUP", DEFAULT, "Failed to dup /dev/null to stderr.");
649 Logs->Log("STARTUP", DEFAULT,"Keeping pseudo-tty open as we are running in the foreground.");
652 /* Set win32 service as running, if we are running as a service */
661 QueryPerformanceFrequency(&stats->QPFrequency);
664 Logs->Log("STARTUP", DEFAULT, "Startup complete as '%s'[%s], %d max open sockets", Config->ServerName.c_str(),Config->GetSID().c_str(), SE->GetMaxFds());
667 std::string SetUser = Config->ConfValue("security")->getString("runasuser");
668 std::string SetGroup = Config->ConfValue("security")->getString("runasgroup");
669 if (!SetGroup.empty())
674 ret = setgroups(0, NULL);
678 this->Logs->Log("SETGROUPS", DEFAULT, "setgroups() failed (wtf?): %s", strerror(errno));
686 g = getgrnam(SetGroup.c_str());
690 this->Logs->Log("SETGUID", DEFAULT, "getgrnam() failed (bad user?): %s", strerror(errno));
694 ret = setgid(g->gr_gid);
698 this->Logs->Log("SETGUID", DEFAULT, "setgid() failed (bad user?): %s", strerror(errno));
703 if (!SetUser.empty())
709 u = getpwnam(SetUser.c_str());
713 this->Logs->Log("SETGUID", DEFAULT, "getpwnam() failed (bad user?): %s", strerror(errno));
717 int ret = setuid(u->pw_uid);
721 this->Logs->Log("SETGUID", DEFAULT, "setuid() failed (bad user?): %s", strerror(errno));
726 this->WritePID(Config->PID);
730 void InspIRCd::UpdateTime()
736 TIME.tv_sec = time(NULL);
737 TIME.tv_nsec = st.wMilliseconds;
739 #ifdef HAS_CLOCK_GETTIME
740 clock_gettime(CLOCK_REALTIME, &TIME);
743 gettimeofday(&tv, NULL);
744 TIME.tv_sec = tv.tv_sec;
745 TIME.tv_nsec = tv.tv_usec * 1000;
752 /* See if we're supposed to be running the test suite rather than entering the mainloop */
753 if (Config->cmdline.TestSuite)
755 TestSuite* ts = new TestSuite;
761 time_t OLDTIME = TIME.tv_sec;
769 /* Check if there is a config thread which has finished executing but has not yet been freed */
770 if (this->ConfigThread && this->ConfigThread->IsDone())
772 /* Rehash has completed */
773 this->Logs->Log("CONFIG",DEBUG,"Detected ConfigThread exiting, tidying up...");
775 this->ConfigThread->Finish();
777 ConfigThread->join();
784 /* Run background module timers every few seconds
785 * (the docs say modules shouldnt rely on accurate
786 * timing using this event, so we dont have to
787 * time this exactly).
789 if (TIME.tv_sec != OLDTIME)
792 getrusage(RUSAGE_SELF, &ru);
793 stats->LastSampled = TIME;
794 stats->LastCPU = ru.ru_utime;
796 if(QueryPerformanceCounter(&stats->LastSampled))
798 FILETIME CreationTime;
802 GetProcessTimes(GetCurrentProcess(), &CreationTime, &ExitTime, &KernelTime, &UserTime);
803 stats->LastCPU.dwHighDateTime = KernelTime.dwHighDateTime + UserTime.dwHighDateTime;
804 stats->LastCPU.dwLowDateTime = KernelTime.dwLowDateTime + UserTime.dwLowDateTime;
808 /* Allow a buffer of two seconds drift on this so that ntpdate etc dont harass admins */
809 if (TIME.tv_sec < OLDTIME - 2)
811 SNO->WriteToSnoMask('d', "\002EH?!\002 -- Time is flowing BACKWARDS in this dimension! Clock drifted backwards %lu secs.", (unsigned long)OLDTIME-TIME.tv_sec);
813 else if (TIME.tv_sec > OLDTIME + 2)
815 SNO->WriteToSnoMask('d', "\002EH?!\002 -- Time is jumping FORWARDS! Clock skipped %lu secs.", (unsigned long)TIME.tv_sec - OLDTIME);
818 OLDTIME = TIME.tv_sec;
820 if ((TIME.tv_sec % 3600) == 0)
822 this->RehashUsersAndChans();
823 FOREACH_MOD(I_OnGarbageCollect, OnGarbageCollect());
826 Timers->TickTimers(TIME.tv_sec);
827 this->DoBackgroundUserStuff();
829 if ((TIME.tv_sec % 5) == 0)
831 FOREACH_MOD(I_OnBackgroundTimer,OnBackgroundTimer(TIME.tv_sec));
832 SNO->FlushSnotices();
836 /* Call the socket engine to wait on the active
837 * file descriptors. The socket engine has everything's
838 * descriptors in its list... dns, modules, users,
839 * servers... so its nice and easy, just one call.
840 * This will cause any read or write events to be
841 * dispatched to their handlers.
843 this->SE->DispatchTrialWrites();
844 this->SE->DispatchEvents();
846 /* if any users were quit, take them out */
852 this->SignalHandler(s_signal);
860 /**********************************************************************************/
863 * An ircd in five lines! bwahahaha. ahahahahaha. ahahah *cough*.
866 /* this returns true when all modules are satisfied that the user should be allowed onto the irc server
867 * (until this returns true, a user will block in the waiting state, waiting to connect up to the
868 * registration timeout maximum seconds)
870 bool InspIRCd::AllModulesReportReady(LocalUser* user)
873 FIRST_MOD_RESULT(OnCheckReady, res, (user));
874 return (res == MOD_RES_PASSTHRU);
877 void InspIRCd::SetSignal(int signal)
882 /* On posix systems, the flow of the program starts right here, with
883 * ENTRYPOINT being a #define that defines main(). On Windows, ENTRYPOINT
884 * defines smain() and the real main() is in the service code under
885 * win32service.cpp. This allows the service control manager to control
886 * the process where we are running as a windows service.
890 new InspIRCd(argc, argv);
891 mysig = &ServerInstance->s_signal;
892 ServerInstance->Run();
893 delete ServerInstance;