1 Star 0 Fork 50

zhongling.h/systemd

forked from src-anolis-os/systemd 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0277-pid1-don-t-reset-setting-from-proc-cmdline-upon-rest.patch 3.18 KB
一键复制 编辑 原始数据 按行查看 历史
张彬琛 提交于 2021-01-20 13:59 . import systemd-239-29.el8.src.rpm
From f71f3271fa149d2b5f022830d43071d97b022b38 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <[email protected]>
Date: Fri, 24 May 2019 08:59:23 +0200
Subject: [PATCH] pid1: don't reset setting from /proc/cmdline upon restart
We have settings which may be set on the kernel command line, and also
in /proc/cmdline (for pid1). The settings in /proc/cmdline have higher priority
of course. When a reload was done, we'd reload just the configuration file,
losing the overrides.
So read /proc/cmdline again during reload.
Also, when initially reading the configuration file when program starts,
don't treat any errors as fatal. The configuration done in there doesn't
seem important enough to refuse boot.
(cherry picked from commit 470a5e6dcec4637439ae953002127af214d396ac)
Related: #1734787
---
src/core/main.c | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/src/core/main.c b/src/core/main.c
index bc1db2af7b..9a9f145080 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -129,6 +129,8 @@ static sd_id128_t arg_machine_id = {};
static EmergencyAction arg_cad_burst_action = EMERGENCY_ACTION_REBOOT_FORCE;
static CPUSet arg_cpu_affinity = {};
+static int parse_configuration(void);
+
_noreturn_ static void freeze_or_reboot(void) {
if (arg_crash_reboot) {
@@ -1659,9 +1661,7 @@ static int invoke_main_loop(
saved_log_level = m->log_level_overridden ? log_get_max_level() : -1;
saved_log_target = m->log_target_overridden ? log_get_target() : _LOG_TARGET_INVALID;
- r = parse_config_file();
- if (r < 0)
- log_warning_errno(r, "Failed to parse config file, ignoring: %m");
+ (void) parse_configuration();
set_manager_defaults(m);
@@ -1965,18 +1965,14 @@ static void free_arguments(void) {
cpu_set_reset(&arg_cpu_affinity);
}
-static int load_configuration(int argc, char **argv, const char **ret_error_message) {
+static int parse_configuration(void) {
int r;
- assert(ret_error_message);
-
arg_default_tasks_max = system_tasks_max_scale(DEFAULT_TASKS_MAX_PERCENTAGE, 100U);
r = parse_config_file();
- if (r < 0) {
- *ret_error_message = "Failed to parse config file";
- return r;
- }
+ if (r < 0)
+ log_warning_errno(r, "Failed to parse config file, ignoring: %m");
if (arg_system) {
r = proc_cmdline_parse(parse_proc_cmdline_item, NULL, 0);
@@ -1987,6 +1983,16 @@ static int load_configuration(int argc, char **argv, const char **ret_error_mess
/* Note that this also parses bits from the kernel command line, including "debug". */
log_parse_environment();
+ return 0;
+}
+
+static int load_configuration(int argc, char **argv, const char **ret_error_message) {
+ int r;
+
+ assert(ret_error_message);
+
+ (void) parse_configuration();
+
r = parse_argv(argc, argv);
if (r < 0) {
*ret_error_message = "Failed to parse commandline arguments";
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhonglingh/systemd.git
[email protected]:zhonglingh/systemd.git
zhonglingh
systemd
systemd
a8

搜索帮助