mirror of
https://github.com/troglobit/finit.git
synced 2026-11-17 19:30:29 +00:00
Protect internal services like dbus-daemon and udevd
In f3669c7 the difference between static and dynamic services was
removed. This led to a regression in handling internally created
services for, e.g., dbus-daemon and udevd, mentioned in issue #90.
This patch introduces a "protected" flag for svc_t to prevent the
mark-and-sweep handling of regularly loaded services.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
523a270f22
commit
d6ea1c0cab
3 files changed
+9
-1
No files matched your search
@@ -732,6 +732,9 @@ recreate:
|
|||||||
else
|
else
|
||||||
svc_mark_clean(svc);
|
svc_mark_clean(svc);
|
||||||
|
|
||||||
|
if (!file)
|
||||||
|
svc->protected = 1;
|
||||||
|
|
||||||
/* Free duped line, from above */
|
/* Free duped line, from above */
|
||||||
free(line);
|
free(line);
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -356,8 +356,12 @@ void svc_mark_dynamic(void)
|
|||||||
{
|
{
|
||||||
svc_t *svc, *iter = NULL;
|
svc_t *svc, *iter = NULL;
|
||||||
|
|
||||||
for (svc = svc_iterator(&iter, 1); svc; svc = svc_iterator(&iter, 0))
|
for (svc = svc_iterator(&iter, 1); svc; svc = svc_iterator(&iter, 0)) {
|
||||||
|
if (svc->protected)
|
||||||
|
continue;
|
||||||
|
|
||||||
*((int *)&svc->dirty) = -1;
|
*((int *)&svc->dirty) = -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void svc_mark_dirty(svc_t *svc)
|
void svc_mark_dirty(svc_t *svc)
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ typedef struct svc {
|
|||||||
pid_t pid;
|
pid_t pid;
|
||||||
const svc_state_t state; /* Paused, Reloading, Restart, Running, ... */
|
const svc_state_t state; /* Paused, Reloading, Restart, Running, ... */
|
||||||
svc_type_t type; /* Service, run, task, inetd, ... */
|
svc_type_t type; /* Service, run, task, inetd, ... */
|
||||||
|
int protected; /* Services like dbus-daemon & udev by Finit */
|
||||||
const int dirty; /* -1: removal, 0: unmodified, 1: modified */
|
const int dirty; /* -1: removal, 0: unmodified, 1: modified */
|
||||||
int starting; /* ... waiting for pidfile to be re-asserted */
|
int starting; /* ... waiting for pidfile to be re-asserted */
|
||||||
int runlevels;
|
int runlevels;
|
||||||
|
|||||||
Reference in new issue
Block a user