42 Commits

Author SHA1 Message Date
Azat Khuzhin
6e4ea6c3f1 evthread: fix NULL dereference in evthread_setup_global_lock_() 2024-02-18 19:49:44 +01:00
Gordon Bergling
8728c98311 evthread: Fix typos in error messages
- s/probaby/probably/
2023-09-02 21:57:32 +02:00
Azat Khuzhin
35375101e7 Fixes some new warnings under clang-15
- -Wdeprecated-non-prototype

  /src/le/libevent/strlcpy.c:48:1: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  event_strlcpy_(dst, src, siz)

- -Wstrict-prototypes

  /src/le/libevent/evthread.c:82:70: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
  struct evthread_condition_callbacks *evthread_get_condition_callbacks()

- -Wunused-but-set-variable

  /src/le/libevent/test/regress_buffer.c:130:6: warning: variable 'n' set but not used [-Wunused-but-set-variable]
          int n = 0;
                                                                     ^
2023-01-27 08:58:51 +01:00
Azat Khuzhin
9081b66c9c Export symbols for -fvisibility=hidden (under cmake)
Fixes: #442
2017-03-13 12:57:22 +03:00
Azat Khuzhin
e4556fcda7 evthread: fix evthread_setup_global_lock_() for debug-lock with a real-lock case
Sample bt:
  (gdb) bt
  #0  0x00000000004a95d2 in evthread_setup_global_lock_ (lock_=0x0, locktype=0, enable_locks=1)
  #1  0x00000000004afbc7 in evsig_global_setup_locks_ (enable_locks=1) at signal.c:475
  #2  0x00000000004a5da8 in event_global_setup_locks_ (enable_locks=1) at event.c:3838
  #3  0x00000000004a8983 in evthread_set_lock_callbacks (cbs=0x7fffffffdde0) at evthread.c:129
  #4  0x0000000000445a8f in use_lock_unlock_profiler () at regress_bufferevent.c:306
  #5  0x0000000000445af2 in test_bufferevent_pair_release_lock (arg=0x70e710) at regress_bufferevent.c:327
  #6  0x000000000048c9a8 in testcase_run_bare_ (testcase=0x6fdc10 <bufferevent_testcases+80>) at tinytest.c:105
  #7  0x000000000048cc8a in testcase_run_one (group=0x6ff270 <testgroups+112>, testcase=0x6fdc10 <bufferevent_testcases+80>) at tinytest.c:252
  #8  0x000000000048d5c9 in tinytest_main (c=3, v=0x7fffffffe008, groups=0x6ff200 <testgroups>) at tinytest.c:434
  #9  0x000000000047a08f in main (argc=3, argv=0x7fffffffe008) at regress_main.c:459

Found-with: regress bufferevent/bufferevent_pair_release_lock (-DEVENT__DISABLE_DEBUG_MODE=ON)
2015-10-04 03:50:40 +03:00
Mark Ellzey
dcfb19a27b Debug mode option to error on evthread init AFTER other event calls.
- A handy event_enable_debug_mode() feature which will error and abort the
  application if any thread-aware libevent functions are called BEFORE the
  evthread API has been initialized (manually, or through
  evthread_use_windows_threads() / evthread_use_pthreads()

- This is done by setting the global debug variable
  'event_debug_created_threadable_ctx_' whenever the following functions
  are called:

     evthreadimpl_lock_alloc_()
     evthreadimpl_cond_alloc_()
     event_base_new_with_config() <- this checks to see if the thread
                                     callbacks are enabled first, so we
                                     have to manually set the variable.

- Example:

int main(int argc, char ** argv) {
    struct event_base * base;

    event_enable_debug_mode();

    base = event_base_new();

    evthread_use_pthreads();

    return 0;
}

When executed, the program will throw an error and exit:

[err] evthread initialization must be called BEFORE anything else!
2015-05-15 02:58:14 -07:00
Azat Khuzhin
ccc55937cf evthread: evthreadimpl_disable_lock_debugging_() for libevent_global_shutdown() 2015-01-26 00:40:09 +03:00
Azat Khuzhin
c0b34f6fd5 evthread: add evthread_get_{lock,condition}_callbacks() helpers 2015-01-26 00:40:09 +03:00
Nick Mathewson
07e132e3ad Rename event_enable_lock_debuging() to ..._debugging()
Keep the misspelled version around for backward compatibility

Based on a patch by Diwaker Gupta.
2012-08-23 10:46:29 -04:00
Nick Mathewson
946b5841c2 Clean up lingering _identifiers. 2012-02-29 15:47:16 -05:00
Nick Mathewson
cb9da0bf38 Fix all identifiers with names beginning with underscore.
These are reserved in C.  We'd been erroneously using them to indicate
internal use.

Instead, we now use a trailing underscore whenever we'd been using a leading
underscore.

This is an automatic conversion.  The script that produced was made by
running the following script over the output of

 git ls-tree -r --name-only HEAD | grep  '\.[ch]$' | \
   xargs ctags --c-kinds=defglmpstuvx -o - | grep '^_' | \
   cut -f 1 | sort| uniq

(GNU ctags was required.)

=====
#!/usr/bin/perl -w -n

use strict;

BEGIN { print "#!/usr/bin/perl -w -i -p\n\n"; }

chomp;

next if (/^__func__/ or
	 /^_FILE_OFFSET_BITS/ or
	 /^_FORTIFY_SOURCE/ or
	 /^_GNU_SOURCE/ or
	 /^_WIN32/ or
	 /^_DARWIN_UNLIMITED/ or
	 /^_FILE_OFFSET_BITS/ or
	 /^_LARGEFILE64_SOURCE/ or
	 /^_LFS64_LARGEFILE/ or
	 /^__cdecl/ or
	 /^__attribute__/ or
	 /^__func__/ or
         /^_SYS_TREE_H_/);

my $ident = $_;

my $better = $ident;
$better =~ s/^_//;

if ($ident !~ /EVENT_LOG_/) {
    $better = "${better}_";
}

print "s/(?<![A-Za-z0-9_])$ident(?![A-Za-z0-9_])/$better/g;\n";

=== And then running the script below that it generated over all
=== the .c and .h files again
#!/usr/bin/perl -w -i -p

s/(?<![A-Za-z0-9_])_ARC4_LOCK(?![A-Za-z0-9_])/ARC4_LOCK_/g;
s/(?<![A-Za-z0-9_])_ARC4_UNLOCK(?![A-Za-z0-9_])/ARC4_UNLOCK_/g;
s/(?<![A-Za-z0-9_])_bev_group_random_element(?![A-Za-z0-9_])/bev_group_random_element_/g;
s/(?<![A-Za-z0-9_])_bev_group_refill_callback(?![A-Za-z0-9_])/bev_group_refill_callback_/g;
s/(?<![A-Za-z0-9_])_bev_group_suspend_reading(?![A-Za-z0-9_])/bev_group_suspend_reading_/g;
s/(?<![A-Za-z0-9_])_bev_group_suspend_writing(?![A-Za-z0-9_])/bev_group_suspend_writing_/g;
s/(?<![A-Za-z0-9_])_bev_group_unsuspend_reading(?![A-Za-z0-9_])/bev_group_unsuspend_reading_/g;
s/(?<![A-Za-z0-9_])_bev_group_unsuspend_writing(?![A-Za-z0-9_])/bev_group_unsuspend_writing_/g;
s/(?<![A-Za-z0-9_])_bev_refill_callback(?![A-Za-z0-9_])/bev_refill_callback_/g;
s/(?<![A-Za-z0-9_])_bufferevent_add_event(?![A-Za-z0-9_])/bufferevent_add_event_/g;
s/(?<![A-Za-z0-9_])_bufferevent_cancel_all(?![A-Za-z0-9_])/bufferevent_cancel_all_/g;
s/(?<![A-Za-z0-9_])_bufferevent_decref_and_unlock(?![A-Za-z0-9_])/bufferevent_decref_and_unlock_/g;
s/(?<![A-Za-z0-9_])_bufferevent_decrement_read_buckets(?![A-Za-z0-9_])/bufferevent_decrement_read_buckets_/g;
s/(?<![A-Za-z0-9_])_bufferevent_decrement_write_buckets(?![A-Za-z0-9_])/bufferevent_decrement_write_buckets_/g;
s/(?<![A-Za-z0-9_])_bufferevent_del_generic_timeout_cbs(?![A-Za-z0-9_])/bufferevent_del_generic_timeout_cbs_/g;
s/(?<![A-Za-z0-9_])_bufferevent_generic_adj_timeouts(?![A-Za-z0-9_])/bufferevent_generic_adj_timeouts_/g;
s/(?<![A-Za-z0-9_])_bufferevent_get_read_max(?![A-Za-z0-9_])/bufferevent_get_read_max_/g;
s/(?<![A-Za-z0-9_])_bufferevent_get_rlim_max(?![A-Za-z0-9_])/bufferevent_get_rlim_max_/g;
s/(?<![A-Za-z0-9_])_bufferevent_get_write_max(?![A-Za-z0-9_])/bufferevent_get_write_max_/g;
s/(?<![A-Za-z0-9_])_bufferevent_incref_and_lock(?![A-Za-z0-9_])/bufferevent_incref_and_lock_/g;
s/(?<![A-Za-z0-9_])_bufferevent_init_generic_timeout_cbs(?![A-Za-z0-9_])/bufferevent_init_generic_timeout_cbs_/g;
s/(?<![A-Za-z0-9_])_bufferevent_ratelim_init(?![A-Za-z0-9_])/bufferevent_ratelim_init_/g;
s/(?<![A-Za-z0-9_])_bufferevent_run_eventcb(?![A-Za-z0-9_])/bufferevent_run_eventcb_/g;
s/(?<![A-Za-z0-9_])_bufferevent_run_readcb(?![A-Za-z0-9_])/bufferevent_run_readcb_/g;
s/(?<![A-Za-z0-9_])_bufferevent_run_writecb(?![A-Za-z0-9_])/bufferevent_run_writecb_/g;
s/(?<![A-Za-z0-9_])_ev(?![A-Za-z0-9_])/ev_/g;
s/(?<![A-Za-z0-9_])_evbuffer_chain_pin(?![A-Za-z0-9_])/evbuffer_chain_pin_/g;
s/(?<![A-Za-z0-9_])_evbuffer_chain_unpin(?![A-Za-z0-9_])/evbuffer_chain_unpin_/g;
s/(?<![A-Za-z0-9_])_evbuffer_decref_and_unlock(?![A-Za-z0-9_])/evbuffer_decref_and_unlock_/g;
s/(?<![A-Za-z0-9_])_evbuffer_expand_fast(?![A-Za-z0-9_])/evbuffer_expand_fast_/g;
s/(?<![A-Za-z0-9_])_evbuffer_incref(?![A-Za-z0-9_])/evbuffer_incref_/g;
s/(?<![A-Za-z0-9_])_evbuffer_incref_and_lock(?![A-Za-z0-9_])/evbuffer_incref_and_lock_/g;
s/(?<![A-Za-z0-9_])_EVBUFFER_IOVEC_IS_NATIVE(?![A-Za-z0-9_])/EVBUFFER_IOVEC_IS_NATIVE_/g;
s/(?<![A-Za-z0-9_])_evbuffer_overlapped_get_fd(?![A-Za-z0-9_])/evbuffer_overlapped_get_fd_/g;
s/(?<![A-Za-z0-9_])_evbuffer_overlapped_set_fd(?![A-Za-z0-9_])/evbuffer_overlapped_set_fd_/g;
s/(?<![A-Za-z0-9_])_evbuffer_read_setup_vecs(?![A-Za-z0-9_])/evbuffer_read_setup_vecs_/g;
s/(?<![A-Za-z0-9_])_evbuffer_validate(?![A-Za-z0-9_])/evbuffer_validate_/g;
s/(?<![A-Za-z0-9_])_evdns_log(?![A-Za-z0-9_])/evdns_log_/g;
s/(?<![A-Za-z0-9_])_evdns_nameserver_add_impl(?![A-Za-z0-9_])/evdns_nameserver_add_impl_/g;
s/(?<![A-Za-z0-9_])_EVENT_CONFIG_H_(?![A-Za-z0-9_])/EVENT_CONFIG_H__/g;
s/(?<![A-Za-z0-9_])_event_debug_assert_is_setup(?![A-Za-z0-9_])/event_debug_assert_is_setup_/g;
s/(?<![A-Za-z0-9_])_event_debug_assert_not_added(?![A-Za-z0-9_])/event_debug_assert_not_added_/g;
s/(?<![A-Za-z0-9_])_event_debug_get_logging_mask(?![A-Za-z0-9_])/event_debug_get_logging_mask_/g;
s/(?<![A-Za-z0-9_])_event_debug_logging_mask(?![A-Za-z0-9_])/event_debug_logging_mask_/g;
s/(?<![A-Za-z0-9_])_event_debug_map_lock(?![A-Za-z0-9_])/event_debug_map_lock_/g;
s/(?<![A-Za-z0-9_])_event_debug_mode_on(?![A-Za-z0-9_])/event_debug_mode_on_/g;
s/(?<![A-Za-z0-9_])_event_debug_note_add(?![A-Za-z0-9_])/event_debug_note_add_/g;
s/(?<![A-Za-z0-9_])_event_debug_note_del(?![A-Za-z0-9_])/event_debug_note_del_/g;
s/(?<![A-Za-z0-9_])_event_debug_note_setup(?![A-Za-z0-9_])/event_debug_note_setup_/g;
s/(?<![A-Za-z0-9_])_event_debug_note_teardown(?![A-Za-z0-9_])/event_debug_note_teardown_/g;
s/(?<![A-Za-z0-9_])_event_debugx(?![A-Za-z0-9_])/event_debugx_/g;
s/(?<![A-Za-z0-9_])_EVENT_DEFINED_LISTENTRY(?![A-Za-z0-9_])/EVENT_DEFINED_LISTENTRY_/g;
s/(?<![A-Za-z0-9_])_EVENT_DEFINED_TQENTRY(?![A-Za-z0-9_])/EVENT_DEFINED_TQENTRY_/g;
s/(?<![A-Za-z0-9_])_EVENT_DEFINED_TQHEAD(?![A-Za-z0-9_])/EVENT_DEFINED_TQHEAD_/g;
s/(?<![A-Za-z0-9_])_EVENT_DNS_USE_FTIME_FOR_ID(?![A-Za-z0-9_])/EVENT_DNS_USE_FTIME_FOR_ID_/g;
s/(?<![A-Za-z0-9_])_EVENT_ERR_ABORT(?![A-Za-z0-9_])/EVENT_ERR_ABORT_/g;
s/(?<![A-Za-z0-9_])_EVENT_EVCONFIG__PRIVATE_H(?![A-Za-z0-9_])/EVENT_EVCONFIG__PRIVATE_H_/g;
s/(?<![A-Za-z0-9_])_event_iocp_port_unlock_and_free(?![A-Za-z0-9_])/event_iocp_port_unlock_and_free_/g;
s/(?<![A-Za-z0-9_])_EVENT_LOG_DEBUG(?![A-Za-z0-9_])/EVENT_LOG_DEBUG/g;
s/(?<![A-Za-z0-9_])_EVENT_LOG_ERR(?![A-Za-z0-9_])/EVENT_LOG_ERR/g;
s/(?<![A-Za-z0-9_])_EVENT_LOG_MSG(?![A-Za-z0-9_])/EVENT_LOG_MSG/g;
s/(?<![A-Za-z0-9_])_EVENT_LOG_WARN(?![A-Za-z0-9_])/EVENT_LOG_WARN/g;
s/(?<![A-Za-z0-9_])_event_strlcpy(?![A-Za-z0-9_])/event_strlcpy_/g;
s/(?<![A-Za-z0-9_])_EVHTTP_REQ_UNKNOWN(?![A-Za-z0-9_])/EVHTTP_REQ_UNKNOWN_/g;
s/(?<![A-Za-z0-9_])_EVLOCK_SORTLOCKS(?![A-Za-z0-9_])/EVLOCK_SORTLOCKS_/g;
s/(?<![A-Za-z0-9_])_evrpc_hooks(?![A-Za-z0-9_])/evrpc_hooks_/g;
s/(?<![A-Za-z0-9_])_evsig_restore_handler(?![A-Za-z0-9_])/evsig_restore_handler_/g;
s/(?<![A-Za-z0-9_])_evsig_set_handler(?![A-Za-z0-9_])/evsig_set_handler_/g;
s/(?<![A-Za-z0-9_])_evthread_cond_fns(?![A-Za-z0-9_])/evthread_cond_fns_/g;
s/(?<![A-Za-z0-9_])_evthread_debug_get_real_lock(?![A-Za-z0-9_])/evthread_debug_get_real_lock_/g;
s/(?<![A-Za-z0-9_])_evthread_id_fn(?![A-Za-z0-9_])/evthread_id_fn_/g;
s/(?<![A-Za-z0-9_])_evthreadimpl_cond_alloc(?![A-Za-z0-9_])/evthreadimpl_cond_alloc_/g;
s/(?<![A-Za-z0-9_])_evthreadimpl_cond_free(?![A-Za-z0-9_])/evthreadimpl_cond_free_/g;
s/(?<![A-Za-z0-9_])_evthreadimpl_cond_signal(?![A-Za-z0-9_])/evthreadimpl_cond_signal_/g;
s/(?<![A-Za-z0-9_])_evthreadimpl_cond_wait(?![A-Za-z0-9_])/evthreadimpl_cond_wait_/g;
s/(?<![A-Za-z0-9_])_evthreadimpl_get_id(?![A-Za-z0-9_])/evthreadimpl_get_id_/g;
s/(?<![A-Za-z0-9_])_evthreadimpl_is_lock_debugging_enabled(?![A-Za-z0-9_])/evthreadimpl_is_lock_debugging_enabled_/g;
s/(?<![A-Za-z0-9_])_evthreadimpl_lock_alloc(?![A-Za-z0-9_])/evthreadimpl_lock_alloc_/g;
s/(?<![A-Za-z0-9_])_evthreadimpl_lock_free(?![A-Za-z0-9_])/evthreadimpl_lock_free_/g;
s/(?<![A-Za-z0-9_])_evthreadimpl_locking_enabled(?![A-Za-z0-9_])/evthreadimpl_locking_enabled_/g;
s/(?<![A-Za-z0-9_])_evthreadimpl_lock_lock(?![A-Za-z0-9_])/evthreadimpl_lock_lock_/g;
s/(?<![A-Za-z0-9_])_evthreadimpl_lock_unlock(?![A-Za-z0-9_])/evthreadimpl_lock_unlock_/g;
s/(?<![A-Za-z0-9_])_evthread_is_debug_lock_held(?![A-Za-z0-9_])/evthread_is_debug_lock_held_/g;
s/(?<![A-Za-z0-9_])_evthread_lock_debugging_enabled(?![A-Za-z0-9_])/evthread_lock_debugging_enabled_/g;
s/(?<![A-Za-z0-9_])_evthread_lock_fns(?![A-Za-z0-9_])/evthread_lock_fns_/g;
s/(?<![A-Za-z0-9_])_EVUTIL_NIL_CONDITION(?![A-Za-z0-9_])/EVUTIL_NIL_CONDITION_/g;
s/(?<![A-Za-z0-9_])_EVUTIL_NIL_STMT(?![A-Za-z0-9_])/EVUTIL_NIL_STMT_/g;
s/(?<![A-Za-z0-9_])_evutil_weakrand(?![A-Za-z0-9_])/evutil_weakrand_/g;
s/(?<![A-Za-z0-9_])_http_close_detection(?![A-Za-z0-9_])/http_close_detection_/g;
s/(?<![A-Za-z0-9_])_http_connection_test(?![A-Za-z0-9_])/http_connection_test_/g;
s/(?<![A-Za-z0-9_])_http_incomplete_test(?![A-Za-z0-9_])/http_incomplete_test_/g;
s/(?<![A-Za-z0-9_])_http_stream_in_test(?![A-Za-z0-9_])/http_stream_in_test_/g;
s/(?<![A-Za-z0-9_])_internal(?![A-Za-z0-9_])/internal_/g;
s/(?<![A-Za-z0-9_])_mm_free_fn(?![A-Za-z0-9_])/mm_free_fn_/g;
s/(?<![A-Za-z0-9_])_mm_malloc_fn(?![A-Za-z0-9_])/mm_malloc_fn_/g;
s/(?<![A-Za-z0-9_])_mm_realloc_fn(?![A-Za-z0-9_])/mm_realloc_fn_/g;
s/(?<![A-Za-z0-9_])_original_cond_fns(?![A-Za-z0-9_])/original_cond_fns_/g;
s/(?<![A-Za-z0-9_])_original_lock_fns(?![A-Za-z0-9_])/original_lock_fns_/g;
s/(?<![A-Za-z0-9_])_rpc_hook_ctx(?![A-Za-z0-9_])/rpc_hook_ctx_/g;
s/(?<![A-Za-z0-9_])_SYS_QUEUE_H_(?![A-Za-z0-9_])/SYS_QUEUE_H__/g;
s/(?<![A-Za-z0-9_])_t(?![A-Za-z0-9_])/t_/g;
s/(?<![A-Za-z0-9_])_t32(?![A-Za-z0-9_])/t32_/g;
s/(?<![A-Za-z0-9_])_test_ai_eq(?![A-Za-z0-9_])/test_ai_eq_/g;
s/(?<![A-Za-z0-9_])_URI_ADD(?![A-Za-z0-9_])/URI_ADD_/g;
s/(?<![A-Za-z0-9_])_URI_FREE_STR(?![A-Za-z0-9_])/URI_FREE_STR_/g;
s/(?<![A-Za-z0-9_])_URI_SET_STR(?![A-Za-z0-9_])/URI_SET_STR_/g;
s/(?<![A-Za-z0-9_])_warn_helper(?![A-Za-z0-9_])/warn_helper_/g;
2012-02-29 15:07:32 -05:00
Nick Mathewson
68120d9b00 Convert event-config.h macros to avoid reserved identifiers
C reserves all identifiers beginning with an underscore for system
use.  But we had been mangling our autoconf identifiers with the
prefix "_EVENT_" to avoid conflict with other programs.

Instead, we will now use the prefix "EVENT__".  With any luck, the
double-underscore will still hint "here be dragons" to anybody
tempted to think that event-config.h is a stable api.

This is an automatically generated patch.  The script that produced
it was made by running this script over config.h.in:

=====

#!/usr/bin/perl -w

# Run this on config.h.in

use strict;

my %macros = ();

while (<>) {
    if (/^# *undef +([A-Za-z0-9_]+)/) {
	$macros{$1} = 1;
    }
}

print "#!/usr/bin/perl -w -i -p\n\n";
for my $k (sort keys %macros) {
    print "s/(?<![A-Za-z0-9_])_EVENT_$k(?![A-Za-z0-9_])/EVENT__$k/g;\n";
}

== And the script that it generated was then run over all .c and .h files:
#!/usr/bin/perl -w -i -p

s/(?<![A-Za-z0-9_])_EVENT_DISABLE_DEBUG_MODE(?![A-Za-z0-9_])/EVENT__DISABLE_DEBUG_MODE/g;
s/(?<![A-Za-z0-9_])_EVENT_DISABLE_MM_REPLACEMENT(?![A-Za-z0-9_])/EVENT__DISABLE_MM_REPLACEMENT/g;
s/(?<![A-Za-z0-9_])_EVENT_DISABLE_THREAD_SUPPORT(?![A-Za-z0-9_])/EVENT__DISABLE_THREAD_SUPPORT/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_ACCEPT4(?![A-Za-z0-9_])/EVENT__HAVE_ACCEPT4/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_ARC4RANDOM(?![A-Za-z0-9_])/EVENT__HAVE_ARC4RANDOM/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_ARC4RANDOM_BUF(?![A-Za-z0-9_])/EVENT__HAVE_ARC4RANDOM_BUF/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_ARPA_INET_H(?![A-Za-z0-9_])/EVENT__HAVE_ARPA_INET_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_CLOCK_GETTIME(?![A-Za-z0-9_])/EVENT__HAVE_CLOCK_GETTIME/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_DECL_CTL_KERN(?![A-Za-z0-9_])/EVENT__HAVE_DECL_CTL_KERN/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_DECL_KERN_ARND(?![A-Za-z0-9_])/EVENT__HAVE_DECL_KERN_ARND/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_DECL_KERN_RANDOM(?![A-Za-z0-9_])/EVENT__HAVE_DECL_KERN_RANDOM/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_DECL_RANDOM_UUID(?![A-Za-z0-9_])/EVENT__HAVE_DECL_RANDOM_UUID/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_DEVPOLL(?![A-Za-z0-9_])/EVENT__HAVE_DEVPOLL/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_DLFCN_H(?![A-Za-z0-9_])/EVENT__HAVE_DLFCN_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_EPOLL(?![A-Za-z0-9_])/EVENT__HAVE_EPOLL/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_EPOLL_CREATE1(?![A-Za-z0-9_])/EVENT__HAVE_EPOLL_CREATE1/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_EPOLL_CTL(?![A-Za-z0-9_])/EVENT__HAVE_EPOLL_CTL/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_EVENTFD(?![A-Za-z0-9_])/EVENT__HAVE_EVENTFD/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_EVENT_PORTS(?![A-Za-z0-9_])/EVENT__HAVE_EVENT_PORTS/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_FCNTL(?![A-Za-z0-9_])/EVENT__HAVE_FCNTL/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_FCNTL_H(?![A-Za-z0-9_])/EVENT__HAVE_FCNTL_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_FD_MASK(?![A-Za-z0-9_])/EVENT__HAVE_FD_MASK/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_GETADDRINFO(?![A-Za-z0-9_])/EVENT__HAVE_GETADDRINFO/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_GETEGID(?![A-Za-z0-9_])/EVENT__HAVE_GETEGID/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_GETEUID(?![A-Za-z0-9_])/EVENT__HAVE_GETEUID/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_GETHOSTBYNAME_R(?![A-Za-z0-9_])/EVENT__HAVE_GETHOSTBYNAME_R/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_GETHOSTBYNAME_R_3_ARG(?![A-Za-z0-9_])/EVENT__HAVE_GETHOSTBYNAME_R_3_ARG/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_GETHOSTBYNAME_R_5_ARG(?![A-Za-z0-9_])/EVENT__HAVE_GETHOSTBYNAME_R_5_ARG/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_GETHOSTBYNAME_R_6_ARG(?![A-Za-z0-9_])/EVENT__HAVE_GETHOSTBYNAME_R_6_ARG/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_GETIFADDRS(?![A-Za-z0-9_])/EVENT__HAVE_GETIFADDRS/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_GETNAMEINFO(?![A-Za-z0-9_])/EVENT__HAVE_GETNAMEINFO/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_GETPROTOBYNUMBER(?![A-Za-z0-9_])/EVENT__HAVE_GETPROTOBYNUMBER/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_GETSERVBYNAME(?![A-Za-z0-9_])/EVENT__HAVE_GETSERVBYNAME/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_GETTIMEOFDAY(?![A-Za-z0-9_])/EVENT__HAVE_GETTIMEOFDAY/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_IFADDRS_H(?![A-Za-z0-9_])/EVENT__HAVE_IFADDRS_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_INET_ATON(?![A-Za-z0-9_])/EVENT__HAVE_INET_ATON/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_INET_NTOP(?![A-Za-z0-9_])/EVENT__HAVE_INET_NTOP/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_INET_PTON(?![A-Za-z0-9_])/EVENT__HAVE_INET_PTON/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_INTTYPES_H(?![A-Za-z0-9_])/EVENT__HAVE_INTTYPES_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_ISSETUGID(?![A-Za-z0-9_])/EVENT__HAVE_ISSETUGID/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_KQUEUE(?![A-Za-z0-9_])/EVENT__HAVE_KQUEUE/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_LIBZ(?![A-Za-z0-9_])/EVENT__HAVE_LIBZ/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_MEMORY_H(?![A-Za-z0-9_])/EVENT__HAVE_MEMORY_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_MMAP(?![A-Za-z0-9_])/EVENT__HAVE_MMAP/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_NANOSLEEP(?![A-Za-z0-9_])/EVENT__HAVE_NANOSLEEP/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_NETDB_H(?![A-Za-z0-9_])/EVENT__HAVE_NETDB_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_NETINET_IN6_H(?![A-Za-z0-9_])/EVENT__HAVE_NETINET_IN6_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_NETINET_IN_H(?![A-Za-z0-9_])/EVENT__HAVE_NETINET_IN_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_NETINET_TCP_H(?![A-Za-z0-9_])/EVENT__HAVE_NETINET_TCP_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_OPENSSL(?![A-Za-z0-9_])/EVENT__HAVE_OPENSSL/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_PIPE(?![A-Za-z0-9_])/EVENT__HAVE_PIPE/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_PIPE2(?![A-Za-z0-9_])/EVENT__HAVE_PIPE2/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_POLL(?![A-Za-z0-9_])/EVENT__HAVE_POLL/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_POLL_H(?![A-Za-z0-9_])/EVENT__HAVE_POLL_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_PORT_CREATE(?![A-Za-z0-9_])/EVENT__HAVE_PORT_CREATE/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_PORT_H(?![A-Za-z0-9_])/EVENT__HAVE_PORT_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_PTHREAD(?![A-Za-z0-9_])/EVENT__HAVE_PTHREAD/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_PTHREADS(?![A-Za-z0-9_])/EVENT__HAVE_PTHREADS/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_PUTENV(?![A-Za-z0-9_])/EVENT__HAVE_PUTENV/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SA_FAMILY_T(?![A-Za-z0-9_])/EVENT__HAVE_SA_FAMILY_T/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SELECT(?![A-Za-z0-9_])/EVENT__HAVE_SELECT/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SENDFILE(?![A-Za-z0-9_])/EVENT__HAVE_SENDFILE/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SETENV(?![A-Za-z0-9_])/EVENT__HAVE_SETENV/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SETFD(?![A-Za-z0-9_])/EVENT__HAVE_SETFD/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SETRLIMIT(?![A-Za-z0-9_])/EVENT__HAVE_SETRLIMIT/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SIGACTION(?![A-Za-z0-9_])/EVENT__HAVE_SIGACTION/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SIGNAL(?![A-Za-z0-9_])/EVENT__HAVE_SIGNAL/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SPLICE(?![A-Za-z0-9_])/EVENT__HAVE_SPLICE/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_STDARG_H(?![A-Za-z0-9_])/EVENT__HAVE_STDARG_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_STDDEF_H(?![A-Za-z0-9_])/EVENT__HAVE_STDDEF_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_STDINT_H(?![A-Za-z0-9_])/EVENT__HAVE_STDINT_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_STDLIB_H(?![A-Za-z0-9_])/EVENT__HAVE_STDLIB_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_STRINGS_H(?![A-Za-z0-9_])/EVENT__HAVE_STRINGS_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_STRING_H(?![A-Za-z0-9_])/EVENT__HAVE_STRING_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_STRLCPY(?![A-Za-z0-9_])/EVENT__HAVE_STRLCPY/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_STRSEP(?![A-Za-z0-9_])/EVENT__HAVE_STRSEP/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_STRTOK_R(?![A-Za-z0-9_])/EVENT__HAVE_STRTOK_R/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_STRTOLL(?![A-Za-z0-9_])/EVENT__HAVE_STRTOLL/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_STRUCT_ADDRINFO(?![A-Za-z0-9_])/EVENT__HAVE_STRUCT_ADDRINFO/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_STRUCT_IN6_ADDR(?![A-Za-z0-9_])/EVENT__HAVE_STRUCT_IN6_ADDR/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_STRUCT_IN6_ADDR_S6_ADDR16(?![A-Za-z0-9_])/EVENT__HAVE_STRUCT_IN6_ADDR_S6_ADDR16/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_STRUCT_IN6_ADDR_S6_ADDR32(?![A-Za-z0-9_])/EVENT__HAVE_STRUCT_IN6_ADDR_S6_ADDR32/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_STRUCT_SOCKADDR_IN6(?![A-Za-z0-9_])/EVENT__HAVE_STRUCT_SOCKADDR_IN6/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN(?![A-Za-z0-9_])/EVENT__HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_STRUCT_SOCKADDR_IN_SIN_LEN(?![A-Za-z0-9_])/EVENT__HAVE_STRUCT_SOCKADDR_IN_SIN_LEN/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_STRUCT_SOCKADDR_STORAGE(?![A-Za-z0-9_])/EVENT__HAVE_STRUCT_SOCKADDR_STORAGE/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY(?![A-Za-z0-9_])/EVENT__HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY(?![A-Za-z0-9_])/EVENT__HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SYSCTL(?![A-Za-z0-9_])/EVENT__HAVE_SYSCTL/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SYS_DEVPOLL_H(?![A-Za-z0-9_])/EVENT__HAVE_SYS_DEVPOLL_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SYS_EPOLL_H(?![A-Za-z0-9_])/EVENT__HAVE_SYS_EPOLL_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SYS_EVENTFD_H(?![A-Za-z0-9_])/EVENT__HAVE_SYS_EVENTFD_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SYS_EVENT_H(?![A-Za-z0-9_])/EVENT__HAVE_SYS_EVENT_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SYS_IOCTL_H(?![A-Za-z0-9_])/EVENT__HAVE_SYS_IOCTL_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SYS_MMAN_H(?![A-Za-z0-9_])/EVENT__HAVE_SYS_MMAN_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SYS_PARAM_H(?![A-Za-z0-9_])/EVENT__HAVE_SYS_PARAM_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SYS_QUEUE_H(?![A-Za-z0-9_])/EVENT__HAVE_SYS_QUEUE_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SYS_RESOURCE_H(?![A-Za-z0-9_])/EVENT__HAVE_SYS_RESOURCE_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SYS_SELECT_H(?![A-Za-z0-9_])/EVENT__HAVE_SYS_SELECT_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SYS_SENDFILE_H(?![A-Za-z0-9_])/EVENT__HAVE_SYS_SENDFILE_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SYS_SOCKET_H(?![A-Za-z0-9_])/EVENT__HAVE_SYS_SOCKET_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SYS_STAT_H(?![A-Za-z0-9_])/EVENT__HAVE_SYS_STAT_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SYS_SYSCTL_H(?![A-Za-z0-9_])/EVENT__HAVE_SYS_SYSCTL_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SYS_TIME_H(?![A-Za-z0-9_])/EVENT__HAVE_SYS_TIME_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SYS_TYPES_H(?![A-Za-z0-9_])/EVENT__HAVE_SYS_TYPES_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SYS_UIO_H(?![A-Za-z0-9_])/EVENT__HAVE_SYS_UIO_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_SYS_WAIT_H(?![A-Za-z0-9_])/EVENT__HAVE_SYS_WAIT_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_TAILQFOREACH(?![A-Za-z0-9_])/EVENT__HAVE_TAILQFOREACH/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_TIMERADD(?![A-Za-z0-9_])/EVENT__HAVE_TIMERADD/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_TIMERCLEAR(?![A-Za-z0-9_])/EVENT__HAVE_TIMERCLEAR/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_TIMERCMP(?![A-Za-z0-9_])/EVENT__HAVE_TIMERCMP/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_TIMERISSET(?![A-Za-z0-9_])/EVENT__HAVE_TIMERISSET/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_UINT16_T(?![A-Za-z0-9_])/EVENT__HAVE_UINT16_T/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_UINT32_T(?![A-Za-z0-9_])/EVENT__HAVE_UINT32_T/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_UINT64_T(?![A-Za-z0-9_])/EVENT__HAVE_UINT64_T/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_UINT8_T(?![A-Za-z0-9_])/EVENT__HAVE_UINT8_T/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_UINTPTR_T(?![A-Za-z0-9_])/EVENT__HAVE_UINTPTR_T/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_UNISTD_H(?![A-Za-z0-9_])/EVENT__HAVE_UNISTD_H/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_UNSETENV(?![A-Za-z0-9_])/EVENT__HAVE_UNSETENV/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_USLEEP(?![A-Za-z0-9_])/EVENT__HAVE_USLEEP/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_VASPRINTF(?![A-Za-z0-9_])/EVENT__HAVE_VASPRINTF/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_WORKING_KQUEUE(?![A-Za-z0-9_])/EVENT__HAVE_WORKING_KQUEUE/g;
s/(?<![A-Za-z0-9_])_EVENT_HAVE_ZLIB_H(?![A-Za-z0-9_])/EVENT__HAVE_ZLIB_H/g;
s/(?<![A-Za-z0-9_])_EVENT_LT_OBJDIR(?![A-Za-z0-9_])/EVENT__LT_OBJDIR/g;
s/(?<![A-Za-z0-9_])_EVENT_NO_MINUS_C_MINUS_O(?![A-Za-z0-9_])/EVENT__NO_MINUS_C_MINUS_O/g;
s/(?<![A-Za-z0-9_])_EVENT_NUMERIC_VERSION(?![A-Za-z0-9_])/EVENT__NUMERIC_VERSION/g;
s/(?<![A-Za-z0-9_])_EVENT_PACKAGE(?![A-Za-z0-9_])/EVENT__PACKAGE/g;
s/(?<![A-Za-z0-9_])_EVENT_PACKAGE_BUGREPORT(?![A-Za-z0-9_])/EVENT__PACKAGE_BUGREPORT/g;
s/(?<![A-Za-z0-9_])_EVENT_PACKAGE_NAME(?![A-Za-z0-9_])/EVENT__PACKAGE_NAME/g;
s/(?<![A-Za-z0-9_])_EVENT_PACKAGE_STRING(?![A-Za-z0-9_])/EVENT__PACKAGE_STRING/g;
s/(?<![A-Za-z0-9_])_EVENT_PACKAGE_TARNAME(?![A-Za-z0-9_])/EVENT__PACKAGE_TARNAME/g;
s/(?<![A-Za-z0-9_])_EVENT_PACKAGE_URL(?![A-Za-z0-9_])/EVENT__PACKAGE_URL/g;
s/(?<![A-Za-z0-9_])_EVENT_PACKAGE_VERSION(?![A-Za-z0-9_])/EVENT__PACKAGE_VERSION/g;
s/(?<![A-Za-z0-9_])_EVENT_PTHREAD_CREATE_JOINABLE(?![A-Za-z0-9_])/EVENT__PTHREAD_CREATE_JOINABLE/g;
s/(?<![A-Za-z0-9_])_EVENT_SIZEOF_INT(?![A-Za-z0-9_])/EVENT__SIZEOF_INT/g;
s/(?<![A-Za-z0-9_])_EVENT_SIZEOF_LONG(?![A-Za-z0-9_])/EVENT__SIZEOF_LONG/g;
s/(?<![A-Za-z0-9_])_EVENT_SIZEOF_LONG_LONG(?![A-Za-z0-9_])/EVENT__SIZEOF_LONG_LONG/g;
s/(?<![A-Za-z0-9_])_EVENT_SIZEOF_OFF_T(?![A-Za-z0-9_])/EVENT__SIZEOF_OFF_T/g;
s/(?<![A-Za-z0-9_])_EVENT_SIZEOF_PTHREAD_T(?![A-Za-z0-9_])/EVENT__SIZEOF_PTHREAD_T/g;
s/(?<![A-Za-z0-9_])_EVENT_SIZEOF_SHORT(?![A-Za-z0-9_])/EVENT__SIZEOF_SHORT/g;
s/(?<![A-Za-z0-9_])_EVENT_SIZEOF_SIZE_T(?![A-Za-z0-9_])/EVENT__SIZEOF_SIZE_T/g;
s/(?<![A-Za-z0-9_])_EVENT_SIZEOF_VOID_P(?![A-Za-z0-9_])/EVENT__SIZEOF_VOID_P/g;
s/(?<![A-Za-z0-9_])_EVENT_STDC_HEADERS(?![A-Za-z0-9_])/EVENT__STDC_HEADERS/g;
s/(?<![A-Za-z0-9_])_EVENT_TIME_WITH_SYS_TIME(?![A-Za-z0-9_])/EVENT__TIME_WITH_SYS_TIME/g;
s/(?<![A-Za-z0-9_])_EVENT_VERSION(?![A-Za-z0-9_])/EVENT__VERSION/g;
s/(?<![A-Za-z0-9_])_EVENT__ALL_SOURCE(?![A-Za-z0-9_])/EVENT___ALL_SOURCE/g;
s/(?<![A-Za-z0-9_])_EVENT__FILE_OFFSET_BITS(?![A-Za-z0-9_])/EVENT___FILE_OFFSET_BITS/g;
s/(?<![A-Za-z0-9_])_EVENT__GNU_SOURCE(?![A-Za-z0-9_])/EVENT___GNU_SOURCE/g;
s/(?<![A-Za-z0-9_])_EVENT__LARGE_FILES(?![A-Za-z0-9_])/EVENT___LARGE_FILES/g;
s/(?<![A-Za-z0-9_])_EVENT__MINIX(?![A-Za-z0-9_])/EVENT___MINIX/g;
s/(?<![A-Za-z0-9_])_EVENT__POSIX_1_SOURCE(?![A-Za-z0-9_])/EVENT___POSIX_1_SOURCE/g;
s/(?<![A-Za-z0-9_])_EVENT__POSIX_PTHREAD_SEMANTICS(?![A-Za-z0-9_])/EVENT___POSIX_PTHREAD_SEMANTICS/g;
s/(?<![A-Za-z0-9_])_EVENT__POSIX_SOURCE(?![A-Za-z0-9_])/EVENT___POSIX_SOURCE/g;
s/(?<![A-Za-z0-9_])_EVENT__TANDEM_SOURCE(?![A-Za-z0-9_])/EVENT___TANDEM_SOURCE/g;
s/(?<![A-Za-z0-9_])_EVENT___EXTENSIONS__(?![A-Za-z0-9_])/EVENT____EXTENSIONS__/g;
s/(?<![A-Za-z0-9_])_EVENT___func__(?![A-Za-z0-9_])/EVENT____func__/g;
s/(?<![A-Za-z0-9_])_EVENT_const(?![A-Za-z0-9_])/EVENT__const/g;
s/(?<![A-Za-z0-9_])_EVENT_inline(?![A-Za-z0-9_])/EVENT__inline/g;
s/(?<![A-Za-z0-9_])_EVENT_pid_t(?![A-Za-z0-9_])/EVENT__pid_t/g;
s/(?<![A-Za-z0-9_])_EVENT_size_t(?![A-Za-z0-9_])/EVENT__size_t/g;
s/(?<![A-Za-z0-9_])_EVENT_socklen_t(?![A-Za-z0-9_])/EVENT__socklen_t/g;
s/(?<![A-Za-z0-9_])_EVENT_ssize_t(?![A-Za-z0-9_])/EVENT__ssize_t/g;
2012-02-29 15:07:31 -05:00
Nick Mathewson
539466e568 Merge remote-tracking branch 'origin/patches-2.0'
Conflicts:
	Makefile.am
	WIN32-Code/event2/event-config.h
	configure.in
2012-02-10 17:33:50 -05:00
Nick Mathewson
e49e289129 Update copyright notices to 2012 2012-02-10 17:29:53 -05:00
Nick Mathewson
2c6b3246fd Merge remote-tracking branch 'origin/patches-2.0' 2012-01-24 17:18:52 -05:00
Nate R
c94a5f2a2c Do a memberwise comparison of threading function tables
Doing a memcmp risks comparing uninitialized padding bytes at the
end of the structure.
2012-01-24 17:15:50 -05:00
Nick Mathewson
f5b937e65f Merge remote-tracking branch 'origin/patches-2.0' 2011-11-14 18:22:08 -05:00
Nick Mathewson
e787413329 Don't try to make notifiable event_base when no threading fns are configured 2011-11-14 17:33:02 -05:00
Nick Mathewson
0cb70e3333 Merge remote-tracking branch 'origin/patches-2.0' 2011-10-26 10:17:21 -04:00
Nick Mathewson
3c824bd334 Update copyright dates to 2011. 2011-10-24 13:18:09 -04:00
Nick Mathewson
78fb99ceb2 Merge remote-tracking branch 'origin/patches-2.0' 2011-07-04 12:22:54 -04:00
Nick Mathewson
e7fe92709e Merge remote-tracking branch 'github/20_global_locks_init' into patches-2.0 2011-07-04 12:16:08 -04:00
Nick Mathewson
614a1712b7 Merge remote-tracking branch 'origin/patches-2.0'
Conflicts:
	evthread.c
2011-04-22 23:46:25 -04:00
Sebastian Hahn
b0ff7eb5ce Add an assert to appease clang's static analyzer
It got confused because in EVLOCK_ASSERT_LOCKED(lock) there is an if
(lock) check.
2011-04-23 02:04:58 +02:00
Nick Mathewson
cb6ecee7f6 Complain if the caller tries to change threading cbs after setting them
We never supported this; it was always fraught with errors; and I
don't believe there is a good reason to _want_ it to work.
2011-04-22 14:06:57 -04:00
Nick Mathewson
b683cae3cb Avoid race-condition when initializing global locks
Previously, we did stuff like
   if (!lock)
      EVTHREAD_ALLOC_LOCK(lock,0);
for the evsig base global lock, the arc4random lock, and the debug_map
lock.  But that's potentially racy!  Instead, we move the
responisiblity for global lock initialization to the functions where
we set up the lock callbacks.

(Rationale: We already require that you set up the locking callbacks
before you create any event_base, and that you do so exatly once.)
2011-04-22 14:06:33 -04:00
Nick Mathewson
f28084ddda munge the debug_lock signature before freeing it: it might help us catch use-after-free 2011-03-07 23:18:07 -05:00
Dave Hart
b4a29c0a0f Add a magic number to debug_locks to better catch lock-coding errors.
Original description by Dave Hart:

 [This patch contains] the addition of a signature field to debug_lock
 initialized by the alloc routine and verified by the rest, to catch
 invalid lock pointers sooner. That helped me track down a nasty
 problem I had before adding the time.h include to
 libevent-internal.h, where different .c files had different ideas of
 whether event_base had a tod_tv_cache member depending on which
 included time.h before libevent-internal.h.
2011-03-07 23:08:42 -05:00
Kevin Bowling
0915ca0aa6 Include evconfig-private.h in internal files for great good. 2011-01-02 08:43:45 -07:00
Evan Jones
fbe64f216c Use relative includes instead of system includes consistently. 2010-12-02 11:03:55 -05:00
Nick Mathewson
5de2bcb70f On windows, make lock/thread function tables static
This requires us to have a separate implementation of the lock macros
that indirects to a set of functions.  Fortunately, this isn't too
hard to do.

This may be a fix for bug 3042969, where our openssl dll and our
libevent dll each got their own version of the thread stuff.
2010-09-01 16:03:39 -04:00
Nick Mathewson
743f866539 Honor NDEBUG; build without warnings with NDEBUG; make NDEBUG always-off in unit test code 2010-08-23 11:49:06 -04:00
Nick Mathewson
d4977b52f0 Add a condition variable backend, with implementations for pthreads and win32
The interface from the user's POV is similar to the locking
implementation: either provide a structure full of function
pointers, or just call evthread_use_*_threads() and everything will
be okay.

The internal interface is meant to vaguely resemble pthread_cond_*,
which Windows people will better recognize as *ConditionVariable*.
2010-08-17 13:15:34 -04:00
Nick Mathewson
3808168d21 Completely remove the (mostly-removed) obsolete thread functions. 2010-08-10 15:02:50 -04:00
Nick Mathewson
ec347b9225 Move event-config.h to include/event2
This change means that all required include files are in event2, and
all files not in event2/* are optional.
2010-08-06 20:21:27 -04:00
Nick Mathewson
c5bab56002 Remove the obsolete evthread interfaces
These were added in 2.0.1, and deprecated in 2.0.4 and 2.0.5; we've
promised that they would be removed, and warned whenever they were
invoked.  Users should call evthread_set_lock_callbacks instead...  or
ideally just call evthread_use_windows_threads or
evthread_use_pthreads.
2010-05-11 11:44:07 -04:00
Nick Mathewson
17efc1cdfa Update all our copyright notices to say "2010" 2010-03-04 01:38:48 -05:00
Nick Mathewson
e5bbd40ad7 Clean up formatting: use tabs, not 8-spaces, to indent. 2010-02-18 17:44:09 -05:00
unknown
c51bb3c342 Fix a few locking issues on windows. 2009-12-21 16:36:40 -05:00
Nick Mathewson
0cd3bb9f3a Improved optional lock debugging.
There were a couple of places in the code where we manually kept lock
counts to make sure we never accessed resources without holding a
lock, and that we never released a lock we didn't have.  The
lock-debugging code already puts counts on _every_ lock when lock
debugging is enabled, so there is no need to keep these counts around
otherwise.  This patch rewrites the ASSERT_FOO_LOCKED macros to all
use a common EVLOCK_ASSERT_LOCKED().

We also teach the lock debugging code to keep track of who exactly
holds each lock, so that EVLOCK_ASSERT_LOCKED() means "locked by this
thread."
2009-11-27 17:36:51 -05:00
Nick Mathewson
76cd2b70bb Stop passing EVTHREAD_READ and EVTHREAD_WRITE to non-rw locks.
Previously, our default lock model kind of assumed that every lock was
potentially a read-write lock.  This was a poor choice, since
read-write locks are far more expensive than regular locks, and so the
lock API should only use them when we can actually take advantage of
them.  Neither our pthreads or win32 lock implementation provided rw
locks.

Now that we have a way (not currently used!) to	indicate that we
really want a read-write lock, we shouldn't actually say "lock this
for reading" or "lock this for writing" unless we mean it.
2009-11-27 17:36:51 -05:00
Nick Mathewson
347952ffe0 Revise the locking API: deprecate the old locking callbacks and add trylock.
Previously, there was no good way to request different kinds of lock
(say, read/write vs writeonly or recursive vs nonrecursive), or for a
lock function to signal failure (which would be important for a
trylock mode).

This patch revises the lock API to be a bit more useful.  The older
lock calls are still supported for now.

We also add a debugging mode to catch common errors in using the
locking APIs.
2009-11-27 17:36:24 -05:00