Prepare for IRIX support, port relevant change from spdylay

This commit is contained in:
Tatsuhiro Tsujikawa 2015-06-27 17:51:07 +09:00
parent 68c0f8a310
commit b06e339dbb
2 changed files with 19 additions and 1 deletions

View File

@ -647,13 +647,23 @@ void renew_ticket_key_cb(struct ev_loop *loop, ev_timer *w, int revents) {
} }
} // namespace } // namespace
namespace {
int call_daemon() {
#ifdef __sgi
return _daemonize(0, 0, 0, 0);
#else // !__sgi
return daemon(0, 0);
#endif // !__sgi
}
} // namespace
namespace { namespace {
int event_loop() { int event_loop() {
auto loop = EV_DEFAULT; auto loop = EV_DEFAULT;
auto conn_handler = make_unique<ConnectionHandler>(loop); auto conn_handler = make_unique<ConnectionHandler>(loop);
if (get_config()->daemon) { if (get_config()->daemon) {
if (daemon(0, 0) == -1) { if (call_daemon() == -1) {
auto error = errno; auto error = errno;
LOG(FATAL) << "Failed to daemonize: " << strerror(error); LOG(FATAL) << "Failed to daemonize: " << strerror(error);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);

View File

@ -1181,14 +1181,18 @@ const char *str_syslog_facility(int facility) {
switch (facility) { switch (facility) {
case (LOG_AUTH): case (LOG_AUTH):
return "auth"; return "auth";
#ifdef LOG_AUTHPRIV
case (LOG_AUTHPRIV): case (LOG_AUTHPRIV):
return "authpriv"; return "authpriv";
#endif // LOG_AUTHPRIV
case (LOG_CRON): case (LOG_CRON):
return "cron"; return "cron";
case (LOG_DAEMON): case (LOG_DAEMON):
return "daemon"; return "daemon";
#ifdef LOG_FTP
case (LOG_FTP): case (LOG_FTP):
return "ftp"; return "ftp";
#endif // LOG_FTP
case (LOG_KERN): case (LOG_KERN):
return "kern"; return "kern";
case (LOG_LOCAL0): case (LOG_LOCAL0):
@ -1227,9 +1231,11 @@ int int_syslog_facility(const char *strfacility) {
return LOG_AUTH; return LOG_AUTH;
} }
#ifdef LOG_AUTHPRIV
if (util::strieq(strfacility, "authpriv")) { if (util::strieq(strfacility, "authpriv")) {
return LOG_AUTHPRIV; return LOG_AUTHPRIV;
} }
#endif // LOG_AUTHPRIV
if (util::strieq(strfacility, "cron")) { if (util::strieq(strfacility, "cron")) {
return LOG_CRON; return LOG_CRON;
@ -1239,9 +1245,11 @@ int int_syslog_facility(const char *strfacility) {
return LOG_DAEMON; return LOG_DAEMON;
} }
#ifdef LOG_FTP
if (util::strieq(strfacility, "ftp")) { if (util::strieq(strfacility, "ftp")) {
return LOG_FTP; return LOG_FTP;
} }
#endif // LOG_FTP
if (util::strieq(strfacility, "kern")) { if (util::strieq(strfacility, "kern")) {
return LOG_KERN; return LOG_KERN;