Bug#767235: torsocks: FTBFS on hurd-i386
Source: torsocks
Version: 2.0.0-1
Severity: important
Tags: patch
User: debian-hurd@lists.debian.org
Usertags: hurd
Hi,
Currently torsocks FTBFS on GNU/Hurd due to lacking OS support. It did
build previously, latest Hurd version is 1.3-3. The attached patch
re-enables the build of torsocks for Hurd. All tests in the testsuite
pass. (Perhaps maybe some comments in the patch are redundant, please
let me know.)
Thanks!
Index: torsocks-2.0.0/configure.ac
===================================================================
--- torsocks-2.0.0.orig/configure.ac
+++ torsocks-2.0.0/configure.ac
@@ -118,7 +118,7 @@ dnl location on Unixish system.
AC_MSG_CHECKING(file name of the C library)
AS_CASE([$host_os],
[darwin*], [libc_name="libSystem.dylib"],
- [linux*|kfreebsd*-gnu],
+ [linux*|kfreebsd*-gnu | gnu*],
[
libc_name=`ldd /usr/bin/yes | grep 'libc\.' | cut -d ' ' -f 1 | tr -d '\t'`
if test "${libc_name}" == ""; then
Index: torsocks-2.0.0/src/common/compat.h
===================================================================
--- torsocks-2.0.0.orig/src/common/compat.h
+++ torsocks-2.0.0/src/common/compat.h
@@ -45,6 +45,20 @@ void tsocks_mutex_unlock(tsocks_mutex_t
#error "OS not supported."
#endif /* __GLIBC__, __darwin__, __FreeBSD__, __NetBSD__ */
+#if defined(__GNU__)
+#include <unistd.h>
+#include <sys/syscall.h>
+#include <mach/i386/syscall_sw.h>
+//mach traps defined here: #include <mach/syscall_sw.h>
+
+/* Arbritary numbering: Hurd functions are not syscalls */
+#define TSOCKS_NR_SOCKET -1
+#define TSOCKS_NR_CONNECT -2
+#define TSOCKS_NR_CLOSE -3
+#define TSOCKS_NR_MMAP -4
+#define TSOCKS_NR_MUNMAP -5
+#endif
+
#if defined(__linux__)
#include <unistd.h>
#include <sys/syscall.h>
Index: torsocks-2.0.0/src/lib/torsocks.h
===================================================================
--- torsocks-2.0.0.orig/src/lib/torsocks.h
+++ torsocks-2.0.0/src/lib/torsocks.h
@@ -198,7 +198,7 @@ struct hostent **result, int *h_errnop
#error "OS not supported."
#endif /* __GLIBC__ , __FreeBSD__, __darwin__, __NetBSD__ */
-#if (defined(__linux__))
+#if (defined(__linux__) || defined(__GNU__))
#define _GNU_SOURCE
Index: torsocks-2.0.0/src/lib/syscall.c
===================================================================
--- torsocks-2.0.0.orig/src/lib/syscall.c
+++ torsocks-2.0.0/src/lib/syscall.c
@@ -68,7 +68,7 @@ static LIBC_CONNECT_RET_TYPE handle_conn
return tsocks_connect(sockfd, addr, addrlen);
}
-#if (defined(__linux__) || defined(__darwin__) || (defined(__FreeBSD_kernel__) && defined(__i386__)))
+#if (defined(__linux__) || defined(__darwin__) || (defined(__FreeBSD_kernel__) && defined(__i386__)) || defined(__GNU__))
/*
* Handle mmap(2) syscall.
*/
Reply to: