UTMP: Set BOOT_TIME record and add shutdown

This patch adds support for initializing /var/run/utmp with the initial
reboot as well as a shutdown record in the UTMP db.

Also, the run level change now properly records ~ and ~~ as line and id,
respectively, and the kernel release and time of each UTMP record is now
set properly.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2016-08-08 19:06:35 +02:00
1 parent 27899feea0
commit addc21bdf6
4 files changed
+43 -5

No files matched your search

+4
View File
@@ -78,6 +78,7 @@
#include "private.h"
#include "sig.h"
#include "service.h"
#include "utmp-api.h"
static int stopped = 0;
static uev_t sigterm_watcher, sigusr1_watcher, sigusr2_watcher;
@@ -105,6 +106,9 @@ void do_shutdown(shutop_t op)
/* Call all shutdown hooks before rebooting... */
plugin_run_hooks(HOOK_SHUTDOWN);
/* Update UTMP db */
utmp_set_halt();
/* Here is where we signal watchdogd to do a forced reset for us */
_d("Sending SIGTERM to all processes.");
kill(-1, SIGTERM);