Lines Matching defs:child
28 struct child {
33 static void release_child(struct child *child)
37 if (!child)
39 close(child->go[1]);
40 close(child->go[0]);
41 if (child->pid > 0)
42 waitpid(child->pid, &child_status, 0);
45 static void kick_child(struct child *child)
49 if (child) {
50 write(child->go[1], &c, 1);
51 release_child(child);
56 static struct child *spawn_child(void)
58 static struct child child;
62 /* pipe to notify child to execute the trigger functions */
63 if (pipe(child.go))
66 child.pid = fork();
67 if (child.pid < 0) {
68 release_child(&child);
73 /* child */
74 if (child.pid == 0) {
75 close(child.go[1]);
78 err = read(child.go[0], &c, 1);
89 return &child;
92 static void uprobe_multi_test_run(struct uprobe_multi *skel, struct child *child)
102 * because the probe should be executed only by child->pid
105 skel->bss->pid = child ? 0 : getpid();
107 if (child)
108 kick_child(child);
129 if (child)
130 ASSERT_EQ(skel->bss->child_pid, child->pid, "uprobe_multi_child_pid");
154 struct child *child)
156 pid_t pid = child ? child->pid : -1;
193 uprobe_multi_test_run(skel, child);
202 struct child *child;
208 child = spawn_child();
209 if (!ASSERT_OK_PTR(child, "spawn_child"))
212 __test_attach_api(binary, pattern, opts, child);
408 static void __test_link_api(struct child *child)
430 opts.uprobe_multi.pid = child ? child->pid : 0;
467 uprobe_multi_test_run(skel, child);
487 struct child *child;
493 child = spawn_child();
494 if (!ASSERT_OK_PTR(child, "spawn_child"))
497 __test_link_api(child);