The man page for read(2) says: > [EINVAL] The value nbytes is greater than INT_MAX. the man page for write(2) says: > [EINVAL] The value nbytes is greater than SSIZE_MAX (or greater than INT_MAX, if the sysctl debug.iosize_max_clamp is non-zero). Experimentally, it looks like the behaviour of read(2) is identical to that of write(2) (though I have not cared to try setting the sysctl). I assume when IO limitations were relaxed and the sysctl was added, man read(2) was missed and never updated.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=3e9515846f8cbff0ecccaab65d9f70890d04429e commit 3e9515846f8cbff0ecccaab65d9f70890d04429e Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2024-02-10 09:40:07 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2024-02-10 09:43:29 +0000 read.2: Describe debug.iosize_max_clamp same as it is done for write.2. PR: 276937 Reported by: bugs.freebsd.org@masklinn.net Sponsored by: The FreeBSD Foundation MFC after: 1 week lib/libsys/read.2 | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)
A commit in branch stable/14 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=16b1438c7371d31daa95595957330d97bc343405 commit 16b1438c7371d31daa95595957330d97bc343405 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2024-02-10 09:40:07 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2024-02-14 03:41:54 +0000 read.2: Describe debug.iosize_max_clamp PR: 276937 (cherry picked from commit 3e9515846f8cbff0ecccaab65d9f70890d04429e) lib/libc/sys/read.2 | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=42667ceb9d0026f7d1e5f95297b942af576cd929 commit 42667ceb9d0026f7d1e5f95297b942af576cd929 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2024-02-10 09:40:07 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2024-02-14 03:54:00 +0000 read.2: Describe debug.iosize_max_clamp PR: 276937 (cherry picked from commit 3e9515846f8cbff0ecccaab65d9f70890d04429e) lib/libc/sys/read.2 | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
^Triage: committed and MFCed.