Skip to content

fix(dkapture): honor parsed pid in read(vector<path>, cb) callback mode - #141

Open
JoeSergen wants to merge 1 commit into
DKapture:mainfrom
JoeSergen:fix/dkapture-paths-callback-pid
Open

fix(dkapture): honor parsed pid in read(vector<path>, cb) callback mode#141
JoeSergen wants to merge 1 commit into
DKapture:mainfrom
JoeSergen:fix/dkapture-paths-callback-pid

Conversation

@JoeSergen

Copy link
Copy Markdown

Fixes #134

ead(std::vector<const char*>&, DKCallback, void*)parsed the pid out of each/proc//path but then ignored it and calledread(dt, cb, ctx), which iterates ALL processes. Read the specific process' data via the buffer API and invoke the callback once per DataHdrrecord, so/proc/1234/statonly reports pid 1234. Guards against zero/oversizeddsz` to avoid an infinite loop on bad records.

The overload read(std::vector<const char*>&, DKCallback, void*) parsed
the pid out of each /proc/<pid>/<node> path but then ignored it and
called read(dt, cb, ctx), which iterates ALL processes. Read the
specific process' data via the buffer API and invoke the callback once
per DataHdr record, so /proc/1234/stat only reports pid 1234. Guard
against zero/oversized dsz to avoid an infinite loop on bad records.
@xu-lang

xu-lang commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

/review

@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

134 - Partially compliant

Compliant requirements:

  • 解析出的 pid 现通过 read(dt, pid, buf, bsz) 正确使用
  • 按 DataHdr 记录逐条回调
  • 添加了 cb 空指针检查,返回 -EINVAL
  • 添加了 dsz 零值/越界守卫,防止无限循环
  • 行为与 buffer 版本一致

Non-compliant requirements:

Requires further human verification:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ No major issues detected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: dkapture::read(paths, cb, ctx) 忽略解析出的 pid,返回所有进程数据

2 participants