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 {
int call_daemon() {
#ifdef __sgi
return _daemonize(0, 0, 0, 0);
#else // !__sgi
return daemon(0, 0);
#endif // !__sgi
}
} // namespace
namespace {
int event_loop() {
auto loop = EV_DEFAULT;
auto conn_handler = make_unique<ConnectionHandler>(loop);
if (get_config()->daemon) {
if (daemon(0, 0) == -1) {
if (call_daemon() == -1) {
auto error = errno;
LOG(FATAL) << "Failed to daemonize: " << strerror(error);
exit(EXIT_FAILURE);

View File

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