[Bug 227185] write(2) blocksize behaviour on raw devices should be added to manpage

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 14 Jul 2025 17:27:22 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=227185

--- Comment #4 from commit-hook@FreeBSD.org ---
A commit in branch stable/14 references this bug:

URL:
https://cgit.FreeBSD.org/src/commit/?id=137fcd6dbc527807da69bc8bc971917a0aedfc69

commit 137fcd6dbc527807da69bc8bc971917a0aedfc69
Author:     Felix Johnson <felix.the.red@gmail.com>
AuthorDate: 2025-07-03 20:27:22 +0000
Commit:     Alexander Ziaee <ziaee@FreeBSD.org>
CommitDate: 2025-07-14 17:23:30 +0000

    write.2: Add EINVAL to ERRORS

    Since phk rewrote the block layer ~2 decades ago, write(2) can return
    EINVAL when the target is a block device and nbytes, the write size, is
    not a multiple of the sector's block size.

    From the original PR:
    When coming from Linux, people are surprised by the fact
    that write(2) to a device must be aligned to block size.
    Writing a non-aligned block onto a raw device is a case
    where EINVAL is also returned but the manpage does not mention this.

    MFC after:              3 days
    PR:                     227185
    Reported by:            riggs
    Reviewed by:            imp, Pau Amma <pauamma@gundo.com>
    Differential Revision:  https://reviews.freebsd.org/D51138

    (cherry picked from commit bd173a540c0ead4881b0866b721955440e3b96fe)

 lib/libc/sys/write.2 | 3 +++
 1 file changed, 3 insertions(+)

-- 
You are receiving this mail because:
You are on the CC list for the bug.