On 05 Nov (16:14:33), Thomas Klausner wrote: > Hi! > > I've patched torsocks-v2.0.0-rc3 to compile on NetBSD. > > There is one warning left: > syscall.c: In function 'handle_mmap': > syscall.c:88:9: warning: cast from pointer to integer of different size I encountered that on FreeBSD but I can't really make it go away :S ... mmap() returns a void * but syscall() returns an int on BSD but even with a cast it prints the warning... I have *no* idea how *BSD systems handle syscall(SYS_MMAP, ...) for instance on an x64 system when syscall() returns an int (8 bytes vs 4 bytes). I'm guessing some more tests on BSD will be needed with that syscall() API in torsocks... > > and I haven't done any functional tests yet. What is the easiest way > to do that? > > Attached are the patches I've used to get this far. Thanks! Will take a look as soon as I can! > > Some additional comments: The package installs a few files where it > shouldn't: > > share/DEBUG > share/SOCKS5 > share/socks-extensions.txt > > These belong in share/doc/torsocks instead, I guess. Yup! Good catch. Will fix that. > > And what is the point of src.old inside the tarball? This is temporary, it contains the source of the previous version (1.3) and I keep them there as a reference for now since it's a rewrite almost everything got modified. But, in the tarball, I agree that it's a bit useless. I'll remove them from there. Thanks! David > > Cheers, > Thomas > > $NetBSD$ > > Handle NetBSD like FreeBSD. > > --- src/common/compat.c.orig 2013-11-03 18:24:51.000000000 +0000 > +++ src/common/compat.c > @@ -19,7 +19,7 @@ > > #include "compat.h" > > -#if (defined(__GLIBC__) || defined(__FreeBSD__) || defined(__darwin__)) > +#if (defined(__GLIBC__) || defined(__FreeBSD__) || defined(__darwin__) || defined(__NetBSD__)) > > /* > * Initialize a pthread mutex. This never fails. > @@ -71,4 +71,4 @@ void tsocks_mutex_unlock(tsocks_mutex_t > assert(!ret); > } > > -#endif /* __GLIBC__, __darwin__, __FreeBSD__ */ > +#endif /* __GLIBC__, __darwin__, __FreeBSD__, __NetBSD__ */ > $NetBSD$ > > Handle NetBSD like FreeBSD. > > --- src/common/compat.h.orig 2013-11-03 18:24:51.000000000 +0000 > +++ src/common/compat.h > @@ -22,7 +22,7 @@ > #define __darwin__ 1 > #endif > > -#if (defined(__GLIBC__) || defined(__FreeBSD__) || defined(__darwin__)) > +#if (defined(__GLIBC__) || defined(__FreeBSD__) || defined(__darwin__) || defined(__NetBSD__)) > > #define RTLD_NEXT ((void *) -1) > > @@ -43,7 +43,7 @@ void tsocks_mutex_unlock(tsocks_mutex_t > > #else > #error "OS not supported." > -#endif /* __GLIBC__, __darwin__, __FreeBSD__ */ > +#endif /* __GLIBC__, __darwin__, __FreeBSD__, __NetBSD__ */ > > #if defined(__linux__) > > @@ -84,17 +84,21 @@ void tsocks_mutex_unlock(tsocks_mutex_t > > #endif /* __linux__ */ > > -#if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__darwin__)) > +#if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__darwin__) || defined(__NetBSD__)) > > #include <sys/syscall.h> > #include <unistd.h> > > +#if defined(__NetBSD__) > +#define SYS_socket SYS___socket30 > +#endif > + > #define TSOCKS_NR_SOCKET SYS_socket > #define TSOCKS_NR_CONNECT SYS_connect > #define TSOCKS_NR_CLOSE SYS_close > #define TSOCKS_NR_MMAP SYS_mmap > #define TSOCKS_NR_MUNMAP SYS_munmap > > -#endif /* __FreeBSD__, __FreeBSD_kernel__, __darwin__ */ > +#endif /* __FreeBSD__, __FreeBSD_kernel__, __darwin__, __NetBSD__ */ > > #endif /* TORSOCKS_COMPAT_H */ > $NetBSD$ > > Handle NetBSD like FreeBSD. > > --- src/common/ref.h.orig 2013-11-03 18:24:51.000000000 +0000 > +++ src/common/ref.h > @@ -26,7 +26,7 @@ struct ref { > long count; > }; > > -#if (defined(__GLIBC__) || defined(__FreeBSD__) || defined(__darwin__)) > +#if (defined(__GLIBC__) || defined(__FreeBSD__) || defined(__darwin__) || defined(__NetBSD__)) > > /* > * Get a reference by incrementing the refcount. > $NetBSD$ > > Handle NetBSD like FreeBSD. > > --- src/lib/torsocks.h.orig 2013-11-03 18:24:51.000000000 +0000 > +++ src/lib/torsocks.h > @@ -33,7 +33,7 @@ > #define TSOCKS_DECL(name, type, sig) \ > extern type tsocks_##name(sig); > > -#if (defined(__GLIBC__) || defined(__FreeBSD__) || defined(__darwin__)) > +#if (defined(__GLIBC__) || defined(__FreeBSD__) || defined(__darwin__) || defined(__NetBSD__)) > > /* connect(2) */ > #include <sys/types.h> > @@ -171,7 +171,7 @@ struct hostent **__result, int *__h_errn > > #else > #error "OS not supported." > -#endif /* __GLIBC__ , __FreeBSD__, __darwin__ */ > +#endif /* __GLIBC__ , __FreeBSD__, __darwin__, __NetBSD__ */ > > #if (defined(__linux__)) > > @@ -186,7 +186,7 @@ struct hostent **__result, int *__h_errn > > #endif /* __linux__ */ > > -#if (defined(__FreeBSD__) || defined(__darwin__)) > +#if (defined(__FreeBSD__) || defined(__darwin__) || defined(__NetBSD__)) > > /* syscall(2) */ > #define LIBC_SYSCALL_NAME syscall > @@ -195,7 +195,7 @@ struct hostent **__result, int *__h_errn > #define LIBC_SYSCALL_SIG int __number, ... > #define LIBC_SYSCALL_ARGS __number > > -#endif /* __FreeBSD__, __darwin__ */ > +#endif /* __FreeBSD__, __darwin__, __NetBSD__ */ > > #if defined(__GLIBC__) && defined(__FreeBSD_kernel__) > > $NetBSD$ > > isdigit() only accepts unsigned chars and -1. > NetBSD's version is quite picky about this. > > --- tests/utils/tap/tap.c.orig 2013-11-03 18:24:51.000000000 +0000 > +++ tests/utils/tap/tap.c > @@ -94,7 +94,7 @@ _gen_result(int ok, const char *func, ch > if(local_test_name) { > name_is_digits = 1; > for(c = local_test_name; *c != '\0'; c++) { > - if(!isdigit(*c) && !isspace(*c)) { > + if(!isdigit((unsigned char)*c) && !isspace((unsigned char)*c)) { > name_is_digits = 0; > break; > } > _______________________________________________ > tor-dev mailing list > tor-dev@xxxxxxxxxxxxxxxxxxxx > https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev
Attachment:
signature.asc
Description: Digital signature
_______________________________________________ tor-dev mailing list tor-dev@xxxxxxxxxxxxxxxxxxxx https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev