pid_t uwsgi_daemonize2() { if (uwsgi.has_emperor) { logto(uwsgi.daemonize2); } else { if (!uwsgi.is_a_reload) { uwsgi_log("*** daemonizing uWSGI ***\n"); daemonize(uwsgi.daemonize2); } else if (uwsgi.log_reopen) { logto(uwsgi.daemonize2); } } uwsgi.mypid = getpid(); uwsgi.workers[0].pid = uwsgi.mypid; if (uwsgi.pidfile && !uwsgi.is_a_reload) { uwsgi_write_pidfile(uwsgi.pidfile); } if (uwsgi.pidfile2 && !uwsgi.is_a_reload) { uwsgi_write_pidfile(uwsgi.pidfile2); } return uwsgi.mypid; }
void uwsgi_setup_log() { if (uwsgi.daemonize) { if (uwsgi.has_emperor) { logto(uwsgi.daemonize); } else { if (!uwsgi.is_a_reload) { daemonize(uwsgi.daemonize); } else if (uwsgi.log_reopen) { logto(uwsgi.daemonize); } } } else if (uwsgi.logfile) { if (!uwsgi.is_a_reload || uwsgi.log_reopen) { logto(uwsgi.logfile); } } }