/** * Read environment properties. In particular ones that can't be left until * there is a requirement to log. */ void os_reportInit(os_boolean forceReInit) { static os_boolean doneOnce = OS_FALSE; char *envValue; os_mutexAttr attr; os_result osr; if (!doneOnce || forceReInit) { if (!doneOnce) { osr = os_mutexAttrInit(&attr); if(osr == os_resultSuccess) { attr.scopeAttr = OS_SCOPE_PRIVATE; osr = os_mutexInit(&reportMutex, &attr); } if(osr != os_resultSuccess) { OS_REPORT(OS_WARNING, "os_reportInit", 0, "Unable to create report mutex"); } } doneOnce = OS_TRUE; envValue = os_getenv(os_env_verbosity); if (envValue != NULL) { if (os_reportSetVerbosity(envValue) == os_resultFail) { OS_REPORT_3(OS_WARNING, "os_reportInit", 0, "Cannot parse report verbosity %s value \"%s\"," " reporting verbosity remains %s", os_env_verbosity, envValue, os_reportTypeText[os_reportVerbosity]); } } if (os_procIsOpenSpliceDomainDaemon()) { /** @todo dds2881 - Change default to OS_FALSE ? */ doAppend = OS_TRUE; } envValue = os_getenv(os_env_append); if (envValue != NULL) { os_boolean shouldAppend; if (os_configIsTrue(envValue, &shouldAppend) == os_resultFail) { OS_REPORT_2(OS_WARNING, "os_reportInit", 0, "Cannot parse report %s value \"%s\"," " reporting append mode unchanged", os_env_append, envValue); } else { os_reportSetDoAppend(shouldAppend); } } } }
os_result os_signalHandlerSetHandler( os_signal signal, os_actionHandler handler) { os_sigset mask; os_result result; os_sigaction action; int r; /* block all signals during handling of a signal */ result = os_sigsetFill(&mask); if (result != os_resultSuccess) { OS_REPORT_2(OS_ERROR, "os_signalHandlerInit", 0, "os_sigsetFill(0x%x) failed, result = %d", &action.sa_mask, result); } else { action = os_sigactionNew(handler, &mask, SA_SIGINFO); } if (result == os_resultSuccess) { r = os_sigsetDel(&action.sa_mask, signal); if (r < 0) { OS_REPORT_3(OS_ERROR, "os_signalHandlerInit", 0, "os_sigsetDel(0x%x, %d) failed, result = %d", &action, signal, r); result = os_resultFail; assert(OS_FALSE); } } if (result == os_resultSuccess) { r = os_sigactionSet(signal, &action, &old_signalHandler[signal]); if (r < 0) { OS_REPORT_4(OS_ERROR, "os_signalHandlerInit", 0, "os_sigactionSet(%d, 0x%x, 0x%x) failed, result = %d", signal, &action, &old_signalHandler[signal], r); result = os_resultFail; assert(OS_FALSE); } } return result; }
d_storeResult d_topicInfoInject( d_topicInfo _this, d_store store, u_participant participant) { d_storeResult result; c_type type; struct baseFind f; u_topic utopic; u_entityAction(u_entity(participant), d_storeGetBase, &f); type = cloneType(c_getBase(_this), f.base, _this->dataType); if(type){ utopic = u_topicNew(participant, _this->name, _this->typeName, _this->keyExpr, _this->qos); if(utopic) { d_storeReport(store, D_LEVEL_FINE, "Topic %s created.\n", _this->name); u_topicFree(utopic); result = D_STORE_RESULT_OK; } else { result = D_STORE_RESULT_METADATA_MISMATCH; d_storeReport(store, D_LEVEL_SEVERE, "Topic '%s' with typeName '%s' and keyList '%s' could NOT be created.\n", _this->name, _this->typeName, _this->keyExpr); OS_REPORT_3(OS_ERROR, "d_topicInfoInject", (os_int32)result, "Topic '%s' with typeName '%s' and keyList '%s' could NOT be created.\n", _this->name, _this->typeName, _this->keyExpr); } } else { result = D_STORE_RESULT_METADATA_MISMATCH; OS_REPORT_1(OS_ERROR, "d_topicInfoInject",(os_int32)result, "Failed to register type '%s'.", _this->typeName); } return result; }
void v_leaseManagerProcessLeaseAction( v_leaseManager _this, v_leaseAction leaseAction, c_time now) { assert(_this != NULL); assert(C_TYPECHECK(_this, v_leaseManager)); assert(leaseAction != NULL); assert(C_TYPECHECK(leaseAction, v_leaseAction)); switch (leaseAction->actionId) { case V_LEASEACTION_SERVICESTATE_EXPIRED: serviceStateExpired(leaseAction); break; case V_LEASEACTION_READER_DEADLINE_MISSED: readerDeadlineMissed(leaseAction, now); break; case V_LEASEACTION_WRITER_DEADLINE_MISSED: writerDeadlineMissed(leaseAction, now); break; case V_LEASEACTION_LIVELINESS_CHECK: livelinessCheck(_this, leaseAction); break; case V_LEASEACTION_HEARTBEAT_SEND: heartbeatSend(leaseAction); break; case V_LEASEACTION_HEARTBEAT_CHECK: heartbeatCheck(leaseAction); break; case V_LEASEACTION_SPLICED_DEATH_DETECTED: splicedDeathDetected(leaseAction); break; default: OS_REPORT_3(OS_WARNING, "v_leaseManager", 0, "Unknown lease action %d for lease %p within leaseManager %p", leaseAction->actionId, leaseAction->lease, _this); /* lets remove lease from lease manager to prevent future wakeups of lease manager. */ v_leaseManagerDeregister(_this, leaseAction->lease); break; } }
void gapi_typeParseError ( sd_errorReport report) { if ( report ) { if ( report->message ) { if ( report->location ) { OS_REPORT_3(OS_API_INFO, TYPEPARSE_CONTEXT, 0, "%s : %s at %s", TYPEPARSE_ERROR, report->message, report->location); } else { OS_REPORT_2(OS_API_INFO, TYPEPARSE_CONTEXT, 0, "%s : %s", TYPEPARSE_ERROR, report->message); } } else { OS_REPORT(OS_API_INFO, TYPEPARSE_CONTEXT, 0, TYPEPARSE_ERROR); } } else { OS_REPORT(OS_API_INFO, TYPEPARSE_CONTEXT, 0, TYPEPARSE_ERROR); } }
void os_signalHandlerFree( void) { #if !defined INTEGRITY && !defined VXWORKS_RTP void *thread_result; int i, r; os_signalHandler _this = signalHandlerObj; struct sig_context info; if (isSignallingSafe(0) && _this) { for (i=0; i<lengthof(exceptions); i++) { const int sig = exceptions[i]; r = os_sigactionSet(sig, &old_signalHandler[sig], NULL); if (r<0) { OS_REPORT_3(OS_ERROR, "os_signalHandlerFree", 0, "os_sigactionSet(%d, 0x%x, NULL) failed, result = %d", sig, &old_signalHandler[sig], r); assert(OS_FALSE); } } memset (&info, 0, sizeof(info)); info.info.si_signo = SIGNAL_THREAD_STOP; r = write(_this->pipeIn[1], &info, sizeof(info)); /* when signalhandler is the exiting thread itself, this can happen when an exit call is done in the signalhandler of the customer * do not call os_threadWaitExit but just let this thread run out of its main function */ if (os_threadIdSelf() != _this->threadId ) { os_threadWaitExit(_this->threadId, &thread_result); } close(_this->pipeIn[0]); close(_this->pipeIn[1]); close(_this->pipeOut[0]); close(_this->pipeOut[1]); os_free(_this); signalHandlerObj = NULL; } #endif }
int OSPL_MAIN(int argc, const char *argv[]) { FILE *testDataFile; char testDataLine[128]; #ifdef _WIN32 char* oldSearchPath; char* newSearchPath; #endif DDS_DomainParticipantFactory domainParticipantFactory; DDS_DomainParticipant domainParticipant = DDS_OBJECT_NIL; os_result result = os_resultSuccess; /** A local configuration file is used : ospllog4cplugin.xml * and a DomainParticpant is created with this configuration */ os_setenv("OSPL_URI", "file://ospllog4cplugin.xml"); #ifdef _WIN32 /** * Iff the patform is windows, the plugin lib directory is added onto the * PATH so it can be loaded */ oldSearchPath = os_getenv(OS_LIB_LOAD_PATH_VAR); if (oldSearchPath == NULL) { oldSearchPath = ""; } newSearchPath = os_malloc(sizeof(".." "lib") + 2 + strlen(oldSearchPath)); sprintf(newSearchPath, "%s%c%s%c%s", "..", OS_FILESEPCHAR, "lib", OS_PATHSEPCHAR, oldSearchPath); os_setenv(OS_LIB_LOAD_PATH_VAR, newSearchPath); os_free(newSearchPath); #endif /** * A single process DomainParticipant is created. */ domainParticipantFactory = DDS_DomainParticipantFactory_get_instance(); if (domainParticipantFactory == NULL) { printf("Error: can't get the domain participant factory.\n"); return -1; } domainParticipant = DDS_DomainParticipantFactory_create_participant(domainParticipantFactory, DDS_DOMAIN_ID_DEFAULT, DDS_PARTICIPANT_QOS_DEFAULT, NULL, DDS_STATUS_MASK_NONE); if (domainParticipant == NULL) { printf("Error: can't create the domain participant. Please check the configuration & the contents of any error logs.\n"); return -1; } /** After a DomainParticipant has been created the log plug-in will have * been initialised and will be in use. Some test data is now loaded and * written as report messages. */ testDataFile = fopen("testdata.txt", "r"); if (testDataFile != NULL) { int i = 0; while (i < 1000 && result == os_resultSuccess) { if (fgets(testDataLine, sizeof(testDataLine), testDataFile) != NULL) { i++; testDataLine[strlen(testDataLine) - 1] = '\0'; OS_REPORT_3 ((os_reportType) (i % (OS_REPAIRED - OS_DEBUG + 1)), "OpenSplice log4c plug-in example", i, "Test data line %d: %s\t\t%s", i, testDataLine, os_reportTypeText[i % (OS_REPAIRED - OS_DEBUG + 1)] ); } else if (i == 0) { OS_REPORT(OS_FATAL, "OpenSplice log4c plug-in example", 0, "Data cannot be read from testsdata.txt."); result = os_resultFail; } else { fseek(testDataFile, 0, SEEK_SET); } } fclose(testDataFile); } DDS_DomainParticipantFactory_delete_participant(domainParticipantFactory, domainParticipant); return result; }
void v_serviceInit( v_service service, v_serviceManager manager, const c_char *name, const c_char *extStateName, v_participantQos qos, v_statistics stats) { c_char *typeName; v_duration lp = {300, 0}; v_kernel kernel; assert(service != NULL); assert(C_TYPECHECK(service, v_service)); assert(C_TYPECHECK(qos, v_participantQos)); assert(name != NULL); kernel = v_objectKernel(service); v_participantInit(v_participant(service), name, qos, stats, TRUE); service->state = v_serviceManagerRegister(manager, service, extStateName); service->lease = v_leaseNew(kernel, lp); if(service->lease) { v_result result; result = v_leaseManagerRegister( kernel->livelinessLM, service->lease, V_LEASEACTION_SERVICESTATE_EXPIRED, v_public(service->state), FALSE/*do not repeat */); if(result != V_RESULT_OK) { c_free(service->lease); service->lease = NULL; OS_REPORT_1(OS_ERROR, "v_service", 0, "A fatal error was detected when trying to register the liveliness lease " "to the liveliness lease manager of the kernel. The result code was %d.", result); } } else { OS_REPORT(OS_ERROR, "v_service", 0, "Unable to create a liveliness lease! Most likely not enough shared " "memory available to complete the operation."); } if(service->lease)/* aka everything is ok so far */ { v_result result; c_iter participants; v_participant splicedParticipant; participants = v_resolveParticipants(kernel, V_SPLICED_NAME); assert(c_iterLength(participants) == 1 || 0 == strcmp(name, V_SPLICED_NAME)); splicedParticipant = v_participant(c_iterTakeFirst(participants)); if(splicedParticipant) { result = v_leaseManagerRegister( v_participant(service)->leaseManager, v_service(splicedParticipant)->lease, V_LEASEACTION_SERVICESTATE_EXPIRED, v_public(v_service(splicedParticipant)->state), FALSE /* only observing, do not repeat */); if(result != V_RESULT_OK) { c_free(service->lease); service->lease = NULL; OS_REPORT_3(OS_ERROR, "v_service", 0, "A fatal error was detected when trying to register the spliced's liveliness lease " "to the lease manager of participant %p (%s). The result code was %d.", service, name, result); } } c_iterFree(participants); } if (service->state != NULL) { /* check if state has correct type */ typeName = c_metaScopedName(c_metaObject(c_getType(c_object(service->state)))); if (extStateName == NULL) { extStateName = VSERVICESTATE_NAME; } if (strcmp(typeName, extStateName) == 0) { if (strcmp(name, V_SPLICED_NAME) != 0) { /* Splicedaemon may not observer itself! */ v_serviceWatchSplicedaemon(service); } } else { OS_REPORT_2(OS_ERROR, "v_service", 0, "Requested state type (%s) differs with existing state type (%s)", extStateName, typeName); c_free(service->state); service->state = NULL; } os_free(typeName); } }
/** \brief Create a process that is an instantiation of a program * * First an argument list is built from \b arguments. * Then \b os_procCreate creates a process by forking the current * process. * * The child process processes the lock policy attribute from * \b procAttr and sets the lock policy accordingly by calling * \b mlockall if required. If the process has root privileges * it processes the user credentials from \b procAttr and sets * the user credentials of the child process accordingly. * The child process then replaces the running program with the * program provided by the \b executable_file by calling \b execve. * * The parent process processes the scheduling class and * scheduling priority attributes from \b procAttr and * sets the scheduling properties of the child process * accordingly by calling \b sched_setscheduler. */ os_result os_procCreate( const char *executable_file, const char *name, const char *arguments, os_procAttr * procAttr, os_procId *procId) { os_result rv = os_resultSuccess; #ifndef INTEGRITY pid_t pid; char *argv[64]; int argc = 1; int go_on = 1; int i = 0; int sq_open = 0; int sq_close = 0; int dq_open = 0; int dq_close = 0; char *argin; struct sched_param sched_param; int sched_policy; char environment[512]; assert(executable_file != NULL); assert(name != NULL); assert(arguments != NULL); assert(procAttr != NULL); assert(procId != NULL); if (procAttr->schedClass == OS_SCHED_REALTIME) { sched_policy = SCHED_FIFO; } else if (procAttr->schedClass == OS_SCHED_TIMESHARE) { sched_policy = SCHED_OTHER; } else if (procAttr->schedClass == OS_SCHED_DEFAULT) { sched_policy = SCHED_OTHER; } else { return os_resultInvalid; } if (procAttr->schedPriority < sched_get_priority_min (sched_policy) || procAttr->schedPriority > sched_get_priority_max (sched_policy)) { procAttr->schedPriority = (sched_get_priority_max (sched_policy) + sched_get_priority_min(sched_policy)) / 2; OS_REPORT_1(OS_WARNING, "os_procCreate", 2, "scheduling priority outside valid range for the policy reverted to valid value (%s)", name); } if (access(executable_file, X_OK) != 0) { rv = os_resultInvalid; } else { /* first translate the input string into an argv structured list */ argin = os_malloc(strlen(arguments) + 1); os_strcpy(argin, arguments); argv[0] = os_malloc(strlen(name) + 1); argv[0] = os_strcpy(argv[0], name); while (go_on && (unsigned int)argc <= (sizeof(argv)/(sizeof(char *)))) { while (argin[i] == ' ' || argin[i] == '\t' ) { i++; } if (argin[i] == '\0' ) { break; } else if (argin[i] == '\'') { if (sq_open == sq_close) { sq_open++; argv[argc] = &argin[i]; } else { sq_close++; } i++; } else if (argin[i] == '\"') { if (dq_open == dq_close) { dq_open++; } else { dq_close++; } i++; } else { argv[argc] = &argin[i]; argc++; while ((argin[i] != ' ' && argin[i] != '\t') || (sq_open != sq_close) || (dq_open != dq_close)) { if (argin[i] == '\0') { go_on = 0; break; } else if (argin[i] == '\'') { sq_close++; if ((sq_open == sq_close) && (dq_open == dq_close)) { argin[i] = '\0'; } i++; } else if (argin[i] == '\"') { dq_close++; if ((dq_open == dq_close) && (sq_open == sq_close)) { argin[i] = '\0'; } i++; } else { i++; } } argin[i] = '\0'; i++; } } argv [argc] = NULL; if ((pid = fork()) == -1) { OS_REPORT_3(OS_WARNING, "os_procCreate", 1, "fork failed with error %d (%s, %s)", errno, executable_file, name); rv = os_resultFail; } else if (pid == 0) { /* child process */ if (procAttr->schedClass == OS_SCHED_REALTIME) { if (getuid() == 0 || geteuid() == 0) { sched_param.sched_priority = procAttr->schedPriority; if (sched_setscheduler(pid, SCHED_FIFO, &sched_param) == -1) { OS_REPORT_2(OS_WARNING, "os_procCreate", 1, "sched_setscheduler failed with error %d (%s)", errno, name); } } else { OS_REPORT_1(OS_WARNING, "os_procCreate", 2, "scheduling policy can not be set because of privilege problems (%s)", name); } } else { sched_param.sched_priority = procAttr->schedPriority; if (sched_setscheduler(pid, SCHED_OTHER, &sched_param) == -1) { OS_REPORT_2(OS_WARNING, "os_procCreate", 1, "sched_setscheduler failed with error %d (%s)", errno, name); } } if (getuid() == 0) { /* first set the gid */ if (procAttr->userCred.gid) { setgid(procAttr->userCred.gid); } /* then set the uid */ if (procAttr->userCred.uid) { setuid(procAttr->userCred.uid); } } /* Set the process name via environment variable SPLICE_PROCNAME */ snprintf(environment, sizeof(environment), "SPLICE_PROCNAME=%s", name); putenv(environment); /* exec executable file */ if (execve(executable_file, argv, environ) == -1) { OS_REPORT_2(OS_WARNING, "os_procCreate", 1, "execve failed with error %d (%s)", errno, executable_file); } /* if executing this, something has gone wrong */ rv = os_resultFail; /* Just to fool QAC */ os_procExit(OS_EXIT_FAILURE); } else { /* parent process */ os_free(argv[0]); os_free(argin); *procId = pid; rv = os_resultSuccess; } } #endif return rv; }
static os_result os_signalHandlerInit( os_signalHandler _this) { os_result result = os_resultSuccess; os_sigaction action; os_sigset block_all_sigset, old_sigset; int i, r; if (_this == NULL) { result = os_resultFail; } _this->exitRequestCallback = (os_signalHandlerExitRequestCallback)0; _this->exceptionCallback = (os_signalHandlerExceptionCallback)0; if(isSignallingSafe(1)) { /* Initialise the exceptionsMask */ sigemptyset(&exceptionsMask); for(i = 0; i < lengthof(exceptions); i++) { sigaddset(&exceptionsMask, exceptions[i]); } /* Initialise the quitsMask */ sigemptyset(&quitsMask); for(i = 0; i < lengthof(quits); i++) { sigaddset(&quitsMask, quits[i]); } /* create signal handling pipes */ if (result == os_resultSuccess) { r = pipe(_this->pipeIn); if (r<0) { OS_REPORT_1(OS_ERROR, "os_signalHandlerInit", 0, "pipe(_this->pipeIn) failed, result = %d", r); result = os_resultFail; } else { r = fcntl(_this->pipeIn[0], F_SETFD, 1); if (r<0) { OS_REPORT_1(OS_WARNING, "os_signalHandlerInit", 0, "fcntl(_this->pipeIn[0]) failed, result = %d", r); assert(OS_FALSE); } r = fcntl(_this->pipeIn[1], F_SETFD, 1); if (r<0) { OS_REPORT_1(OS_WARNING, "os_signalHandlerInit", 0, "fcntl(_this->pipeIn[1]) failed, result = %d", r); assert(OS_FALSE); } } } if (result == os_resultSuccess) { r = pipe(_this->pipeOut); if (r<0) { OS_REPORT_1(OS_ERROR, "os_signalHandlerInit", 1, "pipe(_this->pipeOut) failed, result = %d", r); result = os_resultFail; } else { r = fcntl(_this->pipeOut[0], F_SETFD, 1); if (r<0) { OS_REPORT_1(OS_WARNING, "os_signalHandlerInit", 0, "fcntl(_this->pipeOut[0]) failed, result = %d", r); assert(OS_FALSE); } r = fcntl(_this->pipeOut[1], F_SETFD, 1); if (r<0) { OS_REPORT_1(OS_WARNING, "os_signalHandlerInit", 0, "fcntl(_this->pipeOut[1]) failed, result = %d", r); assert(OS_FALSE); } } } /* Block all signals */ if (result == os_resultSuccess) { result = os_sigsetFill(&block_all_sigset); if (result != os_resultSuccess) { OS_REPORT_1(OS_ERROR, "os_signalHandlerInit", 0, "os_sigsetFill(&block_all_sigset) failed, result = %d", r); assert(OS_FALSE); } else { result = os_sigThreadSetMask(&block_all_sigset, &old_sigset); if (result != os_resultSuccess) { OS_REPORT_3(OS_ERROR, "os_signalHandlerInit", 0, "os_sigThreadSetMask(0x%x, 0x%x) failed, result = %d", &block_all_sigset, &old_sigset, r); assert(OS_FALSE); } } } /* Setup signal handler thread. */ if (result == os_resultSuccess) { os_threadAttr thrAttr; result = os_threadAttrInit(&thrAttr); if (result != os_resultSuccess) { OS_REPORT_2(OS_ERROR, "os_signalHandlerInit", 0, "pthread_attr_init(0x%x) failed, result = %d", &thrAttr, r); assert(OS_FALSE); } else { thrAttr.stackSize = 4*1024*1024; /* 4 MB */ result = os_threadCreate(&_this->threadId, "signalHandler", &thrAttr, signalHandlerThread, (void*)_this); if (result != os_resultSuccess) { OS_REPORT_4(OS_ERROR, "os_signalHandlerInit", 0, "os_threadCreate(0x%x, 0x%x,0x%x,0) failed, result = %d", &_this->threadId, &thrAttr, signalHandlerThread, result); assert(OS_FALSE); } } } /* Reset signal mask to original value. */ if (result == os_resultSuccess) { result = os_sigThreadSetMask(&old_sigset, NULL); if (result != os_resultSuccess) { OS_REPORT_2(OS_ERROR, "os_signalHandlerInit", 0, "os_sigThreadSetMask(0x%x, NULL) failed, result = %d", &old_sigset, r); result = os_resultFail; assert(OS_FALSE); } } /* install signal handlers */ if (result == os_resultSuccess) { os_sigset mask; /* block all signals during handling of a signal */ result = os_sigsetFill(&mask); if (result != os_resultSuccess) { OS_REPORT_2(OS_ERROR, "os_signalHandlerInit", 0, "os_sigsetFill(0x%x) failed, result = %d", &action.sa_mask, result); } else { action = os_sigactionNew(signalHandler, &mask, SA_SIGINFO); } if (result == os_resultSuccess) { for (i=0; i<lengthof(exceptions); i++) { const int sig = exceptions[i]; r = os_sigsetDel(&action.sa_mask, sig); if (r<0) { OS_REPORT_3(OS_ERROR, "os_signalHandlerInit", 0, "os_sigsetDel(0x%x, %d) failed, result = %d", &action, sig, r); result = os_resultFail; assert(OS_FALSE); } } } if (result == os_resultSuccess) { for (i=0; i<lengthof(exceptions); i++) { const int sig = exceptions[i]; /* For exceptions we always set our own signal handler, since * applications that cause an exception are not in a position * to ignore it. However, we will chain the old handler to our * own. */ r = os_sigactionSet(sig, &action, &old_signalHandler[sig]); if (r < 0) { OS_REPORT_4(OS_ERROR, "os_signalHandlerInit", 0, "os_sigactionSet(%d, 0x%x, 0x%x) failed, result = %d", sig, &action, &old_signalHandler[sig], r); result = os_resultFail; assert(OS_FALSE); } } } if (result == os_resultSuccess) { for (i=0; i<lengthof(quits); i++) { const int sig = quits[i]; /* By passing NULL we only retrieve the currently set handler. If * the signal should be ignored, we don't do anything. Otherwise we * chain the old handler to our own. * man-page of sigaction only states behaviour when new * action is non-NULL, but all known implementations act as * expected. That is: return the currently set signal-hand- * ler (and not the previous, as the man-pages state). * NOTE: Not MT-safe */ r = os_sigactionSet(sig, NULL, &old_signalHandler[sig]); if (r == 0) { if(old_signalHandler[sig].sa_handler != SIG_IGN) { /* We don't know if the oldHandler has been modified in the mean * time, since there is no way to make the signal handler reentrant. * It doesn't make sense to look for modifications now, since a * new modification could be on its way while we are processing * the current modification. * For that reason we will ignore any intermediate modifications * and continue setting our own handler. Processes should therefore * refrain from modifying the signal handler in multiple threads. */ r = os_sigactionSet(sig, &action, NULL); if (r != 0) { OS_REPORT_4(OS_ERROR, "os_signalHandlerInit", 0, "os_sigactionSet(%d, 0x%x, 0x%x) failed, result = %d", sig, &action, &old_signalHandler[sig], r); result = os_resultFail; assert(OS_FALSE); } } else { OS_REPORT_1(OS_INFO, "os_signalHandlerThread", 0, "Not installing a signal handler for the already ignored signal %d.", sig); } } else { OS_REPORT_1(OS_ERROR, "os_signalHandlerInit", 0, "Could not retrieve currently set signal-handler for signal %d", sig); result = os_resultFail; assert(OS_FALSE); } } } } } else { result = os_resultSuccess; } return result; }