blob: f3edc7d82b6d3ba4c651438cc2584f5cb5344dfa [file] [log] [blame]
Andrew Geissler595f6302022-01-24 19:11:47 +00001From 3b42a888685aee1776a12cff84a5fe0063378483 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
William A. Kennington IIIac69b482021-06-02 12:28:27 -07004Subject: [PATCH] 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>
William A. Kennington IIIac69b482021-06-02 12:28:27 -070016
Brad Bishop19323692019-04-05 15:28:33 -040017---
William A. Kennington IIIac69b482021-06-02 12:28:27 -070018 src/basic/missing_type.h | 9 +++++++++
19 src/basic/sort-util.h | 1 +
20 src/core/kmod-setup.c | 1 +
21 src/libsystemd/sd-journal/catalog.c | 1 +
Andrew Geissler82c905d2020-04-13 13:39:40 -050022 4 files changed, 12 insertions(+)
Brad Bishop19323692019-04-05 15:28:33 -040023
Brad Bishop19323692019-04-05 15:28:33 -040024--- a/src/basic/missing_type.h
25+++ b/src/basic/missing_type.h
26@@ -10,3 +10,12 @@
27 #if !HAVE_CHAR16_T
28 #define char16_t uint16_t
29 #endif
30+
31+#ifndef __GLIBC__
32+typedef int (*comparison_fn_t)(const void *, const void *);
33+#endif
34+
35+#ifndef __COMPAR_FN_T
36+#define __COMPAR_FN_T
37+typedef int (*__compar_fn_t)(const void *, const void *);
38+#endif
Brad Bishopc342db32019-05-15 21:57:59 -040039--- a/src/basic/sort-util.h
40+++ b/src/basic/sort-util.h
41@@ -4,6 +4,7 @@
42 #include <stdlib.h>
43
Brad Bishop19323692019-04-05 15:28:33 -040044 #include "macro.h"
Andrew Geissler82c905d2020-04-13 13:39:40 -050045+#include "missing_type.h"
Brad Bishop19323692019-04-05 15:28:33 -040046
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000047 /* This is the same as glibc's internal __compar_d_fn_t type. glibc exports a public comparison_fn_t, for the
48 * external type __compar_fn_t, but doesn't do anything similar for __compar_d_fn_t. Let's hence do that
Andrew Geissler82c905d2020-04-13 13:39:40 -050049--- a/src/core/kmod-setup.c
50+++ b/src/core/kmod-setup.c
51@@ -10,6 +10,7 @@
Andrew Geissler82c905d2020-04-13 13:39:40 -050052 #include "macro.h"
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000053 #include "recurse-dir.h"
Andrew Geissler82c905d2020-04-13 13:39:40 -050054 #include "string-util.h"
55+#include "missing_type.h"
56
57 #if HAVE_KMOD
58 #include "module-util.h"
William A. Kennington IIIac69b482021-06-02 12:28:27 -070059--- a/src/libsystemd/sd-journal/catalog.c
60+++ b/src/libsystemd/sd-journal/catalog.c
Andrew Geissler82c905d2020-04-13 13:39:40 -050061@@ -28,6 +28,7 @@
Brad Bishopc342db32019-05-15 21:57:59 -040062 #include "string-util.h"
Brad Bishop19323692019-04-05 15:28:33 -040063 #include "strv.h"
64 #include "tmpfile-util.h"
Andrew Geissler82c905d2020-04-13 13:39:40 -050065+#include "missing_type.h"
Brad Bishop19323692019-04-05 15:28:33 -040066
67 const char * const catalog_file_dirs[] = {
68 "/usr/local/lib/systemd/catalog/",