diff options
author | Michael Biebl <biebl@debian.org> | 2009-11-04 19:37:23 +0100 |
---|---|---|
committer | Michael Biebl <biebl@debian.org> | 2009-11-04 19:37:23 +0100 |
commit | 6f64702386210741d62f3394e27b1b6695dde698 (patch) | |
tree | 676906a73270831fbc42be9ea0f267756cb0031d /tools/ck-log-system-start.c | |
parent | 6e7c6dfda732880e6feaef53f8ff0aaf23b4d4d4 (diff) | |
download | consolekit-6f64702386210741d62f3394e27b1b6695dde698.tar.gz |
Imported Upstream version 0.4.1upstream/0.4.1
Diffstat (limited to 'tools/ck-log-system-start.c')
-rw-r--r-- | tools/ck-log-system-start.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tools/ck-log-system-start.c b/tools/ck-log-system-start.c index 4afdfa0..0860429 100644 --- a/tools/ck-log-system-start.c +++ b/tools/ck-log-system-start.c @@ -28,6 +28,7 @@ #include <fcntl.h> #include <sys/types.h> #include <sys/stat.h> +#include <sys/utsname.h> #include <string.h> #include <locale.h> @@ -40,6 +41,7 @@ #define DEFAULT_LOG_FILENAME LOCALSTATEDIR "/log/ConsoleKit/history" +#define LINUX_KERNEL_CMDLINE "/proc/cmdline" /* Adapted from auditd auditd-event.c */ static gboolean @@ -157,16 +159,46 @@ write_log_for_event (CkLogEvent *event) return TRUE; } +static char * +get_boot_arguments (void) +{ + char *contents; + gboolean res; + + contents = NULL; + res = g_file_get_contents (LINUX_KERNEL_CMDLINE, + &contents, + NULL, + NULL); + if (!res) { + g_free (contents); + contents = NULL; + } else { + g_strchomp (contents); + } + + return contents; +} + int main (int argc, char **argv) { CkLogEvent event; + CkLogSystemStartEvent *e; + struct utsname uts; memset (&event, 0, sizeof (CkLogEvent)); event.type = CK_LOG_EVENT_SYSTEM_START; g_get_current_time (&event.timestamp); + e = (CkLogSystemStartEvent *) &event; + + if (uname (&uts) == 0) { + e->kernel_release = uts.release; + } + + e->boot_arguments = get_boot_arguments (); write_log_for_event (&event); |