mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-27 22:03:31 +01:00
Merge remote-tracking branch 'public/remove_old_libevent_autoconf_stuff'
This commit is contained in:
commit
c366e1fa32
3
changes/deprecated-libevents
Normal file
3
changes/deprecated-libevents
Normal file
@ -0,0 +1,3 @@
|
||||
o New system requirements:
|
||||
- Tor no longer includes workarounds for Libevent versions before 1.3e.
|
||||
Libevent 2.0 or later is recommended. Closes ticket #15248.
|
16
configure.ac
16
configure.ac
@ -438,15 +438,6 @@ AC_SUBST(TOR_LIB_WS32)
|
||||
AC_SUBST(TOR_LIB_GDI)
|
||||
AC_SUBST(TOR_LIB_IPHLPAPI)
|
||||
|
||||
dnl We need to do this before we try our disgusting hack below.
|
||||
AC_CHECK_HEADERS([sys/types.h])
|
||||
|
||||
dnl This is a disgusting hack so we safely include older libevent headers.
|
||||
AC_CHECK_TYPE(u_int64_t, unsigned long long)
|
||||
AC_CHECK_TYPE(u_int32_t, unsigned long)
|
||||
AC_CHECK_TYPE(u_int16_t, unsigned short)
|
||||
AC_CHECK_TYPE(u_int8_t, unsigned char)
|
||||
|
||||
tor_libevent_pkg_redhat="libevent"
|
||||
tor_libevent_pkg_debian="libevent-dev"
|
||||
tor_libevent_devpkg_redhat="libevent-devel"
|
||||
@ -487,13 +478,10 @@ save_CPPFLAGS="$CPPFLAGS"
|
||||
LIBS="-levent $STATIC_LIBEVENT_FLAGS $TOR_LIB_WS32 $LIBS"
|
||||
LDFLAGS="$TOR_LDFLAGS_libevent $LDFLAGS"
|
||||
CPPFLAGS="$TOR_CPPFLAGS_libevent $CPPFLAGS"
|
||||
AC_CHECK_FUNCS([event_get_version \
|
||||
event_get_version_number \
|
||||
event_get_method \
|
||||
event_set_log_callback \
|
||||
AC_CHECK_FUNCS([event_get_version_number \
|
||||
evutil_secure_rng_set_urandom_device_file \
|
||||
evutil_secure_rng_init \
|
||||
event_base_loopexit])
|
||||
])
|
||||
AC_CHECK_MEMBERS([struct event.min_heap_idx], , ,
|
||||
[#include <event.h>
|
||||
])
|
||||
|
@ -56,11 +56,6 @@ typedef uint32_t le_version_t;
|
||||
* it is. */
|
||||
#define LE_OTHER V(0,0,99)
|
||||
|
||||
#if 0
|
||||
static le_version_t tor_get_libevent_version(const char **v_out);
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_EVENT_SET_LOG_CALLBACK) || defined(RUNNING_DOXYGEN)
|
||||
/** A string which, if it appears in a libevent log, should be ignored. */
|
||||
static const char *suppress_msg = NULL;
|
||||
/** Callback function passed to event_set_log() so we can intercept
|
||||
@ -107,17 +102,6 @@ suppress_libevent_log_msg(const char *msg)
|
||||
{
|
||||
suppress_msg = msg;
|
||||
}
|
||||
#else
|
||||
void
|
||||
configure_libevent_logging(void)
|
||||
{
|
||||
}
|
||||
void
|
||||
suppress_libevent_log_msg(const char *msg)
|
||||
{
|
||||
(void)msg;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_EVENT2_EVENT_H
|
||||
/** Work-alike replacement for event_new() on pre-Libevent-2.0 systems. */
|
||||
@ -275,19 +259,11 @@ tor_libevent_initialize(tor_libevent_cfg *torcfg)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
#if defined(HAVE_EVENT_GET_VERSION) && defined(HAVE_EVENT_GET_METHOD)
|
||||
/* Making this a NOTICE for now so we can link bugs to a libevent versions
|
||||
* or methods better. */
|
||||
log_info(LD_GENERAL,
|
||||
"Initialized libevent version %s using method %s. Good.",
|
||||
event_get_version(), tor_libevent_get_method());
|
||||
#else
|
||||
log_notice(LD_GENERAL,
|
||||
"Initialized old libevent (version 1.0b or earlier).");
|
||||
log_warn(LD_GENERAL,
|
||||
"You have a *VERY* old version of libevent. It is likely to be buggy; "
|
||||
"please build Tor with a more recent version.");
|
||||
#endif
|
||||
|
||||
#ifdef USE_BUFFEREVENTS
|
||||
tor_libevent_set_tick_timeout(torcfg->msec_per_tick);
|
||||
@ -301,27 +277,14 @@ tor_libevent_get_base, (void))
|
||||
return the_event_base;
|
||||
}
|
||||
|
||||
#ifndef HAVE_EVENT_BASE_LOOPEXIT
|
||||
/** Replacement for event_base_loopexit on some very old versions of Libevent
|
||||
* that we are not yet brave enough to deprecate. */
|
||||
int
|
||||
tor_event_base_loopexit(struct event_base *base, struct timeval *tv)
|
||||
{
|
||||
tor_assert(base == the_event_base);
|
||||
return event_loopexit(tv);
|
||||
}
|
||||
#endif
|
||||
|
||||
/** Return the name of the Libevent backend we're using. */
|
||||
const char *
|
||||
tor_libevent_get_method(void)
|
||||
{
|
||||
#ifdef HAVE_EVENT2_EVENT_H
|
||||
return event_base_get_method(the_event_base);
|
||||
#elif defined(HAVE_EVENT_GET_METHOD)
|
||||
return event_get_method();
|
||||
#else
|
||||
return "<unknown>";
|
||||
return event_get_method();
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -376,54 +339,12 @@ le_versions_compatibility(le_version_t v)
|
||||
return 5;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/** Return the version number of the currently running version of Libevent.
|
||||
* See le_version_t for info on the format.
|
||||
*/
|
||||
static le_version_t
|
||||
tor_get_libevent_version(const char **v_out)
|
||||
{
|
||||
const char *v;
|
||||
le_version_t r;
|
||||
#if defined(HAVE_EVENT_GET_VERSION_NUMBER)
|
||||
v = event_get_version();
|
||||
r = event_get_version_number();
|
||||
#elif defined (HAVE_EVENT_GET_VERSION)
|
||||
v = event_get_version();
|
||||
r = tor_decode_libevent_version(v);
|
||||
#else
|
||||
v = "pre-1.0c";
|
||||
r = LE_OLD;
|
||||
#endif
|
||||
if (v_out)
|
||||
*v_out = v;
|
||||
return r;
|
||||
}
|
||||
#endif
|
||||
|
||||
/** Return a string representation of the version of the currently running
|
||||
* version of Libevent. */
|
||||
const char *
|
||||
tor_libevent_get_version_str(void)
|
||||
{
|
||||
#ifdef HAVE_EVENT_GET_VERSION
|
||||
return event_get_version();
|
||||
#else
|
||||
return "pre-1.0c";
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare the current Libevent method and version to a list of versions
|
||||
* which are known not to work. Warn the user as appropriate.
|
||||
*/
|
||||
void
|
||||
tor_check_libevent_version(const char *m, int server,
|
||||
const char **badness_out)
|
||||
{
|
||||
(void) m;
|
||||
(void) server;
|
||||
*badness_out = NULL;
|
||||
}
|
||||
|
||||
#if defined(LIBEVENT_VERSION)
|
||||
@ -452,7 +373,7 @@ tor_check_libevent_header_compatibility(void)
|
||||
/* In libevent versions before 2.0, it's hard to keep binary compatibility
|
||||
* between upgrades, and unpleasant to detect when the version we compiled
|
||||
* against is unlike the version we have linked against. Here's how. */
|
||||
#if defined(HEADER_VERSION) && defined(HAVE_EVENT_GET_VERSION)
|
||||
#if defined(HEADER_VERSION)
|
||||
/* We have a header-file version and a function-call version. Easy. */
|
||||
if (strcmp(HEADER_VERSION, event_get_version())) {
|
||||
le_version_t v1, v2;
|
||||
@ -474,7 +395,7 @@ tor_check_libevent_header_compatibility(void)
|
||||
else
|
||||
log_info(LD_GENERAL, "I think these versions are binary-compatible.");
|
||||
}
|
||||
#elif defined(HAVE_EVENT_GET_VERSION)
|
||||
#else
|
||||
/* event_get_version but no _EVENT_VERSION. We might be in 1.4.0-beta or
|
||||
earlier, where that's normal. To see whether we were compiled with an
|
||||
earlier version, let's see whether the struct event defines MIN_HEAP_IDX.
|
||||
@ -504,9 +425,6 @@ tor_check_libevent_header_compatibility(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#elif defined(HEADER_VERSION)
|
||||
#warn "_EVENT_VERSION is defined but not get_event_version(): Libevent is odd."
|
||||
#else
|
||||
/* Your libevent is ancient. */
|
||||
#endif
|
||||
}
|
||||
|
@ -52,12 +52,7 @@ periodic_timer_t *periodic_timer_new(struct event_base *base,
|
||||
void *data);
|
||||
void periodic_timer_free(periodic_timer_t *);
|
||||
|
||||
#ifdef HAVE_EVENT_BASE_LOOPEXIT
|
||||
#define tor_event_base_loopexit event_base_loopexit
|
||||
#else
|
||||
struct timeval;
|
||||
int tor_event_base_loopexit(struct event_base *base, struct timeval *tv);
|
||||
#endif
|
||||
|
||||
/** Defines a configuration for using libevent with Tor: passed as an argument
|
||||
* to tor_libevent_initialize() to describe how we want to set up. */
|
||||
@ -74,8 +69,6 @@ typedef struct tor_libevent_cfg {
|
||||
void tor_libevent_initialize(tor_libevent_cfg *cfg);
|
||||
MOCK_DECL(struct event_base *, tor_libevent_get_base, (void));
|
||||
const char *tor_libevent_get_method(void);
|
||||
void tor_check_libevent_version(const char *m, int server,
|
||||
const char **badness_out);
|
||||
void tor_check_libevent_header_compatibility(void);
|
||||
const char *tor_libevent_get_version_str(void);
|
||||
const char *tor_libevent_get_header_version_str(void);
|
||||
|
@ -6748,7 +6748,6 @@ get_num_cpus(const or_options_t *options)
|
||||
static void
|
||||
init_libevent(const or_options_t *options)
|
||||
{
|
||||
const char *badness=NULL;
|
||||
tor_libevent_cfg cfg;
|
||||
|
||||
tor_assert(options);
|
||||
@ -6769,17 +6768,6 @@ init_libevent(const or_options_t *options)
|
||||
tor_libevent_initialize(&cfg);
|
||||
|
||||
suppress_libevent_log_msg(NULL);
|
||||
|
||||
tor_check_libevent_version(tor_libevent_get_method(),
|
||||
server_mode(get_options()),
|
||||
&badness);
|
||||
if (badness) {
|
||||
const char *v = tor_libevent_get_version_str();
|
||||
const char *m = tor_libevent_get_method();
|
||||
control_event_general_status(LOG_WARN,
|
||||
"BAD_LIBEVENT VERSION=%s METHOD=%s BADNESS=%s RECOVERED=NO",
|
||||
v, m, badness);
|
||||
}
|
||||
}
|
||||
|
||||
/** Return a newly allocated string holding a filename relative to the data
|
||||
|
Loading…
Reference in New Issue
Block a user