Skip to content

fix(procfs): align statfs metadata with linux - #2716

Merged
fslongjin merged 2 commits into
DragonOS-Community:masterfrom
Loystus:fix/procfs-statfs
Nov 27, 2026
Merged

fslongjin merged 2 commits into
DragonOS-Community:masterfrom
Loystus:fix/procfs-statfs

Conversation

@Loystus

@Loystus Loystus commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Fixes #2620

BusyBox 在 DragonOS 上执行 stat -f -c '%t|%s|%S|%l' /proc 时,输出 9fa0|512|512|64,Linux x86_64 对照组输出 9fa0|4096|4096|255。strace 显示,修复前系统调用返回的 f_frsize 实际为 0。

此修改让 procfs 的块大小取架构页大小,基本块大小取相同值,文件名长度上限复用 VFS 的 NAME_MAX。

新增 user/apps/c_unitest/test_procfs_statfs.c,对 /proc、/proc/self 和 /proc/uptime 分别调用 statfs 和 fstatfs,检查文件系统类型、块大小、基本块大小和文件名长度上限。现有 Makefile 自动构建该测试。

验证

  • 内核编译、Rust 格式检查和补丁检查通过。
  • 同一个静态回归程序在 Linux 上通过,在旧 DragonOS 内核上检出 18 项字段差异、返回 1,在最终修复提交上通过全部 24 项检查、返回 0。
  • 修复后,BusyBox 在 /proc 和 /proc/uptime 上均输出 9fa0|4096|4096|255。
  • ext4 对照输出为 ef53|4096|4096|255。
  • strace 确认修复后返回 f_bsize=4096、f_frsize=4096、f_namelen=255。

@github-actions github-actions Bot added the Bug fix A bug is fixed in this pull request label Nov 25, 2026
Signed-off-by: longjin <longjin@dragonos.org>
@fslongjin
fslongjin merged commit d83e821 into DragonOS-Community:master Nov 27, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug fix A bug is fixed in this pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG REPORT] procfs: statfs reports different block sizes and name limit for /proc

2 participants