To take in account only if you are willing to support such old settings :)
Cheers.
From 51d70fa8f86a224d995d0545fb96adf072fee72d Mon Sep 17 00:00:00 2001
From: David Carlier <[email protected]>
Date: Thu, 7 Aug 2025 19:43:39 +0100
Subject: [PATCH] MINOR: sock: update broken accept4 detection for older
hardwares.
Some older ARM embedded settings set errno to EPERM instead of ENOSYS
for missing implementations (e.g. Freescale ARM 2.6.35)
---
src/sock.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/sock.c b/src/sock.c
index 83db74595..621cff59b 100644
--- a/src/sock.c
+++ b/src/sock.c
@@ -88,9 +88,13 @@ struct connection *sock_accept_conn(struct listener *l, int *status)
* the legacy accept() + fcntl().
*/
if (unlikely(accept4_broken) ||
+ /* Albeit it appears it does not make sense to carry on with accept
+ * if we encounter EPERM, some old embedded ARM Linux 2.6.x sets as
+ * such instead of ENOSYS.
+ */
(((cfd = accept4(l->rx.fd, (struct sockaddr*)addr, &laddr,
SOCK_NONBLOCK | (master ? SOCK_CLOEXEC : 0))) == -1) &&
- (errno == ENOSYS || errno == EINVAL || errno == EBADF) &&
+ (errno == ENOSYS || errno == EINVAL || errno == EBADF || errno == EPERM) &&
((accept4_broken = 1))))
#endif
{
--
2.48.1