Hash :
57d9eec6
Author :
Date :
2023-07-10T10:40:49
Disable signalfd by default
signalfd may behave differently to sigaction/signal, so to avoid
breaking libevent users (like [1], [2]) disable it by default.
[1]: https://github.com/tmux/tmux/pull/3621
[2]: https://github.com/tmux/tmux/pull/3626
Also signalfd is not that perfect:
- you need to SIG_BLOCK the signal before
- blocked signals are not reset on exec
- blocked signals are allowed to coalesce - so in case of multiple
signals sent you may get the signal only once (ok for most of the
signals, but may be a problem for SIGCHLD, though you may call
waitpid() in a loop or use pidfd)
- and also one implementation problem -
sigprocmask is unspecified in a multithreaded process
Refs:
- https://lwn.net/Articles/415684/
- https://ldpreload.com/blog/signalfd-is-useless
Refs: https://github.com/libevent/libevent/issues/1460
Refs: #1342 (cc @dmantipov)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
# test/Makefile.am for libevent
# Copyright 2000-2007 Niels Provos
# Copyright 2007-2012 Niels Provos and Nick Mathewson
#
# See LICENSE for copying information.
regress_CPPFLAGS = -DTINYTEST_LOCAL
EXTRA_DIST+= \
test/check-dumpevents.py \
test/regress.gen.c \
test/regress.gen.h \
test/regress.rpc \
test/rpcgen_wrapper.sh \
test/print-winsock-errors.c \
test/test.sh
TESTPROGRAMS = \
test/bench \
test/bench_cascade \
test/bench_http \
test/bench_httpclient \
test/test-changelist \
test/test-dumpevents \
test/test-eof \
test/test-closed \
test/test-fdleak \
test/test-init \
test/test-ratelim \
test/test-time \
test/test-weof \
test/regress
if BUILD_REGRESS
noinst_PROGRAMS += $(TESTPROGRAMS)
EXTRA_PROGRAMS+= test/regress
endif
noinst_HEADERS+= \
test/regress.h \
test/regress_thread.h \
test/tinytest.h \
test/tinytest_local.h \
test/tinytest_macros.h
TESTS = \
test_runner_epoll \
test_runner_select \
test_runner_kqueue \
test_runner_evport \
test_runner_devpoll \
test_runner_poll \
test_runner_win32 \
test_runner_wepoll \
test_runner_timerfd \
test_runner_changelist \
test_runner_timerfd_changelist
LOG_COMPILER = true
TESTS_COMPILER = true
test_runner_epoll: $(top_srcdir)/test/test.sh
$(top_srcdir)/test/test.sh -b EPOLL
test_runner_select: $(top_srcdir)/test/test.sh
$(top_srcdir)/test/test.sh -b SELECT
test_runner_kqueue: $(top_srcdir)/test/test.sh
$(top_srcdir)/test/test.sh -b KQUEUE
test_runner_evport: $(top_srcdir)/test/test.sh
$(top_srcdir)/test/test.sh -b EVPORT
test_runner_devpoll: $(top_srcdir)/test/test.sh
$(top_srcdir)/test/test.sh -b DEVPOLL
test_runner_poll: $(top_srcdir)/test/test.sh
$(top_srcdir)/test/test.sh -b POLL
test_runner_win32: $(top_srcdir)/test/test.sh
$(top_srcdir)/test/test.sh -b WIN32
test_runner_wepoll: $(top_srcdir)/test/test.sh
$(top_srcdir)/test/test.sh -b WEPOLL
test_runner_timerfd: $(top_srcdir)/test/test.sh
$(top_srcdir)/test/test.sh -b "" -t
test_runner_changelist: $(top_srcdir)/test/test.sh
$(top_srcdir)/test/test.sh -b "" -c
test_runner_timerfd_changelist: $(top_srcdir)/test/test.sh
$(top_srcdir)/test/test.sh -b "" -T
test_runner_timerfd_changelist: $(top_srcdir)/test/test.sh
$(top_srcdir)/test/test.sh -b "" -S
DISTCLEANFILES += test/regress.gen.c test/regress.gen.h
if BUILD_REGRESS
BUILT_SOURCES += test/regress.gen.c test/regress.gen.h
endif
test_test_init_SOURCES = test/test-init.c
test_test_init_LDADD = libevent_core.la
test_test_dumpevents_SOURCES = test/test-dumpevents.c
test_test_dumpevents_LDADD = libevent_core.la
test_test_eof_SOURCES = test/test-eof.c
test_test_eof_LDADD = libevent_core.la
test_test_closed_SOURCES = test/test-closed.c
test_test_closed_LDADD = libevent_core.la
test_test_changelist_SOURCES = test/test-changelist.c
test_test_changelist_LDADD = libevent_core.la
test_test_weof_SOURCES = test/test-weof.c
test_test_weof_LDADD = libevent_core.la
test_test_time_SOURCES = test/test-time.c
test_test_time_LDADD = libevent_core.la
test_test_ratelim_SOURCES = test/test-ratelim.c
test_test_ratelim_LDADD = libevent_core.la -lm
test_test_fdleak_SOURCES = test/test-fdleak.c
test_test_fdleak_LDADD = libevent_core.la
test_regress_SOURCES = \
test/regress.c \
test/regress.gen.c \
test/regress.gen.h \
test/regress_buffer.c \
test/regress_bufferevent.c \
test/regress_dns.c \
test/regress_et.c \
test/regress_finalize.c \
test/regress_http.c \
test/regress_http.h \
test/regress_listener.c \
test/regress_main.c \
test/regress_minheap.c \
test/regress_rpc.c \
test/regress_testutils.c \
test/regress_testutils.h \
test/regress_util.c \
test/regress_watch.c \
test/regress_ws.c \
test/regress_ws.h \
test/regress_timer_timeout.c \
test/tinytest.c \
$(regress_thread_SOURCES) \
$(regress_zlib_SOURCES)
if PTHREADS
regress_thread_SOURCES = test/regress_thread.c
PTHREAD_LIBS += libevent_pthreads.la
endif
if BUILD_WIN32
if THREADS
regress_thread_SOURCES = test/regress_thread.c
endif
endif
if ZLIB_REGRESS
regress_zlib_SOURCES = test/regress_zlib.c
endif
if BUILD_WIN32
test_regress_SOURCES += test/regress_iocp.c
endif
test_regress_LDADD = $(LIBEVENT_GC_SECTIONS) libevent_core.la libevent_extra.la $(PTHREAD_LIBS) $(ZLIB_LIBS)
test_regress_CPPFLAGS = $(AM_CPPFLAGS) $(PTHREAD_CFLAGS) $(ZLIB_CFLAGS) -Itest
test_regress_LDFLAGS = $(PTHREAD_CFLAGS)
if OPENSSL
test_regress_SOURCES += test/regress_openssl.c
test_regress_CPPFLAGS += $(OPENSSL_INCS)
test_regress_LDADD += libevent_openssl.la $(OPENSSL_LIBS) ${OPENSSL_LIBADD}
endif
if MBEDTLS
test_regress_SOURCES += test/regress_mbedtls.c
test_regress_CPPFLAGS += $(MBEDTLS_INCS)
test_regress_LDADD += libevent_mbedtls.la $(MBEDTLS_LIBS)
endif
test_bench_SOURCES = test/bench.c
test_bench_LDADD = $(LIBEVENT_GC_SECTIONS) libevent.la
test_bench_cascade_SOURCES = test/bench_cascade.c
test_bench_cascade_LDADD = $(LIBEVENT_GC_SECTIONS) libevent.la
test_bench_http_SOURCES = test/bench_http.c
test_bench_http_LDADD = $(LIBEVENT_GC_SECTIONS) libevent.la
test_bench_httpclient_SOURCES = test/bench_httpclient.c
test_bench_httpclient_LDADD = $(LIBEVENT_GC_SECTIONS) libevent_core.la
test/regress.gen.c test/regress.gen.h: test/rpcgen-attempted
test/rpcgen-attempted: test/regress.rpc event_rpcgen.py test/rpcgen_wrapper.sh
$(AM_V_GEN)date -u > $@
$(AM_V_at)if $(srcdir)/test/rpcgen_wrapper.sh $(srcdir)/test; then \
true; \
else \
echo "No Python installed; stubbing out RPC test." >&2; \
echo " "> test/regress.gen.c; \
echo "#define NO_PYTHON_EXISTS" > test/regress.gen.h; \
fi
CLEANFILES += test/rpcgen-attempted
$(TESTPROGRAMS) : libevent.la