mirror of
https://github.com/troglobit/finit.git
synced 2026-11-12 16:51:25 +00:00
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:
1 parent
3f3220e806
commit
8f415aeaf6
3 files changed
+8
No files matched your search
@@ -538,6 +538,11 @@ state, etc. Available hook points are:
|
|||||||
|
|
||||||
**NOTE:** This hook callback gets the lost PID as argument.
|
**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
|
* `HOOK_RUNLEVEL_CHANGE`: Called when the user has issued a runlevel
|
||||||
change. The hook is called when services not matching the new
|
change. The hook is called when services not matching the new
|
||||||
runlevel have been been stopped. When the hook has completed, Finit
|
runlevel have been been stopped. When the hook has completed, Finit
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ typedef enum {
|
|||||||
/* Runtime hooks */
|
/* Runtime hooks */
|
||||||
HOOK_SVC_RECONF,
|
HOOK_SVC_RECONF,
|
||||||
HOOK_SVC_LOST,
|
HOOK_SVC_LOST,
|
||||||
|
HOOK_SVC_START,
|
||||||
HOOK_RUNLEVEL_CHANGE,
|
HOOK_RUNLEVEL_CHANGE,
|
||||||
|
|
||||||
/* Shutdown hooks */
|
/* Shutdown hooks */
|
||||||
|
|||||||
@@ -248,6 +248,8 @@ static int service_start(svc_t *svc)
|
|||||||
close(svc->stdin);
|
close(svc->stdin);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
plugin_run_hook(HOOK_SVC_START, (void *)(uintptr_t)pid);
|
||||||
|
|
||||||
if (SVC_TYPE_RUN == svc->type) {
|
if (SVC_TYPE_RUN == svc->type) {
|
||||||
result = WEXITSTATUS(complete(svc->cmd, pid));
|
result = WEXITSTATUS(complete(svc->cmd, pid));
|
||||||
svc->pid = 0;
|
svc->pid = 0;
|
||||||
|
|||||||
Reference in new issue
Block a user