libtool has VERSION_INFO [1], cmake has SOVERSION/VERSION instead
(although it has different format). Also libtool has RELEASE [2] while
cmake do not have analog yet [3], hence manual symlinks should be
created.
[1]: https://www.gnu.org/software/libtool/manual/html_node/Libtool-versioning.html
[2]: https://www.gnu.org/software/libtool/manual/html_node/Release-numbers.html
[3]: https://gitlab.kitware.com/cmake/cmake/issues/17652
Plus osx has compatibility_version/current_version dylib properties and
cmake do not have separate properties for them [4], hence manual LINK_FLAGS.
And also there INSTALL_NAME_DIR property which should be adjusted too.
[4]: https://public.kitware.com/Bug/view.php?id=4383
So after all changes, here is an example before/after for osx and linux:
# osx
# autotools
.libs/libevent_pthreads-2.2.1.dylib
.libs/libevent_pthreads.dylib -> libevent_pthreads-2.2.1.dylib
/usr/local/lib/libevent_pthreads-2.2.1.dylib (compatibility version 2.0.0, current version 2.0.0)
# cmake
# before patch
lib/libevent_pthreads.2.2.0.dylib
lib/libevent_pthreads.dylib -> libevent_pthreads.2.2.0.dylib
@rpath/libevent_pthreads.2.2.0.dylib (compatibility version 2.2.0, current version 0.0.0)
# after patch
lib/libevent_pthreads-2.2.1.dylib
lib/libevent_pthreads.dylib -> libevent_pthreads-2.2.1.dylib
/vagrant/.cmake/inst/lib/libevent_pthreads-2.2.1.dylib (compatibility version 2.0.0, current version 2.0.0)
# linux
# autotools
.libs/libevent_pthreads-2.2.so.1 -> libevent_pthreads-2.2.so.1.0.0
.libs/libevent_pthreads-2.2.so.1.0.0
.libs/libevent_pthreads.so -> libevent_pthreads-2.2.so.1.0.0
# cmake
# before patch
lib/libevent_pthreads.so -> libevent_pthreads.so.2.2.0
lib/libevent_pthreads.so.2.2.0
# after patch
lib/libevent_pthreads-2.2.so -> libevent_pthreads-2.2.so.1
lib/libevent_pthreads-2.2.so.1 -> libevent_pthreads-2.2.so.1.0.0
lib/libevent_pthreads-2.2.so.1.0.0
lib/libevent_pthreads.so -> libevent_pthreads-2.2.so.1.0.0
Closes: #838 (cherry-picked)
Closes: #760
When targeting the Android NDK _GNU_SOURCE is not enabled by default:
```
/*
* With bionic, you always get all C and POSIX API.
*
* If you want BSD and/or GNU extensions, _BSD_SOURCE and/or _GNU_SOURCE are
* expected to be defined by callers before *any* standard header file is
* included.
*
* In our header files we test against __USE_BSD and __USE_GNU.
*/
#if defined(_GNU_SOURCE)
# define __USE_BSD 1
# define __USE_GNU 1
#endif
```
Because of this `pipe2` is not available:
```
#if defined(__USE_GNU)
int pipe2(int __fds[2], int __flags) __INTRODUCED_IN(9);
#endif
```
The function used to check if it does exist:
```
CHECK_FUNCTION_EXISTS_EX(pipe2 EVENT__HAVE_PIPE2)
```
Just check that the _linking_ succeeds, which it does, it's just not
visible in the import, leading to a warning (or error):
```
evutil.c:2637:6: error: implicit declaration of function 'pipe2' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
if (pipe2(fd, O_NONBLOCK|O_CLOEXEC) == 0)
^
```
When targeting the NDK it should be safe to always opt into this. Clang
would pass the right flag for us automatically _if_ the source was C++
instead of C.
The CMAKE_CROSSCOMPILING variable is not set for Apple targets seemingly
because of cmake implementation details (more info
https://cmake.org/cmake/help/latest/variable/CMAKE_CROSSCOMPILING.html).
Since Apple targets have working kqueue implementations this check makes
sure we enable it always when those are the targets, without users
having to explicitly set EVENT__HAVE_WORKING_KQUEUE
Calling fork() from the event loop is not a great idea, since at least
it shares some internal pipes (for handling signals) before
event_reinit() call
Closes: #833
@ygj6 reported:
"My platform is MacOS 10.13.5, This problem only happens on Mac.
As written in the file CMakeLists.txt, the minimum required version of cmake is 3.1:
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
So I built this project with cmake-3.1.0, but I got the following errors:
CMake Error at /usr/local/cmake-3.1.0/share/cmake/Modules/FindOpenSSL.cmake:293 (list):
list GET given empty list
Call Stack (most recent call first):
CMakeLists.txt:824 (find_package)
CMake Error at /usr/local/cmake-3.1.0/share/cmake/Modules/FindOpenSSL.cmake:294 (list):
list GET given empty list
Call Stack (most recent call first):
CMakeLists.txt:824 (find_package)
CMake Error at /usr/local/cmake-3.1.0/share/cmake/Modules/FindOpenSSL.cmake:296 (list):
list GET given empty list
Call Stack (most recent call first):
CMakeLists.txt:824 (find_package)
CMake Error at /usr/local/cmake-3.1.0/share/cmake/Modules/FindOpenSSL.cmake:298 (list):
list GET given empty list
Call Stack (most recent call first):
CMakeLists.txt:824 (find_package)
I googled this error and got this answer:
https://bugs.archlinux.org/task/43688
It is a bug in FindOpenSSL.cmake on cmake-3.1.0 and fixed on cmake-3.1.2 .
Of course, It was successful when rebuilding with cmake-3.1.2 .
So I suggest setting the minimum version required for cmake to 3.1.2 or higher.
"
Closes: #845
Refs: de4ccee75a
This will allow to customize SO_RCVBUF/SO_SNDBUF for nameservers in this
evdns_base, you may want to adjust them if the kernel starts dropping
udp packages.
Since commit 506df426dbeb0187bbd3654bd286b4100628fb16, OPENSSL_INCS is
added to CPPFLAGS without any white space, as a result openssl detection
fails on:
configure:10395: checking openssl/ssl.h usability
configure:10395: /home/fabrice/buildroot-test/buildroot/output/host/bin/riscv32-linux-gcc -c -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -Wall -fno-strict-aliasing -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64-I/home/fabrice/buildroot-test/buildroot/output/host/bin/../riscv32-buildroot-linux-gnu/sysroot/usr/include conftest.c >&5
<command-line>:0:0: warning: "_FILE_OFFSET_BITS" redefined
<command-line>:0:0: note: this is the location of the previous definition
<command-line>:0:23: error: division by zero in #if
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
When connecting to a non-existent HTTPS service, the "req" is not null
but the "evhttp_request_get_response_code(req)" is zero.
Closes: #822 (cherry-picked)
* evbuffer-fixes-806-v2:
evbuffer: fix last_with_datap after prepend with empty chain
test: regression for evbuffer_expand_fast_() with invalid last_with_datap
test: cover adjusting of last_with_datap in evbuffer_prepend()
Fixes: #806
Before the fix:
$ regress --no-fork evbuffer/reserve_invalid_last_with_datap
evbuffer/empty_chain_expand: [err] ../buffer.c:2138: Assertion chain == buf->first failed in evbuffer_expand_fast_
Aborted (core dumped)
This is the a shorter version of test from the #806 (with some
comments).
* issue-807-accept4-getnameinfo-AF_UNIX:
http-server: add usage/help dialog
http: avoid use of uninitialized value for AF_UNIX/AF_LOCAL sockaddr
http-server: add ability to bind to unix-socket
build: struct sockaddr_un detection (sys/un.h, afunix.h)
Fixes: #807
As ploxiln pointed out in pull request 811 the check "newsize < 0"
is undefined behaviour (signed int overflow).
Follow the advice and check kqop->changes_size instead.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Closes: #813 (cherry-picked)
On amd64 systems with kqueue (e.g. *BSD systems) an integer overflow
could be triggered with an excessively huge amount of events.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
If slot is larger than INT_MAX / 2, then the loop which increases
nentries until it is larger than slot would never return.
Also make sure that nentries * msize will never overflow INT_MAX.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
It doesn't make sense to allow a signal number higher than NSIG.
The NSIG check already exists in signal.c for internally used
functions.
As this is a programming error of libevent consumers, this is a
purely defensive mechanism.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Converting unsigned to size_t for size of memory objects allows
proper handling of very large heaps on 64 bit systems.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Closes: #799 (cherry-picked)
There was a race between event_base_loop and evwatch_new (adding a
prepare/check watcher while iterating over the watcher list). Only
release the mutex immediately before invoking each watcher callback,
and reacquire it immediately afterwards (same as is done for normal
event handlers).
User can define his own response method by calling
evhttp_set_ext_method_cmp() on the struct http, or
evhttp_connection_set_ext_method_cmp() on the connection.
We expose a new stucture `evhttp_ext_method` which is passed to the
callback if it's set. So any field can be modified, with some exceptions
(in evhttp_method_):
If the cmp function is set, it has the ability to modify method, and
flags. Other fields will be ignored. Flags returned are OR'd with the
current flags.
Based on changes to the #282 from: Mark Ellzey <socket@gmail.com>
From the server perspective the evhttp_response_phrase_internal() should
not be called with 0 before this patch, it will be called with
EVHTTP_REQ_UNKNOWN_ hence this patch should not change behavior.
Fixes: 68eb526d7b ("http: add WebDAV methods support")
Fixes: #789Fixes: #796
Reported-by: Thomas Bernard <miniupnp@free.fr>