Minor refactor, new fn svc_mark()

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2023-02-28 00:49:55 +01:00
parent f796d59f77
commit 9cb6a54493
2 changed files with 11 additions and 6 deletions
+10 -6
View File
@@ -500,6 +500,14 @@ svc_t *svc_find_by_pidfile(char *fn)
return NULL;
}
void svc_mark(svc_t *svc)
{
if (!svc || svc->protect)
return;
*((int *)&svc->removed) = 1;
}
/**
* svc_mark_dynamic - Mark dynamically loaded services for deletion.
*
@@ -514,12 +522,8 @@ void svc_mark_dynamic(void)
{
svc_t *svc, *iter = NULL;
for (svc = svc_iterator(&iter, 1); svc; svc = svc_iterator(&iter, 0)) {
if (svc->protect)
continue;
*((int *)&svc->removed) = 1;
}
for (svc = svc_iterator(&iter, 1); svc; svc = svc_iterator(&iter, 0))
svc_mark(svc);
}
void svc_mark_dirty(svc_t *svc)
+1
View File
@@ -225,6 +225,7 @@ void svc_foreach_type (int types, int (*cb)(svc_t *));
svc_t *svc_stop_completed (void);
void svc_mark (svc_t *svc);
void svc_mark_dynamic (void);
void svc_mark_dirty (svc_t *svc);
void svc_mark_clean (svc_t *svc);