X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fsysdep.c;h=4ea98415f5d119fc90e53714fbafc8cf9e8b09f0;hb=6fd1e59f005b06d5c005a5467753be4381a114a3;hp=5d81fe3d248b581420affe4fb8a5ad826f39c084;hpb=c34c2775f70ea5557ec411b40f8e9b9eb7c19f2c;p=citadel.git diff --git a/webcit/sysdep.c b/webcit/sysdep.c index 5d81fe3d2..4ea98415f 100644 --- a/webcit/sysdep.c +++ b/webcit/sysdep.c @@ -107,7 +107,7 @@ void InitialiseSemaphores(void) if (pipe(ExitPipe)) { - syslog(2, "Failed to open exit pipe: %d [%s]\n", + syslog(LOG_WARNING, "Failed to open exit pipe: %d [%s]\n", errno, strerror(errno)); @@ -198,17 +198,17 @@ void worker_entry(void) if (shutdown == 1) {/* we're the one to cleanup the mess. */ http_destroy_modules(&Hdr); - syslog(2, "I'm master shutdown: tagging sessions to be killed.\n"); + syslog(LOG_DEBUG, "I'm master shutdown: tagging sessions to be killed.\n"); shutdown_sessions(); - syslog(2, "master shutdown: waiting for others\n"); + syslog(LOG_DEBUG, "master shutdown: waiting for others\n"); sleeeeeeeeeep(1); /* wait so some others might finish... */ - syslog(2, "master shutdown: cleaning up sessions\n"); + syslog(LOG_DEBUG, "master shutdown: cleaning up sessions\n"); do_housekeeping(); - syslog(2, "master shutdown: cleaning up libical\n"); + syslog(LOG_DEBUG, "master shutdown: cleaning up libical\n"); ShutDownWebcit(); - syslog(2, "master shutdown exiting.\n"); + syslog(LOG_DEBUG, "master shutdown exiting.\n"); exit(0); } break; @@ -220,7 +220,7 @@ void worker_entry(void) /* Now do something. */ if (msock < 0) { if (ssock > 0) close (ssock); - syslog(2, "in between."); + syslog(LOG_DEBUG, "in between."); pthread_exit(NULL); } else { /* Got it? do some real work! */ @@ -242,11 +242,11 @@ void worker_entry(void) int fdflags; fdflags = fcntl(ssock, F_GETFL); if (fdflags < 0) - syslog(1, "unable to get server socket flags! %s \n", + syslog(LOG_WARNING, "unable to get server socket flags! %s \n", strerror(errno)); fdflags = fdflags | O_NONBLOCK; if (fcntl(ssock, F_SETFL, fdflags) < 0) - syslog(1, "unable to set server socket nonblocking flags! %s \n", + syslog(LOG_WARNING, "unable to set server socket nonblocking flags! %s \n", strerror(errno)); } @@ -276,7 +276,7 @@ void worker_entry(void) } while (!time_to_die); http_destroy_modules(&Hdr); - syslog(1, "Thread exiting.\n"); + syslog(LOG_DEBUG, "Thread exiting.\n"); pthread_exit(NULL); } @@ -287,7 +287,7 @@ void worker_entry(void) */ pid_t current_child; void graceful_shutdown_watcher(int signum) { - syslog(1, "Watcher thread exiting.\n"); + syslog(LOG_INFO, "Watcher thread exiting.\n"); write(ExitPipe[0], HKEY(" ")); kill(current_child, signum); if (signum != SIGHUP) @@ -304,7 +304,7 @@ void graceful_shutdown(int signum) { FILE *FD; int fd; - syslog(1, "WebCit is being shut down on signal %d.\n", signum); + syslog(LOG_INFO, "WebCit is being shut down on signal %d.\n", signum); fd = msock; msock = -1; time_to_die = 1; @@ -434,13 +434,13 @@ void spawn_another_worker_thread() * otherwise the MIME parser crashes on FreeBSD. */ if ((ret = pthread_attr_setstacksize(&attr, 1024 * 1024))) { - syslog(1, "pthread_attr_setstacksize: %s\n", strerror(ret)); + syslog(LOG_WARNING, "pthread_attr_setstacksize: %s\n", strerror(ret)); pthread_attr_destroy(&attr); } /* now create the thread */ if (pthread_create(&SessThread, &attr, (void *(*)(void *)) worker_entry, NULL) != 0) { - syslog(1, "Can't create thread: %s\n", strerror(errno)); + syslog(LOG_WARNING, "Can't create thread: %s\n", strerror(errno)); } /* free up the attributes */ @@ -490,7 +490,7 @@ webcit_calc_dirs_n_files(int relh, const char *basedir, int home, char *webcitdi ctdl_key_dir); /* we should go somewhere we can leave our coredump, if enabled... */ - syslog(9, "Changing directory to %s\n", socket_dir); + syslog(LOG_INFO, "Changing directory to %s\n", socket_dir); if (chdir(webcitdir) != 0) { perror("chdir"); } @@ -540,7 +540,7 @@ void drop_root(uid_t UID) /* * print the actual stack frame. */ -void wc_backtrace(void) +void wc_backtrace(long LogLevel) { #ifdef HAVE_BACKTRACE void *stack_frames[50]; @@ -552,9 +552,9 @@ void wc_backtrace(void) strings = backtrace_symbols(stack_frames, size); for (i = 0; i < size; i++) { if (strings != NULL) - syslog(1, "%s\n", strings[i]); + syslog(LogLevel, "%s\n", strings[i]); else - syslog(1, "%p\n", stack_frames[i]); + syslog(LogLevel, "%p\n", stack_frames[i]); } free(strings); #endif