diff options
Diffstat (limited to 'user/networkmanager/musl.patch')
-rw-r--r-- | user/networkmanager/musl.patch | 223 |
1 files changed, 223 insertions, 0 deletions
diff --git a/user/networkmanager/musl.patch b/user/networkmanager/musl.patch new file mode 100644 index 000000000..2e4370969 --- /dev/null +++ b/user/networkmanager/musl.patch @@ -0,0 +1,223 @@ +Misc header fixes for compatibility with musl libc. + +diff --git a/shared/systemd/src/basic/stdio-util.h b/shared/systemd/src/basic/stdio-util.h +index c3b9448..e80a938 100644 +--- a/shared/systemd/src/basic/stdio-util.h ++++ b/shared/systemd/src/basic/stdio-util.h +@@ -1,7 +1,9 @@ + /* SPDX-License-Identifier: LGPL-2.1+ */ + #pragma once + ++#if defined(__GLIBC__) + #include <printf.h> ++#endif + #include <stdarg.h> + #include <stdio.h> + #include <sys/types.h> +diff --git a/shared/systemd/src/basic/sort-util.h b/shared/systemd/src/basic/sort-util.h +index e029f86..935f136 100644 +--- a/shared/systemd/src/basic/sort-util.h ++++ b/shared/systemd/src/basic/sort-util.h +@@ -5,6 +5,13 @@ + + #include "macro.h" + ++#ifndef __COMPAR_FN_T ++# define __COMPAR_FN_T ++typedef int (*__compar_fn_t) (const void *, const void *); ++typedef __compar_fn_t comparison_fn_t; ++typedef int (*__compar_d_fn_t) (const void *, const void *, void *); ++#endif ++ + void *xbsearch_r(const void *key, const void *base, size_t nmemb, size_t size, + __compar_d_fn_t compar, void *arg); + +diff --git a/shared/systemd/src/basic/util.h b/shared/systemd/src/basic/util.h +index 25e6ab8..7967e8a 100644 +--- a/shared/systemd/src/basic/util.h ++++ b/shared/systemd/src/basic/util.h +@@ -46,6 +46,12 @@ static inline unsigned u64log2(uint64_t n) { + #endif + } + ++#if !defined(__GLIBC__) ++typedef int (*__compar_fn_t) (const void*, const void*); ++typedef __compar_fn_t comparison_fn_t; ++typedef int (*__compar_d_fn_t) (const void *, const void *, void *); ++#endif ++ + static inline unsigned u32ctz(uint32_t n) { + #if __SIZEOF_INT__ == 4 + return n != 0 ? __builtin_ctz(n) : 32; +diff --git a/libnm-core/nm-utils.h b/libnm-core/nm-utils.h +index 2b5baba..976850c 100644 +--- a/libnm-core/nm-utils.h ++++ b/libnm-core/nm-utils.h +@@ -30,7 +30,11 @@ + #include <netinet/in.h> + + /* For ETH_ALEN and INFINIBAND_ALEN */ ++#if defined(__GLIBC__) + #include <linux/if_ether.h> ++#else ++#define ETH_ALEN 6 /* Octets in one ethernet addr */ ++#endif + #include <linux/if_infiniband.h> + + #include "nm-core-enum-types.h" +diff --git a/shared/systemd/src/basic/socket-util.h b/shared/systemd/src/basic/socket-util.h +index d2246a8..4cb0807 100644 +--- a/shared/systemd/src/basic/socket-util.h ++++ b/shared/systemd/src/basic/socket-util.h +@@ -12,6 +12,11 @@ + #include <sys/socket.h> + #include <sys/types.h> + #include <sys/un.h> ++#if !defined(__GLIBC__) ++/* SIOCGSTAMPNS from linux/asm-generic.h ++ * for src/systemd/src/libsystemd-network/sd-lldp.c */ ++#include <linux/sockios.h> ++#endif + + #include "macro.h" + #include "missing_socket.h" +diff --git a/src/platform/wifi/nm-wifi-utils.h b/src/platform/wifi/nm-wifi-utils.h +index 36148b5..d282eb2 100644 +--- a/src/platform/wifi/nm-wifi-utils.h ++++ b/src/platform/wifi/nm-wifi-utils.h +@@ -22,7 +22,11 @@ + #ifndef __WIFI_UTILS_H__ + #define __WIFI_UTILS_H__ + ++#if defined(__GLIBC__) + #include <net/ethernet.h> ++#else /* musl libc */ ++#define ETH_ALEN 6 /* Octets in one ethernet addr */ ++#endif + + #include "nm-dbus-interface.h" + #include "nm-setting-wireless.h" +diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c +index 7514fa7..f041382 100644 +--- a/src/devices/nm-device.c ++++ b/src/devices/nm-device.c +@@ -32,7 +32,11 @@ + #include <arpa/inet.h> + #include <fcntl.h> + #include <linux/if_addr.h> ++#if defined(__GLIBC__) + #include <linux/if_arp.h> ++#else ++#include <linux/if.h> ++#endif + #include <linux/rtnetlink.h> + #include <linux/pkt_sched.h> + +diff --git a/src/nm-manager.c b/src/nm-manager.c +index 0bf6a75..e392507 100644 +--- a/src/nm-manager.c ++++ b/src/nm-manager.c +@@ -26,6 +26,7 @@ + #include <stdlib.h> + #include <fcntl.h> + #include <unistd.h> ++#include <asm/types.h> + + #include "nm-utils/nm-c-list.h" + +--- NetworkManager-1.18.1/shared/systemd/src/basic/fs-util.h.old 2019-04-18 09:19:11.000000000 +0000 ++++ NetworkManager-1.18.1/shared/systemd/src/basic/fs-util.h 2019-05-10 06:02:21.493921788 +0000 +@@ -7,6 +7,7 @@ + #include <stdbool.h> + #include <stdint.h> + #include <sys/inotify.h> ++#include <sys/stat.h> + #include <sys/types.h> + #include <unistd.h> + +diff --git a/src/systemd/sd-adapt-core/nm-sd-adapt-core.h b/src/systemd/sd-adapt-core/nm-sd-adapt-core.h +index 8c07c53..d043afc 100644 +--- a/src/systemd/sd-adapt-core/nm-sd-adapt-core.h ++++ b/src/systemd/sd-adapt-core/nm-sd-adapt-core.h +@@ -65,7 +65,7 @@ + # ifdef HAVE___SECURE_GETENV + # define secure_getenv __secure_getenv + # else +-# error neither secure_getenv nor __secure_getenv is available ++# define secure_getenv getenv + # endif + #endif + +--- NetworkManager-1.18.1/src/platform/nm-linux-platform.c.old 2019-04-19 09:31:51.000000000 +0000 ++++ NetworkManager-1.18.1/src/platform/nm-linux-platform.c 2019-05-10 07:21:32.665163629 +0000 +@@ -20,6 +20,7 @@ + #include "nm-default.h" + + #include "nm-linux-platform.h" ++#include "wpan/nm-wpan-utils.h" + + #include <arpa/inet.h> + #include <dlfcn.h> +@@ -28,7 +29,11 @@ + #include <libudev.h> + #include <linux/fib_rules.h> + #include <linux/ip.h> ++#ifdef __GLIBC__ + #include <linux/if_arp.h> ++#else ++#include <linux/if.h> ++#endif + #include <linux/if_bridge.h> + #include <linux/if_link.h> + #include <linux/if_tun.h> +@@ -57,7 +62,6 @@ + #include "nm-platform-private.h" + #include "wifi/nm-wifi-utils.h" + #include "wifi/nm-wifi-utils-wext.h" +-#include "wpan/nm-wpan-utils.h" + #include "nm-glib-aux/nm-io-utils.h" + #include "nm-udev-aux/nm-udev-utils.h" + +diff --git a/shared/systemd/src/basic/process-util.c b/shared/systemd/src/basic/process-util.c +index b0afb5c..f72e346 100644 +--- a/shared/systemd/src/basic/process-util.c ++++ b/shared/systemd/src/basic/process-util.c +@@ -21,6 +21,9 @@ + #include <sys/wait.h> + #include <syslog.h> + #include <unistd.h> ++#ifndef __GLIBC__ ++#include <pthread.h> ++#endif + #if 0 /* NM_IGNORED */ + #if HAVE_VALGRIND_VALGRIND_H + #include <valgrind/valgrind.h> +@@ -1168,11 +1171,13 @@ void reset_cached_pid(void) { + cached_pid = CACHED_PID_UNSET; + } + ++#ifdef __GLIBC__ + /* We use glibc __register_atfork() + __dso_handle directly here, as they are not included in the glibc + * headers. __register_atfork() is mostly equivalent to pthread_atfork(), but doesn't require us to link against + * libpthread, as it is part of glibc anyway. */ + extern int __register_atfork(void (*prepare) (void), void (*parent) (void), void (*child) (void), void *dso_handle); + extern void* __dso_handle _weak_; ++#endif + + pid_t getpid_cached(void) { + static bool installed = false; +@@ -1201,7 +1206,12 @@ pid_t getpid_cached(void) { + * only half-documented (glibc doesn't document it but LSB does — though only superficially) + * we'll check for errors only in the most generic fashion possible. */ + +- if (__register_atfork(NULL, NULL, reset_cached_pid, __dso_handle) != 0) { ++ #ifdef __GLIBC__ ++ if (__register_atfork(NULL, NULL, reset_cached_pid, __dso_handle) != 0) { ++ #else ++ if (pthread_atfork(NULL, NULL, reset_cached_pid) != 0) { ++ #endif ++ + /* OOM? Let's try again later */ + cached_pid = CACHED_PID_UNSET; + return new_pid; + |