mirror of
https://github.com/troglobit/finit.git
synced 2026-10-28 12:30:44 +00:00
New function, svc_find_by_pidfile()
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
a1c33dec21
commit
cccf199280
2 files changed
+21
No files matched your search
@@ -32,6 +32,7 @@
|
||||
#include "finit.h"
|
||||
#include "svc.h"
|
||||
#include "helpers.h"
|
||||
#include "pid.h"
|
||||
#include "util.h"
|
||||
|
||||
/* Each svc_t needs a unique job# */
|
||||
@@ -342,6 +343,25 @@ svc_t *svc_find_by_nameid(char *name, int id)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* svc_find_by_plidfile - Find an service object by its PID file
|
||||
* @fn: PID file, can be absolute path or relative to /run
|
||||
*
|
||||
* Returns:
|
||||
* A pointer to an &svc_t object, or %NULL if not found.
|
||||
*/
|
||||
svc_t *svc_find_by_pidfile(char *fn)
|
||||
{
|
||||
svc_t *svc, *iter = NULL;
|
||||
|
||||
for (svc = svc_iterator(&iter, 1); svc; svc = svc_iterator(&iter, 0)) {
|
||||
if (string_compare(fn, pid_file(svc)))
|
||||
return svc;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* svc_mark_dynamic - Mark dynamically loaded services for deletion.
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user