Detect accept4() on specific versions of various platforms (#294)

This PR has mainly done three things:

1. Enable `accept4()` on DragonFlyBSD
2. Fix the failures of determining the presence of `accept4()` due to
   the missing <sys/param.h> on two OSs: NetBSD, OpenBSD
3. Drop the support of FreeBSD < 10.0 for `valkey`

### References
- [param.h in
DragonFlyBSD](7485684fa5/sys/sys/param.h (L129-L257))
- [param.h in
FreeBSD](https://github.com/freebsd/freebsd-src/blob/main/sys/sys/param.h#L46-L76)
- [param.h in
NetBSD](b5f8d2f930/sys/sys/param.h (L53-L70))
- [param.h in
OpenBSD](d9c286e032/sys/sys/param.h (L40-L45))

---------

Signed-off-by: Andy Pan <i@andypan.me>
This commit is contained in:
Andy Pan 2024-04-25 22:20:40 +08:00 committed by GitHub
parent 52f9291f79
commit 4948d536b9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -30,6 +30,8 @@
#ifndef CONFIG_H
#define CONFIG_H
#include <sys/param.h>
#ifdef __APPLE__
#include <fcntl.h> // for fcntl(fd, F_FULLFSYNC)
#include <AvailabilityMacros.h>
@ -96,9 +98,11 @@
#endif
/* Test for accept4() */
#if defined(__linux__) || defined(OpenBSD5_7) || \
(__FreeBSD__ >= 10 || __FreeBSD_version >= 1000000) || \
(defined(NetBSD8_0) || __NetBSD_Version__ >= 800000000)
#if defined(__linux__) || \
defined(__FreeBSD__) || \
defined(OpenBSD5_7) || \
(defined(__DragonFly__) && __DragonFly_version >= 400305) || \
(defined(__NetBSD__) && (defined(NetBSD8_0) || __NetBSD_Version__ >= 800000000))
#define HAVE_ACCEPT4 1
#endif
@ -316,7 +320,7 @@ void setcpuaffinity(const char *cpulist);
#endif
/* Test for posix_fadvise() */
#if defined(__linux__) || __FreeBSD__ >= 10
#if defined(__linux__) || defined(__FreeBSD__)
#define HAVE_FADVISE
#endif