summaryrefslogtreecommitdiffstats
path: root/action.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-10-23 14:46:47 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2008-10-23 14:46:47 +0200
commit6334d335d89ae5df344f833c5095e9dea2abf6fb (patch)
tree9cd1a8de9e3b94e72b38b0612ba4d90cadccd81d /action.c
parentcf38fc81759b01af5125b1a05e0d6fe8e2e1bc21 (diff)
downloadrsyslog-6334d335d89ae5df344f833c5095e9dea2abf6fb.tar.gz
rsyslog-6334d335d89ae5df344f833c5095e9dea2abf6fb.tar.xz
rsyslog-6334d335d89ae5df344f833c5095e9dea2abf6fb.zip
added configuration directive "HUPisRestart"
...which enables to configure HUP to be either a full restart or "just" a leightweight way to close open files
Diffstat (limited to 'action.c')
-rw-r--r--action.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/action.c b/action.c
index ec8732bc..dee46f16 100644
--- a/action.c
+++ b/action.c
@@ -498,6 +498,39 @@ finalize_it:
}
#pragma GCC diagnostic warning "-Wempty-body"
+
+/* call the HUP handler for a given action, if such a handler is defined. The
+ * action mutex is locked, because the HUP handler most probably needs to modify
+ * some internal state information.
+ * rgerhards, 2008-10-22
+ */
+#pragma GCC diagnostic ignored "-Wempty-body"
+rsRetVal
+actionCallHUPHdlr(action_t *pAction)
+{
+ DEFiRet;
+ int iCancelStateSave;
+
+ ASSERT(pAction != NULL);
+ DBGPRINTF("Action %p checks HUP hdlr: %p\n", pAction, pAction->pMod->doHUP);
+
+ if(pAction->pMod->doHUP == NULL) {
+ FINALIZE; /* no HUP handler, so we are done ;) */
+ }
+
+ pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &iCancelStateSave);
+ d_pthread_mutex_lock(&pAction->mutActExec);
+ pthread_cleanup_push(mutexCancelCleanup, &pAction->mutActExec);
+ pthread_setcancelstate(iCancelStateSave, NULL);
+ CHKiRet(pAction->pMod->doHUP(pAction->pModData));
+ pthread_cleanup_pop(1); /* unlock mutex */
+
+finalize_it:
+ RETiRet;
+}
+#pragma GCC diagnostic warning "-Wempty-body"
+
+
/* set the action message queue mode
* TODO: probably move this into queue object, merge with MainMsgQueue!
* rgerhards, 2008-01-28