1 Star 0 Fork 24

xielh/sysstat

forked from src-openEuler/sysstat 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
bugfix-sysstat-10.1.5-read-ttyAMA-first-for-arm64.patch 1.68 KB
一键复制 编辑 原始数据 按行查看 历史
dogsheng 提交于 2019-12-14 14:49 . Package init
From cfddf05021b151fdd16830cef764bf180b273ec8 Mon Sep 17 00:00:00 2001
From: Zhikun Shan <[email protected]>
Date: Wed, 7 Aug 2019 02:23:19 -0400
Subject: [PATCH] sysstat: bugfix sysstat 10.1.5 read ttyAMA first for arm64
reason:read ttyAMA first for arm64.
Signed-off-by: Zhikun Shan <[email protected]>
---
count.c | 7 +++++--
rd_stats.c | 7 +++++--
rd_stats.h | 1 +
3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/count.c b/count.c
index d84ae7a..56864d3 100644
--- a/count.c
+++ b/count.c
@@ -317,8 +317,11 @@ __nr_t get_serial_nr(void)
char line[256];
__nr_t sl = 0;
- if ((fp = fopen(SERIAL, "r")) == NULL)
- return 0; /* No SERIAL file */
+ if ((fp = fopen(TTYAMA, "r")) == NULL) {
+ if ((fp = fopen(SERIAL, "r")) == NULL) {
+ return 0; /* No SERIAL file */
+ }
+ }
while (fgets(line, sizeof(line), fp) != NULL) {
/*
diff --git a/rd_stats.c b/rd_stats.c
index 68e2799..8ccfec4 100644
--- a/rd_stats.c
+++ b/rd_stats.c
@@ -871,8 +871,11 @@ __nr_t read_tty_driver_serial(struct stats_serial *st_serial, __nr_t nr_alloc)
char *p;
__nr_t sl_read = 0;
- if ((fp = fopen(SERIAL, "r")) == NULL)
- return 0;
+ if ((fp = fopen(TTYAMA, "r")) == NULL) {
+ if ((fp = fopen(SERIAL, "r")) == NULL) {
+ return;
+ }
+ }
while (fgets(line, sizeof(line), fp) != NULL ) {
diff --git a/rd_stats.h b/rd_stats.h
index bc99127..599fbea 100644
--- a/rd_stats.h
+++ b/rd_stats.h
@@ -54,6 +54,7 @@
/* Files */
#define SERIAL PRE "/proc/tty/driver/serial"
+#define TTYAMA PRE "/proc/tty/driver/ttyAMA"
#define FDENTRY_STATE PRE "/proc/sys/fs/dentry-state"
#define FFILE_NR PRE "/proc/sys/fs/file-nr"
#define FINODE_STATE PRE "/proc/sys/fs/inode-state"
--
2.19.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/xielhxie/sysstat.git
[email protected]:xielhxie/sysstat.git
xielhxie
sysstat
sysstat
master

搜索帮助