kexec-tools-klibc: fix kexec_load() syscall workaround

As soon as klibc adds kexec_file_load() syscall we can rework this patch.

Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Andrea Adami
2018-08-31 15:40:54 +02:00
committed by Khem Raj
parent e8b9543fb9
commit b5d062af3d
@@ -1,6 +1,6 @@
From e6aa1f18dc44dc71be3ceada2a96383d22454399 Mon Sep 17 00:00:00 2001 From 45a80fe7d247898d83edfeabe32b9de80a50a6be Mon Sep 17 00:00:00 2001
From: Andrea Adami <andrea.adami@gmail.com> From: Andrea Adami <andrea.adami@gmail.com>
Date: Thu, 19 Apr 2018 00:25:01 +0200 Date: Fri, 31 Aug 2018 11:33:51 +0200
Subject: [PATCH] kexec-syscall.h: work around missing syscall() wrapper Subject: [PATCH] kexec-syscall.h: work around missing syscall() wrapper
Fix Fix
@@ -12,26 +12,31 @@ Upstream-Status: Inappropriate [klibc specific]
Signed-off-by: Andrea Adami <andrea.adami@gmail.com> Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
--- ---
kexec/kexec-syscall.h | 8 ++++++++ kexec/kexec-syscall.h | 9 +++++++++
1 file changed, 8 insertions(+) 1 file changed, 9 insertions(+)
diff --git a/kexec/kexec-syscall.h b/kexec/kexec-syscall.h diff --git a/kexec/kexec-syscall.h b/kexec/kexec-syscall.h
index 33638c2..6b633e4 100644 index 33638c2..b4bd63c 100644
--- a/kexec/kexec-syscall.h --- a/kexec/kexec-syscall.h
+++ b/kexec/kexec-syscall.h +++ b/kexec/kexec-syscall.h
@@ -77,7 +77,11 @@ struct kexec_segment; @@ -74,11 +74,16 @@
struct kexec_segment;
+#ifndef __KLIBC__
static inline long kexec_load(void *entry, unsigned long nr_segments, static inline long kexec_load(void *entry, unsigned long nr_segments,
struct kexec_segment *segments, unsigned long flags) struct kexec_segment *segments, unsigned long flags)
{ {
+#ifndef __KLIBC__
return (long) syscall(__NR_kexec_load, entry, nr_segments, segments, flags); return (long) syscall(__NR_kexec_load, entry, nr_segments, segments, flags);
+#else
+ return (long) kexec_load(entry, nr_segments, segments, flags);
+#endif
} }
+#else
+extern long kexec_load(void *entry, unsigned long nr_segments,
+ struct kexec_segment *segments, unsigned long flags);
+#endif
static inline int is_kexec_file_load_implemented(void) { static inline int is_kexec_file_load_implemented(void) {
@@ -90,8 +94,12 @@ static inline long kexec_file_load(int kernel_fd, int initrd_fd, if (__NR_kexec_file_load != 0xffffffff)
@@ -90,8 +95,12 @@ static inline long kexec_file_load(int kernel_fd, int initrd_fd,
unsigned long cmdline_len, const char *cmdline_ptr, unsigned long cmdline_len, const char *cmdline_ptr,
unsigned long flags) unsigned long flags)
{ {