aboutsummaryrefslogtreecommitdiff
path: root/src/sysvinit.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2016-02-18 08:12:39 +0200
committerSergey Poznyakoff <gray@gnu.org>2016-02-18 08:17:35 +0200
commitd5302613a00915076b945b25b50eb6b376121955 (patch)
tree58c8ba0120c52632f008dff191532afc8decaf79 /src/sysvinit.c
parente430f586ccf6621136089fb1d9d865ce1a351360 (diff)
downloadpies-d5302613a00915076b945b25b50eb6b376121955.tar.gz
pies-d5302613a00915076b945b25b50eb6b376121955.tar.bz2
Improve logging
* src/diag.c: Rewrite. (vdiagmsg,diagmsg): New functions. * src/pies.c (main): Set DIAG_REOPEN_LOG for init process. * src/pies.h (DIAG_REOPEN_LOG): New flag (DIAG_TO_MASK,DIAG_ALL): New constants. (diagmsg): New proto. * src/sysvinit.c: Add log messages in important transition points (inittrans): Reinitialize logging to syslog upon transition to normal mode.
Diffstat (limited to 'src/sysvinit.c')
-rw-r--r--src/sysvinit.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/sysvinit.c b/src/sysvinit.c
index 7fad00b..87a52d6 100644
--- a/src/sysvinit.c
+++ b/src/sysvinit.c
@@ -61,6 +61,8 @@ int prevlevel = 'N';
int initdefault; /* Default runlevel */
int dfl_level;
int emergency_shell;
+
+#define DIAG_CON (DIAG_TO_STDERR|DIAG_REOPEN_LOG)
int
console_open (int mode)
@@ -430,6 +432,8 @@ sysvinit_set_runlevel (int newlevel)
case 'A':
case 'B':
case 'C':
+ diagmsg (DIAG_ALL, LOG_INFO,
+ "Activating on-demand level '%c'", newlevel);
sysvinit_demand (newlevel);
break;
@@ -437,10 +441,11 @@ sysvinit_set_runlevel (int newlevel)
if (newlevel == runlevel)
{
}
- if (runlevel_index (newlevel) == -1)
+ else if (runlevel_index (newlevel) == -1)
return -1;
else
{
+ diagmsg (DIAG_ALL, LOG_INFO, "Switching to runlevel: %c", newlevel);
dfl_level = newlevel;
raise (SIGALRM);
}
@@ -827,6 +832,7 @@ inittrans ()
/* boot -> normal */
create_fifo ();
ctl_open ();
+ diag_setup (DIAG_TO_SYSLOG | DIAG_REOPEN_LOG);
}
}
if (newlevel && newlevel != runlevel)
@@ -849,10 +855,12 @@ inittrans ()
/* Stop disabled programs */
sig = SIGTERM;
+ diagmsg (DIAG_CON, LOG_INFO, "Sending processes the TERM signal");
progman_foreach (terminate_disabled, &sig);
if (progman_wait_until (no_disabled_running, NULL))
{
sig = SIGKILL;
+ diagmsg (DIAG_CON, LOG_INFO, "Sending processes the KILL signal");
progman_foreach (terminate_disabled, &sig);
progman_wait_until (no_disabled_running, NULL);
}

Return to:

Send suggestions and report system problems to the System administrator.