include windows.h globally in libnetdata (#18878)
* include windows.h globally in libnetdata * LF newlines * global static variable only if needed * remove individual includes of windows.h and related headers * fixes for nt internals
Costa Tsaousis committed
Oct 27, 2024 at 14:33 UTC
c7b9f5235e41272b9b14229b85f26483240c2796
28 files changed
+483
-541
src/aclk/mqtt_websockets/mqtt_ng.c
+19
-19
@@ -64,12 +64,12 @@ struct transaction_buffer {
64
};
65
66
enum mqtt_client_state {
67
- RAW = 0,
68
- CONNECT_PENDING,
69
- CONNECTING,
70
- CONNECTED,
71
- ERROR,
72
- DISCONNECTED
67
+ MQTT_STATE_RAW = 0,
68
+ MQTT_STATE_CONNECT_PENDING,
69
+ MQTT_STATE_CONNECTING,
70
+ MQTT_STATE_CONNECTED,
71
+ MQTT_STATE_ERROR,
72
+ MQTT_STATE_DISCONNECTED
73
};
74
75
enum parser_state {
@@ -957,7 +957,7 @@ int mqtt_ng_connect(struct mqtt_ng_client *client,
957
uint8_t clean_start,
958
uint16_t keep_alive)
959
{
960
- client->client_state = RAW;
960
+ client->client_state = MQTT_STATE_RAW;
961
client->parser.state = MQTT_PARSE_FIXED_HEADER_PACKET_TYPE;
962
963
LOCK_HDR_BUFFER(&client->main_buffer);
@@ -992,7 +992,7 @@ int mqtt_ng_connect(struct mqtt_ng_client *client,
992
client->stats.rx_messages_rcvd = 0;
993
spinlock_unlock(&client->stats_spinlock);
994
995
- client->client_state = CONNECT_PENDING;
995
+ client->client_state = MQTT_STATE_CONNECT_PENDING;
996
return 0;
997
}
998
@@ -1834,12 +1834,12 @@ static int parse_data(struct mqtt_ng_client *client)
1834
// return -1 on error
1835
// return 0 if there is fragment set
1836
static int mqtt_ng_next_to_send(struct mqtt_ng_client *client) {
1837
- if (client->client_state == CONNECT_PENDING) {
1837
+ if (client->client_state == MQTT_STATE_CONNECT_PENDING) {
1838
client->main_buffer.sending_frag = client->connect_msg;
1839
- client->client_state = CONNECTING;
1839
+ client->client_state = MQTT_STATE_CONNECTING;
1840
return 0;
1841
}
1842
- if (client->client_state != CONNECTED)
1842
+ if (client->client_state != MQTT_STATE_CONNECTED)
1843
return -1;
1844
1845
struct buffer_fragment *frag = BUFFER_FIRST_FRAG(&client->main_buffer.hdr_buffer);
@@ -1970,9 +1970,9 @@ int handle_incoming_traffic(struct mqtt_ng_client *client)
1970
1971
client->connect_msg = NULL;
1972
1973
- if (client->client_state != CONNECTING) {
1973
+ if (client->client_state != MQTT_STATE_CONNECTING) {
1974
nd_log(NDLS_DAEMON, NDLP_ERR, "Received unexpected CONNACK");
1975
- client->client_state = ERROR;
1975
+ client->client_state = MQTT_STATE_ERROR;
1976
return MQTT_NG_CLIENT_PROTOCOL_ERROR;
1977
}
1978
@@ -1985,10 +1985,10 @@ int handle_incoming_traffic(struct mqtt_ng_client *client)
1985
client->connack_callback(client->user_ctx, client->parser.mqtt_packet.connack.reason_code);
1986
if (!client->parser.mqtt_packet.connack.reason_code) {
1987
nd_log(NDLS_DAEMON, NDLP_INFO, "MQTT Connection Accepted By Server");
1988
- client->client_state = CONNECTED;
1988
+ client->client_state = MQTT_STATE_CONNECTED;
1989
break;
1990
}
1991
- client->client_state = ERROR;
1991
+ client->client_state = MQTT_STATE_ERROR;
1992
return MQTT_NG_CLIENT_SERVER_RETURNED_ERROR;
1993
1994
case MQTT_CPT_PUBACK:
@@ -2016,7 +2016,7 @@ int handle_incoming_traffic(struct mqtt_ng_client *client)
2016
}
2017
2018
if ( pub->qos == 1 && ((rc = mqtt_ng_puback(client, pub->packet_id, 0))) ) {
2019
- client->client_state = ERROR;
2019
+ client->client_state = MQTT_STATE_ERROR;
2020
nd_log(NDLS_DAEMON, NDLP_ERR, "Error generating PUBACK reply for PUBLISH");
2021
return rc;
2022
}
@@ -2050,7 +2050,7 @@ int handle_incoming_traffic(struct mqtt_ng_client *client)
2050
2051
case MQTT_CPT_DISCONNECT:
2052
nd_log(NDLS_DAEMON, NDLP_INFO, "Got MQTT DISCONNECT control packet from server. Reason code: %d", (int)client->parser.mqtt_packet.disconnect.reason_code);
2053
- client->client_state = DISCONNECTED;
2053
+ client->client_state = MQTT_STATE_DISCONNECTED;
2054
break;
2055
2056
default:
@@ -2063,10 +2063,10 @@ int handle_incoming_traffic(struct mqtt_ng_client *client)
2063
2064
int mqtt_ng_sync(struct mqtt_ng_client *client)
2065
{
2066
- if (client->client_state == RAW || client->client_state == DISCONNECTED)
2066
+ if (client->client_state == MQTT_STATE_RAW || client->client_state == MQTT_STATE_DISCONNECTED)
2067
return 0;
2068
2069
- if (client->client_state == ERROR)
2069
+ if (client->client_state == MQTT_STATE_ERROR)
2070
return 1;
2071
2072
LOCK_HDR_BUFFER(&client->main_buffer);
src/aclk/mqtt_websockets/ws_client.c
-5
@@ -5,11 +5,6 @@
5
#include "ws_client.h"
6
#include "common_internal.h"
7
8
-#ifdef OS_WINDOWS
9
-#include <windows.h>
10
-#include <bcrypt.h> // For BCryptGenRandom
11
-#endif
12
-
8
static uint32_t generate_random_32bit(void) {
9
uint32_t random_number = 0;
10
src/collectors/apps.plugin/apps_os_windows_nt.c
+41
-44
@@ -1,44 +1,41 @@
1
-// SPDX-License-Identifier: GPL-3.0-or-later
2
-
3
-// this must not include libnetdata.h because STRING is defined in winternl.h
4
-
5
-#include "config.h"
6
-#if defined(OS_WINDOWS)
7
-
8
-#include <windows.h>
9
-#include <winternl.h>
10
-#include <psapi.h>
11
-#include <stdint.h>
12
-
13
-// --------------------------------------------------------------------------------------------------------------------
14
-// Get the full windows command line
15
-
16
-WCHAR* GetProcessCommandLine(HANDLE hProcess) {
17
- PROCESS_BASIC_INFORMATION pbi;
18
- ULONG len;
19
- NTSTATUS status = NtQueryInformationProcess(hProcess, 0, &pbi, sizeof(pbi), &len);
20
- if (status != 0)
21
- return NULL;
22
-
23
- // The rest of the function remains the same as before
24
- PEB peb;
25
- if (!ReadProcessMemory(hProcess, pbi.PebBaseAddress, &peb, sizeof(peb), NULL))
26
- return NULL;
27
-
28
- RTL_USER_PROCESS_PARAMETERS procParams;
29
- if (!ReadProcessMemory(hProcess, peb.ProcessParameters, &procParams, sizeof(procParams), NULL))
30
- return NULL;
31
-
32
- WCHAR* commandLine = (WCHAR*)malloc(procParams.CommandLine.MaximumLength);
33
- if (!commandLine)
34
- return NULL;
35
-
36
- if (!ReadProcessMemory(hProcess, procParams.CommandLine.Buffer, commandLine, procParams.CommandLine.MaximumLength, NULL)) {
37
- free(commandLine);
38
- return NULL;
39
- }
40
-
41
- return commandLine;
42
-}
43
-
44
-#endif
1
+// SPDX-License-Identifier: GPL-3.0-or-later
2
+
3
+// this must not include libnetdata.h because STRING is defined in winternl.h
4
+
5
+#include "libnetdata/common.h"
6
+
7
+#if defined(OS_WINDOWS)
8
+#include <winternl.h>
9
+
10
+// --------------------------------------------------------------------------------------------------------------------
11
+// Get the full windows command line
12
+
13
+WCHAR* GetProcessCommandLine(HANDLE hProcess) {
14
+ PROCESS_BASIC_INFORMATION pbi;
15
+ ULONG len;
16
+ NTSTATUS status = NtQueryInformationProcess(hProcess, 0, &pbi, sizeof(pbi), &len);
17
+ if (status != 0)
18
+ return NULL;
19
+
20
+ // The rest of the function remains the same as before
21
+ PEB peb;
22
+ if (!ReadProcessMemory(hProcess, pbi.PebBaseAddress, &peb, sizeof(peb), NULL))
23
+ return NULL;
24
+
25
+ RTL_USER_PROCESS_PARAMETERS procParams;
26
+ if (!ReadProcessMemory(hProcess, peb.ProcessParameters, &procParams, sizeof(procParams), NULL))
27
+ return NULL;
28
+
29
+ WCHAR* commandLine = (WCHAR*)malloc(procParams.CommandLine.MaximumLength);
30
+ if (!commandLine)
31
+ return NULL;
32
+
33
+ if (!ReadProcessMemory(hProcess, procParams.CommandLine.Buffer, commandLine, procParams.CommandLine.MaximumLength, NULL)) {
34
+ free(commandLine);
35
+ return NULL;
36
+ }
37
+
38
+ return commandLine;
39
+}
40
+
41
+#endif
src/collectors/apps.plugin/apps_plugin.h
-2
@@ -85,8 +85,6 @@ struct pid_info {
85
#define OS_FUNCTION(func) OS_FUNC_CONCAT(func, _macos)
86
87
#elif defined(OS_WINDOWS)
88
-#include <windows.h>
89
-
88
#define OS_INIT_PID 0 // dynamic, is set during data collection
89
#define ALL_PIDS_ARE_READ_INSTANTLY 1
90
#define PROCESSES_HAVE_CPU_GUEST_TIME 0
src/collectors/windows-events.plugin/windows-events-unicode.h
-2
@@ -4,8 +4,6 @@
4
#define NETDATA_WINDOWS_EVENTS_UNICODE_H
5
6
#include "libnetdata/libnetdata.h"
7
-#include <windows.h>
8
-#include <wchar.h>
7
8
#define WINEVENT_NAME_KEYWORDS_SEPARATOR ", "
9
static inline void txt_utf8_add_keywords_separator_if_needed(TXT_UTF8 *dst) {
src/collectors/windows-events.plugin/windows-events.h
-3
@@ -5,9 +5,6 @@
5
6
#include "libnetdata/libnetdata.h"
7
#include "collectors/all.h"
8
-#include <windows.h>
9
-#include <winevt.h>
10
-#include <wchar.h>
8
9
typedef enum {
10
WEVT_NO_CHANNEL_MATCHED,
src/collectors/windows.plugin/perflib-rrd.c
-1
@@ -1,7 +1,6 @@
1
// SPDX-License-Identifier: GPL-3.0-or-later
2
3
#include "perflib-rrd.h"
4
-#include <windows.h>
4
5
#define COLLECTED_NUMBER_PRECISION 10000
6
src/collectors/windows.plugin/windows-internals.h
+1
-1
@@ -3,7 +3,7 @@
3
#ifndef NETDATA_WINDOWS_INTERNALS_H
4
#define NETDATA_WINDOWS_INTERNALS_H
5
6
-#include <windows.h>
6
+#include "libnetdata/common.h"
7
8
static inline ULONGLONG FileTimeToULL(FILETIME ft) {
9
ULARGE_INTEGER ul;
src/daemon/winsvc.cc
-2
@@ -8,8 +8,6 @@ void nd_process_signals(void);
8
9
}
10
11
-#include <windows.h>
12
-
11
__attribute__((format(printf, 1, 2)))
12
static void netdata_service_log(const char *fmt, ...)
13
{
src/libnetdata/common.h
+420
-394
@@ -1,394 +1,420 @@
1
-// SPDX-License-Identifier: GPL-3.0-or-later
2
-
3
-#ifndef LIBNETDATA_COMMON_H
4
-#define LIBNETDATA_COMMON_H
5
-
6
-# ifdef __cplusplus
7
-extern "C" {
8
-# endif
9
-
10
-#include "config.h"
11
-
12
-#if defined(NETDATA_DEV_MODE) && !defined(NETDATA_INTERNAL_CHECKS)
13
-#define NETDATA_INTERNAL_CHECKS 1
14
-#endif
15
-
16
-#ifndef SIZEOF_VOID_P
17
-#error SIZEOF_VOID_P is not defined
18
-#endif
19
-
20
-#if SIZEOF_VOID_P == 4
21
-#define ENV32BIT 1
22
-#else
23
-#define ENV64BIT 1
24
-#endif
25
-
26
-#ifdef HAVE_LIBDATACHANNEL
27
-#define ENABLE_WEBRTC 1
28
-#endif
29
-
30
-#define STRINGIFY(x) #x
31
-#define TOSTRING(x) STRINGIFY(x)
32
-
33
-// --------------------------------------------------------------------------------------------------------------------
34
-// NETDATA_OS_TYPE
35
-
36
-#if defined(__FreeBSD__)
37
-#include <pthread_np.h>
38
-#define NETDATA_OS_TYPE "freebsd"
39
-#elif defined(__APPLE__)
40
-#define NETDATA_OS_TYPE "macos"
41
-#elif defined(OS_WINDOWS)
42
-#define NETDATA_OS_TYPE "windows"
43
-#else
44
-#define NETDATA_OS_TYPE "linux"
45
-#endif /* __FreeBSD__, __APPLE__*/
46
-
47
-// --------------------------------------------------------------------------------------------------------------------
48
-// memory allocators
49
-
50
-/* select the memory allocator, based on autoconf findings */
51
-#if defined(ENABLE_JEMALLOC)
52
-
53
-#if defined(HAVE_JEMALLOC_JEMALLOC_H)
54
-#include <jemalloc/jemalloc.h>
55
-#else // !defined(HAVE_JEMALLOC_JEMALLOC_H)
56
-#include <malloc.h>
57
-#endif // !defined(HAVE_JEMALLOC_JEMALLOC_H)
58
-
59
-#elif defined(ENABLE_TCMALLOC)
60
-
61
-#include <google/tcmalloc.h>
62
-
63
-#else /* !defined(ENABLE_JEMALLOC) && !defined(ENABLE_TCMALLOC) */
64
-
65
-#if !(defined(__FreeBSD__) || defined(__APPLE__))
66
-#include <malloc.h>
67
-#endif /* __FreeBSD__ || __APPLE__ */
68
-
69
-#endif /* !defined(ENABLE_JEMALLOC) && !defined(ENABLE_TCMALLOC) */
70
-
71
-// --------------------------------------------------------------------------------------------------------------------
72
-
73
-#include <pthread.h>
74
-#include <errno.h>
75
-#include <stdbool.h>
76
-#include <stdio.h>
77
-#include <stdlib.h>
78
-#include <stdarg.h>
79
-#include <stddef.h>
80
-#include <ctype.h>
81
-#include <string.h>
82
-#include <strings.h>
83
-#include <libgen.h>
84
-#include <dirent.h>
85
-#include <fcntl.h>
86
-#include <getopt.h>
87
-#include <limits.h>
88
-#include <locale.h>
89
-#include <signal.h>
90
-#include <sys/time.h>
91
-#include <sys/types.h>
92
-#include <time.h>
93
-#include <unistd.h>
94
-#include <uv.h>
95
-#include <assert.h>
96
-
97
-#ifdef HAVE_ARPA_INET_H
98
-#include <arpa/inet.h>
99
-#endif
100
-
101
-#ifdef HAVE_NETINET_TCP_H
102
-#include <netinet/tcp.h>
103
-#endif
104
-
105
-#ifdef HAVE_SYS_IOCTL_H
106
-#include <sys/ioctl.h>
107
-#endif
108
-
109
-#ifdef HAVE_GRP_H
110
-#include <grp.h>
111
-#else
112
-typedef uint32_t gid_t;
113
-#endif
114
-
115
-#ifdef HAVE_PWD_H
116
-#include <pwd.h>
117
-#else
118
-typedef uint32_t uid_t;
119
-#endif
120
-
121
-#ifdef HAVE_NET_IF_H
122
-#include <net/if.h>
123
-#endif
124
-
125
-#ifdef HAVE_POLL_H
126
-#include <poll.h>
127
-#endif
128
-
129
-#ifdef HAVE_SYSLOG_H
130
-#include <syslog.h>
131
-#else
132
-/* priorities */
133
-#define LOG_EMERG 0 /* system is unusable */
134
-#define LOG_ALERT 1 /* action must be taken immediately */
135
-#define LOG_CRIT 2 /* critical conditions */
136
-#define LOG_ERR 3 /* error conditions */
137
-#define LOG_WARNING 4 /* warning conditions */
138
-#define LOG_NOTICE 5 /* normal but significant condition */
139
-#define LOG_INFO 6 /* informational */
140
-#define LOG_DEBUG 7 /* debug-level messages */
141
-
142
-/* facility codes */
143
-#define LOG_KERN (0<<3) /* kernel messages */
144
-#define LOG_USER (1<<3) /* random user-level messages */
145
-#define LOG_MAIL (2<<3) /* mail system */
146
-#define LOG_DAEMON (3<<3) /* system daemons */
147
-#define LOG_AUTH (4<<3) /* security/authorization messages */
148
-#define LOG_SYSLOG (5<<3) /* messages generated internally by syslogd */
149
-#define LOG_LPR (6<<3) /* line printer subsystem */
150
-#define LOG_NEWS (7<<3) /* network news subsystem */
151
-#define LOG_UUCP (8<<3) /* UUCP subsystem */
152
-#define LOG_CRON (9<<3) /* clock daemon */
153
-#define LOG_AUTHPRIV (10<<3) /* security/authorization messages (private) */
154
-#define LOG_FTP (11<<3) /* ftp daemon */
155
-
156
-/* other codes through 15 reserved for system use */
157
-#define LOG_LOCAL0 (16<<3) /* reserved for local use */
158
-#define LOG_LOCAL1 (17<<3) /* reserved for local use */
159
-#define LOG_LOCAL2 (18<<3) /* reserved for local use */
160
-#define LOG_LOCAL3 (19<<3) /* reserved for local use */
161
-#define LOG_LOCAL4 (20<<3) /* reserved for local use */
162
-#define LOG_LOCAL5 (21<<3) /* reserved for local use */
163
-#define LOG_LOCAL6 (22<<3) /* reserved for local use */
164
-#define LOG_LOCAL7 (23<<3) /* reserved for local use */
165
-#endif
166
-
167
-#ifdef HAVE_SYS_MMAN_H
168
-#include <sys/mman.h>
169
-#endif
170
-
171
-#ifdef HAVE_SYS_RESOURCE_H
172
-#include <sys/resource.h>
173
-#endif
174
-
175
-#ifdef HAVE_SYS_SOCKET_H
176
-#include <sys/socket.h>
177
-#endif
178
-
179
-#ifdef HAVE_SYS_WAIT_H
180
-#include <sys/wait.h>
181
-#endif
182
-
183
-#ifdef HAVE_SYS_UN_H
184
-#include <sys/un.h>
185
-#endif
186
-
187
-#ifdef HAVE_SPAWN_H
188
-#include <spawn.h>
189
-#endif
190
-
191
-#ifdef HAVE_NETINET_IN_H
192
-#include <netinet/in.h>
193
-#endif
194
-
195
-#ifdef HAVE_RESOLV_H
196
-#include <resolv.h>
197
-#endif
198
-
199
-#ifdef HAVE_NETDB_H
200
-#include <netdb.h>
201
-#endif
202
-
203
-#ifdef HAVE_SYS_PRCTL_H
204
-#include <sys/prctl.h>
205
-#endif
206
-
207
-#ifdef HAVE_SYS_STAT_H
208
-#include <sys/stat.h>
209
-#endif
210
-
211
-#ifdef HAVE_SYS_VFS_H
212
-#include <sys/vfs.h>
213
-#endif
214
-
215
-#ifdef HAVE_SYS_STATFS_H
216
-#include <sys/statfs.h>
217
-#endif
218
-
219
-#ifdef HAVE_LINUX_MAGIC_H
220
-#include <linux/magic.h>
221
-#endif
222
-
223
-#ifdef HAVE_SYS_MOUNT_H
224
-#include <sys/mount.h>
225
-#endif
226
-
227
-#ifdef HAVE_SYS_STATVFS_H
228
-#include <sys/statvfs.h>
229
-#endif
230
-
231
-// #1408
232
-#ifdef MAJOR_IN_MKDEV
233
-#include <sys/mkdev.h>
234
-#endif
235
-#ifdef MAJOR_IN_SYSMACROS
236
-#include <sys/sysmacros.h>
237
-#endif
238
-
239
-#include <math.h>
240
-#include <float.h>
241
-
242
-#if defined(HAVE_INTTYPES_H)
243
-#include <inttypes.h>
244
-#elif defined(HAVE_STDINT_H)
245
-#include <stdint.h>
246
-#endif
247
-
248
-#include <zlib.h>
249
-
250
-#ifdef HAVE_SYS_CAPABILITY_H
251
-#include <sys/capability.h>
252
-#endif
253
-
254
-#define XXH_INLINE_ALL
255
-#include "xxHash/xxhash.h"
256
-
257
-// --------------------------------------------------------------------------------------------------------------------
258
-// OpenSSL
259
-
260
-#define OPENSSL_VERSION_095 0x00905100L
261
-#define OPENSSL_VERSION_097 0x0907000L
262
-#define OPENSSL_VERSION_110 0x10100000L
263
-#define OPENSSL_VERSION_111 0x10101000L
264
-#define OPENSSL_VERSION_300 0x30000000L
265
-
266
-#include <openssl/ssl.h>
267
-#include <openssl/rand.h>
268
-#include <openssl/err.h>
269
-#include <openssl/evp.h>
270
-#include <openssl/pem.h>
271
-#if (SSLEAY_VERSION_NUMBER >= OPENSSL_VERSION_097) && (OPENSSL_VERSION_NUMBER < OPENSSL_VERSION_110)
272
-#include <openssl/conf.h>
273
-#endif
274
-
275
-#if OPENSSL_VERSION_NUMBER >= OPENSSL_VERSION_300
276
-#include <openssl/core_names.h>
277
-#include <openssl/decoder.h>
278
-#endif
279
-
280
-// --------------------------------------------------------------------------------------------------------------------
281
-
282
-#ifndef O_CLOEXEC
283
-#define O_CLOEXEC (0)
284
-#endif
285
-
286
-// --------------------------------------------------------------------------------------------------------------------
287
-// FUNCTION ATTRIBUTES
288
-
289
-#define _cleanup_(x) __attribute__((__cleanup__(x)))
290
-
291
-#ifdef HAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL
292
-#define NEVERNULL __attribute__((returns_nonnull))
293
-#else
294
-#define NEVERNULL
295
-#endif
296
-
297
-#ifdef HAVE_FUNC_ATTRIBUTE_NOINLINE
298
-#define NOINLINE __attribute__((noinline))
299
-#else
300
-#define NOINLINE
301
-#endif
302
-
303
-#ifdef HAVE_FUNC_ATTRIBUTE_MALLOC
304
-#define MALLOCLIKE __attribute__((malloc))
305
-#else
306
-#define MALLOCLIKE
307
-#endif
308
-
309
-#if defined(HAVE_FUNC_ATTRIBUTE_FORMAT_GNU_PRINTF)
310
-#define PRINTFLIKE(f, a) __attribute__ ((format(gnu_printf, f, a)))
311
-#elif defined(HAVE_FUNC_ATTRIBUTE_FORMAT_PRINTF)
312
-#define PRINTFLIKE(f, a) __attribute__ ((format(printf, f, a)))
313
-#else
314
-#define PRINTFLIKE(f, a)
315
-#endif
316
-
317
-#ifdef HAVE_FUNC_ATTRIBUTE_NORETURN
318
-#define NORETURN __attribute__ ((noreturn))
319
-#else
320
-#define NORETURN
321
-#endif
322
-
323
-#ifdef HAVE_FUNC_ATTRIBUTE_WARN_UNUSED_RESULT
324
-#define WARNUNUSED __attribute__ ((warn_unused_result))
325
-#else
326
-#define WARNUNUSED
327
-#endif
328
-
329
-#define UNUSED(x) (void)(x)
330
-
331
-#ifdef __GNUC__
332
-#define UNUSED_FUNCTION(x) __attribute__((unused)) UNUSED_##x
333
-#else
334
-#define UNUSED_FUNCTION(x) UNUSED_##x
335
-#endif
336
-
337
-// --------------------------------------------------------------------------------------------------------------------
338
-// fix for alpine linux
339
-
340
-#if !defined(RUSAGE_THREAD) && defined(RUSAGE_CHILDREN)
341
-#define RUSAGE_THREAD RUSAGE_CHILDREN
342
-#endif
343
-
344
-// --------------------------------------------------------------------------------------------------------------------
345
-// HELPFUL MACROS
346
-
347
-#define ABS(x) (((x) < 0)? (-(x)) : (x))
348
-#define MIN(a,b) (((a)<(b))?(a):(b))
349
-#define MAX(a,b) (((a)>(b))?(a):(b))
350
-#define SWAP(a, b) do { \
351
- typeof(a) _tmp = b; \
352
- b = a; \
353
- a = _tmp; \
354
-} while(0)
355
-
356
-// --------------------------------------------------------------------------------------------------------------------
357
-// NETDATA CLOUD
358
-
359
-// BEWARE: this exists in alarm-notify.sh
360
-#define DEFAULT_CLOUD_BASE_URL "https://app.netdata.cloud"
361
-
362
-// --------------------------------------------------------------------------------------------------------------------
363
-// DBENGINE
364
-
365
-#define RRD_STORAGE_TIERS 5
366
-
367
-// --------------------------------------------------------------------------------------------------------------------
368
-// PIPES
369
-
370
-#define PIPE_READ 0
371
-#define PIPE_WRITE 1
372
-
373
-// --------------------------------------------------------------------------------------------------------------------
374
-// UUIDs
375
-
376
-#define GUID_LEN 36
377
-
378
-// --------------------------------------------------------------------------------------------------------------------
379
-// Macro-only includes
380
-
381
-#include "linked_lists/linked_lists.h"
382
-
383
-// --------------------------------------------------------------------------------------------------------------------
384
-
385
-// Taken from linux kernel
386
-#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
387
-
388
-// --------------------------------------------------------------------------------------------------------------------
389
-
390
-# ifdef __cplusplus
391
-}
392
-# endif
393
-
394
-#endif //LIBNETDATA_COMMON_H
1
+// SPDX-License-Identifier: GPL-3.0-or-later
2
+
3
+/*
4
+ * This file should include everything from the operating system needed to compile Netdata,
5
+ * without any Netdata specific includes.
6
+ *
7
+ * It should be the baseline of includes (operating system and common libraries related).
8
+ */
9
+
10
+#ifndef LIBNETDATA_COMMON_H
11
+#define LIBNETDATA_COMMON_H
12
+
13
+# ifdef __cplusplus
14
+extern "C" {
15
+# endif
16
+
17
+#include "config.h"
18
+
19
+#if defined(NETDATA_DEV_MODE) && !defined(NETDATA_INTERNAL_CHECKS)
20
+#define NETDATA_INTERNAL_CHECKS 1
21
+#endif
22
+
23
+#ifndef SIZEOF_VOID_P
24
+#error SIZEOF_VOID_P is not defined
25
+#endif
26
+
27
+#if SIZEOF_VOID_P == 4
28
+#define ENV32BIT 1
29
+#else
30
+#define ENV64BIT 1
31
+#endif
32
+
33
+#ifdef HAVE_LIBDATACHANNEL
34
+#define ENABLE_WEBRTC 1
35
+#endif
36
+
37
+#define STRINGIFY(x) #x
38
+#define TOSTRING(x) STRINGIFY(x)
39
+
40
+// --------------------------------------------------------------------------------------------------------------------
41
+// NETDATA_OS_TYPE
42
+
43
+#if defined(__FreeBSD__)
44
+#include <pthread_np.h>
45
+#define NETDATA_OS_TYPE "freebsd"
46
+#elif defined(__APPLE__)
47
+#define NETDATA_OS_TYPE "macos"
48
+#elif defined(OS_WINDOWS)
49
+#define NETDATA_OS_TYPE "windows"
50
+#else
51
+#define NETDATA_OS_TYPE "linux"
52
+#endif /* __FreeBSD__, __APPLE__*/
53
+
54
+// --------------------------------------------------------------------------------------------------------------------
55
+// memory allocators
56
+
57
+/* select the memory allocator, based on autoconf findings */
58
+#if defined(ENABLE_JEMALLOC)
59
+
60
+#if defined(HAVE_JEMALLOC_JEMALLOC_H)
61
+#include <jemalloc/jemalloc.h>
62
+#else // !defined(HAVE_JEMALLOC_JEMALLOC_H)
63
+#include <malloc.h>
64
+#endif // !defined(HAVE_JEMALLOC_JEMALLOC_H)
65
+
66
+#elif defined(ENABLE_TCMALLOC)
67
+
68
+#include <google/tcmalloc.h>
69
+
70
+#else /* !defined(ENABLE_JEMALLOC) && !defined(ENABLE_TCMALLOC) */
71
+
72
+#if !(defined(__FreeBSD__) || defined(__APPLE__))
73
+#include <malloc.h>
74
+#endif /* __FreeBSD__ || __APPLE__ */
75
+
76
+#endif /* !defined(ENABLE_JEMALLOC) && !defined(ENABLE_TCMALLOC) */
77
+
78
+// --------------------------------------------------------------------------------------------------------------------
79
+
80
+#include <pthread.h>
81
+#include <errno.h>
82
+#include <stdbool.h>
83
+#include <stdio.h>
84
+#include <stdlib.h>
85
+#include <stdarg.h>
86
+#include <stddef.h>
87
+#include <ctype.h>
88
+#include <string.h>
89
+#include <strings.h>
90
+#include <libgen.h>
91
+#include <dirent.h>
92
+#include <fcntl.h>
93
+#include <getopt.h>
94
+#include <limits.h>
95
+#include <locale.h>
96
+#include <signal.h>
97
+#include <sys/time.h>
98
+#include <sys/types.h>
99
+#include <time.h>
100
+#include <unistd.h>
101
+#include <uv.h>
102
+#include <assert.h>
103
+
104
+#ifdef HAVE_ARPA_INET_H
105
+#include <arpa/inet.h>
106
+#endif
107
+
108
+#ifdef HAVE_NETINET_TCP_H
109
+#include <netinet/tcp.h>
110
+#endif
111
+
112
+#ifdef HAVE_SYS_IOCTL_H
113
+#include <sys/ioctl.h>
114
+#endif
115
+
116
+#ifdef HAVE_GRP_H
117
+#include <grp.h>
118
+#else
119
+typedef uint32_t gid_t;
120
+#endif
121
+
122
+#ifdef HAVE_PWD_H
123
+#include <pwd.h>
124
+#else
125
+typedef uint32_t uid_t;
126
+#endif
127
+
128
+#ifdef HAVE_NET_IF_H
129
+#include <net/if.h>
130
+#endif
131
+
132
+#ifdef HAVE_POLL_H
133
+#include <poll.h>
134
+#endif
135
+
136
+#ifdef HAVE_SYSLOG_H
137
+#include <syslog.h>
138
+#else
139
+/* priorities */
140
+#define LOG_EMERG 0 /* system is unusable */
141
+#define LOG_ALERT 1 /* action must be taken immediately */
142
+#define LOG_CRIT 2 /* critical conditions */
143
+#define LOG_ERR 3 /* error conditions */
144
+#define LOG_WARNING 4 /* warning conditions */
145
+#define LOG_NOTICE 5 /* normal but significant condition */
146
+#define LOG_INFO 6 /* informational */
147
+#define LOG_DEBUG 7 /* debug-level messages */
148
+
149
+/* facility codes */
150
+#define LOG_KERN (0<<3) /* kernel messages */
151
+#define LOG_USER (1<<3) /* random user-level messages */
152
+#define LOG_MAIL (2<<3) /* mail system */
153
+#define LOG_DAEMON (3<<3) /* system daemons */
154
+#define LOG_AUTH (4<<3) /* security/authorization messages */
155
+#define LOG_SYSLOG (5<<3) /* messages generated internally by syslogd */
156
+#define LOG_LPR (6<<3) /* line printer subsystem */
157
+#define LOG_NEWS (7<<3) /* network news subsystem */
158
+#define LOG_UUCP (8<<3) /* UUCP subsystem */
159
+#define LOG_CRON (9<<3) /* clock daemon */
160
+#define LOG_AUTHPRIV (10<<3) /* security/authorization messages (private) */
161
+#define LOG_FTP (11<<3) /* ftp daemon */
162
+
163
+/* other codes through 15 reserved for system use */
164
+#define LOG_LOCAL0 (16<<3) /* reserved for local use */
165
+#define LOG_LOCAL1 (17<<3) /* reserved for local use */
166
+#define LOG_LOCAL2 (18<<3) /* reserved for local use */
167
+#define LOG_LOCAL3 (19<<3) /* reserved for local use */
168
+#define LOG_LOCAL4 (20<<3) /* reserved for local use */
169
+#define LOG_LOCAL5 (21<<3) /* reserved for local use */
170
+#define LOG_LOCAL6 (22<<3) /* reserved for local use */
171
+#define LOG_LOCAL7 (23<<3) /* reserved for local use */
172
+#endif
173
+
174
+#ifdef HAVE_SYS_MMAN_H
175
+#include <sys/mman.h>
176
+#endif
177
+
178
+#ifdef HAVE_SYS_RESOURCE_H
179
+#include <sys/resource.h>
180
+#endif
181
+
182
+#ifdef HAVE_SYS_SOCKET_H
183
+#include <sys/socket.h>
184
+#endif
185
+
186
+#ifdef HAVE_SYS_WAIT_H
187
+#include <sys/wait.h>
188
+#endif
189
+
190
+#ifdef HAVE_SYS_UN_H
191
+#include <sys/un.h>
192
+#endif
193
+
194
+#ifdef HAVE_SPAWN_H
195
+#include <spawn.h>
196
+#endif
197
+
198
+#ifdef HAVE_NETINET_IN_H
199
+#include <netinet/in.h>
200
+#endif
201
+
202
+#ifdef HAVE_RESOLV_H
203
+#include <resolv.h>
204
+#endif
205
+
206
+#ifdef HAVE_NETDB_H
207
+#include <netdb.h>
208
+#endif
209
+
210
+#ifdef HAVE_SYS_PRCTL_H
211
+#include <sys/prctl.h>
212
+#endif
213
+
214
+#ifdef HAVE_SYS_STAT_H
215
+#include <sys/stat.h>
216
+#endif
217
+
218
+#ifdef HAVE_SYS_VFS_H
219
+#include <sys/vfs.h>
220
+#endif
221
+
222
+#ifdef HAVE_SYS_STATFS_H
223
+#include <sys/statfs.h>
224
+#endif
225
+
226
+#ifdef HAVE_LINUX_MAGIC_H
227
+#include <linux/magic.h>
228
+#endif
229
+
230
+#ifdef HAVE_SYS_MOUNT_H
231
+#include <sys/mount.h>
232
+#endif
233
+
234
+#ifdef HAVE_SYS_STATVFS_H
235
+#include <sys/statvfs.h>
236
+#endif
237
+
238
+// #1408
239
+#ifdef MAJOR_IN_MKDEV
240
+#include <sys/mkdev.h>
241
+#endif
242
+#ifdef MAJOR_IN_SYSMACROS
243
+#include <sys/sysmacros.h>
244
+#endif
245
+
246
+#include <math.h>
247
+#include <float.h>
248
+
249
+#if defined(HAVE_INTTYPES_H)
250
+#include <inttypes.h>
251
+#elif defined(HAVE_STDINT_H)
252
+#include <stdint.h>
253
+#endif
254
+
255
+#include <zlib.h>
256
+
257
+#ifdef HAVE_SYS_CAPABILITY_H
258
+#include <sys/capability.h>
259
+#endif
260
+
261
+#define XXH_INLINE_ALL
262
+#include "xxHash/xxhash.h"
263
+
264
+// --------------------------------------------------------------------------------------------------------------------
265
+// OpenSSL
266
+
267
+#define OPENSSL_VERSION_095 0x00905100L
268
+#define OPENSSL_VERSION_097 0x0907000L
269
+#define OPENSSL_VERSION_110 0x10100000L
270
+#define OPENSSL_VERSION_111 0x10101000L
271
+#define OPENSSL_VERSION_300 0x30000000L
272
+
273
+#include <openssl/ssl.h>
274
+#include <openssl/rand.h>
275
+#include <openssl/err.h>
276
+#include <openssl/evp.h>
277
+#include <openssl/pem.h>
278
+#if (SSLEAY_VERSION_NUMBER >= OPENSSL_VERSION_097) && (OPENSSL_VERSION_NUMBER < OPENSSL_VERSION_110)
279
+#include <openssl/conf.h>
280
+#endif
281
+
282
+#if OPENSSL_VERSION_NUMBER >= OPENSSL_VERSION_300
283
+#include <openssl/core_names.h>
284
+#include <openssl/decoder.h>
285
+#endif
286
+
287
+// --------------------------------------------------------------------------------------------------------------------
288
+
289
+#ifndef O_CLOEXEC
290
+#define O_CLOEXEC (0)
291
+#endif
292
+
293
+// --------------------------------------------------------------------------------------------------------------------
294
+// FUNCTION ATTRIBUTES
295
+
296
+#define _cleanup_(x) __attribute__((__cleanup__(x)))
297
+
298
+#ifdef HAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL
299
+#define NEVERNULL __attribute__((returns_nonnull))
300
+#else
301
+#define NEVERNULL
302
+#endif
303
+
304
+#ifdef HAVE_FUNC_ATTRIBUTE_NOINLINE
305
+#define NOINLINE __attribute__((noinline))
306
+#else
307
+#define NOINLINE
308
+#endif
309
+
310
+#ifdef HAVE_FUNC_ATTRIBUTE_MALLOC
311
+#define MALLOCLIKE __attribute__((malloc))
312
+#else
313
+#define MALLOCLIKE
314
+#endif
315
+
316
+#if defined(HAVE_FUNC_ATTRIBUTE_FORMAT_GNU_PRINTF)
317
+#define PRINTFLIKE(f, a) __attribute__ ((format(gnu_printf, f, a)))
318
+#elif defined(HAVE_FUNC_ATTRIBUTE_FORMAT_PRINTF)
319
+#define PRINTFLIKE(f, a) __attribute__ ((format(printf, f, a)))
320
+#else
321
+#define PRINTFLIKE(f, a)
322
+#endif
323
+
324
+#ifdef HAVE_FUNC_ATTRIBUTE_NORETURN
325
+#define NORETURN __attribute__ ((noreturn))
326
+#else
327
+#define NORETURN
328
+#endif
329
+
330
+#ifdef HAVE_FUNC_ATTRIBUTE_WARN_UNUSED_RESULT
331
+#define WARNUNUSED __attribute__ ((warn_unused_result))
332
+#else
333
+#define WARNUNUSED
334
+#endif
335
+
336
+#define UNUSED(x) (void)(x)
337
+
338
+#ifdef __GNUC__
339
+#define UNUSED_FUNCTION(x) __attribute__((unused)) UNUSED_##x
340
+#else
341
+#define UNUSED_FUNCTION(x) UNUSED_##x
342
+#endif
343
+
344
+// --------------------------------------------------------------------------------------------------------------------
345
+// fix for alpine linux
346
+
347
+#if !defined(RUSAGE_THREAD) && defined(RUSAGE_CHILDREN)
348
+#define RUSAGE_THREAD RUSAGE_CHILDREN
349
+#endif
350
+
351
+// --------------------------------------------------------------------------------------------------------------------
352
+// HELPFUL MACROS
353
+
354
+#define ABS(x) (((x) < 0)? (-(x)) : (x))
355
+#define MIN(a,b) (((a)<(b))?(a):(b))
356
+#define MAX(a,b) (((a)>(b))?(a):(b))
357
+#define SWAP(a, b) do { \
358
+ typeof(a) _tmp = b; \
359
+ b = a; \
360
+ a = _tmp; \
361
+} while(0)
362
+
363
+// --------------------------------------------------------------------------------------------------------------------
364
+// NETDATA CLOUD
365
+
366
+// BEWARE: this exists in alarm-notify.sh
367
+#define DEFAULT_CLOUD_BASE_URL "https://app.netdata.cloud"
368
+
369
+// --------------------------------------------------------------------------------------------------------------------
370
+// DBENGINE
371
+
372
+#define RRD_STORAGE_TIERS 5
373
+
374
+// --------------------------------------------------------------------------------------------------------------------
375
+// PIPES
376
+
377
+#define PIPE_READ 0
378
+#define PIPE_WRITE 1
379
+
380
+// --------------------------------------------------------------------------------------------------------------------
381
+// UUIDs
382
+
383
+#define GUID_LEN 36
384
+
385
+// --------------------------------------------------------------------------------------------------------------------
386
+// Macro-only includes
387
+
388
+#include "linked_lists/linked_lists.h"
389
+
390
+// --------------------------------------------------------------------------------------------------------------------
391
+
392
+// Taken from linux kernel
393
+#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
394
+
395
+// --------------------------------------------------------------------------------------------------------------------
396
+
397
+#if defined(OS_WINDOWS)
398
+#include <windows.h>
399
+#include <wctype.h>
400
+#include <wchar.h>
401
+#include <tchar.h>
402
+#include <guiddef.h>
403
+#include <bcrypt.h> // For BCryptGenRandom
404
+#include <io.h>
405
+#include <fcntl.h>
406
+#include <process.h>
407
+#include <tlhelp32.h>
408
+#include <sys/cygwin.h>
409
+#include <winevt.h>
410
+#include <evntprov.h>
411
+#include <wbemidl.h>
412
+#include <sddl.h>
413
+// #include <winternl.h> // conflicts on STRING,
414
+#endif
415
+
416
+# ifdef __cplusplus
417
+}
418
+# endif
419
+
420
+#endif //LIBNETDATA_COMMON_H
src/libnetdata/log/nd_log-internals.h
-4
@@ -5,10 +5,6 @@
5
6
#include "../libnetdata.h"
7
8
-#if defined(OS_WINDOWS)
9
-#include <windows.h>
10
-#endif
11
-
8
#ifdef __FreeBSD__
9
#include <sys/endian.h>
10
#endif
src/libnetdata/log/nd_log-to-systemd-journal.c
+1
-2
@@ -76,8 +76,6 @@ bool nd_log_journal_direct_init(const char *path) {
76
return true;
77
}
78
79
-static bool sockets_before[1024];
80
-
79
bool nd_logger_journal_libsystemd(struct log_field *fields __maybe_unused, size_t fields_max __maybe_unused) {
80
#ifdef HAVE_SYSTEMD
81
@@ -158,6 +156,7 @@ bool nd_logger_journal_libsystemd(struct log_field *fields __maybe_unused, size_
156
}
157
}
158
159
+ static bool sockets_before[1024];
160
bool detect_systemd_socket = __atomic_load_n(&nd_log.journal.first_msg, __ATOMIC_RELAXED) == false;
161
if(detect_systemd_socket) {
162
for(int i = 3 ; (size_t)i < _countof(sockets_before); i++)
src/libnetdata/log/nd_log-to-windows-events.c
-6
@@ -3,12 +3,6 @@
3
#include "nd_log-internals.h"
4
5
#if defined(OS_WINDOWS) && (defined(HAVE_ETW) || defined(HAVE_WEL))
6
-#include <windows.h>
7
-#include <winevt.h>
8
-#include <evntprov.h>
9
-#include <wchar.h>
10
-#include <guiddef.h>
11
-#include <wctype.h>
6
7
// --------------------------------------------------------------------------------------------------------------------
8
// construct an event id
src/libnetdata/os/get_system_cpus.c
-4
@@ -2,10 +2,6 @@
2
3
#include "../libnetdata.h"
4
5
-#if defined(OS_WINDOWS)
6
-#include <windows.h>
7
-#endif
8
-
5
#define CPUS_FOR_COLLECTORS 0
6
#define CPUS_FOR_NETDATA 1
7
src/libnetdata/os/gettid.c
-4
@@ -2,10 +2,6 @@
2
3
#include "../libnetdata.h"
4
5
-#if defined(OS_WINDOWS)
6
-#include <windows.h>
7
-#endif
8
-
5
pid_t os_gettid(void) {
6
#if defined(HAVE_GETTID)
7
return gettid();
src/libnetdata/os/os-windows-wrappers.c
-2
@@ -3,8 +3,6 @@
3
#include "../libnetdata.h"
4
5
#if defined(OS_WINDOWS)
6
-#include <windows.h>
7
-
6
long netdata_registry_get_dword_from_open_key(unsigned int *out, void *lKey, char *name)
7
{
8
DWORD length = 260;
src/libnetdata/os/setenv.c
+1
-9
@@ -1,14 +1,6 @@
1
// SPDX-License-Identifier: GPL-3.0-or-later
2
3
-#include "config.h"
4
-
5
-#include <stdio.h>
6
-#include <stdlib.h>
7
-#include <string.h>
8
-
9
-#if defined(OS_WINDOWS)
10
-#include <windows.h>
11
-#endif
3
+#include "libnetdata/libnetdata.h"
4
5
#ifndef HAVE_SETENV
6
int os_setenv(const char *name, const char *value, int overwrite) {
src/libnetdata/os/system-maps/cached-sid-username.c
-2
@@ -4,8 +4,6 @@
4
5
#if defined(OS_WINDOWS)
6
#include "cached-sid-username.h"
7
-#include <windows.h>
8
-#include <sddl.h>
7
8
typedef struct {
9
size_t len;
src/libnetdata/os/tinysleep.c
-2
@@ -3,8 +3,6 @@
3
#include "../libnetdata.h"
4
5
#ifdef OS_WINDOWS
6
-#include <windows.h>
7
-
6
void tinysleep(void) {
7
// Improve the system timer resolution to 1 ms
8
timeBeginPeriod(1);
src/libnetdata/os/uuid_generate.c
-2
@@ -6,8 +6,6 @@
6
#undef uuid_generate_time
7
8
#ifdef OS_WINDOWS
9
-#include <windows.h>
10
-
9
void os_uuid_generate(void *out) {
10
RPC_STATUS status = UuidCreate(out);
11
while (status != RPC_S_OK && status != RPC_S_UUID_LOCAL_ONLY) {
src/libnetdata/os/windows-perflib/perflib-dump.c
-2
@@ -3,8 +3,6 @@
3
#include "perflib.h"
4
5
#if defined(OS_WINDOWS)
6
-#include <windows.h>
7
-
6
static const char *getCounterType(DWORD CounterType) {
7
switch (CounterType) {
8
case PERF_COUNTER_COUNTER:
src/libnetdata/os/windows-perflib/perflib-names.c
-2
@@ -3,8 +3,6 @@
3
#include "perflib.h"
4
5
#if defined(OS_WINDOWS)
6
-#include <windows.h>
7
-
6
#define REGISTRY_KEY "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Perflib\\009"
7
8
typedef struct perflib_registry {
src/libnetdata/os/windows-perflib/perflib.c
-2
@@ -3,8 +3,6 @@
3
#include "perflib.h"
4
5
#if defined(OS_WINDOWS)
6
-#include <windows.h>
7
-
6
// --------------------------------------------------------------------------------
7
8
// Retrieve a buffer that contains the specified performance data.
src/libnetdata/os/windows-wmi/windows-wmi.h
-4
@@ -6,10 +6,6 @@
6
#include "../../libnetdata.h"
7
8
#if defined(OS_WINDOWS)
9
-
10
-#include <windows.h>
11
-#include <wbemidl.h>
12
-
9
typedef struct {
10
IWbemLocator *pLoc;
11
IWbemServices *pSvc;
src/libnetdata/spawn_server/spawn_popen.c
-4
@@ -2,10 +2,6 @@
2
3
#include "spawn_popen.h"
4
5
-#if defined(OS_WINDOWS)
6
-#include <windows.h>
7
-#endif
8
-
5
struct popen_instance {
6
SPAWN_INSTANCE *si;
7
FILE *child_stdin_fp;
src/libnetdata/spawn_server/spawn_server_internals.h
-10
@@ -18,16 +18,6 @@
18
// #define SPAWN_SERVER_VERSION_POSIX_SPAWN 1
19
#endif
20
21
-#if defined(SPAWN_SERVER_VERSION_WINDOWS)
22
-#include <windows.h>
23
-#include <io.h>
24
-#include <fcntl.h>
25
-#include <process.h>
26
-#include <tlhelp32.h>
27
-#include <tchar.h>
28
-#include <sys/cygwin.h>
29
-#endif
30
-
21
struct spawn_server {
22
size_t id;
23
size_t request_id;
src/libnetdata/string/utf8.c
-2
@@ -3,8 +3,6 @@
3
#include "../libnetdata.h"
4
5
#if defined(OS_WINDOWS)
6
-#include <windows.h>
7
-
6
/*
7
* Convert any CodePage to UTF16
8
* Goals:
src/web/api/v2/api_v2_claim.c
-5
@@ -3,11 +3,6 @@
3
#include "api_v2_calls.h"
4
#include "claim/claim.h"
5
6
-#if defined(OS_WINDOWS)
7
-#include <windows.h>
8
-#include <sys/cygwin.h>
9
-#endif
10
-
6
static char *netdata_random_session_id_filename = NULL;
7
static nd_uuid_t netdata_random_session_id = { 0 };
8