From nobody Wed Aug 19 14:47:19 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4hQ8YT0w6yz6p7qk for ; Wed, 19 Aug 2026 14:47:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hQ8YT0MTXz3shG for ; Wed, 19 Aug 2026 14:47:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1787150845; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vTFyHncI6rs4FnWxV6+JZxxx/h4L0bsFGcBAzqMkbgs=; b=VSHM8AxLgiwLAL+sqkZI56h0A00qxhF6QkhQXEwppIAmt6Nf921YXMohUXugqj7YIEJfyr 0DDzp3GRWj9gDFpJ2ZbVPkpRNy2ywrfRiztKVInjA78Dxa9eKSaV3zeKpaW0howxXIs6rf 6q9KU2uqBxesQ4Dp+5zRvMuD52W2L+boq8rO8kfJ0NrY3wnenAUz+2fwRJOUx1zmG7fnkf yU0JiUXiA3MGSqbv1Ds4oZX8NrEBsx8f4kSyueRoBaVunGuYRWxlMfs7Vi3ssBObKaE5rF VsFE3Qw/OtuyHcMOpNqizBaw2dTnodzmkPbEuJNu3kCuclJFix3NgkqL9NuR/w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1787150845; a=rsa-sha256; cv=none; b=ERdW80LENgvLuTjrh+M6iYG2H5eZkwb7Qp2rRAmZ2AwbBTg1E5b/C9s5nTaKD0eETQQVEs Zup1ZVxOVk1nK9G2V17Gg8OJwqZiN6nYf5ujltostcygl69rWDBTKOj3tyoB/6pnHle92+ PKFm5Yl+C8rAXZf6psPhX2gw0/siKtxPVmzO18jPppcRXouVNfX1LBIC8HSW1gt8EbYnWd ML25jiMoKewi90QcFlZxoy9BKiKrt2EQtRI5yPpvQlOaqrrYGDsn5vpKWyQ1ojM/oD/dRu CW1fjNUg9dzAVQkquopcu5TMyc8Y5eG8ecRe73qtENDevcY6FroRFplI35cjdg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1787150845; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vTFyHncI6rs4FnWxV6+JZxxx/h4L0bsFGcBAzqMkbgs=; b=wuDCeg1gB+FmsgJ+agBHOdjuKnW+ihUgiR8K96Sp2jeD/PNgQUiyiWGg/vqtV5uq0s0zaD j9SxvUAFZz/yNnqb+wnxXlZOwrp458IF1cYcbS18womlLs2amEQgTD025iL9agCGawsq0V qM1enkaeLwjgQybSnnmGDJLnvgpBmkPPPclvrQbKXGV4M+aDNC+ddzxdff7ELD9Q8qq/09 KhOl5Qmgx7SukkKyvovrsP1/TZoc7/9AVey0Wv0aRCbnphmvbS0ndlxE/mz4+WBxU3WE7R s2fal4ZDkX9+BNo/vK+8OkCAEGdo4lFRcuq/av152OXL5gTS0K1dXtKtNm92/Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hQ8YS5VQ5zbxG for ; Wed, 19 Aug 2026 14:47:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3119d by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 19 Aug 2026 14:47:19 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 3a1bf59d195c - main - shmfd: consistently return size in 512 byte blocks for fstat(2) st_blocks List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3a1bf59d195ced99c0f69774969d7090d21f6097 Auto-Submitted: auto-generated Date: Wed, 19 Aug 2026 14:47:19 +0000 Message-Id: <6a85c1f7.3119d.64f40c1e@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=3a1bf59d195ced99c0f69774969d7090d21f6097 commit 3a1bf59d195ced99c0f69774969d7090d21f6097 Author: Konstantin Belousov AuthorDate: 2026-08-19 02:27:46 +0000 Commit: Konstantin Belousov CommitDate: 2026-08-19 14:46:34 +0000 shmfd: consistently return size in 512 byte blocks for fstat(2) st_blocks This is ABI-breaking change that could be considered as the bug fix. Requested by: David Timber Reviewed by: emaste, markj Sponsored by: The FreeBSD Foundation Relnotes: yes MFC after: 1 week Differential revision: https://reviews.freebsd.org/D58942 --- lib/libsys/stat.2 | 8 ++++++-- sys/kern/uipc_shm.c | 8 ++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/libsys/stat.2 b/lib/libsys/stat.2 index c16af32a340d..bbec876da1fd 100644 --- a/lib/libsys/stat.2 +++ b/lib/libsys/stat.2 @@ -271,10 +271,14 @@ be zero. .Pp For file descriptors referencing specific non-file objects, the field is type-specific. +.Pp For POSIX shared memory segments .Pq see Xr shm_open 2 , -the block size is equal to -the platform page size +the block size is 512 bytes. +For older versions of +.Fx +.Pq before 15.2 and 16.0 +the block size was equal to the platform page size .Pq Xr getpagesize 2 . .El .Pp diff --git a/sys/kern/uipc_shm.c b/sys/kern/uipc_shm.c index 8341364f4d16..04b6f4f6e07a 100644 --- a/sys/kern/uipc_shm.c +++ b/sys/kern/uipc_shm.c @@ -658,12 +658,8 @@ shm_stat(struct file *fp, struct stat *sb, struct ucred *active_cred) sb->st_dev = shm_dev_ino; sb->st_ino = shmfd->shm_ino; sb->st_nlink = shmfd->shm_object->ref_count; - if (shm_largepage(shmfd)) { - sb->st_blocks = shmfd->shm_object->size / - (pagesizes[shmfd->shm_lp_psind] >> PAGE_SHIFT); - } else { - sb->st_blocks = shmfd->shm_pages; - } + sb->st_blocks = ptoa(shm_largepage(shmfd) ? shmfd->shm_object->size : + shmfd->shm_pages) / DEV_BSIZE; return (0); }