[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [torsocks/master] Add support for musl-libc



commit 3e793e9eac05ad926cc016da5129e95986d105f2
Author: David Goulet <dgoulet@xxxxxxxxx>
Date:   Mon Jun 13 14:39:53 2016 -0400

    Add support for musl-libc
    
    Musl library does not have a specific define so use __linux__ instead.
    
    Signed-off-by: David Goulet <dgoulet@xxxxxxxxx>
---
 src/common/compat.c | 5 +++--
 src/common/compat.h | 5 +++--
 src/common/ref.h    | 5 +++--
 src/lib/torsocks.h  | 9 +++++----
 4 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/src/common/compat.c b/src/common/compat.c
index a861b3d..323f2ed 100644
--- a/src/common/compat.c
+++ b/src/common/compat.c
@@ -19,7 +19,8 @@
 
 #include "compat.h"
 
-#if (defined(__GLIBC__) || defined(__FreeBSD__) || defined(__darwin__) || defined(__NetBSD__))
+#if (defined(__linux__) || defined(__GLIBC__) || defined(__FreeBSD__) || \
+		defined(__darwin__) || defined(__NetBSD__))
 
 /*
  * Initialize a pthread mutex. This never fails.
@@ -96,4 +97,4 @@ void tsocks_once(tsocks_once_t *o, void (*init_routine)(void))
 	tsocks_mutex_unlock(&o->mutex);
 }
 
-#endif /* __GLIBC__, __darwin__, __FreeBSD__, __NetBSD__ */
+#endif /* __linux__, __GLIBC__, __darwin__, __FreeBSD__, __NetBSD__ */
diff --git a/src/common/compat.h b/src/common/compat.h
index ce47129..6c8ce32 100644
--- a/src/common/compat.h
+++ b/src/common/compat.h
@@ -22,7 +22,8 @@
 #define __darwin__	1
 #endif
 
-#if (defined(__GLIBC__) || defined(__FreeBSD__) || defined(__darwin__) || defined(__NetBSD__))
+#if (defined(__linux__) || defined(__GLIBC__) || defined(__FreeBSD__) || \
+		defined(__darwin__) || defined(__NetBSD__))
 
 #define RTLD_NEXT	((void *) -1)
 
@@ -55,7 +56,7 @@ void tsocks_once(tsocks_once_t *o, void (*init_routine)(void));
 
 #else
 #error "OS not supported."
-#endif /* __GLIBC__, __darwin__, __FreeBSD__, __NetBSD__ */
+#endif /* __linux__, __GLIBC__, __darwin__, __FreeBSD__, __NetBSD__ */
 
 #if defined(__linux__)
 #include <unistd.h>
diff --git a/src/common/ref.h b/src/common/ref.h
index 88aec2e..d9b9df8 100644
--- a/src/common/ref.h
+++ b/src/common/ref.h
@@ -26,7 +26,8 @@ struct ref {
 	long count;
 };
 
-#if (defined(__GLIBC__) || defined(__FreeBSD__) || defined(__darwin__) || defined(__NetBSD__))
+#if (defined(__linux__) || defined(__GLIBC__) || defined(__FreeBSD__) || \
+		defined(__darwin__) || defined(__NetBSD__))
 
 /*
  * Get a reference by incrementing the refcount.
@@ -57,6 +58,6 @@ static inline void ref_put(struct ref *r,
 
 #else
 #error "OS not supported"
-#endif /* __GLIBC__, __FreeBSD__, __darwin__ */
+#endif /* __linux__, __GLIBC__, __FreeBSD__, __darwin__, __NetBSD__ */
 
 #endif /* TORSOCKS_REF_H */
diff --git a/src/lib/torsocks.h b/src/lib/torsocks.h
index 076f3a5..0eeef2a 100644
--- a/src/lib/torsocks.h
+++ b/src/lib/torsocks.h
@@ -33,7 +33,8 @@
 #define TSOCKS_DECL(name, type, sig) \
 	extern type tsocks_##name(sig);
 
-#if (defined(__GLIBC__) || defined(__FreeBSD__) || defined(__darwin__) || defined(__NetBSD__))
+#if (defined(__linux__) || defined(__GLIBC__) || defined(__FreeBSD__) || \
+		defined(__darwin__) || defined(__NetBSD__))
 
 /* connect(2) */
 #include <sys/types.h>
@@ -207,7 +208,7 @@ struct hostent **result, int *h_errnop
 
 #else
 #error "OS not supported."
-#endif /* __GLIBC__ , __FreeBSD__, __darwin__, __NetBSD__ */
+#endif /* __linux__, __GLIBC__ , __FreeBSD__, __darwin__, __NetBSD__ */
 
 #if (defined(__linux__))
 
@@ -241,7 +242,7 @@ struct hostent **result, int *h_errnop
 
 #endif /* __FreeBSD__, __darwin__, __NetBSD__ */
 
-#if defined(__GLIBC__) && defined(__FreeBSD_kernel__)
+#if (defined(__linux__) || defined(__GLIBC__)) && defined(__FreeBSD_kernel__)
 
 /* syscall(2) */
 #define LIBC_SYSCALL_NAME syscall
@@ -250,7 +251,7 @@ struct hostent **result, int *h_errnop
 #define LIBC_SYSCALL_SIG long int number, ...
 #define LIBC_SYSCALL_ARGS number
 
-#endif /* __GLIBC__ && __FreeBSD_kernel__ */
+#endif /* (__linux__ || __GLIBC__) && __FreeBSD_kernel__ */
 
 /* __syscall(2) */
 #if defined(__FreeBSD__)



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits