Control: tags -1 + patch
Hello,
Hefee, le mar. 24 févr. 2026 13:57:26 +0100, a ecrit:
> Will you update the patch, so that will apply to the current torsocks version
> 2.5.0?
Here is an updated patch, which notably simply drops the syscall() part
since that's not actually used on GNU/Hurd.
> Will you create a upstream MR with that patch or should I forward that?
Please forward it.
> PS: btw. but a different issue - also HURD/amd64 is failing but already in
> the
> configure step:
> https://buildd.debian.org/status/fetch.php?pkg=torsocks&arch=hurd-amd64&ver=2.5.0-5&stamp=1771514351&raw=0
It is actually related: another symptom that syscall() is unused there.
Samuel
Index: torsocks-2.5.0/configure.ac
===================================================================
--- torsocks-2.5.0.orig/configure.ac
+++ torsocks-2.5.0/configure.ac
@@ -53,11 +53,16 @@ AC_CHECK_HEADERS(dlfcn.h sys/syscall.h s
dnl Checks for required library functions.
AC_CHECK_FUNCS(strcspn strdup strerror strcasecmp strncasecmp mmap munmap \
- socket connect close syscall recv send memset memcpy strlen \
+ socket connect close recv send memset memcpy strlen \
strcmp malloc calloc strstr strtoul free,,
[AC_MSG_ERROR("Required function not found")]
)
+AS_CASE([$host_os],
+ [gnu*], [],
+ [AC_CHECK_FUNCS(syscall)]
+)
+
dnl Checks for optional library functions.
AC_CHECK_FUNCS(strlcpy strlcat)
@@ -124,7 +129,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|freebsd*],
+ [linux*|kfreebsd*-gnu|freebsd*|gnu*],
[
libc_name=`ldd /usr/bin/yes | grep 'libc\.' | cut -d ' ' -f 1 |
tr -d '\t'`
if test "${libc_name}" == ""; then
Index: torsocks-2.5.0/src/lib/syscall.c
===================================================================
--- torsocks-2.5.0.orig/src/lib/syscall.c
+++ torsocks-2.5.0/src/lib/syscall.c
@@ -23,6 +23,8 @@
#include "torsocks.h"
+#ifndef __GNU__
+
/* syscall(2) */
TSOCKS_LIBC_DECL(syscall, LIBC_SYSCALL_RET_TYPE, LIBC_SYSCALL_SIG)
@@ -703,3 +705,5 @@ LIBC___SYSCALL_DECL
}
#endif /* __NetBSD__, __FreeBSD__ */
+
+#endif /* !__GNU__ */
Index: torsocks-2.5.0/src/lib/accept.c
===================================================================
--- torsocks-2.5.0.orig/src/lib/accept.c
+++ torsocks-2.5.0/src/lib/accept.c
@@ -87,7 +87,7 @@ LIBC_ACCEPT_DECL
return tsocks_accept(LIBC_ACCEPT_ARGS);
}
-#if (defined(__linux__))
+#if (defined(__linux__) || defined(__GNU__))
TSOCKS_LIBC_DECL(accept4, LIBC_ACCEPT4_RET_TYPE, LIBC_ACCEPT4_SIG)
@@ -155,4 +155,4 @@ LIBC_ACCEPT4_DECL
return tsocks_accept4(LIBC_ACCEPT4_ARGS);
}
-#endif
+#endif /* __linux__, __GNU__ */
Index: torsocks-2.5.0/src/lib/torsocks.c
===================================================================
--- torsocks-2.5.0.orig/src/lib/torsocks.c
+++ torsocks-2.5.0/src/lib/torsocks.c
@@ -240,11 +240,16 @@ static void init_libc_symbols(void)
tsocks_libc_connect = dlsym(libc_ptr, LIBC_CONNECT_NAME_STR);
tsocks_libc_close = dlsym(libc_ptr, LIBC_CLOSE_NAME_STR);
tsocks_libc_socket = dlsym(libc_ptr, LIBC_SOCKET_NAME_STR);
+#ifndef __GNU__
tsocks_libc_syscall = dlsym(libc_ptr, LIBC_SYSCALL_NAME_STR);
+#endif
tsocks_libc_execve = dlsym(libc_ptr, LIBC_EXECVE_NAME_STR);
tsocks_libc_accept4 = dlsym(libc_ptr, LIBC_ACCEPT4_NAME_STR);
if (!tsocks_libc_connect || !tsocks_libc_close || !tsocks_libc_socket ||
- !tsocks_libc_syscall || !tsocks_libc_execve || !
tsocks_libc_accept4) {
+#ifndef __GNU__
+ !tsocks_libc_syscall ||
+#endif
+ !tsocks_libc_execve || ! tsocks_libc_accept4) {
ERR("Unable to lookup symbols in " LIBC_NAME "(%s)", dlerror());
goto error;
}
Index: torsocks-2.5.0/src/lib/torsocks.h
===================================================================
--- torsocks-2.5.0.orig/src/lib/torsocks.h
+++ torsocks-2.5.0/src/lib/torsocks.h
@@ -242,6 +242,10 @@ struct hostent **result, int *h_errnop
#define LIBC_SYSCALL_SIG long int number, ...
#define LIBC_SYSCALL_ARGS number
+#endif /* __linux__ */
+
+#if (defined(__linux__) || defined(__GNU__))
+
/* accept4(2) */
#define LIBC_ACCEPT4_NAME accept4
#define LIBC_ACCEPT4_NAME_STR XSTR(LIBC_ACCEPT4_NAME)
@@ -250,7 +254,7 @@ struct hostent **result, int *h_errnop
int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags
#define LIBC_ACCEPT4_ARGS sockfd, addr, addrlen, flags
-#endif /* __linux__ */
+#endif /* __linux__, __GNU__ */
#if (defined(__FreeBSD__) || defined(__darwin__) || defined(__NetBSD__))
@@ -328,10 +332,12 @@ TSOCKS_DECL(socketpair, LIBC_SOCKETPAIR_
#define LIBC_SOCKETPAIR_DECL \
LIBC_SOCKETPAIR_RET_TYPE
LIBC_SOCKETPAIR_NAME(LIBC_SOCKETPAIR_SIG)
+#ifndef __GNU__
/* syscall(2) */
extern TSOCKS_LIBC_DECL(syscall, LIBC_SYSCALL_RET_TYPE, LIBC_SYSCALL_SIG)
#define LIBC_SYSCALL_DECL \
LIBC_SYSCALL_RET_TYPE LIBC_SYSCALL_NAME(LIBC_SYSCALL_SIG)
+#endif /* !__GNU__ */
/* __syscall(2) */
#if (defined(__FreeBSD__) || defined(__NetBSD__))
@@ -414,12 +420,12 @@ TSOCKS_DECL(accept, LIBC_ACCEPT_RET_TYPE
LIBC_ACCEPT_NAME(LIBC_ACCEPT_SIG)
/* accept4(2) */
-#if (defined(__linux__))
+#if (defined(__linux__) || defined(__GNU__))
extern TSOCKS_LIBC_DECL(accept4, LIBC_ACCEPT4_RET_TYPE, LIBC_ACCEPT4_SIG)
TSOCKS_DECL(accept4, LIBC_ACCEPT4_RET_TYPE, LIBC_ACCEPT4_SIG)
#define LIBC_ACCEPT4_DECL LIBC_ACCEPT4_RET_TYPE \
LIBC_ACCEPT4_NAME(LIBC_ACCEPT4_SIG)
-#endif
+#endif /* __linux__, __GNU__ */
/* listen(2) */
extern TSOCKS_LIBC_DECL(listen, LIBC_LISTEN_RET_TYPE, LIBC_LISTEN_SIG)