startup: fork before initialising the event subsystem

On FreeBSD 4.8, fork(2) doesn't actually behave like fork(2).

Namely, kqueue(2) descriptors are not inherited by the child.
IOW, we can't fork(2) after we get the kqueue(2) descriptor.

So we'll just have to rely on people to actually read the
server log file if they want to understand why their server
is dying during startup.
This commit is contained in:
Aaron Jones 2016-08-21 22:29:16 +00:00
parent 0c23c0b1c5
commit f4e9d91580
No known key found for this signature in database
GPG key ID: EC6F86EE9CD840B5

View file

@ -724,6 +724,12 @@ charybdis_main(int argc, char * const argv[])
if(!testing_conf)
{
check_pidfile(pidFileName);
#ifndef _WIN32
if(!server_state_foreground)
make_daemon();
#endif
inotice("starting %s ...", ircd_version);
inotice("%s", rb_lib_version());
}
@ -838,6 +844,7 @@ charybdis_main(int argc, char * const argv[])
construct_umodebuf();
check_class();
write_pidfile(pidFileName);
load_help();
open_logfiles();
@ -861,12 +868,6 @@ charybdis_main(int argc, char * const argv[])
if(server_state_foreground)
inotice("now running in foreground mode from %s as pid %d ...",
ConfigFileEntry.dpath, getpid());
#ifndef _WIN32
else
make_daemon();
#endif
write_pidfile(pidFileName);
rb_lib_loop(0);