1 Star 0 Fork 49

YYNA/systemd

forked from src-anolis-os/systemd 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
10002-exit-status-introduce-EXIT_EXCEPTION-mapping-to-255.patch 2.15 KB
一键复制 编辑 原始数据 按行查看 历史
庞庆 提交于 2022-04-19 15:08 . Add optimized patches
From f7940c9cdf872d7504aca9637e9fd14328b2b726 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 19 Apr 2022 11:26:10 +0800
Subject: [PATCH] exit-status: introduce EXIT_EXCEPTION mapping to 255
---
src/basic/exit-status.c | 9 ++++++---
src/basic/exit-status.h | 1 +
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/basic/exit-status.c b/src/basic/exit-status.c
index 0a7a53b..8b67d44 100644
--- a/src/basic/exit-status.c
+++ b/src/basic/exit-status.c
@@ -19,9 +19,9 @@ const char* exit_status_to_string(int status, ExitStatusLevel level) {
* 79…199 │ (Currently unmapped)
* 200…241 │ systemd's private error codes (might be extended to 254 in future development)
* 242…254 │ (Currently unmapped, but see above)
- * 255 │ (We should probably stay away from that one, it's frequently used by applications to indicate an
- * │ exit reason that cannot really be expressed in a single exit status value — such as a propagated
- * │ signal or such)
+ * 255 │ EXIT_EXCEPTION (We use this to propagate exit-by-signal events. It's frequently used by others apps (like bash)
+ * │ to indicate exit reason that cannot really be expressed in a single exit status value — such as a propagated
+ * │ signal or such, and we follow that logic here.)
*/
switch (status) { /* We always cover the ISO C ones */
@@ -158,6 +158,9 @@ const char* exit_status_to_string(int status, ExitStatusLevel level) {
case EXIT_NUMA_POLICY:
return "NUMA_POLICY";
+
+ case EXIT_EXCEPTION:
+ return "EXCEPTION";
}
}
diff --git a/src/basic/exit-status.h b/src/basic/exit-status.h
index dc284aa..e923247 100644
--- a/src/basic/exit-status.h
+++ b/src/basic/exit-status.h
@@ -70,6 +70,7 @@ enum {
EXIT_LOGS_DIRECTORY, /* 240 */
EXIT_CONFIGURATION_DIRECTORY,
EXIT_NUMA_POLICY,
+ EXIT_EXCEPTION = 255, /* Whenever we want to propagate an abnormal/signal exit, in line with bash */
};
typedef enum ExitStatusLevel {
--
2.27.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ful9/systemd.git
git@gitee.com:ful9/systemd.git
ful9
systemd
systemd
a8

搜索帮助

0d507c66 1850385 C8b1a773 1850385