diff options
author | Bixuan Cui <cuibixuan@linux.alibaba.com> | 2023-02-27 10:55:24 +0800 |
---|---|---|
committer | Tony Luck <tony.luck@intel.com> | 2023-02-27 09:20:00 -0800 |
commit | 507960843a49fb955bc4b4e6548618eec592ec09 (patch) | |
tree | b147913e2163e8d0610ec6974a270db34898e0e6 | |
parent | bfacfa2af3e04b51e39c5cbbf45ad6ac9c23a1b3 (diff) | |
download | ras-tools-507960843a49fb955bc4b4e6548618eec592ec09.tar.gz |
einj_mem_uc: Support before 3.14 kernel
Run einj_mem_uc in 3.10 kernel:
./einj_mem_uc: cannot open '/sys/kernel/debug/apei/einj/flags'
The 'flags' is added by 3482fb5e0c1c (ACPI, APEI, EINJ: Changes to the
ACPI/APEI/EINJ debugfs interface) on 3.14 kernel. Add kernel version
check.
Signed-off-by: Bixuan Cui <cuibixuan@linux.alibaba.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
-rw-r--r-- | einj_mem_uc.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/einj_mem_uc.c b/einj_mem_uc.c index 3bb2d39..acc64fd 100644 --- a/einj_mem_uc.c +++ b/einj_mem_uc.c @@ -27,6 +27,7 @@ #include <linux/futex.h> #include <pthread.h> #include <sys/wait.h> +#include <linux/version.h> #ifndef MAP_HUGETLB #define MAP_HUGETLB 0x40000 @@ -110,6 +111,11 @@ static void wfile(char *file, unsigned long long val) exit(1); } +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,14,0) + if (!strcmp(file, EINJ_FLAGS)) + return; +#endif + fp = fopen(file, "w"); if (fp == NULL) { fprintf(stderr, "%s: cannot open '%s'\n", progname, file); |