Lines Matching +full:remote +full:- +full:pid

1 // SPDX-License-Identifier: GPL-2.0
17 sigusr1_received = (int)(long long)i->si_value.sival_ptr; in sigusr1_siginfo_handler()
21 bool signal_thread, bool remote) in test_send_signal_common() argument
26 int err = -1, pmu_fd = -1; in test_send_signal_common()
30 pid_t pid; in test_send_signal_common() local
42 pid = fork(); in test_send_signal_common()
43 if (!ASSERT_GE(pid, 0, "fork")) { in test_send_signal_common()
51 if (pid == 0) { in test_send_signal_common()
53 if (remote) { in test_send_signal_common()
56 ASSERT_NEQ(sigaction(SIGUSR1, &sa, NULL), -1, "sigaction"); in test_send_signal_common()
68 if (!remote) { in test_send_signal_common()
72 ASSERT_OK(setpriority(PRIO_PROCESS, 0, -20), "setpriority"); in test_send_signal_common()
84 if (remote) in test_send_signal_common()
101 if (!remote) in test_send_signal_common()
120 if (remote) { in test_send_signal_common()
124 ASSERT_OK(setpriority(PRIO_PROCESS, 0, -20), "setpriority"); in test_send_signal_common()
130 err = -1; in test_send_signal_common()
134 if (!remote) in test_send_signal_common()
135 pmu_fd = syscall(__NR_perf_event_open, attr, pid, -1 /* cpu */, in test_send_signal_common()
136 -1 /* group id */, 0 /* flags */); in test_send_signal_common()
138 pmu_fd = syscall(__NR_perf_event_open, attr, getpid(), -1 /* cpu */, in test_send_signal_common()
139 -1 /* group id */, 0 /* flags */); in test_send_signal_common()
141 err = -1; in test_send_signal_common()
145 skel->links.send_signal_perf = in test_send_signal_common()
146 bpf_program__attach_perf_event(skel->progs.send_signal_perf, pmu_fd); in test_send_signal_common()
147 if (!ASSERT_OK_PTR(skel->links.send_signal_perf, "attach_perf_event")) in test_send_signal_common()
155 skel->bss->signal_thread = signal_thread; in test_send_signal_common()
156 skel->bss->sig = SIGUSR1; in test_send_signal_common()
157 if (!remote) { in test_send_signal_common()
158 skel->bss->target_pid = 0; in test_send_signal_common()
159 skel->bss->pid = pid; in test_send_signal_common()
161 skel->bss->target_pid = pid; in test_send_signal_common()
162 skel->bss->pid = getpid(); in test_send_signal_common()
169 /* For the remote test, the BPF program is triggered from this in test_send_signal_common()
172 if (remote) { in test_send_signal_common()
183 if (err == -EAGAIN && retry_count++ < 10000) in test_send_signal_common()
190 err = -1; in test_send_signal_common()
204 if (remote) in test_send_signal_common()
212 static void test_send_signal_tracepoint(bool signal_thread, bool remote) in test_send_signal_tracepoint() argument
214 test_send_signal_common(NULL, signal_thread, remote); in test_send_signal_tracepoint()
217 static void test_send_signal_perf(bool signal_thread, bool remote) in test_send_signal_perf() argument
226 test_send_signal_common(&attr, signal_thread, remote); in test_send_signal_perf()
229 static void test_send_signal_nmi(bool signal_thread, bool remote) in test_send_signal_nmi() argument
242 pmu_fd = syscall(__NR_perf_event_open, &attr, 0 /* pid */, in test_send_signal_nmi()
243 -1 /* cpu */, -1 /* group_fd */, 0 /* flags */); in test_send_signal_nmi()
244 if (pmu_fd == -1) { in test_send_signal_nmi()
256 test_send_signal_common(&attr, signal_thread, remote); in test_send_signal_nmi()
274 /* Signal remote thread and thread group */ in test_send_signal()