From a1f57c1f0a26d6df04681eb42f468b70cf69705b Mon Sep 17 00:00:00 2001 From: Johnathan Corgan Date: Sat, 22 Aug 2026 14:53:47 +0100 Subject: [PATCH] Correct what the changelog says the native API uses on FreeBSD The entry said the listener uses SOCK_SEQPACKET on Linux and FreeBSD. That was true when it was written and is not true now: FreeBSD accepts the constant and returns something that is not an atomic-record socket, so it takes SOCK_DGRAM alongside macOS, for a different reason and with the same effect. The entry now says which kernel does what and that both facts were measured on the image rather than inferred. --- CHANGELOG.md | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eac2231f..0c15c687 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -78,15 +78,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 counterpart in Berkeley sockets and a client author must know it: the v1 wire carries no half-close, so nothing peer-driven ever closes a flow, and a server written to read until the flow ends waits for a signal that cannot - arrive. The listener uses `SOCK_SEQPACKET` on Linux and FreeBSD and - `SOCK_DGRAM` on macOS, which does not implement `SOCK_SEQPACKET` for - `AF_UNIX`; both keep the message boundaries the API's contract with its - clients rests on. The two kernels signal a closed peer differently and were - measured rather than reasoned about, so the receive path treats a Darwin - `ECONNRESET` as end of file alongside the `POLLHUP` and zero-byte read that - Linux gives. `EAGAIN` is deliberately not in that company: it means the - socket is empty and the peer alive, so it stays an error and the caller - waits again. + arrive. The listener uses `SOCK_SEQPACKET` on Linux and `SOCK_DGRAM` on macOS + and FreeBSD; both keep the message boundaries the API's contract with its + clients rests on. macOS does not implement `SOCK_SEQPACKET` for `AF_UNIX` at + all. FreeBSD accepts the constant and returns a socket that is not an + atomic-record socket, so consecutive messages coalesce and a zero-length + message is dropped rather than delivered; both were measured on the FreeBSD + 15.1 image rather than reasoned about. The three kernels signal a closed + peer differently and were measured too, so the receive path treats a Darwin + or FreeBSD `ECONNRESET` as end of file alongside the `POLLHUP` and + zero-byte read that Linux gives. `EAGAIN` is deliberately not in that + company: it means the socket is empty and the peer alive, so it stays an + error and the caller waits again. #### OpenWrt mesh