resolve compilation issues for musl libc #66
Costa Tsaousis (ktsaou) committed
Apr 2, 2016 at 05:53 UTC
38c56a78e543e6e1a406e40436dd8f22fcff997c
2 files changed
+14
src/common.h
+10
@@ -1,3 +1,6 @@
1
+#include <sys/time.h>
2
+#include <sys/resource.h>
3
+
4
#ifndef NETDATA_COMMON_H
5
#define NETDATA_COMMON_H 1
6
@@ -32,4 +35,11 @@ extern void get_HZ(void);
35
36
extern pid_t gettid(void);
37
38
+/* fix for alpine linux */
39
+#ifndef RUSAGE_THREAD
40
+#ifdef RUSAGE_CHILDREN
41
+#define RUSAGE_THREAD RUSAGE_CHILDREN
42
+#endif
43
+#endif
44
+
45
#endif /* NETDATA_COMMON_H */
src/web_server.c
+4
@@ -30,6 +30,7 @@ int listen_backlog = LISTEN_BACKLOG;
30
int listen_fd = -1;
31
int listen_port = LISTEN_PORT;
32
33
+#ifdef NETDATA_INTERNAL_CHECKS
34
static void log_allocations(void)
35
{
36
static int mem = 0;
@@ -46,6 +47,7 @@ static void log_allocations(void)
47
mem = mi.uordblks;
48
}
49
}
50
+#endif
51
52
int create_listen_socket4(int port, int listen_backlog)
53
{
@@ -210,7 +212,9 @@ void *socket_listen_main(void *ptr)
212
debug(D_WEB_CLIENT, "%llu: Removing client.", w->id);
213
// pthread_join(w->thread, NULL);
214
w = web_client_free(w);
215
+#ifdef NETDATA_INTERNAL_CHECKS
216
log_allocations();
217
+#endif
218
}
219
}
220
}