Bug 276937 - read(2) is documented as returning EINVAL on reads above INT_MAX
Summary: read(2) is documented as returning EINVAL on reads above INT_MAX
Status: Closed FIXED
Alias: None
Product: Documentation
Classification: Unclassified
Component: Manual Pages (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Konstantin Belousov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-02-10 08:54 UTC by bugs.freebsd.org
Modified: 2024-02-19 06:53 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description bugs.freebsd.org 2024-02-10 08:54:29 UTC
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.
Comment 1 commit-hook freebsd_committer freebsd_triage 2024-02-10 09:44:21 UTC
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(-)
Comment 2 commit-hook freebsd_committer freebsd_triage 2024-02-14 03:54:11 UTC
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(-)
Comment 3 commit-hook freebsd_committer freebsd_triage 2024-02-14 04:06:16 UTC
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(-)
Comment 4 Mark Linimon freebsd_committer freebsd_triage 2024-02-19 06:53:25 UTC
^Triage: committed and MFCed.