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:18:52 +00:00
parent 24ba10b6b1
commit 856ecd0011
No known key found for this signature in database
GPG key ID: EC6F86EE9CD840B5

View file

@ -585,6 +585,10 @@ main(int argc, char *argv[])
if(!testing_conf)
{
check_pidfile(pidFileName);
if(!server_state_foreground)
make_daemon();
inotice("starting %s ...", ircd_version);
inotice("%s", rb_lib_version());
}
@ -702,6 +706,7 @@ main(int argc, char *argv[])
construct_umodebuf();
check_class();
write_pidfile(pidFileName);
load_help();
open_logfiles();
@ -723,10 +728,6 @@ main(int argc, char *argv[])
if(server_state_foreground)
inotice("now running in foreground mode from %s as pid %d ...",
ConfigFileEntry.dpath, getpid());
else
make_daemon();
write_pidfile(pidFileName);
rb_lib_loop(0);