systemd-logind button_dispatch add log to display devices that triggered the button
This commit is contained in:
parent
deacc7e6e0
commit
e4e7f3689d
49
systemd-logind-add-log-to-display-devices.patch
Normal file
49
systemd-logind-add-log-to-display-devices.patch
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
From daebc1a8c4ef28c8a52f7549f18d42702abd7cdc Mon Sep 17 00:00:00 2001
|
||||||
|
From: huyubiao <huyubiao@huawei.com>
|
||||||
|
Date: Tue, 12 Nov 2024 15:36:21 +0800
|
||||||
|
Subject: [PATCH] systemd-logind button_dispatch add log to display devices that triggered the button
|
||||||
|
|
||||||
|
---
|
||||||
|
src/login/logind-action.c | 7 +++++++
|
||||||
|
src/login/logind-button.c | 7 +++++++
|
||||||
|
2 files changed, 14 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/login/logind-action.c b/src/login/logind-action.c
|
||||||
|
index 8ed066c..5bc4d6f 100644
|
||||||
|
--- a/src/login/logind-action.c
|
||||||
|
+++ b/src/login/logind-action.c
|
||||||
|
@@ -158,6 +158,13 @@ int manager_handle_action(
|
||||||
|
return is_edge ? -EPERM : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ // Extra log to console
|
||||||
|
+ LogTarget old_target = log_get_target();
|
||||||
|
+ log_set_always_reopen_console(true);
|
||||||
|
+ log_set_target_and_open(LOG_TARGET_CONSOLE);
|
||||||
|
+ log_info("%s", message_table[handle]);
|
||||||
|
+ log_set_always_reopen_console(false);
|
||||||
|
+ log_set_target_and_open(old_target);
|
||||||
|
log_info("%s", message_table[handle]);
|
||||||
|
|
||||||
|
r = bus_manager_shutdown_or_sleep_now_or_later(m, target, inhibit_operation, &error);
|
||||||
|
diff --git a/src/login/logind-button.c b/src/login/logind-button.c
|
||||||
|
index 0ee6702..70e379c 100644
|
||||||
|
--- a/src/login/logind-button.c
|
||||||
|
+++ b/src/login/logind-button.c
|
||||||
|
@@ -126,6 +126,13 @@ static int button_dispatch(sd_event_source *s, int fd, uint32_t revents, void *u
|
||||||
|
assert(fd == b->fd);
|
||||||
|
assert(b);
|
||||||
|
|
||||||
|
+ LogTarget old_target = log_get_target();
|
||||||
|
+ log_set_always_reopen_console(true);
|
||||||
|
+ log_set_target_and_open(LOG_TARGET_CONSOLE);
|
||||||
|
+ log_info("button:%s event", b->name);
|
||||||
|
+ log_set_always_reopen_console(false);
|
||||||
|
+ log_set_target_and_open(old_target);
|
||||||
|
+
|
||||||
|
l = read(b->fd, &ev, sizeof(ev));
|
||||||
|
if (l < 0)
|
||||||
|
return errno != EAGAIN ? -errno : 0;
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
@ -25,7 +25,7 @@
|
|||||||
Name: systemd
|
Name: systemd
|
||||||
Url: https://systemd.io/
|
Url: https://systemd.io/
|
||||||
Version: 249
|
Version: 249
|
||||||
Release: 98
|
Release: 99
|
||||||
License: MIT and LGPLv2+ and GPLv2+
|
License: MIT and LGPLv2+ and GPLv2+
|
||||||
Summary: System and Service Manager
|
Summary: System and Service Manager
|
||||||
|
|
||||||
@ -791,6 +791,7 @@ Patch9057: add-support-to-relabel-systemd-process-for-embedded.patch
|
|||||||
Patch9058: embedded-add-noexec-mount-option-to-strenthen-tmp-pa.patch
|
Patch9058: embedded-add-noexec-mount-option-to-strenthen-tmp-pa.patch
|
||||||
Patch9059: embedded-use-yocto-configs.patch
|
Patch9059: embedded-use-yocto-configs.patch
|
||||||
Patch9060: embedded-add-cpuset-cgv1-and-freezer-cgv1-option.patch
|
Patch9060: embedded-add-cpuset-cgv1-and-freezer-cgv1-option.patch
|
||||||
|
Patch9061: systemd-logind-add-log-to-display-devices.patch
|
||||||
|
|
||||||
Patch9801: Systemd-Add-sw64-architecture.patch
|
Patch9801: Systemd-Add-sw64-architecture.patch
|
||||||
Patch9802: 0029-Add-support-for-the-LoongArch-architecture.patch
|
Patch9802: 0029-Add-support-for-the-LoongArch-architecture.patch
|
||||||
@ -2245,6 +2246,9 @@ grep -q -E '^KEYMAP="?fi-latin[19]"?' /etc/vconsole.conf 2>/dev/null &&
|
|||||||
/usr/bin/systemd-cryptenroll
|
/usr/bin/systemd-cryptenroll
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Dec 24 2024 huyubiao <huyubiao@huawei.com> - 249-99
|
||||||
|
- systemd-logind button_dispatch add log to display devices that triggered the button
|
||||||
|
|
||||||
* Fri Dec 13 2024 wangyuhang <wangyuhang27@huawei.com> - 249-98
|
* Fri Dec 13 2024 wangyuhang <wangyuhang27@huawei.com> - 249-98
|
||||||
- add backport-run-split-out-creation-of-unit-creation-messages.patch
|
- add backport-run-split-out-creation-of-unit-creation-messages.patch
|
||||||
backport-run-pass-the-pty-slave-fd-to-transient-service.patch
|
backport-run-pass-the-pty-slave-fd-to-transient-service.patch
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user