Skip to content

feat(procfs): improve standard /proc entries and add /proc/uptime#1807

Open
jiuyue486 wants to merge 1 commit intoDragonOS-Community:masterfrom
jiuyue486:feat/procfs-standard-improvements
Open

feat(procfs): improve standard /proc entries and add /proc/uptime#1807
jiuyue486 wants to merge 1 commit intoDragonOS-Community:masterfrom
jiuyue486:feat/procfs-standard-improvements

Conversation

@jiuyue486
Copy link

This PR improves several standard procfs entries in DragonOS.

Changes included:

  • add /proc/uptime
  • improve /proc/meminfo and expose MemAvailable
  • improve /proc/stat and provide btime
  • improve /proc/[pid]/status for stable process-readable output
  • improve /proc/[pid]/stat
  • fix stale /proc/ entries after process reap

Validation:

  • cat /proc/uptime
  • cat /proc/meminfo
  • cat /proc/stat
  • cat /proc/1/status
  • cat /proc/1/stat
  • verify /proc/ disappears after process reap

Closes #1751

@github-actions github-actions bot added the ambiguous The title of PR/issue doesn't match the format label Mar 8, 2026
@jiuyue486 jiuyue486 changed the title improve standard /proc entries and add /proc/uptime feat(procfs): improve standard /proc entries and add /proc/uptime Mar 8, 2026
@github-actions github-actions bot added enhancement New feature or request and removed ambiguous The title of PR/issue doesn't match the format labels Mar 8, 2026
Comment on lines +146 to +149

s.push_str("DragonOS Process Status\n");
s.push_str("=======================\n");

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个行为与Linux不一致。

@fslongjin
Copy link
Member

@claude review

@dragonos-community-ai-pr-reviewer
Copy link

dragonos-community-ai-pr-reviewer bot commented Mar 9, 2026

Claude finished @fslongjin's task in 5m 51s —— View job


PR Review for #1807: feat(procfs): improve standard /proc entries and add /proc/uptime

I'll review the PR changes and provide feedback. Here's my plan:

  • Gather context and examine PR changes
  • Check the existing review comment about inconsistency at kernel/src/filesystem/procfs/pid/status.rs:149
  • Review each changed file for correctness, consistency with Linux behavior, and potential issues
  • Provide comprehensive review feedback
  • Suggest fixes if needed

Review Summary

The existing review comment is correct: line 149 in kernel/src/filesystem/procfs/pid/status.rs contains a separator line that doesn't exist in Linux's /proc/[pid]/status. Beyond this, I've identified several other Linux compatibility issues in the status file implementation.

Key Findings:

  1. /proc/[pid]/status has significant Linux incompatibilities:

    • Header lines "DragonOS Process Status" and separator (lines 147-149)
    • Field format uses "{key:<12}: {value}" instead of Linux's "{key}:\t{value}"
    • Non-standard fields (Kthread, CpuId, Priority, Preempt, Vruntime, ExecRuntime, StartTime, Flags)
    • Missing many standard Linux fields
  2. Other /proc entries are generally good:

    • /proc/meminfo: Format matches Linux, though field set is limited and MemAvailable calculation is simplistic
    • /proc/stat: Good Linux compatibility, includes btime
    • /proc/uptime: Correct format, idle time calculation looks proper
    • PID directory cleanup: Good fixes for stale entries
    • /proc/[pid]/stat: Linux-compatible format with placeholder zeros

Recommendations:

  1. Priority fix: Align /proc/[pid]/status with Linux format. At minimum, remove the non-standard header lines: Fix this →
  2. Consider adopting tab-separated field format and adding missing standard Linux fields over time.
  3. The other changes in this PR are positive improvements that enhance Linux compatibility.

Next Steps:

Would you like me to implement specific fixes for the status file? I can:

  • Remove the header/separator lines (minimal fix)
  • Adjust field formatting to use tabs
  • Begin adding missing Linux-standard fields (this would be a larger effort)

The choice depends on how closely you want to match Linux behavior versus maintaining DragonOS-specific extensions.

@jiuyue486
Copy link
Author

jiuyue486 commented Mar 9, 2026 via email

@github-actions github-actions bot added the Bug fix A bug is fixed in this pull request label Mar 9, 2026
@fslongjin
Copy link
Member

  1. 需要对照Linux 6.6.21的代码来做
  2. 本地下好上述linux代码,让ai参考这个的行为来review
  3. 每个pr功能应该单一,而不是一次改一堆东西
  4. 新增的功能应当在dunitest下面补充单元测试

@jiuyue486
Copy link
Author

jiuyue486 commented Mar 9, 2026 via email

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 enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG REPORT] procfs: 进程退出后 /proc/<pid> 条目未清理

2 participants