[Tor-BSD] Building Tor 0.2.7.x on OpenBSD

attila attila at stalphonsos.com
Tue Jul 28 10:21:45 EDT 2015


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA384


teor <teor2345 at gmail.com> writes:

>> On 28 Jul 2015, at 01:33 , attila <attila at stalphonsos.com> wrote:
>> 
>> Signed PGP part
>> 
>> attila <attila at stalphonsos.com> writes:
>> 
>>  
>> This patch below is a little better that the first one but
>> in the end it's the same: call evthread_use_pthreads() on Unix.  We
>> ARE always using threads so there's no need to conditionalize it more
>> than that, it's just the way that using_threads gets set to 1 is a
>> little convoluted... whatever, not going to fix the world with one
>> patch, just trying to make it incrementally better:
>> 
>> Patch:
>> ========================================================================
>> diff --git a/configure.ac b/configure.ac
>> index 214b7e6..963bb71 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -570,7 +570,12 @@ int x = y(zz);
>> #else
>> int x = 1;
>> #endif
>> -   ])], [ AC_MSG_RESULT([yes]) ],
>> +   ])], [ AC_MSG_RESULT([yes])
>> +       TOR_LIBEVENT_LIBS="-levent_core -levent_extra"
>> +       if test "$bwin32" = "false"; then
>> +           TOR_LIBEVENT_LIBS="-levent_pthreads ${TOR_LIBEVENT_LIBS}"
>> +       fi
>> +   ],
>>        [ AC_MSG_RESULT([no])
>>          AC_MSG_ERROR([Libevent does not seem new enough to support bufferevents.  We require 2.0.13-stable or later]) ] )
>>      fi
>> diff --git a/src/common/compat_libevent.c b/src/common/compat_libevent.c
>> index a366b6c..8dfeae2 100644
>> --- a/src/common/compat_libevent.c
>> +++ b/src/common/compat_libevent.c
>> @@ -208,7 +208,11 @@ tor_libevent_initialize(tor_libevent_cfg *torcfg)
>>      }
>> #elif defined(__COVERITY__)
>>      /* Avoid a 'dead code' warning below. */
>> -    using_threads = ! torcfg->disable_iocp;
>> +    /* N.B. To be clear: This piece of code is always compiled in on
>> +     * Unix when we are using libevent2.  We are always using pthreads
>> +     * in this case. */
>> +    using_threads = ! torcfg->disable_iocp; /* disable_iocp defaults to 1 */
>> +    evthread_use_pthreads();
>> #endif
>> 
>>      if (!using_threads) {
>> ========================================================================
>
> I can't see how this patch makes any difference, as the modified code is only compiled in under coverity.
>

So true.  I just can't seem to stop f'ing up.  Your patch below is right...

> You probably want something more like this (showing the full preprocessor block):
>
> #if defined(_WIN32) && defined(USE_BUFFEREVENTS)
>     if (! torcfg->disable_iocp) {
>       evthread_use_windows_threads();
>       event_config_set_flag(cfg, EVENT_BASE_FLAG_STARTUP_IOCP);
>       using_iocp_bufferevents = 1;
>       using_threads = 1;
>     } else {
>       using_iocp_bufferevents = 0;
>     }
> #elif defined(__COVERITY__)
>     /* Avoid a 'dead code' warning below. */
>     using_threads = ! torcfg->disable_iocp;
> +#else /* is a libevent2 preprocessor conditional needed here? */

We don't need a conditional here because we're already inside the
HAVE_EVENT2_EVENT_H conditional.  I just spaced out on __COVERITY__

> +    /* N.B. To be clear: This piece of code is always compiled in on
> +     * Unix when we are using libevent2.  We are always using pthreads
> +     * in this case. */
> +    evthread_use_pthreads();
> #endif
>

Can you confirm that this fixes your crashes under OpenBSD for head of
line?  I recently came into some hardware that should make it easier
for me to test things a little more rigorously, but I don't have it
all humming yet... only so much you can do on a uniprocessor i386
w/1GB of RAM.

> Regards
>
> Tim (teor)
>
> Tim Wilson-Brown (teor)
>
> teor2345 at gmail dot com
> pgp ABFED1AC
> https://gist.github.com/teor2345/d033b8ce0a99adbc89c5
>
> teor at blah dot im
> OTR D5BE4EC2 255D7585 F3874930 DB130265 7C9EBBC7

Pax, -A
- --
http://trac.haqistan.net | attila at stalphonsos.com | 0xE6CC1EDB
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Processed by Mailcrypt 3.5.9 <http://mailcrypt.sourceforge.net/>

iQIcBAEBCQAGBQJVt4/4AAoJEJZ30KbmzB7b9wIQAKXAjzSQltMbssCZiOGJTTf4
MVyqPrbqx69go5R4SywWvxU2zT876Bp4sHDlxFhIrJWcrQHaI5UZLvb7ZAuLERJS
Yp/fk/0BxpOS0OdXHGXHyUVxfzsru6FYsZM5h51AjC6Zs/OwKrT+qp2mxg8zchpB
y+g8AUxJJup9WahxtRMQJKkxXgigaMFz8C9QaYe6kgbs0M4rOEsD6CXZgGLHi09U
Klp7pt9+jnJHoZFh0FXVeKbeeZ8S1WT94xEMZRbq5N5mv2ZepK3QAtk5pIz3W/Zz
GsUyQvIWuEd4f0M2AZB+e7wnONfHLVmP0WYMDwjkwJScd/h2DD7eqdqGwT9YIyT6
/X7PDaWu7Xykv1nWFPZZ2CaWPn+y0tN9uXsbTmmdOLUDdh9Hgeof0XqDEUwLuVeE
DROTdnOF/AXnU18MgezlGxv4bhdfQul6YkX82N+1AB4N13z6SyuaUw5KHGmMeWfJ
ZZlxldjNcDt1seZZljfvg1Mqz+beZymFpkbj9WDfwsGdfgSIgZbq4mYCBkGShIpM
Fca7olFx+E6UMTaa0JLtHcf0k0g0E9BNtViVRIXWSzlzqLpo80wb7+77MIjy5IiA
q14Qh3c06rAdZKLMKFRzuKw9+QOTGbWYr0n3m+Lv0XZQuvGlworp5Ih8m/x3lYCe
FQMp1dO59nwDCyshi0LP
=Rt2u
-----END PGP SIGNATURE-----



More information about the Tor-BSD mailing list