执行 AGENTS align-linuxcnc 加速规则
结论:补强 WASM tooldata 可执行探针,依据 LinuxCNC src/emc/tooldata/tooldata_mmap.cc 非随机刀库 T0 查找优先返回 pocket 0 的源行为。验证通过:./test-linuxcnc-wasm-tooldata-link.sh、./test-native.sh、./test-linuxcnc-source-link.sh。
This commit is contained in:
@@ -84,6 +84,35 @@ int main() {
|
||||
return 45;
|
||||
}
|
||||
|
||||
const pid_t nonrandom_t0_child = fork();
|
||||
if (nonrandom_t0_child < 0) {
|
||||
return 64;
|
||||
}
|
||||
if (nonrandom_t0_child == 0) {
|
||||
if (tool_mmap_creator(nullptr, 0) != 0) {
|
||||
_exit(65);
|
||||
}
|
||||
CANON_TOOL_TABLE nonrandom_t0 = tooldata_entry_init();
|
||||
nonrandom_t0.toolno = 0;
|
||||
nonrandom_t0.pocketno = 12;
|
||||
if (tooldata_put(nonrandom_t0, 12) == IDX_FAIL) {
|
||||
_exit(66);
|
||||
}
|
||||
// LinuxCNC src/emc/tooldata/tooldata_mmap.cc returns pocket 0 for T0
|
||||
// before scanning table entries when the toolchanger is not random.
|
||||
if (tooldata_find_index_for_tool(0) != 0) {
|
||||
_exit(67);
|
||||
}
|
||||
_exit(0);
|
||||
}
|
||||
int nonrandom_t0_status = 0;
|
||||
if (waitpid(nonrandom_t0_child, &nonrandom_t0_status, 0) != nonrandom_t0_child) {
|
||||
return 68;
|
||||
}
|
||||
if (!WIFEXITED(nonrandom_t0_status) || WEXITSTATUS(nonrandom_t0_status) != 0) {
|
||||
return 69;
|
||||
}
|
||||
|
||||
if (tool_mmap_user() != -1) {
|
||||
return 25;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user