1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
|
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
@@ -30,6 +30,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
@@ -15,7 +15,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
@@ -13,6 +13,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
@@ -7,7 +7,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
@@ -17,7 +17,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
@@ -15,6 +15,7 @@
#include <sys/stat.h>
#include <sys/sendfile.h>
#include <limits.h>
+#include <asm/types.h>
#include "nm-glib-aux/nm-c-list.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
@@ -50,7 +50,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
@@ -6,6 +6,7 @@
#include "nm-default.h"
#include "nm-linux-platform.h"
+#include "wpan/nm-wpan-utils.h"
#include <arpa/inet.h>
#include <dlfcn.h>
@@ -14,7 +15,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>
@@ -44,7 +49,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
@@ -17,6 +17,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>
@@ -1123,11 +1126,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;
@@ -1156,7 +1161,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;
--- NetworkManager-1.20.0/src/systemd/src/libsystemd-network/sd-dhcp6-client.c.old 2019-08-06 10:22:09.000000000 +0000
+++ NetworkManager-1.20.0/src/systemd/src/libsystemd-network/sd-dhcp6-client.c 2019-08-09 05:17:18.249955730 +0000
@@ -7,7 +7,7 @@
#include <errno.h>
#include <string.h>
#include <sys/ioctl.h>
-#include <linux/if_arp.h>
+#include <net/if_arp.h>
#include <linux/if_infiniband.h>
#include "sd-dhcp6-client.h"
|