Hash :
96c259f1
Author :
Date :
2024-06-26T12:10:00
tcpkeepalive: distinguish OS versions and use proper time units (#1669) DragonFly BSD changed the time unit for TCP keep-alive from milliseconds to seconds since v5.8 and Solaris 11.4 added `TCP_KEEPIDLE`, `TCP_KEEPINTVL`, and `TCP_KEEPCNT` with time units in second while Solaris <11.4 still use `TCP_KEEPALIVE_THRESHOLD` and `TCP_KEEPALIVE_ABORT_THRESHOLD` with time units in millisecond. Currently, we don't differentiate among DragonFly BSD versions but set the keepalive options with seconds, which will result in unexpected behaviors on DragonFlyBSD <5.8. This PR intends to fix the wrong usage of time units of TCP keepalive options on DragonFly BSD <5.8 and consolidate the logic of time units conversion for TCP keepalive across platforms. In addition, this PR introduces a new custom macro for determining Solaris 11.4. This macro is expected to help us implement some new features for `libuv` using some abilities that only exist on Solaris 11.4 and other mainstream platforms in the future, considering that Oracle developed and released Solaris 11.4 to replenish plenty of features on Solaris that have already been implemented on other UNIX-like OSs but missing from Solaris <11.4, also bring a good deal of new features. ### References - [Change tcp keepalive options from ms to seconds (DISRUPTIVE)](https://lists.dragonflybsd.org/pipermail/commits/2019-July/719125.html) - [DragonFly BSD 5.8 release notes](https://www.dragonflybsd.org/release58/) - [DragonFly TCP](https://man.dragonflybsd.org/?command=tcp§ion=4) - [Solaris 11.3 TCP](https://docs.oracle.com/cd/E86824_01/html/E54777/tcp-7p.html) - [Solaris 11.4 TCP](https://docs.oracle.com/cd/E88353_01/html/E37851/tcp-4p.html) - [Solaris 11.4 release notes](https://docs.oracle.com/cd/E37838_01/html/E60973/) Signed-off-by: Andy Pan <i@andypan.me>

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.