mirror of
https://github.com/troglobit/finit.git
synced 2026-10-17 10:49:34 +00:00
Remove --disable-quiet and quiet mode, default to a sane behavior
This patch is a follow-up to 1f1c2e0 which introduced the new semantics
for the very confusing quiet and silent modes.
The initial idea was to loosely follow the kernel cmdline 'quiet' option
and as a working concept this was good. The resulting code, however,
became unnecessarily complex and the configure options impossible to
explain.
With this patch the quiet mode, and thus the --disable-quiet configure
option, is removed. Finit now defaults to a sane behavior: services are
shown only at startup. The --enable-silent option works like it did
before, silencing everything.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
7a48240856
commit
516dbcc512
5 files changed
+14
-32
No files matched your search
+2
-5
@@ -43,7 +43,7 @@ static int parse_conf(char *file);
|
||||
|
||||
void conf_parse_cmdline(void)
|
||||
{
|
||||
int dbg = 0, qit = 0;
|
||||
int dbg = 0;
|
||||
FILE *fp;
|
||||
|
||||
fp = fopen("/proc/cmdline", "r");
|
||||
@@ -57,13 +57,10 @@ void conf_parse_cmdline(void)
|
||||
if (strstr(line, "finit_debug") || strstr(line, "--debug"))
|
||||
dbg = 1;
|
||||
|
||||
if (strstr(line, "quiet"))
|
||||
qit = 1;
|
||||
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
log_init(qit, dbg);
|
||||
log_init(dbg);
|
||||
}
|
||||
|
||||
/* Convert optional "[!123456789S]" string into a bitmask */
|
||||
|
||||
+1
-1
@@ -202,7 +202,7 @@ static void emergency_shell(void)
|
||||
if (pid) {
|
||||
waitpid(pid, NULL, 0);
|
||||
fprintf(stderr, "\n=> Embarrassingly, Finit has crashed. Check /dev/kmsg for details.\n");
|
||||
fprintf(stderr, "=> For more, remove 'quiet' and add '--debug' to the kernel command line.\n\n");
|
||||
fprintf(stderr, "=> To debug, add '--debug' to the kernel command line.\n\n");
|
||||
|
||||
/*
|
||||
* Become session leader and set controlling TTY
|
||||
|
||||
@@ -32,27 +32,22 @@
|
||||
|
||||
static int up = 0;
|
||||
static int debug = 0;
|
||||
static int quiet = QUIET_MODE; /* Delayed disable of silent mode. */
|
||||
static int silent = SILENT_MODE; /* Completely silent, including boot */
|
||||
static int loglevel = LOG_NOTICE;
|
||||
|
||||
void log_init(int qit, int dbg)
|
||||
void log_init(int dbg)
|
||||
{
|
||||
if (dbg)
|
||||
debug = 1;
|
||||
if (!dbg && qit)
|
||||
quiet = 1;
|
||||
}
|
||||
|
||||
/* If we enabled terse mode at boot, restore to previous setting at shutdown */
|
||||
void log_exit(void)
|
||||
{
|
||||
if (quiet) {
|
||||
silent = SILENT_MODE;
|
||||
if (!silent) {
|
||||
sched_yield();
|
||||
fputs("\n", stderr);
|
||||
}
|
||||
silent = SILENT_MODE;
|
||||
if (!silent) {
|
||||
sched_yield();
|
||||
fputs("\n", stderr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,10 +67,10 @@ void log_open(void)
|
||||
|
||||
void log_silent(void)
|
||||
{
|
||||
if (quiet && !debug)
|
||||
silent = 1;
|
||||
else
|
||||
if (debug)
|
||||
silent = 0;
|
||||
else
|
||||
silent = 1;
|
||||
}
|
||||
|
||||
int log_is_silent(void)
|
||||
@@ -89,10 +84,10 @@ void log_debug(void)
|
||||
debug = !debug;
|
||||
|
||||
if (debug) {
|
||||
silent = 0;
|
||||
silent = 0;
|
||||
loglevel = LOG_DEBUG;
|
||||
} else {
|
||||
silent = quiet ? 1 : SILENT_MODE;
|
||||
silent = SILENT_MODE;
|
||||
loglevel = LOG_NOTICE;
|
||||
}
|
||||
log_open();
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
#define _e(fmt, args...) logit(LOG_ERR, "%s():" fmt "\n", __func__, ##args)
|
||||
#define _pe(fmt, args...) logit(LOG_ERR, "%s():" fmt ": %m\n", __func__, ##args)
|
||||
|
||||
void log_init (int qit, int dbg);
|
||||
void log_init (int dbg);
|
||||
void log_exit (void);
|
||||
|
||||
void log_silent (void);
|
||||
|
||||
Reference in new issue
Block a user