mirror of
https://github.com/troglobit/finit.git
synced 2026-11-16 19:20:26 +00:00
conf: generate runtime .conf files in the block format
Finit's own generated services -- watchdogd, keventd, runparts, and
the dbus plugin -- still went through conf_save_service() as legacy
one-liners, so `initctl show keventd` taught the old format on a
system otherwise converted to the new one.
conf_save_service() now takes the block title and a printf-style body
and writes the file itself:
# Generated by finit:conf_save_service()
service keventd {
description = "Finit kernel event daemon"
runlevel = "S12345789"
notify = "none"
cgroup init {}
command = "/libexec/finit/keventd"
}
vfprintf() into the file also removes the fixed-size staging buffers
in the callers, where a long dbus pidfile path could truncate inside
a quoted string and take the whole generated file with it.
Semantics preserved: watch-only pid:! maps to pidfile without
pidfile-create, the watchdog keeps its watchdog:finit identity, and
log:console becomes log { file = "/dev/console" }.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
3 files changed
+45
-21
No files matched your search
+2
-1
@@ -71,7 +71,8 @@ int conf_monitor (void);
|
||||
|
||||
void conf_saverc (void);
|
||||
void conf_save_exec_order (svc_t *svc, char *cmdline, int result);
|
||||
void conf_save_service (int type, char *cfg, char *file);
|
||||
void conf_save_service (int type, const char *name, char *file, const char *fmt, ...)
|
||||
__attribute__ ((format (printf, 4, 5)));
|
||||
void conf_parse_cmdline (int argc, char *argv[]);
|
||||
|
||||
void conf_reset_env (void);
|
||||
|
||||
Reference in new issue
Block a user