Hash :
fe610f2c
Author :
Date :
2023-05-14T22:35:53
Fix util/mm_calloc_enomem under FreeBSD
It looks like the compiler optimizes this call out with tt_assert():
(gdb) disas /m test_event_calloc_enomem
Dump of assembler code for function test_event_calloc_enomem:
0x0000000000293bb0 <+0>: push %rbp
0x0000000000293bb1 <+1>: mov %rsp,%rbp
0x0000000000293bb4 <+4>: call 0x29f510 <__error@plt>
0x0000000000293bb9 <+9>: movl $0x0,(%rax)
0x0000000000293bbf <+15>: call 0x2990e0 <tinytest_set_test_failed_>
0x0000000000293bc4 <+20>: mov $0x2168e4,%edi
0x0000000000293bc9 <+25>: mov $0x220582,%esi
0x0000000000293bce <+30>: mov $0x20d893,%edx
0x0000000000293bd3 <+35>: mov $0x53a,%ecx
0x0000000000293bd8 <+40>: xor %eax,%eax
0x0000000000293bda <+42>: call 0x29f3b0 <printf@plt>
0x0000000000293bdf <+47>: mov $0x20da72,%edi
0x0000000000293be4 <+52>: mov $0x20f731,%esi
0x0000000000293be9 <+57>: xor %eax,%eax
0x0000000000293beb <+59>: pop %rbp
0x0000000000293bec <+60>: jmp 0x29f3b0 <printf@plt>
While with tt_ptr_op() it does not:
(gdb) disas /m test_event_calloc_enomem
Dump of assembler code for function test_event_calloc_enomem:
0x0000000000293bd0 <+0>: push %rbp
0x0000000000293bd1 <+1>: mov %rsp,%rbp
0x0000000000293bd4 <+4>: push %rbx
0x0000000000293bd5 <+5>: push %rax
0x0000000000293bd6 <+6>: call 0x29f610 <__error@plt>
0x0000000000293bdb <+11>: movl $0x0,(%rax)
0x0000000000293be1 <+17>: mov $0xffffffffffffffff,%rdi
0x0000000000293be8 <+24>: mov $0xffffffffffffffff,%rsi
0x0000000000293bef <+31>: call 0x2a01c0 <calloc@plt>
0x0000000000293bf4 <+36>: test %rax,%rax
0x0000000000293bf7 <+39>: je 0x293c2b <test_event_calloc_enomem+91>

mkdir build && cd build
cmake .. # Default to Unix Makefiles.
make
make verify # (optional)
See Documentation/Building#Building on Unix using CMake for more information.
Install CMake: https://cmake.org/
md build && cd build
cmake -G "Visual Studio 10" .. # Or use any generator you want to use. Run cmake --help for a list
cmake --build . --config Release # Or "start libevent.sln" and build with menu in Visual Studio.
See Documentation/Building#Building on Windows for more information.
You can download and install libevent using the vcpkg dependency manager:
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh
./vcpkg integrate install
./vcpkg install libevent
The libevent port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please create an issue or pull request on the vcpkg repository.
Note, since 2.2 it is deprecated
./configure
make
make verify # (optional)
sudo make install
See Documentation/Building#Autoconf for more information.
For the latest released version of Libevent, see the official website at https://libevent.org/ .
There’s a pretty good work-in-progress manual up at http://www.wangafu.net/~nickm/libevent-book/ .
For the latest development versions of Libevent, access our Git repository via
$ git clone https://github.com/libevent/libevent.git
You can browse the git repository online at:
https://github.com/libevent/libevent
To report bugs, issues, or ask for new features:
Patches: https://github.com/libevent/libevent/pulls
OK, those are not really patches. You fork, modify, and hit the “Create Pull Request” button. You can still submit normal git patches via the mailing list.
Bugs, Features [RFC], and Issues: https://github.com/libevent/libevent/issues
Or you can do it via the mailing list.
There’s also a libevent-users mailing list for talking about Libevent use and development:
https://archives.seul.org/libevent/users/
The following people have helped with suggestions, ideas, code or fixing bugs.