aboutsummaryrefslogtreecommitdiffstats
path: root/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0009-vmcore-dmesg.c-work-around-missing-imaxdiv.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0009-vmcore-dmesg.c-work-around-missing-imaxdiv.patch')
-rw-r--r--meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0009-vmcore-dmesg.c-work-around-missing-imaxdiv.patch57
1 files changed, 57 insertions, 0 deletions
diff --git a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0009-vmcore-dmesg.c-work-around-missing-imaxdiv.patch b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0009-vmcore-dmesg.c-work-around-missing-imaxdiv.patch
new file mode 100644
index 0000000000..df980b118e
--- /dev/null
+++ b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/0009-vmcore-dmesg.c-work-around-missing-imaxdiv.patch
@@ -0,0 +1,57 @@
+From ad598a71ffff6f86462211f252ac0c7b5de53869 Mon Sep 17 00:00:00 2001
+From: Andrea Adami <andrea.adami@gmail.com>
+Date: Tue, 17 Apr 2018 13:14:12 +0200
+Subject: [PATCH] vmcore-dmesg.c: work around missing imaxdiv()
+
+Convert to integer arithmetic for klibc.
+
+Fix
+
+ vmcore-dmesg.c: In function 'dump_dmesg_structured':
+ vmcore-dmesg.c:578:2: error: unknown type name 'imaxdiv_t'
+
+Upstream-Status: Inappropriate [klibc specific]
+Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
+
+---
+ vmcore-dmesg/vmcore-dmesg.c | 13 ++++++++++++-
+ 1 file changed, 12 insertions(+), 1 deletion(-)
+
+diff --git a/vmcore-dmesg/vmcore-dmesg.c b/vmcore-dmesg/vmcore-dmesg.c
+index e340ef4..1b27b71 100644
+--- a/vmcore-dmesg/vmcore-dmesg.c
++++ b/vmcore-dmesg/vmcore-dmesg.c
+@@ -575,8 +575,11 @@ static void dump_dmesg_structured(int fd)
+ ssize_t ret;
+ char *msg;
+ uint16_t text_len;
++#ifndef __KLIBC__
+ imaxdiv_t imaxdiv_sec, imaxdiv_usec;
+-
++#else
++ int64_t imaxdiv_sec, imaxdiv_usec;
++#endif
+ if (!log_buf_vaddr) {
+ fprintf(stderr, "Missing the log_buf symbol\n");
+ exit(60);
+@@ -645,12 +648,20 @@ static void dump_dmesg_structured(int fd)
+ exit(65);
+ }
+ ts_nsec = struct_val_u64(buf, log_offset_ts_nsec);
++#ifndef __KLIBC__
+ imaxdiv_sec = imaxdiv(ts_nsec, 1000000000);
+ imaxdiv_usec = imaxdiv(imaxdiv_sec.rem, 1000);
+
+ len += sprintf(out_buf + len, "[%5llu.%06llu] ",
+ (long long unsigned int)imaxdiv_sec.quot,
+ (long long unsigned int)imaxdiv_usec.quot);
++#else
++ imaxdiv_sec = ts_nsec / 1000000000;
++ imaxdiv_usec = (ts_nsec % 1000000000) / 1000;
++ len += sprintf(out_buf + len, "[%5llu.%06llu] ",
++ (long long unsigned int)imaxdiv_sec,
++ (long long unsigned int)imaxdiv_usec);
++#endif
+
+ /* escape non-printable characters */
+ text_len = struct_val_u16(buf, log_offset_text_len);