Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 1 | From 3b42a888685aee1776a12cff84a5fe0063378483 Mon Sep 17 00:00:00 2001 |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 2 | From: Chen Qi <Qi.Chen@windriver.com> |
| 3 | Date: Mon, 25 Feb 2019 13:55:12 +0800 |
William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame] | 4 | Subject: [PATCH] missing_type.h: add __compare_fn_t and comparison_fn_t |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 5 | |
| 6 | Make it work with musl where comparison_fn_t and __compare_fn_t |
| 7 | is not provided. |
| 8 | |
| 9 | Upstream-Status: Inappropriate [musl specific] |
| 10 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 11 | Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> |
| 12 | [Rebased for v244] |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 13 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 14 | [Rebased for v242] |
| 15 | Signed-off-by: Andrej Valek <andrej.valek@siemens.com> |
William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame] | 16 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 17 | --- |
William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame] | 18 | 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 Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 22 | 4 files changed, 12 insertions(+) |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 23 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 24 | --- 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 Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 39 | --- a/src/basic/sort-util.h |
| 40 | +++ b/src/basic/sort-util.h |
| 41 | @@ -4,6 +4,7 @@ |
| 42 | #include <stdlib.h> |
| 43 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 44 | #include "macro.h" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 45 | +#include "missing_type.h" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 46 | |
Andrew Geissler | 7e0e3c0 | 2022-02-25 20:34:39 +0000 | [diff] [blame^] | 47 | /* 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 Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 49 | --- a/src/core/kmod-setup.c |
| 50 | +++ b/src/core/kmod-setup.c |
| 51 | @@ -10,6 +10,7 @@ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 52 | #include "macro.h" |
Andrew Geissler | 7e0e3c0 | 2022-02-25 20:34:39 +0000 | [diff] [blame^] | 53 | #include "recurse-dir.h" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 54 | #include "string-util.h" |
| 55 | +#include "missing_type.h" |
| 56 | |
| 57 | #if HAVE_KMOD |
| 58 | #include "module-util.h" |
William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame] | 59 | --- a/src/libsystemd/sd-journal/catalog.c |
| 60 | +++ b/src/libsystemd/sd-journal/catalog.c |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 61 | @@ -28,6 +28,7 @@ |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 62 | #include "string-util.h" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 63 | #include "strv.h" |
| 64 | #include "tmpfile-util.h" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 65 | +#include "missing_type.h" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 66 | |
| 67 | const char * const catalog_file_dirs[] = { |
| 68 | "/usr/local/lib/systemd/catalog/", |