accept4NonBlocking

private fnint accept4NonBlocking(int srv, void * addr, uint * alen) @trusted nothrow @nogc

Accept a new client socket with SOCK_NONBLOCK | SOCK_CLOEXEC atomically.

On Linux and FreeBSD this is a single accept4(2) syscall, replacing the previous accept() + two fcntl() calls. On other POSIX platforms (notably macOS) accept4 is unavailable and the helper falls back to accept() — the caller is then responsible for setNonBlocking().

Parameters

srvListening socket file descriptor.
addrOutput buffer for the peer address (sockaddr_storage).
alenIn/out length of the address buffer.

Returns

The new client fd, or -1 with errno set.