Conversation
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.
|
/review |
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
|
P1 /proc//fd 仍然只能回调一个 FD Line 313 in e6df61c 建议不要通过单记录 buffer API实现该回调重载。可以继续使用遍历接口,但增加一个包装回调,根据 DataHdr::pid 过滤目标 PID;或者为 DataMap 增加按 PID 和类型遍历全部匹配记录的接口。 |
|
你好,这是对 libdkapture#141 fix(dkapture): honor parsed pid in read(vector, cb) ca 的评审。 本轮为 DKapture 两仓(libdkapture / dkapture-bpf)全部以 fix 开头 open PR 的批量评审,共 17 个;汇总表如下,本 PR 加粗。逐项详评见分隔线下方。
本 PR 评审详情作者: JoeSergen | 规模: +23/-2 | 文件: 1 总体结论: PR 正确解决了 #134 的核心问题(旧代码解析出 pid 后调用 read(dt, cb, ctx) 遍历全部进程),改为经 buffer API 按指定 pid 读取并逐条回调,方向正确。但底层 DataMap::unsafe_find 命中 hash 即复制单条记录返回,导致多记录类型(fd 等)仍只回调一次,PR 描述中"invoke the callback once per DataHdr record"未真正达成;返回值也从字节数漂移为记录数,与文档契约及同文件其他重载不一致。 主要问题:
次要建议:
亮点:
commit message: 符合规范 — fix(dkapture) 作用域正确,说明了改动机(pid 被忽略)与 dsz 防护理由,单一职责。 已有讨论: bot 自动评审(09-11)认为完全合规;成员 xu-lang 于 09-14 提出 P1:/proc//fd 只能回调一个 FD,建议不改走单记录 buffer API,而是继续用遍历接口加按 DataHdr::pid 过滤的包装回调,或为 DataMap 增加按 pid+type 遍历全部匹配记录的接口。经本评审核实该问题成立且当前 head(e6df61c0)尚未修复,是合并前必须解决的阻塞点;返回值语义漂移为本评审新增的增量意见。 |
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 perDataHdrrecord, so/proc/1234/statonly reports pid 1234. Guards against zero/oversizeddsz` to avoid an infinite loop on bad records.