blob: f43a22aa8ba8516e59d06422f609a5c5ec2cb880 [file] [log] [blame]
Andrew Geisslerc723b722021-01-08 16:14:09 -06001From 9f0d5996bbb2db3679a4075fa8301750b786c03b Mon Sep 17 00:00:00 2001
Brad Bishop19323692019-04-05 15:28:33 -04002From: Chen Qi <Qi.Chen@windriver.com>
3Date: Mon, 25 Feb 2019 13:55:12 +0800
Andrew Geisslerc723b722021-01-08 16:14:09 -06004Subject: [PATCH 03/26] missing_type.h: add __compare_fn_t and comparison_fn_t
Brad Bishop19323692019-04-05 15:28:33 -04005
6Make it work with musl where comparison_fn_t and __compare_fn_t
7is not provided.
8
9Upstream-Status: Inappropriate [musl specific]
10
Andrew Geissler82c905d2020-04-13 13:39:40 -050011Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
12[Rebased for v244]
Brad Bishop19323692019-04-05 15:28:33 -040013Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Brad Bishopc342db32019-05-15 21:57:59 -040014[Rebased for v242]
15Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
Brad Bishop19323692019-04-05 15:28:33 -040016---
17 src/basic/missing_type.h | 9 +++++++++
Brad Bishopc342db32019-05-15 21:57:59 -040018 src/basic/sort-util.h | 1 +
Andrew Geissler82c905d2020-04-13 13:39:40 -050019 src/core/kmod-setup.c | 1 +
Brad Bishop19323692019-04-05 15:28:33 -040020 src/journal/catalog.c | 1 +
Andrew Geissler82c905d2020-04-13 13:39:40 -050021 4 files changed, 12 insertions(+)
Brad Bishop19323692019-04-05 15:28:33 -040022
23diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h
Andrew Geisslerc723b722021-01-08 16:14:09 -060024index f6233090a9..aeaf6ad5ec 100644
Brad Bishop19323692019-04-05 15:28:33 -040025--- a/src/basic/missing_type.h
26+++ b/src/basic/missing_type.h
27@@ -10,3 +10,12 @@
28 #if !HAVE_CHAR16_T
29 #define char16_t uint16_t
30 #endif
31+
32+#ifndef __GLIBC__
33+typedef int (*comparison_fn_t)(const void *, const void *);
34+#endif
35+
36+#ifndef __COMPAR_FN_T
37+#define __COMPAR_FN_T
38+typedef int (*__compar_fn_t)(const void *, const void *);
39+#endif
Brad Bishopc342db32019-05-15 21:57:59 -040040diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h
Andrew Geisslerc723b722021-01-08 16:14:09 -060041index 3394c9eb72..d9cb2aecb6 100644
Brad Bishopc342db32019-05-15 21:57:59 -040042--- a/src/basic/sort-util.h
43+++ b/src/basic/sort-util.h
44@@ -4,6 +4,7 @@
45 #include <stdlib.h>
46
Brad Bishop19323692019-04-05 15:28:33 -040047 #include "macro.h"
Andrew Geissler82c905d2020-04-13 13:39:40 -050048+#include "missing_type.h"
Brad Bishop19323692019-04-05 15:28:33 -040049
Brad Bishopc342db32019-05-15 21:57:59 -040050 void *xbsearch_r(const void *key, const void *base, size_t nmemb, size_t size,
51 __compar_d_fn_t compar, void *arg);
Andrew Geissler82c905d2020-04-13 13:39:40 -050052diff --git a/src/core/kmod-setup.c b/src/core/kmod-setup.c
Andrew Geisslerc723b722021-01-08 16:14:09 -060053index 8a7f82812a..a56f12f47f 100644
Andrew Geissler82c905d2020-04-13 13:39:40 -050054--- a/src/core/kmod-setup.c
55+++ b/src/core/kmod-setup.c
56@@ -10,6 +10,7 @@
57 #include "kmod-setup.h"
58 #include "macro.h"
59 #include "string-util.h"
60+#include "missing_type.h"
61
62 #if HAVE_KMOD
63 #include "module-util.h"
Brad Bishop19323692019-04-05 15:28:33 -040064diff --git a/src/journal/catalog.c b/src/journal/catalog.c
Andrew Geisslerc723b722021-01-08 16:14:09 -060065index 0f6ad8a29e..4e1077ade4 100644
Brad Bishop19323692019-04-05 15:28:33 -040066--- a/src/journal/catalog.c
67+++ b/src/journal/catalog.c
Andrew Geissler82c905d2020-04-13 13:39:40 -050068@@ -28,6 +28,7 @@
Brad Bishopc342db32019-05-15 21:57:59 -040069 #include "string-util.h"
Brad Bishop19323692019-04-05 15:28:33 -040070 #include "strv.h"
71 #include "tmpfile-util.h"
Andrew Geissler82c905d2020-04-13 13:39:40 -050072+#include "missing_type.h"
Brad Bishop19323692019-04-05 15:28:33 -040073
74 const char * const catalog_file_dirs[] = {
75 "/usr/local/lib/systemd/catalog/",
Andrew Geisslerc723b722021-01-08 16:14:09 -060076--
772.27.0
78