From f32732e784cdff0f52004b688e9c96a12f1a7d66 Mon Sep 17 00:00:00 2001 From: erickson Date: Tue, 29 May 2007 12:54:49 +0000 Subject: [PATCH] added some more descriptive logging. removed old signal handling code. no longer freeing return value from strerror since it should not be modified git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@924 9efc2488-bf62-4759-914b-345cdb29e865 --- src/libstack/osrf_system.c | 42 +++++++++++++------------------------- 1 file changed, 14 insertions(+), 28 deletions(-) diff --git a/src/libstack/osrf_system.c b/src/libstack/osrf_system.c index a9f793e..2cda339 100644 --- a/src/libstack/osrf_system.c +++ b/src/libstack/osrf_system.c @@ -3,7 +3,6 @@ #include "osrf_application.h" #include "osrf_prefork.h" -static void osrfSystemSignalHandler( int sig ); static int _osrfSystemInitCache( void ); static transport_client* osrfGlobalTransportClient = NULL; @@ -129,20 +128,20 @@ int osrfSystemBootstrap( char* hostname, char* configfile, char* contextNode ) { /* background and let our children do their thing */ daemonize(); - while(1) { - errno = 0; - pid_t pid = wait( NULL ); - if ( -1 == pid ) { - if ( errno != ECHILD ) { - char* err_str = strerror( errno ); - osrfLogWarning( OSRF_LOG_MARK, "Exiting on singal or error: %s\n", err_str ); - free(err_str); - } - break; - } else { - osrfLogWarning( OSRF_LOG_MARK, "We lost child %d", pid); - } - } + while(1) { + errno = 0; + pid_t pid = wait(NULL); + if(-1 == pid) { + if(errno == ECHILD) + osrfLogError(OSRF_LOG_MARK, "We have no more live services... exiting"); + else + osrfLogError(OSRF_LOG_MARK, "Exiting top-level system loop with error: %s", strerror(errno)); + break; + } else { + osrfLogError(OSRF_LOG_MARK, "We lost a top-level service process with PID %d", pid); + } + } + return 0; } @@ -316,16 +315,3 @@ int osrf_system_shutdown( void ) { -static void osrfSystemSignalHandler( int sig ) { - - pid_t pid; - int status; - - while( (pid = waitpid(-1, &status, WNOHANG)) > 0) { - osrfLogWarning( OSRF_LOG_MARK, "We lost child %d", pid); - } - - /** relaunch the server **/ -} - - -- 2.43.2