summaryrefslogtreecommitdiff
path: root/epoll.c
Commit message (Collapse)AuthorAgeFilesLines
* signal: new signal handling backend based on signalfdDmitry Antipov2022-11-121-1/+2
| | | | | | | | Linux-specific signal handling backend based on signalfd(2) system call, and public function event_base_get_signal_method() to obtain an underlying kernel signal handling mechanism. Signed-off-by: Dmitry Antipov <dantipov@cloudlinux.com>
* epoll: use epoll_pwait2() if availableDmitry Antipov2022-09-271-3/+17
| | | | | On GNU/Linux with epoll backend, prefer epoll_pwait2() if available, which is useful to support the timeout with microsecond precision.
* Add wepoll support to light up the epoll backend on WindowsNick Grifka2020-05-081-14/+57
| | | | | | | | | | | | | | | | | | | | | | libevent is lacking a scalable backend on Windows. Let's leverage the wepoll library until Windows comes up with an epoll/kqueue compete user mode API. - All regress tests pass for standard wepoll - These 2 tests fail intermittently for changelist wepoll, so disabling changelist wepoll for now http/cancel_inactive_server http/stream_in - verify target on Windows runs tests for both wepoll and win32 backends - wepoll backend preferred over win32 backend - wepoll version 1.5.6 v2: cleaner backend abstraction. Disallow wepoll on MinGW/Cygwin. v3: Add wepoll.h to dist v4: Make sure wepoll source files are excluded from cygwin/mingw builds v5: Keep win32 as default backend on windows. v6: Include wepoll in mingw builds. Verified that regress tests pass w/ WEPOLL backend. v7: Enable wepoll on mingw when building with cmake v8: Add wepoll testrunner for autotools test target
* Fix EV_CLOSED detection/reporting (epoll only)Azat Khuzhin2020-05-051-1/+3
| | | | | | | | | | | - EV_CLOSED is EPOLLRDHUP in epoll - EPOLLRDHUP reported w/o EPOLLHUP if the socket closed with shutdown(SHUT_WR) - EPOLLRDHUP reported w/ EPOLLHUP if the socket closed with close() so in this case epoll backend will detect this event as error (EV_READ|EV_WRITE), since the epoll_ctl() will return EPOLLRDHUP with EPOLLHUP set, but this is not correct, let's fix this. Fixes: #984
* epoll: handle EV_ET for EV_CLOSED tooAzat Khuzhin2020-05-041-1/+1
|
* Add EVENT_BASE_FLAG_EPOLL_DISALLOW_TIMERFD flag (fixes: #958)Azat Khuzhin2020-03-011-0/+1
| | | | | | | | By default we are using CLOCK_MONOTONIC_COARSE, but if EVENT_BASE_FLAG_PRECISE_TIMER isset, then CLOCK_MONOTONIC will be used, however this will also enable timerfd, while this is not always what someone wants, hence add a flag to control this (by default the old behavior is preserved, set new flag to change it).
* Epoll ET setting lost with multiple events for same fdIsidor Kouvelas2018-10-311-3/+6
| | | | | | | | | After two or more events have been registered for the same file descriptor using EV_ET, if one of the events is deleted, then the epoll_ctl() call issued by libevent drops the EPOLLET flag resulting in level triggered notifications. [ azat: use existing "et" in the evmap_io_del_() ]
* epoll: introduce PRINT_CHANGES() macro to avoid copy-pastingAzat Khuzhin2015-11-181-20/+19
| | | | | And also this will use change_to_string() for successfully returned epoll_ctl()
* Do not offer EV_FEATURE_EARLY_CLOSE if we have no EPOLLRDHUPNick Mathewson2014-02-241-1/+4
|
* BUGFIX: Fix compilation on systems with EPOLLRDHUP undefined.Joakim Soderberg2014-02-171-7/+8
| | | | Since epolltable-internal.h uses this define, it must be defined before that is included.
* Split epoll lookup table into a separate header fileNick Mathewson2014-01-211-1136/+4
| | | | | It accounted for more than half the length of epoll.c, and it's machine-generated, so we might as well keep it separate.
* Implemented EV_CLOSED event for epoll backend (EPOLLRDHUP).Diego Giagio2014-01-171-82/+1067
| | | | | | | | | | | | | | | | | | | | | | | | - Added new EV_CLOSED event - detects premature connection close by clients without the necessity of reading all the pending data. Does not depend on EV_READ and/or EV_WRITE. - Added new EV_FEATURE_EARLY_CLOSED feature for epoll. Must be supported for listening to EV_CLOSED event. - Added new regression test: test-closed.c - All regression tests passed (test/regress and test/test.sh) - strace output of test-closed using EV_CLOSED: socketpair(PF_LOCAL, SOCK_STREAM, 0, [6, 7]) = 0 sendto(6, "test string\0", 12, 0, NULL, 0) = 12 shutdown(6, SHUT_WR) = 0 epoll_ctl(3, EPOLL_CTL_ADD, 7, {EPOLLRDHUP, {u32=7, u64=7}}) = 0 epoll_wait(3, {{EPOLLRDHUP, {u32=7, u64=7}}}, 32, 3000) = 1 epoll_ctl(3, EPOLL_CTL_MOD, 7, {EPOLLRDHUP, {u32=7, u64=7}}) = 0 fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 4), ...}) mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYM... write(1, "closed_cb: detected connection close "..., 45) = 45
* avoid valgrind false positive by zeroing epoll_eventPatrick Pelletier2012-11-161-0/+1
|
* Avoid giving a spurious warning when timerfd support is unavailableDave Hart2012-06-181-1/+8
| | | | | | | We forgot to do the obligatory "Check if there is no syscall there" dance when calling timerfd_create(). (Commit message by Nick)
* When PRECISE_TIMERS is set with epoll, use timerfd for microsecond precisionNick Mathewson2012-04-261-1/+83
| | | | | | | | | | | | | | The epoll interface ordinarily gives us one-millisecond precision, so on Linux it makes perfect sense to use the CLOCK_MONOTONIC_COARSE timer. But when the user has set the new PRECISE_TIMER flag for an event_base (either by the EVENT_BASE_FLAG_PRECISE_TIMER flag, or by the EVENT_PRECISE_TIMER environment variable), they presumably want finer granularity. On not-too-old Linuxes, we can achieve this using the Timerfd mechanism, which accepts nanosecond granularity and understands posix clocks. It's a little more expensive than just calling epoll_wait(), so we won't do it by default.
* Split out time-related prototypes into time-internal.hNick Mathewson2012-04-201-0/+1
|
* Have all visible internal function names end with an underscore.Nick Mathewson2012-02-291-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We haven't had a convention for naming internal functions in -internal.h versus naming visible functions in include/**.h. This patch changes every function declared in a -internal.h file to be named ending with an underscore. Static function names are unaffected, since there's no risk of calling them from outside Libevent. This is an automatic conversion. The script that produced was made by running the following script over the output of ctags --c-kinds=pf -o - *-internal.h | 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; my $ident = $_; next if ($ident =~ /_$/); next if ($ident =~ /^TAILQ/); my $better = "${ident}_"; 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_])bufferevent_async_can_connect(?![A-Za-z0-9_])/bufferevent_async_can_connect_/g; s/(?<![A-Za-z0-9_])bufferevent_async_connect(?![A-Za-z0-9_])/bufferevent_async_connect_/g; s/(?<![A-Za-z0-9_])bufferevent_async_new(?![A-Za-z0-9_])/bufferevent_async_new_/g; s/(?<![A-Za-z0-9_])bufferevent_async_set_connected(?![A-Za-z0-9_])/bufferevent_async_set_connected_/g; s/(?<![A-Za-z0-9_])bufferevent_decref(?![A-Za-z0-9_])/bufferevent_decref_/g; s/(?<![A-Za-z0-9_])bufferevent_disable_hard(?![A-Za-z0-9_])/bufferevent_disable_hard_/g; s/(?<![A-Za-z0-9_])bufferevent_enable_locking(?![A-Za-z0-9_])/bufferevent_enable_locking_/g; s/(?<![A-Za-z0-9_])bufferevent_incref(?![A-Za-z0-9_])/bufferevent_incref_/g; s/(?<![A-Za-z0-9_])bufferevent_init_common(?![A-Za-z0-9_])/bufferevent_init_common_/g; s/(?<![A-Za-z0-9_])bufferevent_remove_from_rate_limit_group_internal(?![A-Za-z0-9_])/bufferevent_remove_from_rate_limit_group_internal_/g; s/(?<![A-Za-z0-9_])bufferevent_suspend_read(?![A-Za-z0-9_])/bufferevent_suspend_read_/g; s/(?<![A-Za-z0-9_])bufferevent_suspend_write(?![A-Za-z0-9_])/bufferevent_suspend_write_/g; s/(?<![A-Za-z0-9_])bufferevent_unsuspend_read(?![A-Za-z0-9_])/bufferevent_unsuspend_read_/g; s/(?<![A-Za-z0-9_])bufferevent_unsuspend_write(?![A-Za-z0-9_])/bufferevent_unsuspend_write_/g; s/(?<![A-Za-z0-9_])evbuffer_commit_read(?![A-Za-z0-9_])/evbuffer_commit_read_/g; s/(?<![A-Za-z0-9_])evbuffer_commit_write(?![A-Za-z0-9_])/evbuffer_commit_write_/g; s/(?<![A-Za-z0-9_])evbuffer_invoke_callbacks(?![A-Za-z0-9_])/evbuffer_invoke_callbacks_/g; s/(?<![A-Za-z0-9_])evbuffer_launch_read(?![A-Za-z0-9_])/evbuffer_launch_read_/g; s/(?<![A-Za-z0-9_])evbuffer_launch_write(?![A-Za-z0-9_])/evbuffer_launch_write_/g; s/(?<![A-Za-z0-9_])evbuffer_overlapped_new(?![A-Za-z0-9_])/evbuffer_overlapped_new_/g; s/(?<![A-Za-z0-9_])evbuffer_set_parent(?![A-Za-z0-9_])/evbuffer_set_parent_/g; s/(?<![A-Za-z0-9_])event_active_nolock(?![A-Za-z0-9_])/event_active_nolock_/g; s/(?<![A-Za-z0-9_])event_base_add_virtual(?![A-Za-z0-9_])/event_base_add_virtual_/g; s/(?<![A-Za-z0-9_])event_base_assert_ok(?![A-Za-z0-9_])/event_base_assert_ok_/g; s/(?<![A-Za-z0-9_])event_base_del_virtual(?![A-Za-z0-9_])/event_base_del_virtual_/g; s/(?<![A-Za-z0-9_])event_base_get_deferred_cb_queue(?![A-Za-z0-9_])/event_base_get_deferred_cb_queue_/g; s/(?<![A-Za-z0-9_])event_base_get_iocp(?![A-Za-z0-9_])/event_base_get_iocp_/g; s/(?<![A-Za-z0-9_])event_base_start_iocp(?![A-Za-z0-9_])/event_base_start_iocp_/g; s/(?<![A-Za-z0-9_])event_base_stop_iocp(?![A-Za-z0-9_])/event_base_stop_iocp_/g; s/(?<![A-Za-z0-9_])event_changelist_add(?![A-Za-z0-9_])/event_changelist_add_/g; s/(?<![A-Za-z0-9_])event_changelist_del(?![A-Za-z0-9_])/event_changelist_del_/g; s/(?<![A-Za-z0-9_])event_changelist_freemem(?![A-Za-z0-9_])/event_changelist_freemem_/g; s/(?<![A-Za-z0-9_])event_changelist_init(?![A-Za-z0-9_])/event_changelist_init_/g; s/(?<![A-Za-z0-9_])event_changelist_remove_all(?![A-Za-z0-9_])/event_changelist_remove_all_/g; s/(?<![A-Za-z0-9_])event_deferred_cb_cancel(?![A-Za-z0-9_])/event_deferred_cb_cancel_/g; s/(?<![A-Za-z0-9_])event_deferred_cb_init(?![A-Za-z0-9_])/event_deferred_cb_init_/g; s/(?<![A-Za-z0-9_])event_deferred_cb_queue_init(?![A-Za-z0-9_])/event_deferred_cb_queue_init_/g; s/(?<![A-Za-z0-9_])event_deferred_cb_schedule(?![A-Za-z0-9_])/event_deferred_cb_schedule_/g; s/(?<![A-Za-z0-9_])event_get_win32_extension_fns(?![A-Za-z0-9_])/event_get_win32_extension_fns_/g; s/(?<![A-Za-z0-9_])event_iocp_activate_overlapped(?![A-Za-z0-9_])/event_iocp_activate_overlapped_/g; s/(?<![A-Za-z0-9_])event_iocp_port_associate(?![A-Za-z0-9_])/event_iocp_port_associate_/g; s/(?<![A-Za-z0-9_])event_iocp_port_launch(?![A-Za-z0-9_])/event_iocp_port_launch_/g; s/(?<![A-Za-z0-9_])event_iocp_shutdown(?![A-Za-z0-9_])/event_iocp_shutdown_/g; s/(?<![A-Za-z0-9_])event_overlapped_init(?![A-Za-z0-9_])/event_overlapped_init_/g; s/(?<![A-Za-z0-9_])evhttp_connection_connect(?![A-Za-z0-9_])/evhttp_connection_connect_/g; s/(?<![A-Za-z0-9_])evhttp_connection_fail(?![A-Za-z0-9_])/evhttp_connection_fail_/g; s/(?<![A-Za-z0-9_])evhttp_connection_reset(?![A-Za-z0-9_])/evhttp_connection_reset_/g; s/(?<![A-Za-z0-9_])evhttp_parse_firstline(?![A-Za-z0-9_])/evhttp_parse_firstline_/g; s/(?<![A-Za-z0-9_])evhttp_parse_headers(?![A-Za-z0-9_])/evhttp_parse_headers_/g; s/(?<![A-Za-z0-9_])evhttp_response_code(?![A-Za-z0-9_])/evhttp_response_code_/g; s/(?<![A-Za-z0-9_])evhttp_send_page(?![A-Za-z0-9_])/evhttp_send_page_/g; s/(?<![A-Za-z0-9_])evhttp_start_read(?![A-Za-z0-9_])/evhttp_start_read_/g; s/(?<![A-Za-z0-9_])EVLOCK_TRY_LOCK(?![A-Za-z0-9_])/EVLOCK_TRY_LOCK_/g; s/(?<![A-Za-z0-9_])evmap_check_integrity(?![A-Za-z0-9_])/evmap_check_integrity_/g; s/(?<![A-Za-z0-9_])evmap_delete_all(?![A-Za-z0-9_])/evmap_delete_all_/g; s/(?<![A-Za-z0-9_])evmap_foreach_event(?![A-Za-z0-9_])/evmap_foreach_event_/g; s/(?<![A-Za-z0-9_])evmap_io_active(?![A-Za-z0-9_])/evmap_io_active_/g; s/(?<![A-Za-z0-9_])evmap_io_add(?![A-Za-z0-9_])/evmap_io_add_/g; s/(?<![A-Za-z0-9_])evmap_io_clear(?![A-Za-z0-9_])/evmap_io_clear_/g; s/(?<![A-Za-z0-9_])evmap_io_del(?![A-Za-z0-9_])/evmap_io_del_/g; s/(?<![A-Za-z0-9_])evmap_io_get_fdinfo(?![A-Za-z0-9_])/evmap_io_get_fdinfo_/g; s/(?<![A-Za-z0-9_])evmap_io_initmap(?![A-Za-z0-9_])/evmap_io_initmap_/g; s/(?<![A-Za-z0-9_])evmap_reinit(?![A-Za-z0-9_])/evmap_reinit_/g; s/(?<![A-Za-z0-9_])evmap_signal_active(?![A-Za-z0-9_])/evmap_signal_active_/g; s/(?<![A-Za-z0-9_])evmap_signal_add(?![A-Za-z0-9_])/evmap_signal_add_/g; s/(?<![A-Za-z0-9_])evmap_signal_clear(?![A-Za-z0-9_])/evmap_signal_clear_/g; s/(?<![A-Za-z0-9_])evmap_signal_del(?![A-Za-z0-9_])/evmap_signal_del_/g; s/(?<![A-Za-z0-9_])evmap_signal_initmap(?![A-Za-z0-9_])/evmap_signal_initmap_/g; s/(?<![A-Za-z0-9_])evrpc_hook_associate_meta(?![A-Za-z0-9_])/evrpc_hook_associate_meta_/g; s/(?<![A-Za-z0-9_])evrpc_hook_context_free(?![A-Za-z0-9_])/evrpc_hook_context_free_/g; s/(?<![A-Za-z0-9_])evrpc_hook_meta_new(?![A-Za-z0-9_])/evrpc_hook_meta_new_/g; s/(?<![A-Za-z0-9_])evrpc_reqstate_free(?![A-Za-z0-9_])/evrpc_reqstate_free_/g; s/(?<![A-Za-z0-9_])evsig_dealloc(?![A-Za-z0-9_])/evsig_dealloc_/g; s/(?<![A-Za-z0-9_])evsig_init(?![A-Za-z0-9_])/evsig_init_/g; s/(?<![A-Za-z0-9_])evsig_set_base(?![A-Za-z0-9_])/evsig_set_base_/g; s/(?<![A-Za-z0-9_])ev_token_bucket_get_tick(?![A-Za-z0-9_])/ev_token_bucket_get_tick_/g; s/(?<![A-Za-z0-9_])ev_token_bucket_init(?![A-Za-z0-9_])/ev_token_bucket_init_/g; s/(?<![A-Za-z0-9_])ev_token_bucket_update(?![A-Za-z0-9_])/ev_token_bucket_update_/g; s/(?<![A-Za-z0-9_])evutil_accept4(?![A-Za-z0-9_])/evutil_accept4_/g; s/(?<![A-Za-z0-9_])evutil_addrinfo_append(?![A-Za-z0-9_])/evutil_addrinfo_append_/g; s/(?<![A-Za-z0-9_])evutil_adjust_hints_for_addrconfig(?![A-Za-z0-9_])/evutil_adjust_hints_for_addrconfig_/g; s/(?<![A-Za-z0-9_])evutil_ersatz_socketpair(?![A-Za-z0-9_])/evutil_ersatz_socketpair_/g; s/(?<![A-Za-z0-9_])evutil_eventfd(?![A-Za-z0-9_])/evutil_eventfd_/g; s/(?<![A-Za-z0-9_])evutil_format_sockaddr_port(?![A-Za-z0-9_])/evutil_format_sockaddr_port_/g; s/(?<![A-Za-z0-9_])evutil_getaddrinfo_async(?![A-Za-z0-9_])/evutil_getaddrinfo_async_/g; s/(?<![A-Za-z0-9_])evutil_getaddrinfo_common(?![A-Za-z0-9_])/evutil_getaddrinfo_common_/g; s/(?<![A-Za-z0-9_])evutil_getenv(?![A-Za-z0-9_])/evutil_getenv_/g; s/(?<![A-Za-z0-9_])evutil_hex_char_to_int(?![A-Za-z0-9_])/evutil_hex_char_to_int_/g; s/(?<![A-Za-z0-9_])EVUTIL_ISALNUM(?![A-Za-z0-9_])/EVUTIL_ISALNUM_/g; s/(?<![A-Za-z0-9_])EVUTIL_ISALPHA(?![A-Za-z0-9_])/EVUTIL_ISALPHA_/g; s/(?<![A-Za-z0-9_])EVUTIL_ISDIGIT(?![A-Za-z0-9_])/EVUTIL_ISDIGIT_/g; s/(?<![A-Za-z0-9_])EVUTIL_ISLOWER(?![A-Za-z0-9_])/EVUTIL_ISLOWER_/g; s/(?<![A-Za-z0-9_])EVUTIL_ISPRINT(?![A-Za-z0-9_])/EVUTIL_ISPRINT_/g; s/(?<![A-Za-z0-9_])EVUTIL_ISSPACE(?![A-Za-z0-9_])/EVUTIL_ISSPACE_/g; s/(?<![A-Za-z0-9_])EVUTIL_ISUPPER(?![A-Za-z0-9_])/EVUTIL_ISUPPER_/g; s/(?<![A-Za-z0-9_])EVUTIL_ISXDIGIT(?![A-Za-z0-9_])/EVUTIL_ISXDIGIT_/g; s/(?<![A-Za-z0-9_])evutil_load_windows_system_library(?![A-Za-z0-9_])/evutil_load_windows_system_library_/g; s/(?<![A-Za-z0-9_])evutil_make_internal_pipe(?![A-Za-z0-9_])/evutil_make_internal_pipe_/g; s/(?<![A-Za-z0-9_])evutil_new_addrinfo(?![A-Za-z0-9_])/evutil_new_addrinfo_/g; s/(?<![A-Za-z0-9_])evutil_open_closeonexec(?![A-Za-z0-9_])/evutil_open_closeonexec_/g; s/(?<![A-Za-z0-9_])evutil_read_file(?![A-Za-z0-9_])/evutil_read_file_/g; s/(?<![A-Za-z0-9_])evutil_resolve(?![A-Za-z0-9_])/evutil_resolve_/g; s/(?<![A-Za-z0-9_])evutil_set_evdns_getaddrinfo_fn(?![A-Za-z0-9_])/evutil_set_evdns_getaddrinfo_fn_/g; s/(?<![A-Za-z0-9_])evutil_sockaddr_is_loopback(?![A-Za-z0-9_])/evutil_sockaddr_is_loopback_/g; s/(?<![A-Za-z0-9_])evutil_socket(?![A-Za-z0-9_])/evutil_socket_/g; s/(?<![A-Za-z0-9_])evutil_socket_connect(?![A-Za-z0-9_])/evutil_socket_connect_/g; s/(?<![A-Za-z0-9_])evutil_socket_finished_connecting(?![A-Za-z0-9_])/evutil_socket_finished_connecting_/g; s/(?<![A-Za-z0-9_])EVUTIL_TOLOWER(?![A-Za-z0-9_])/EVUTIL_TOLOWER_/g; s/(?<![A-Za-z0-9_])EVUTIL_TOUPPER(?![A-Za-z0-9_])/EVUTIL_TOUPPER_/g; s/(?<![A-Za-z0-9_])evutil_tv_to_msec(?![A-Za-z0-9_])/evutil_tv_to_msec_/g; s/(?<![A-Za-z0-9_])evutil_usleep(?![A-Za-z0-9_])/evutil_usleep_/g; s/(?<![A-Za-z0-9_])ht_improve_hash(?![A-Za-z0-9_])/ht_improve_hash_/g; s/(?<![A-Za-z0-9_])ht_string_hash(?![A-Za-z0-9_])/ht_string_hash_/g; s/(?<![A-Za-z0-9_])min_heap_adjust(?![A-Za-z0-9_])/min_heap_adjust_/g; s/(?<![A-Za-z0-9_])min_heap_ctor(?![A-Za-z0-9_])/min_heap_ctor_/g; s/(?<![A-Za-z0-9_])min_heap_dtor(?![A-Za-z0-9_])/min_heap_dtor_/g; s/(?<![A-Za-z0-9_])min_heap_elem_init(?![A-Za-z0-9_])/min_heap_elem_init_/g; s/(?<![A-Za-z0-9_])min_heap_elt_is_top(?![A-Za-z0-9_])/min_heap_elt_is_top_/g; s/(?<![A-Za-z0-9_])min_heap_empty(?![A-Za-z0-9_])/min_heap_empty_/g; s/(?<![A-Za-z0-9_])min_heap_erase(?![A-Za-z0-9_])/min_heap_erase_/g; s/(?<![A-Za-z0-9_])min_heap_pop(?![A-Za-z0-9_])/min_heap_pop_/g; s/(?<![A-Za-z0-9_])min_heap_push(?![A-Za-z0-9_])/min_heap_push_/g; s/(?<![A-Za-z0-9_])min_heap_reserve(?![A-Za-z0-9_])/min_heap_reserve_/g; s/(?<![A-Za-z0-9_])min_heap_size(?![A-Za-z0-9_])/min_heap_size_/g; s/(?<![A-Za-z0-9_])min_heap_top(?![A-Za-z0-9_])/min_heap_top_/g;
* Convert event-config.h macros to avoid reserved identifiersNick Mathewson2012-02-291-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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;
* Merge remote-tracking branch 'github/21_fast_syscalls'Nick Mathewson2012-02-151-9/+14
|\
| * Prefer epoll_create1 on Linuxen that have itNick Mathewson2012-02-101-9/+14
| |
* | Merge branch 'ifdef' of git://github.com/rosslagerwall/libeventNick Mathewson2012-02-101-0/+4
|\ \
| * | Put #ifdef around some files to support alternate build systems.Ross Lagerwall2012-02-081-0/+4
| |/
* | Merge remote-tracking branch 'origin/patches-2.0'Nick Mathewson2012-02-101-1/+1
|\ \ | |/ |/| | | | | | | | | Conflicts: Makefile.am WIN32-Code/event2/event-config.h configure.in
| * Update copyright notices to 2012Nick Mathewson2012-02-101-1/+1
| |
* | Merge remote-tracking branch 'origin/patches-2.0'Nick Mathewson2011-10-261-2/+5
|\ \ | |/
| * epoll: close fd on alloc fail at initializationJamie Iles2011-10-261-1/+4
| | | | | | | | | | | | If the memory allocations fail then we free any other allocated structures but don't close the file descriptor resulting in an leak of fd's.
| * Update copyright dates to 2011.Nick Mathewson2011-10-241-1/+1
| |
* | Include evconfig-private.h in internal files for great good.Kevin Bowling2011-01-021-0/+1
| |
* | Reindent epoll_apply_one_change()Nick Mathewson2010-12-161-89/+86
| |
* | Clean up error handling in epoll_apply_one_change() a littleNick Mathewson2010-12-161-18/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The old code was more or less: if (op == X && errno == FOO) { ... } else if (op == Y && errno == BAR) { ... } but really we wanted to do a switch (op) to avoid needless checks and branches. This patch leaves the indentation a little weird so as to make it easier to see what changed; the next patch will fix the indentation.
* | Replace big chain of if/thens in epoll.c with a table lookupNick Mathewson2010-12-161-77/+174
|/ | | | | | | | This should save a bunch of branches by doing instead a lookup in a nice static table. To ensure correctness, the table is generated from a Python script, included with this commit.
* Disable changelist for epoll by default because of Linux dup() bug; add an ↵Nick Mathewson2010-11-221-15/+87
| | | | | | option and/or an envvar to reenable it for speed. Rename option to control epoll changelist; make epoll changelist off by default
* Simplify the logic for choosing EPOLL_CTL_ADD vs EPOLL_CTL_MODNick Mathewson2010-10-241-16/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously, we chose "ADD" whenever old_events==new_events, (since we expected the add to fail with EEXIST), or whenever old_events was==0, and MOD otherwise (i.e., when old_events was nonzero and not equal to new_events). But now that we retry failed MOD events as ADD *and* failed ADD events as MOD, the important thing is now to try to guess right the largest amount of the time, since guessing right means we do only one syscall, but guessing wrong means we do two. When old_events is 0, ADD is probably right (unless we're hitting the dup bug, when we'll fall back). And when old_events is set and != new_events, MOD is almost certainly right for the same reasons as before. But when old_events is equal to new events, then MOD will work fine unless we closed and reopened the fd, in which case we'll have to fall back to the ADD case. (Redundant del/add pairs are more common than closes for most use cases.) This change lets us avoid calculating new_events, which ought to save a little time in epoll.c
* Fix a nasty bug related to use of dup() with epoll on LinuxNick Mathewson2010-10-241-13/+19
| | | | | | | | | | | | | | | | | | | | | Current versions of the Linux kernel don't seem to remove the struct epitem for a given (file,fd) combo when the fd is closed unless the file itself is also completely closed. This means that if you do: fd = dup(fd_orig); add(fd); close(fd); dup2(fd_orig, fd); add(fd); you will get an EEXIST when you should have gotten a success. This could cause warnings and dropped events when using dup and epoll. The solution is pretty simple: when we get an EEXIST from EPOLL_CTL_ADD, we retry with EPOLL_CTL_MOD. Unit test included to demonstrate the bug. Found due to the patient efforts of Gilad Benjamini; diagnosed with help from Nicholas Marriott.
* Fix a spurious-call bug on epoll.cNick Mathewson2010-09-301-1/+1
| | | | | | | | | | | | | We were trying to check whether any events had really been notified on an fd before calling evmap_io_active on it, but instead we were checking for an event pointer, which was always true. In practice, this patch shouldn't change much, since epoll_wait shouldn't return an event unless there is actually an event going on. Spotted by an anonymous bug reporter on Sourceforge. Closes bug 3078425.
* Make debugging output for epoll backend more comprehensiveNick Mathewson2010-09-211-5/+14
|
* Remove the now-useless evsig_caught and evsig_processNick Mathewson2010-09-151-3/+0
|
* Move event-config.h to include/event2Nick Mathewson2010-08-061-1/+1
| | | | | This change means that all required include files are in event2, and all files not in event2/* are optional.
* Improve error message for failed epoll to make debugging easier.Nick Mathewson2010-07-291-10/+33
|
* Suppress a spurious EPERM warning in epoll.cNick Mathewson2010-07-081-1/+2
| | | | | | | | It's okay for us to get an EPERM when doing an EPOLL_DEL on an fd; it just means that before we got a chance to the EPOLL_DEL, we closed the fd and reopened a new non-socket that wound up having the same fd. Partial fix for Bug 3019973.
* Add evutil_tv_to_msec for safe conversion of timevals to milliseconds.Christopher Davis2010-03-311-9/+11
| | | | | This is useful for backends that require their timeout values be in milliseconds.
* more whitespace normalizationNick Mathewson2010-03-051-3/+3
|
* Update all our copyright notices to say "2010"Nick Mathewson2010-03-041-1/+1
|
* Minimize epoll_ctl calls by using changelistNick Mathewson2010-01-231-69/+152
| | | | | | The logic here is a little complex, since epoll_add must used called exactly when no events were previously set, epoll_mod must be used when any events were previously set, and epoll_del only called when the removing all events.
* Introduced evutil_make_socket_closeonexec() to preserve fd flags for F_SETFD.Jardel Weyrich2009-12-291-10/+1
| | | | | Use this to eliminate the various macros that called F_SETFD throughout the code.
* Stop passing EVTHREAD_READ and EVTHREAD_WRITE to non-rw locks.Nick Mathewson2009-11-271-2/+2
| | | | | | | | | | | | | 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.
* Prefer calloc(a,b) to malloc(a*b). via openbsd.Nick Mathewson2009-11-151-1/+1
| | | | svn:r1531
* We do not work any more without an event-config.h; stop pretending that it ↵Nick Mathewson2009-11-061-2/+0
| | | | | | is meaningful to check for HAVE_CONFIG_H svn:r1516
* Remove compat/sys/_time.hNick Mathewson2009-11-031-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I've gone through everything that it declared to see where it was used, and it seems that we probably don't need it anywhere. Here's what it declared, and why I think we're okay dropping it. o struct timeval {} (Used all over, and we can't really get away with declaring it ourselves; we need the same definition the system uses. If we can't find struct timeval, we're pretty much sunk.) o struct timespec {} (Used in event.c, evdns.c, kqueue.c, evport.c. Of these, kqueue.c and event.c include sys/_time.h. event.c conditions its use on _EVENT_HAVE_CLOCK_GETTIME, and kqueue() only works if timespec is defined.) o TIMEVAL_TO_TIMESPEC (Used in kqueue.c, but every place with kqueue has sys/time.h) o struct timezone {} (event2/util.h has a forward declaration; only evutil.c references it and doesn't look at its contents.) o timerclear, timerisset, timercmp, timeradd, timersub (Everything now uses the evutil_timer* variants.) o ITIMER_REAL, ITIMER_VIRTUAL, ITIMER_PROF, struct itemerval (These are only used in test/regress.c, which does not include _time.h) o CLOCK_REALTIME (Only used in evdns.c, which does not include _time.h) o TIMESPEC_TO_TIMEVAL o DST_* o timespecclear, timespecisset, timespeccmp, timespecadd, timespecsub o struct clockinfo {} o CLOCK_VIRTUAL, CLOCK_PROF o TIMER_RELTIME, TIMER_ABSTIME (unused) svn:r1494
* Use EVUTIL_ASSERT() consistently instead of assert.Nick Mathewson2009-10-261-2/+1
| | | | svn:r1464