chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
event: hook up sd-event with the service watchdog logic
[elogind.git]
/
src
/
journal
/
journald-kmsg.c
diff --git
a/src/journal/journald-kmsg.c
b/src/journal/journald-kmsg.c
index 284ace984d58f839731bce88f0c0d34a91e3d13f..af49d8578a8ec3ba0e6390ff063130d7d83908a2 100644
(file)
--- a/
src/journal/journald-kmsg.c
+++ b/
src/journal/journald-kmsg.c
@@
-28,7
+28,7
@@
#include <systemd/sd-messages.h>
#include <libudev.h>
#include <systemd/sd-messages.h>
#include <libudev.h>
-#include "journald.h"
+#include "journald
-server
.h"
#include "journald-kmsg.h"
#include "journald-syslog.h"
#include "journald-kmsg.h"
#include "journald-syslog.h"
@@
-88,7
+88,7
@@
void server_forward_kmsg(
IOVEC_SET_STRING(iovec[n++], "\n");
if (writev(s->dev_kmsg_fd, iovec, n) < 0)
IOVEC_SET_STRING(iovec[n++], "\n");
if (writev(s->dev_kmsg_fd, iovec, n) < 0)
- log_debug("Failed to write to /dev/kmsg for logging: %
s", strerror(errno)
);
+ log_debug("Failed to write to /dev/kmsg for logging: %
m"
);
free(ident_buf);
}
free(ident_buf);
}
@@
-109,7
+109,7
@@
static void dev_kmsg_record(Server *s, char *p, size_t l) {
char *message = NULL, *syslog_priority = NULL, *syslog_pid = NULL, *syslog_facility = NULL, *syslog_identifier = NULL, *source_time = NULL;
int priority, r;
unsigned n = 0, z = 0, j;
char *message = NULL, *syslog_priority = NULL, *syslog_pid = NULL, *syslog_facility = NULL, *syslog_identifier = NULL, *source_time = NULL;
int priority, r;
unsigned n = 0, z = 0, j;
- u
sec_t
usec;
+ u
nsigned long long
usec;
char *identifier = NULL, *pid = NULL, *e, *f, *k;
uint64_t serial;
size_t pl;
char *identifier = NULL, *pid = NULL, *e, *f, *k;
uint64_t serial;
size_t pl;
@@
-151,7
+151,8
@@
static void dev_kmsg_record(Server *s, char *p, size_t l) {
/* Did we lose any? */
if (serial > *s->kernel_seqnum)
/* Did we lose any? */
if (serial > *s->kernel_seqnum)
- server_driver_message(s, SD_MESSAGE_JOURNAL_MISSED, "Missed %llu kernel messages", (unsigned long long) serial - *s->kernel_seqnum - 1);
+ server_driver_message(s, SD_MESSAGE_JOURNAL_MISSED, "Missed %"PRIu64" kernel messages",
+ serial - *s->kernel_seqnum - 1);
/* Make sure we never read this one again. Note that
* we always store the next message serial we expect
/* Make sure we never read this one again. Note that
* we always store the next message serial we expect
@@
-171,7
+172,7
@@
static void dev_kmsg_record(Server *s, char *p, size_t l) {
e = f;
*e = 0;
e = f;
*e = 0;
- r =
parse_usec
(p, &usec);
+ r =
safe_atollu
(p, &usec);
if (r < 0)
return;
if (r < 0)
return;
@@
-250,10
+251,12
@@
static void dev_kmsg_record(Server *s, char *p, size_t l) {
break;
g = udev_list_entry_get_name(ll);
break;
g = udev_list_entry_get_name(ll);
- b = strappend("_UDEV_DEVLINK=", g);
if (g) {
if (g) {
- IOVEC_SET_STRING(iovec[n++], b);
- z++;
+ b = strappend("_UDEV_DEVLINK=", g);
+ if (b) {
+ IOVEC_SET_STRING(iovec[n++], b);
+ z++;
+ }
}
j++;
}
j++;
@@
-263,8
+266,7
@@
static void dev_kmsg_record(Server *s, char *p, size_t l) {
}
}
}
}
- if (asprintf(&source_time, "_SOURCE_MONOTONIC_TIMESTAMP=%llu",
- (unsigned long long) usec) >= 0)
+ if (asprintf(&source_time, "_SOURCE_MONOTONIC_TIMESTAMP=%llu", usec) >= 0)
IOVEC_SET_STRING(iovec[n++], source_time);
IOVEC_SET_STRING(iovec[n++], "_TRANSPORT=kernel");
IOVEC_SET_STRING(iovec[n++], source_time);
IOVEC_SET_STRING(iovec[n++], "_TRANSPORT=kernel");
@@
-275,7
+277,7
@@
static void dev_kmsg_record(Server *s, char *p, size_t l) {
if ((priority & LOG_FACMASK) == LOG_KERN)
IOVEC_SET_STRING(iovec[n++], "SYSLOG_IDENTIFIER=kernel");
else {
if ((priority & LOG_FACMASK) == LOG_KERN)
IOVEC_SET_STRING(iovec[n++], "SYSLOG_IDENTIFIER=kernel");
else {
- syslog_parse_identifier((const char**) &p, &identifier, &pid);
+
pl -=
syslog_parse_identifier((const char**) &p, &identifier, &pid);
/* Avoid any messages we generated ourselves via
* log_info() and friends. */
/* Avoid any messages we generated ourselves via
* log_info() and friends. */
@@
-302,7
+304,7
@@
static void dev_kmsg_record(Server *s, char *p, size_t l) {
if (message)
IOVEC_SET_STRING(iovec[n++], message);
if (message)
IOVEC_SET_STRING(iovec[n++], message);
- server_dispatch_message(s, iovec, n, ELEMENTSOF(iovec), NULL, NULL, NULL, 0, NULL, priority);
+ server_dispatch_message(s, iovec, n, ELEMENTSOF(iovec), NULL, NULL, NULL, 0, NULL, priority
, 0
);
finish:
for (j = 0; j < z; j++)
finish:
for (j = 0; j < z; j++)
@@
-411,7
+413,7
@@
int server_open_kernel_seqnum(Server *s) {
/* We store the seqnum we last read in an mmaped file. That
* way we can just use it like a variable, but it is
/* We store the seqnum we last read in an mmaped file. That
* way we can just use it like a variable, but it is
- * persist
a
nt and automatically flushed at reboot. */
+ * persist
e
nt and automatically flushed at reboot. */
fd = open("/run/systemd/journal/kernel-seqnum", O_RDWR|O_CREAT|O_CLOEXEC|O_NOCTTY|O_NOFOLLOW, 0644);
if (fd < 0) {
fd = open("/run/systemd/journal/kernel-seqnum", O_RDWR|O_CREAT|O_CLOEXEC|O_NOCTTY|O_NOFOLLOW, 0644);
if (fd < 0) {