From 3b42a888685aee1776a12cff84a5fe0063378483 Mon Sep 17 00:00:00 2001 From: Chen Qi Date: Mon, 25 Feb 2019 13:55:12 +0800 Subject: [PATCH] missing_type.h: add __compare_fn_t and comparison_fn_t Make it work with musl where comparison_fn_t and __compare_fn_t is not provided. Upstream-Status: Inappropriate [musl specific] Signed-off-by: Alex Kiernan [Rebased for v244] Signed-off-by: Chen Qi [Rebased for v242] Signed-off-by: Andrej Valek --- src/basic/missing_type.h | 9 +++++++++ src/basic/sort-util.h | 1 + src/core/kmod-setup.c | 1 + src/libsystemd/sd-journal/catalog.c | 1 + 4 files changed, 12 insertions(+) --- a/src/basic/missing_type.h +++ b/src/basic/missing_type.h @@ -10,3 +10,12 @@ #if !HAVE_CHAR16_T #define char16_t uint16_t #endif + +#ifndef __GLIBC__ +typedef int (*comparison_fn_t)(const void *, const void *); +#endif + +#ifndef __COMPAR_FN_T +#define __COMPAR_FN_T +typedef int (*__compar_fn_t)(const void *, const void *); +#endif --- a/src/basic/sort-util.h +++ b/src/basic/sort-util.h @@ -4,6 +4,7 @@ #include #include "macro.h" +#include "missing_type.h" /* This is the same as glibc's internal __compar_d_fn_t type. glibc exports a public comparison_fn_t, for the * external type __compar_fn_t, but doesn't do anything similar for __compar_d_fn_t. Let's hence do that --- a/src/core/kmod-setup.c +++ b/src/core/kmod-setup.c @@ -10,6 +10,7 @@ #include "macro.h" #include "recurse-dir.h" #include "string-util.h" +#include "missing_type.h" #if HAVE_KMOD #include "module-util.h" --- a/src/libsystemd/sd-journal/catalog.c +++ b/src/libsystemd/sd-journal/catalog.c @@ -28,6 +28,7 @@ #include "string-util.h" #include "strv.h" #include "tmpfile-util.h" +#include "missing_type.h" const char * const catalog_file_dirs[] = { "/usr/local/lib/systemd/catalog/",