X-Git-Url: https://git.proxmox.com/?p=pve-qemu.git;a=blobdiff_plain;f=debian%2Fpatches%2Fpve%2F0036-PVE-redirect-stderr-to-journal-when-daemonized.patch;fp=debian%2Fpatches%2Fpve%2F0036-PVE-redirect-stderr-to-journal-when-daemonized.patch;h=c5be26b68bb68f9d9557c3befcdb99a2ff359df1;hp=0000000000000000000000000000000000000000;hb=5b15e2ecaf054107200a49c7d2509053fb91c9fe;hpb=2775b2e3788bfed64345046ce6a669bcdf28eb43 diff --git a/debian/patches/pve/0036-PVE-redirect-stderr-to-journal-when-daemonized.patch b/debian/patches/pve/0036-PVE-redirect-stderr-to-journal-when-daemonized.patch new file mode 100644 index 0000000..c5be26b --- /dev/null +++ b/debian/patches/pve/0036-PVE-redirect-stderr-to-journal-when-daemonized.patch @@ -0,0 +1,61 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Stefan Reiter +Date: Tue, 12 Jan 2021 14:12:20 +0100 +Subject: [PATCH] PVE: redirect stderr to journal when daemonized + +QEMU uses the logging for error messages usually, so LOG_ERR is most +fitting. + +Signed-off-by: Stefan Reiter +Signed-off-by: Thomas Lamprecht +--- + meson.build | 2 ++ + os-posix.c | 7 +++++-- + 2 files changed, 7 insertions(+), 2 deletions(-) + +diff --git a/meson.build b/meson.build +index be4785e2f6..3fc7c8d435 100644 +--- a/meson.build ++++ b/meson.build +@@ -1463,6 +1463,7 @@ keyutils = dependency('libkeyutils', required: false, + has_gettid = cc.has_function('gettid') + + libuuid = cc.find_library('uuid', required: true) ++libsystemd = cc.find_library('systemd', required: true) + libproxmox_backup_qemu = cc.find_library('proxmox_backup_qemu', required: true) + + # libselinux +@@ -3105,6 +3106,7 @@ if have_block + # os-posix.c contains POSIX-specific functions used by qemu-storage-daemon, + # os-win32.c does not + blockdev_ss.add(when: 'CONFIG_POSIX', if_true: files('os-posix.c')) ++ blockdev_ss.add(when: 'CONFIG_POSIX', if_true: libsystemd) + softmmu_ss.add(when: 'CONFIG_WIN32', if_true: [files('os-win32.c')]) + endif + +diff --git a/os-posix.c b/os-posix.c +index 321fc4bd13..b1870d2690 100644 +--- a/os-posix.c ++++ b/os-posix.c +@@ -28,6 +28,8 @@ + #include + #include + #include ++#include ++#include + + /* Needed early for CONFIG_BSD etc. */ + #include "net/slirp.h" +@@ -281,9 +283,10 @@ void os_setup_post(void) + + dup2(fd, 0); + dup2(fd, 1); +- /* In case -D is given do not redirect stderr to /dev/null */ ++ /* In case -D is given do not redirect stderr to journal */ + if (!qemu_log_enabled()) { +- dup2(fd, 2); ++ int journal_fd = sd_journal_stream_fd("QEMU", LOG_ERR, 0); ++ dup2(journal_fd, 2); + } + + close(fd);