SHA256
1
0
forked from pool/systemd
systemd/log-target-null-instead-kmsg.patch

115 lines
3.5 KiB
Diff
Raw Normal View History

Accepting request 233680 from Base:System - Add patch log-target-null-instead-kmsg.patch from Thomas Blume to enable the kernel developers to see a clean kmsg ring buffer without any systemd/udev messages included (bnc#877021) - Add upstram patches for backlight 0001-backlight-Avoid-restoring-brightness-to-an-unreadabl.patch 0002-backlight-do-nothing-if-max_brightness-is-0.patch 0003-backlight-unify-error-messages.patch 0004-backlight-warn-if-kernel-exposes-backlight-device-wi.patch 0005-backlight-handle-saved-brightness-exceeding-max-brig.patch - Add upstream patches 0001-errno-make-sure-to-handle-the-3-errnos-that-are-alia.patch 0002-udev-warn-when-name_to_handle_at-is-not-implemented.patch 0003-analyze-fix-plot-with-bad-y-size.patch 0004-job-add-waiting-jobs-to-run-queue-in-unit_coldplug.patch 0005-job-always-add-waiting-jobs-to-run-queue-during-cold.patch - Drop upstream-net_id-changes.patch and replace them with the correct patches from upstream and their commits: add: 1014-udev-update-net_id-comments.patch add: 1015-udev-persistent-naming-we-cannot-use-virtio-numbers-.patch - Add patch log-target-null-instead-kmsg.patch from Thomas Blume to enable the kernel developers to see a clean kmsg ring buffer without any systemd/udev messages included (bnc#877021) - Add upstram patches for backlight 0001-backlight-Avoid-restoring-brightness-to-an-unreadabl.patch 0002-backlight-do-nothing-if-max_brightness-is-0.patch OBS-URL: https://build.opensuse.org/request/show/233680 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=186
2014-05-13 20:46:20 +02:00
---
src/journal/journald-kmsg.c | 16 +++++++++++++++-
src/libudev/libudev-util.c | 16 +++++++++++++++-
src/shared/log.c | 16 +++++++++++++++-
src/shared/util.c | 6 +++++-
4 files changed, 50 insertions(+), 4 deletions(-)
--- systemd-210/src/journal/journald-kmsg.c
+++ systemd-210/src/journal/journald-kmsg.c 2014-05-09 07:35:02.880122386 +0000
@@ -391,12 +391,26 @@
return server_read_dev_kmsg(s);
}
+static int parse_proc_cmdline_word(const char *word) {
+ int r;
+
+ if (streq(word, "systemd.log_target=null"))
+ return -115;
+
+ return 0;
+}
+
int server_open_dev_kmsg(Server *s) {
int r;
assert(s);
- s->dev_kmsg_fd = open("/dev/kmsg", O_RDWR|O_CLOEXEC|O_NONBLOCK|O_NOCTTY);
+ if (parse_proc_cmdline(parse_proc_cmdline_word) == -115) {
+ s->dev_kmsg_fd = open("/dev/null", O_RDWR|O_CLOEXEC|O_NONBLOCK|O_NOCTTY);
+ } else {
+ s->dev_kmsg_fd = open("/dev/kmsg", O_RDWR|O_CLOEXEC|O_NONBLOCK|O_NOCTTY);
+ }
+
if (s->dev_kmsg_fd < 0) {
log_full(errno == ENOENT ? LOG_DEBUG : LOG_WARNING,
"Failed to open /dev/kmsg, ignoring: %m");
--- systemd-210/src/libudev/libudev-util.c
+++ systemd-210/src/libudev/libudev-util.c 2014-05-09 07:35:28.304122530 +0000
@@ -416,6 +416,15 @@
return bits;
}
+static int parse_proc_cmdline_word(const char *word) {
+ int r;
+
+ if (streq(word, "systemd.log_target=null"))
+ return -115;
+
+ return 0;
+}
+
ssize_t print_kmsg(const char *fmt, ...)
{
_cleanup_close_ int fd = -1;
@@ -424,7 +433,12 @@
ssize_t len;
ssize_t ret;
- fd = open("/dev/kmsg", O_WRONLY|O_NOCTTY|O_CLOEXEC);
+ if (parse_proc_cmdline(parse_proc_cmdline_word) == -115) {
+ fd = open("/dev/null", O_WRONLY|O_NOCTTY|O_CLOEXEC);
+ } else {
+ fd = open("/dev/kmsg", O_WRONLY|O_NOCTTY|O_CLOEXEC);
+ }
+
if (fd < 0)
return -errno;
--- systemd-210/src/shared/log.c
+++ systemd-210/src/shared/log.c 2014-05-09 07:35:52.900122669 +0000
@@ -92,12 +92,26 @@
kmsg_fd = -1;
}
+static int parse_proc_cmdline_word(const char *word) {
+ int r;
+
+ if (streq(word, "systemd.log_target=null"))
+ return -115;
+
+ return 0;
+}
+
static int log_open_kmsg(void) {
if (kmsg_fd >= 0)
return 0;
- kmsg_fd = open("/dev/kmsg", O_WRONLY|O_NOCTTY|O_CLOEXEC);
+ if (parse_proc_cmdline(parse_proc_cmdline_word) == -115) {
+ kmsg_fd = open("/dev/null", O_WRONLY|O_NOCTTY|O_CLOEXEC);
+ } else {
+ kmsg_fd = open("/dev/kmsg", O_WRONLY|O_NOCTTY|O_CLOEXEC);
+ }
+
if (kmsg_fd < 0)
return -errno;
--- systemd-210/src/shared/util.c
+++ systemd-210/src/shared/util.c 2014-05-09 08:51:55.436148462 +0000
@@ -5975,7 +5975,11 @@
r = parse_word(word);
if (r < 0) {
- log_error("Failed on cmdline argument %s: %s", word, strerror(-r));
+ if (r == -115) {
+ log_error("Warning: %s set, redirecting messages to /dev/null.", word);
+ } else {
+ log_error("Failed on cmdline argument %s: %s", word, strerror(-r));
+ }
return r;
}
}