]> jfr.im git - solanum.git/blob - ircd/ircd.c
whowas.c: store account name in whowas (#323)
[solanum.git] / ircd / ircd.c
1 /*
2 * Solanum: a slightly advanced ircd
3 * ircd.c: Starts up and runs the ircd.
4 *
5 * Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center
6 * Copyright (C) 1996-2002 Hybrid Development Team
7 * Copyright (C) 2002-2008 ircd-ratbox development team
8 * Copyright (C) 2005-2013 charybdis development team
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23 * USA
24 */
25
26 #include "rb_lib.h"
27 #include "stdinc.h"
28 #include "setup.h"
29 #include "defaults.h"
30 #include "ircd.h"
31 #include "channel.h"
32 #include "class.h"
33 #include "client.h"
34 #include "hash.h"
35 #include "match.h"
36 #include "ircd_signal.h"
37 #include "msg.h" /* msgtab */
38 #include "hostmask.h"
39 #include "numeric.h"
40 #include "parse.h"
41 #include "restart.h"
42 #include "s_conf.h"
43 #include "logger.h"
44 #include "s_serv.h" /* try_connections */
45 #include "s_user.h"
46 #include "s_stats.h"
47 #include "scache.h"
48 #include "send.h"
49 #include "supported.h"
50 #include "whowas.h"
51 #include "modules.h"
52 #include "hook.h"
53 #include "ircd_getopt.h"
54 #include "newconf.h"
55 #include "reject.h"
56 #include "s_newconf.h"
57 #include "cache.h"
58 #include "monitor.h"
59 #include "patchlevel.h"
60 #include "serno.h"
61 #include "sslproc.h"
62 #include "wsproc.h"
63 #include "chmode.h"
64 #include "privilege.h"
65 #include "bandbi.h"
66 #include "authproc.h"
67 #include "operhash.h"
68
69 static void
70 ircd_die_cb(const char *str) __attribute__((noreturn));
71
72 /* /quote set variables */
73 struct SetOptions GlobalSetOptions;
74
75 /* configuration set from ircd.conf */
76 struct config_file_entry ConfigFileEntry;
77 /* server info set from ircd.conf */
78 struct server_info ServerInfo;
79 /* admin info set from ircd.conf */
80 struct admin_info AdminInfo;
81
82 struct Counter Count;
83 struct ServerStatistics ServerStats;
84
85 int maxconnections;
86 struct Client me; /* That's me */
87 struct LocalUser meLocalUser; /* That's also part of me */
88
89 rb_dlink_list global_client_list;
90
91 /* unknown/client pointer lists */
92 rb_dlink_list unknown_list; /* unknown clients ON this server only */
93 rb_dlink_list lclient_list; /* local clients only ON this server */
94 rb_dlink_list serv_list; /* local servers to this server ONLY */
95 rb_dlink_list global_serv_list; /* global servers on the network */
96 rb_dlink_list local_oper_list; /* our opers, duplicated in lclient_list */
97 rb_dlink_list oper_list; /* network opers */
98
99 char * const *myargv;
100 volatile sig_atomic_t dorehash = false;
101 volatile sig_atomic_t dorehashbans = false;
102 volatile sig_atomic_t doremotd = false;
103 bool kline_queued = false;
104 bool server_state_foreground = false;
105 bool opers_see_all_users = false;
106 bool ircd_ssl_ok = false;
107 bool ircd_zlib_ok = true;
108
109 int testing_conf = 0;
110 time_t startup_time;
111
112 int default_server_capabs;
113
114 int splitmode;
115 int splitchecking;
116 int split_users;
117 int split_servers;
118 int eob_count;
119
120 const char *ircd_paths[IRCD_PATH_COUNT] = {
121 [IRCD_PATH_PREFIX] = DPATH,
122 [IRCD_PATH_MODULES] = MODPATH,
123 [IRCD_PATH_AUTOLOAD_MODULES] = AUTOMODPATH,
124 [IRCD_PATH_ETC] = ETCPATH,
125 [IRCD_PATH_LOG] = LOGPATH,
126 [IRCD_PATH_USERHELP] = UHPATH,
127 [IRCD_PATH_OPERHELP] = HPATH,
128 [IRCD_PATH_IRCD_EXEC] = SPATH,
129 [IRCD_PATH_IRCD_CONF] = CPATH,
130 [IRCD_PATH_IRCD_MOTD] = MPATH,
131 [IRCD_PATH_IRCD_LOG] = LPATH,
132 [IRCD_PATH_IRCD_PID] = PPATH,
133 [IRCD_PATH_IRCD_OMOTD] = OPATH,
134 [IRCD_PATH_BANDB] = DBPATH,
135 [IRCD_PATH_BIN] = BINPATH,
136 [IRCD_PATH_LIBEXEC] = PKGLIBEXECDIR,
137 };
138
139 const char *ircd_pathnames[IRCD_PATH_COUNT] = {
140 [IRCD_PATH_PREFIX] = "prefix",
141 [IRCD_PATH_MODULES] = "modules",
142 [IRCD_PATH_AUTOLOAD_MODULES] = "autoload modules",
143 [IRCD_PATH_ETC] = "config",
144 [IRCD_PATH_LOG] = "log",
145 [IRCD_PATH_USERHELP] = "user help",
146 [IRCD_PATH_OPERHELP] = "oper help",
147 [IRCD_PATH_IRCD_EXEC] = "ircd binary",
148 [IRCD_PATH_IRCD_CONF] = "ircd.conf",
149 [IRCD_PATH_IRCD_MOTD] = "ircd.motd",
150 [IRCD_PATH_IRCD_LOG] = "ircd.log",
151 [IRCD_PATH_IRCD_PID] = "ircd.pid",
152 [IRCD_PATH_IRCD_OMOTD] = "oper motd",
153 [IRCD_PATH_BANDB] = "bandb",
154 [IRCD_PATH_BIN] = "binary dir",
155 [IRCD_PATH_LIBEXEC] = "libexec dir",
156 };
157
158 const char *logFileName = NULL;
159 const char *pidFileName = NULL;
160
161 void
162 ircd_shutdown(const char *reason)
163 {
164 struct Client *target_p;
165 rb_dlink_node *ptr;
166
167 RB_DLINK_FOREACH(ptr, lclient_list.head)
168 {
169 target_p = ptr->data;
170
171 sendto_one(target_p, ":%s NOTICE %s :Server Terminating. %s",
172 me.name, target_p->name, reason);
173 }
174
175 RB_DLINK_FOREACH(ptr, serv_list.head)
176 {
177 target_p = ptr->data;
178
179 sendto_one(target_p, ":%s ERROR :Terminated by %s",
180 me.name, reason);
181 }
182
183 ilog(L_MAIN, "Server Terminating. %s", reason);
184 close_logfiles();
185
186 unlink(pidFileName);
187 exit(0);
188 }
189
190 /*
191 * init_sys
192 *
193 * inputs - boot_daemon flag
194 * output - none
195 * side effects - if boot_daemon flag is not set, don't daemonize
196 */
197 static void
198 init_sys(void)
199 {
200 #if defined(RLIMIT_NOFILE) && defined(HAVE_SYS_RESOURCE_H)
201 struct rlimit limit;
202
203 if(!getrlimit(RLIMIT_NOFILE, &limit))
204 {
205 maxconnections = limit.rlim_cur;
206 if(maxconnections <= MAX_BUFFER)
207 {
208 fprintf(stderr, "ERROR: Shell FD limits are too low.\n");
209 fprintf(stderr, "ERROR: solanum reserves %d FDs, shell limits must be above this\n", MAX_BUFFER);
210 exit(EXIT_FAILURE);
211 }
212 return;
213 }
214 #endif /* RLIMIT_FD_MAX */
215 maxconnections = MAXCONNECTIONS;
216 }
217
218 static int
219 make_daemon(void)
220 {
221 int pid, nullfd, fdx;
222
223 /* The below is approximately what daemon(1, 0) does, but
224 we need control over the parent after forking to print
225 the startup message -- Aaron */
226
227 if((nullfd = open("/dev/null", O_RDWR)) < 0)
228 {
229 perror("open /dev/null");
230 exit(EXIT_FAILURE);
231 }
232
233 if((pid = fork()) < 0)
234 {
235 perror("fork");
236 exit(EXIT_FAILURE);
237 }
238 else if(pid > 0)
239 {
240 inotice("now running in background mode from %s as pid %d ...",
241 ConfigFileEntry.dpath, pid);
242
243 exit(EXIT_SUCCESS);
244 }
245
246 for(fdx = 0; fdx <= 2; fdx++)
247 if (fdx != nullfd)
248 (void) dup2(nullfd, fdx);
249
250 if(nullfd > 2)
251 (void) close(nullfd);
252
253 (void) setsid();
254
255 return 0;
256 }
257
258 static int printVersion = 0;
259
260 struct lgetopt myopts[] = {
261 {"configfile", &ConfigFileEntry.configfile,
262 STRING, "File to use for ircd.conf"},
263 {"logfile", &logFileName,
264 STRING, "File to use for ircd.log"},
265 {"pidfile", &pidFileName,
266 STRING, "File to use for process ID"},
267 {"foreground", &server_state_foreground,
268 YESNO, "Run in foreground (don't detach)"},
269 {"version", &printVersion,
270 YESNO, "Print version and exit"},
271 {"conftest", &testing_conf,
272 YESNO, "Test the configuration files and exit"},
273 {"help", NULL, USAGE, "Print this text"},
274 {NULL, NULL, STRING, NULL},
275 };
276
277 static void
278 check_rehash(void *unused)
279 {
280 /*
281 * Check to see whether we have to rehash the configuration ..
282 */
283 if(dorehash)
284 {
285 rehash(true);
286 dorehash = false;
287 }
288
289 if(dorehashbans)
290 {
291 rehash_bans();
292 dorehashbans = false;
293 }
294
295 if(doremotd)
296 {
297 sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
298 "Got signal SIGUSR1, reloading ircd motd file");
299 cache_user_motd();
300 doremotd = false;
301 }
302 }
303
304 /*
305 * initalialize_global_set_options
306 *
307 * inputs - none
308 * output - none
309 * side effects - This sets all global set options needed
310 */
311 static void
312 initialize_global_set_options(void)
313 {
314 memset(&GlobalSetOptions, 0, sizeof(GlobalSetOptions));
315 /* memset( &ConfigFileEntry, 0, sizeof(ConfigFileEntry)); */
316
317 GlobalSetOptions.maxclients = ServerInfo.default_max_clients;
318
319 if(GlobalSetOptions.maxclients > (maxconnections - MAX_BUFFER) || (GlobalSetOptions.maxclients <= 0))
320 GlobalSetOptions.maxclients = maxconnections - MAX_BUFFER;
321
322 GlobalSetOptions.autoconn = 1;
323
324 GlobalSetOptions.spam_time = MIN_JOIN_LEAVE_TIME;
325 GlobalSetOptions.spam_num = MAX_JOIN_LEAVE_COUNT;
326
327 GlobalSetOptions.floodcount = ConfigFileEntry.default_floodcount;
328
329 split_servers = ConfigChannel.default_split_server_count;
330 split_users = ConfigChannel.default_split_user_count;
331
332 if(split_users && split_servers
333 && (ConfigChannel.no_create_on_split || ConfigChannel.no_join_on_split))
334 {
335 splitmode = 1;
336 splitchecking = 1;
337 }
338
339 GlobalSetOptions.ident_timeout = ConfigFileEntry.default_ident_timeout;
340
341 rb_strlcpy(GlobalSetOptions.operstring,
342 ConfigFileEntry.default_operstring,
343 sizeof(GlobalSetOptions.operstring));
344 rb_strlcpy(GlobalSetOptions.adminstring,
345 ConfigFileEntry.default_adminstring,
346 sizeof(GlobalSetOptions.adminstring));
347
348 /* memset( &ConfigChannel, 0, sizeof(ConfigChannel)); */
349
350 /* End of global set options */
351
352 }
353
354 /*
355 * write_pidfile
356 *
357 * inputs - filename+path of pid file
358 * output - none
359 * side effects - write the pid of the ircd to filename
360 */
361 static void
362 write_pidfile(const char *filename)
363 {
364 FILE *fb;
365 char buff[32];
366 if((fb = fopen(filename, "w")))
367 {
368 unsigned int pid = (unsigned int) getpid();
369
370 snprintf(buff, sizeof(buff), "%u\n", pid);
371 if((fputs(buff, fb) == -1))
372 {
373 ilog(L_MAIN, "Error writing %u to pid file %s (%s)",
374 pid, filename, strerror(errno));
375 }
376 fclose(fb);
377 return;
378 }
379 else
380 {
381 ilog(L_MAIN, "Error opening pid file %s", filename);
382 }
383 }
384
385 /*
386 * check_pidfile
387 *
388 * inputs - filename+path of pid file
389 * output - none
390 * side effects - reads pid from pidfile and checks if ircd is in process
391 * list. if it is, gracefully exits
392 * -kre
393 */
394 static void
395 check_pidfile(const char *filename)
396 {
397 FILE *fb;
398 char buff[32];
399 pid_t pidfromfile;
400
401 /* Don't do logging here, since we don't have log() initialised */
402 if((fb = fopen(filename, "r")))
403 {
404 if(fgets(buff, 20, fb) != NULL)
405 {
406 pidfromfile = atoi(buff);
407 if(!rb_kill(pidfromfile, 0))
408 {
409 printf("ircd: daemon is already running\n");
410 exit(-1);
411 }
412 }
413 fclose(fb);
414 }
415 }
416
417 /*
418 * setup_corefile
419 *
420 * inputs - nothing
421 * output - nothing
422 * side effects - setups corefile to system limits.
423 * -kre
424 */
425 static void
426 setup_corefile(void)
427 {
428 #ifdef HAVE_SYS_RESOURCE_H
429 struct rlimit rlim; /* resource limits */
430
431 /* Set corefilesize to maximum */
432 if(!getrlimit(RLIMIT_CORE, &rlim))
433 {
434 rlim.rlim_cur = rlim.rlim_max;
435 setrlimit(RLIMIT_CORE, &rlim);
436 }
437 #endif
438 }
439
440 static void
441 ircd_log_cb(const char *str)
442 {
443 ilog(L_MAIN, "librb reports: %s", str);
444 }
445
446 static void
447 ircd_restart_cb(const char *str)
448 {
449 inotice("librb has called the restart callback: %s", str);
450 restart(str);
451 }
452
453 /*
454 * Why EXIT_FAILURE here?
455 * Because if ircd_die_cb() is called it's because of a fatal
456 * error inside libsolanum, and we don't know how to handle the
457 * exception, so it is logical to return a FAILURE exit code here.
458 * --nenolod
459 */
460 static void
461 ircd_die_cb(const char *str)
462 {
463 if(str != NULL)
464 {
465 /* Try to get the message out to currently logged in operators. */
466 sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, "librb has called the die callback..aborting: %s", str);
467 inotice("librb has called the die callback..aborting: %s", str);
468 }
469 else
470 inotice("librb has called the die callback..aborting");
471
472 unlink(pidFileName);
473 exit(EXIT_FAILURE);
474 }
475
476 struct ev_entry *check_splitmode_ev = NULL;
477
478 static int
479 seed_with_urandom(void)
480 {
481 unsigned int seed;
482 int fd;
483
484 fd = open("/dev/urandom", O_RDONLY);
485 if(fd >= 0)
486 {
487 if(read(fd, &seed, sizeof(seed)) == sizeof(seed))
488 {
489 close(fd);
490 srand(seed);
491 return 1;
492 }
493 close(fd);
494 }
495 return 0;
496 }
497
498 static void
499 seed_with_clock(void)
500 {
501 const struct timeval *tv;
502 rb_set_time();
503 tv = rb_current_time_tv();
504 srand(tv->tv_sec ^ (tv->tv_usec | (getpid() << 20)));
505 }
506
507 static void
508 seed_random(void *unused)
509 {
510 unsigned int seed;
511 if(rb_get_random(&seed, sizeof(seed)) == -1)
512 {
513 if(!seed_with_urandom())
514 seed_with_clock();
515 return;
516 }
517 srand(seed);
518 }
519
520 /*
521 * main
522 *
523 * Initializes the IRCd.
524 *
525 * Inputs - number of commandline args, args themselves
526 * Outputs - none
527 * Side Effects - this is where the ircd gets going right now
528 */
529 int
530 solanum_main(int argc, char * const argv[])
531 {
532 int fd;
533
534 /* Check to see if the user is running us as root, which is a nono */
535 if(geteuid() == 0)
536 {
537 fprintf(stderr, "Don't run ircd as root!!!\n");
538 return -1;
539 }
540
541 logFileName = ircd_paths[IRCD_PATH_IRCD_LOG];
542 pidFileName = ircd_paths[IRCD_PATH_IRCD_PID];
543
544 ConfigFileEntry.dpath = ircd_paths[IRCD_PATH_PREFIX];
545 ConfigFileEntry.configfile = ircd_paths[IRCD_PATH_IRCD_CONF]; /* Server configuration file */
546 ConfigFileEntry.connect_timeout = 30; /* Default to 30 */
547
548 init_sys();
549
550 umask(077); /* better safe than sorry --SRB */
551
552 myargv = argv;
553 parseargs(&argc, &argv, myopts);
554
555 if(chdir(ConfigFileEntry.dpath))
556 {
557 fprintf(stderr, "Unable to chdir to %s: %s\n", ConfigFileEntry.dpath, strerror(errno));
558 exit(EXIT_FAILURE);
559 }
560
561 rb_set_time();
562
563 /*
564 * Setup corefile size immediately after boot -kre
565 */
566 setup_corefile();
567
568 /* initialise operhash fairly early. */
569 init_operhash();
570
571 memset(&me, 0, sizeof(me));
572 memset(&meLocalUser, 0, sizeof(meLocalUser));
573 me.localClient = &meLocalUser;
574
575 /* Make sure all lists are zeroed */
576 memset(&global_client_list, 0, sizeof(global_client_list));
577 memset(&unknown_list, 0, sizeof(unknown_list));
578 memset(&lclient_list, 0, sizeof(lclient_list));
579 memset(&serv_list, 0, sizeof(serv_list));
580 memset(&global_serv_list, 0, sizeof(global_serv_list));
581 memset(&local_oper_list, 0, sizeof(local_oper_list));
582 memset(&oper_list, 0, sizeof(oper_list));
583
584 rb_dlinkAddTail(&me, &me.node, &global_client_list);
585
586 memset(&Count, 0, sizeof(Count));
587 memset(&ServerInfo, 0, sizeof(ServerInfo));
588 memset(&AdminInfo, 0, sizeof(AdminInfo));
589 memset(&ServerStats, 0, sizeof(struct ServerStatistics));
590
591 if(printVersion)
592 {
593 printf("ircd: version %s(%s)\n", ircd_version, serno);
594 #ifdef CUSTOM_BRANDING
595 printf("ircd: based on %s-%s\n", PACKAGE_NAME, PACKAGE_VERSION);
596 #endif
597 printf("ircd: %s\n", rb_lib_version());
598 exit(EXIT_SUCCESS);
599 }
600
601 setup_signals();
602
603 if (testing_conf)
604 server_state_foreground = true;
605
606 /* Make sure fd 0, 1 and 2 are in use -- jilles */
607 do
608 {
609 fd = open("/dev/null", O_RDWR);
610 } while (fd < 2 && fd != -1);
611 if (fd > 2)
612 close(fd);
613 else if (fd == -1)
614 exit(1);
615
616 /* Check if there is pidfile and daemon already running */
617 if(!testing_conf)
618 {
619 check_pidfile(pidFileName);
620
621 inotice("starting %s ...", ircd_version);
622 inotice("%s", rb_lib_version());
623
624 if(!server_state_foreground)
625 make_daemon();
626 }
627
628 /* Init the event subsystem */
629 rb_lib_init(ircd_log_cb, ircd_restart_cb, ircd_die_cb, !server_state_foreground, maxconnections, DNODE_HEAP_SIZE, FD_HEAP_SIZE);
630 rb_linebuf_init(LINEBUF_HEAP_SIZE);
631
632 rb_init_prng(NULL, RB_PRNG_DEFAULT);
633
634 seed_random(NULL);
635
636 init_builtin_capabs();
637 default_server_capabs = CAP_MASK;
638
639 init_main_logfile();
640 newconf_init();
641 init_s_conf();
642 init_s_newconf();
643 init_hash();
644 clear_scache_hash_table(); /* server cache name table */
645 init_host_hash();
646 clear_hash_parse();
647 init_client();
648 init_hook();
649 init_channels();
650 initclass();
651 whowas_init();
652 init_reject();
653 init_cache();
654 init_monitor();
655
656 construct_cflags_strings();
657
658 init_authd(); /* Start up authd. */
659 init_dns(); /* Start up DNS query system */
660 init_modules(); /* Start up modules system */
661
662 privilegeset_set_new("default", "", 0);
663
664 if (testing_conf)
665 fprintf(stderr, "\nBeginning config test\n");
666 read_conf_files(true); /* cold start init conf files */
667
668 load_all_modules(1);
669 load_core_modules(1);
670
671 init_isupport();
672
673 init_bandb();
674 init_ssld();
675 init_wsockd();
676
677 rehash_bans();
678
679 initialize_global_set_options();
680
681 if(ServerInfo.name == NULL)
682 {
683 ierror("no server name specified in serverinfo block.");
684 return -1;
685 }
686 rb_strlcpy(me.name, ServerInfo.name, sizeof(me.name));
687
688 if(ServerInfo.sid[0] == '\0')
689 {
690 ierror("no server sid specified in serverinfo block.");
691 return -2;
692 }
693 rb_strlcpy(me.id, ServerInfo.sid, sizeof(me.id));
694 init_uid();
695
696 /* serverinfo{} description must exist. If not, error out. */
697 if(ServerInfo.description == NULL)
698 {
699 ierror("no server description specified in serverinfo block.");
700 return -3;
701 }
702 rb_strlcpy(me.info, ServerInfo.description, sizeof(me.info));
703
704 if(ServerInfo.ssl_cert != NULL)
705 {
706 /* just do the rb_setup_ssl_server to validate the config */
707 if(!rb_setup_ssl_server(ServerInfo.ssl_cert, ServerInfo.ssl_private_key, ServerInfo.ssl_dh_params, ServerInfo.ssl_cipher_list))
708 {
709 ilog(L_MAIN, "WARNING: Unable to setup SSL.");
710 ircd_ssl_ok = false;
711 }
712 else
713 ircd_ssl_ok = true;
714 }
715
716 me.from = &me;
717 me.servptr = &me;
718 SetMe(&me);
719 make_server(&me);
720 startup_time = rb_current_time();
721 add_to_client_hash(me.name, &me);
722 add_to_id_hash(me.id, &me);
723 me.serv->nameinfo = scache_connect(me.name, me.info, 0);
724
725 rb_dlinkAddAlloc(&me, &global_serv_list);
726
727 construct_umodebuf();
728
729 if (testing_conf)
730 {
731 fprintf(stderr, "\nConfig testing complete.\n");
732 fflush(stderr);
733 return 0; /* Why? We want the launcher to exit out. */
734 }
735
736 check_class();
737 write_pidfile(pidFileName);
738 load_help();
739 open_logfiles();
740
741 configure_authd();
742
743 ilog(L_MAIN, "Server Ready");
744
745 /* We want try_connections to be called as soon as possible now! -- adrian */
746 /* No, 'cause after a restart it would cause all sorts of nick collides */
747 /* um. by waiting even longer, that just means we have even *more*
748 * nick collisions. what a stupid idea. set an event for the IO loop --fl
749 */
750 rb_event_addish("try_connections", try_connections, NULL, STARTUP_CONNECTIONS_TIME);
751 rb_event_addonce("try_connections_startup", try_connections, NULL, 2);
752 rb_event_add("check_rehash", check_rehash, NULL, 3);
753 rb_event_addish("reseed_srand", seed_random, NULL, 300); /* reseed every 10 minutes */
754
755 if(splitmode)
756 check_splitmode_ev = rb_event_add("check_splitmode", check_splitmode, NULL, 5);
757
758 if(server_state_foreground)
759 inotice("now running in foreground mode from %s as pid %d ...",
760 ConfigFileEntry.dpath, getpid());
761
762 rb_lib_loop(0);
763
764 return 0;
765 }