Add HOOK_SVC_START to detect started processes

This patch adds support for the runtime `HOOK_SVC_START`.

Customer request.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson
2016-04-05 03:45:23 +02:00
parent 3f3220e806
commit 8f415aeaf6
3 changed files with 8 additions and 0 deletions
+5
View File
@@ -538,6 +538,11 @@ state, etc. Available hook points are:
**NOTE:** This hook callback gets the lost PID as argument.
* `HOOK_SVC_START`: Like `HOOK_SVC_LOST`, but called when a process is
started. Same caveats apply.
**NOTE:** This hook callback gets the new PID as argument.
* `HOOK_RUNLEVEL_CHANGE`: Called when the user has issued a runlevel
change. The hook is called when services not matching the new
runlevel have been been stopped. When the hook has completed, Finit
+1
View File
@@ -52,6 +52,7 @@ typedef enum {
/* Runtime hooks */
HOOK_SVC_RECONF,
HOOK_SVC_LOST,
HOOK_SVC_START,
HOOK_RUNLEVEL_CHANGE,
/* Shutdown hooks */
+2
View File
@@ -248,6 +248,8 @@ static int service_start(svc_t *svc)
close(svc->stdin);
#endif
plugin_run_hook(HOOK_SVC_START, (void *)(uintptr_t)pid);
if (SVC_TYPE_RUN == svc->type) {
result = WEXITSTATUS(complete(svc->cmd, pid));
svc->pid = 0;