| /tools/testing/selftests/powerpc/ptrace/ |
| D | ptrace-perf-hwbreak.c | 39 static inline long sys_ptrace(long request, pid_t pid, unsigned long addr, unsigned long data) in sys_ptrace() argument 41 return syscall(__NR_ptrace, request, pid, addr, data); in sys_ptrace() 49 static long ptrace_getregs(pid_t pid, struct pt_regs *result) in ptrace_getregs() argument 51 return sys_ptrace(PTRACE_GETREGS, pid, 0, (unsigned long)result); in ptrace_getregs() 54 static long ptrace_setregs(pid_t pid, struct pt_regs *result) in ptrace_setregs() argument 56 return sys_ptrace(PTRACE_SETREGS, pid, 0, (unsigned long)result); in ptrace_setregs() 59 static long ptrace_cont(pid_t pid, long signal) in ptrace_cont() argument 61 return sys_ptrace(PTRACE_CONT, pid, 0, signal); in ptrace_cont() 64 static long ptrace_singlestep(pid_t pid, long signal) in ptrace_singlestep() argument 66 return sys_ptrace(PTRACE_SINGLESTEP, pid, 0, signal); in ptrace_singlestep() [all …]
|
| /tools/testing/selftests/powerpc/signal/ |
| D | sigreturn_kernel.c | 35 pid_t pid; in fork_child() local 37 pid = fork(); in fork_child() 38 if (pid == 0) { in fork_child() 43 return pid; in fork_child() 46 static int expect_segv(pid_t pid) in expect_segv() argument 50 waitpid(pid, &child_ret, 0); in expect_segv() 62 pid_t pid; in test_sigreturn_kernel() local 73 pid = fork_child(); in test_sigreturn_kernel() 74 expect_segv(pid); in test_sigreturn_kernel() 78 pid = fork_child(); in test_sigreturn_kernel() [all …]
|
| /tools/testing/selftests/rlimits/ |
| D | rlimits-per-userns.c | 32 pid_t pid = getpid(); in setrlimit_nproc() local 38 warnx("(pid=%d): Setting RLIMIT_NPROC=%ld", pid, n); in setrlimit_nproc() 41 err(EXIT_FAILURE, "(pid=%d): setrlimit(RLIMIT_NPROC)", pid); in setrlimit_nproc() 46 pid_t pid = fork(); in fork_child() local 48 if (pid < 0) in fork_child() 51 if (pid > 0) in fork_child() 52 return pid; in fork_child() 54 pid = getpid(); in fork_child() 56 warnx("(pid=%d): New process starting ...", pid); in fork_child() 59 err(EXIT_FAILURE, "(pid=%d): prctl(PR_SET_PDEATHSIG)", pid); in fork_child() [all …]
|
| /tools/testing/selftests/bpf/progs/ |
| D | task_kfunc_common.h | 25 struct task_struct *bpf_task_from_pid(s32 pid) __ksym; 31 s32 pid; in tasks_kfunc_map_value_lookup() local 34 status = bpf_probe_read_kernel(&pid, sizeof(pid), &p->pid); in tasks_kfunc_map_value_lookup() 38 return bpf_map_lookup_elem(&__tasks_kfunc_map, &pid); in tasks_kfunc_map_value_lookup() 46 s32 pid; in tasks_kfunc_map_insert() local 48 status = bpf_probe_read_kernel(&pid, sizeof(pid), &p->pid); in tasks_kfunc_map_insert() 53 status = bpf_map_update_elem(&__tasks_kfunc_map, &pid, &local, BPF_NOEXIST); in tasks_kfunc_map_insert() 57 v = bpf_map_lookup_elem(&__tasks_kfunc_map, &pid); in tasks_kfunc_map_insert() 59 bpf_map_delete_elem(&__tasks_kfunc_map, &pid); in tasks_kfunc_map_insert()
|
| D | test_uprobe.c | 18 pid_t pid = bpf_get_current_pid_tgid() >> 32; in BPF_UPROBE() local 20 if (pid != my_pid) in BPF_UPROBE() 30 pid_t pid = bpf_get_current_pid_tgid() >> 32; in BPF_UPROBE() local 32 if (pid != my_pid) in BPF_UPROBE() 42 pid_t pid = bpf_get_current_pid_tgid() >> 32; in BPF_URETPROBE() local 44 if (pid != my_pid) in BPF_URETPROBE() 54 pid_t pid = bpf_get_current_pid_tgid() >> 32; in BPF_UPROBE() local 56 if (pid != my_pid) in BPF_UPROBE()
|
| /tools/perf/scripts/perl/ |
| D | rw-by-pid.pl | 82 foreach my $pid (sort { ($reads{$b}{bytes_read} || 0) <=> 84 my $comm = $reads{$pid}{comm} || ""; 85 my $total_reads = $reads{$pid}{total_reads} || 0; 86 my $bytes_requested = $reads{$pid}{bytes_requested} || 0; 87 my $bytes_read = $reads{$pid}{bytes_read} || 0; 89 printf("%6s %-20s %10s %10s %10s\n", $pid, $comm, 101 foreach my $pid (keys %reads) { 102 foreach my $error (keys %{$reads{$pid}{errors}}) { 103 my $comm = $reads{$pid}{comm} || ""; 104 my $errcount = $reads{$pid}{errors}{$error} || 0; [all …]
|
| /tools/testing/selftests/proc/ |
| D | proc-loadavg-001.c | 27 pid_t pid; in main() local 36 pid = fork(); in main() 37 if (pid == -1) in main() 39 if (pid == 0) { in main() 56 pid = fork(); in main() 57 if (pid == -1) in main() 59 if (pid == 0) in main() 61 if (waitpid(pid, NULL, 0) == -1) in main() 77 if (waitpid(pid, &wstatus, 0) == -1) in main()
|
| D | setns-dcache.c | 36 static pid_t pid = -1; variable 40 if (pid > 0) { in f() 41 kill(pid, SIGTERM); in f() 69 pid = fork(); in main() 70 if (pid == -1) { in main() 74 if (pid == 0) { in main() 94 snprintf(buf, sizeof(buf), "/proc/%u/ns/net", pid); in main() 108 kill(pid, SIGTERM); in main() 109 pid = 0; in main()
|
| D | setns-sysvipc.c | 35 static pid_t pid = -1; variable 39 if (pid > 0) { in f() 40 kill(pid, SIGTERM); in f() 68 pid = fork(); in main() 69 if (pid == -1) { in main() 73 if (pid == 0) { in main() 93 snprintf(buf, sizeof(buf), "/proc/%u/ns/ipc", pid); in main() 107 kill(pid, SIGTERM); in main() 108 pid = 0; in main()
|
| D | proc-tid0.c | 26 static pid_t pid = -1; variable 30 if (pid > 0) { in atexit_hook() 31 kill(pid, SIGKILL); in atexit_hook() 47 pid = fork(); in main() 48 if (pid == 0) { in main() 55 } else if (pid > 0) { in main() 60 snprintf(buf, sizeof(buf), "/proc/%u/task", pid); in main()
|
| D | proc-empty-vm.c | 173 pid_t pid; in vsyscall() local 176 pid = fork(); in vsyscall() 177 if (pid < 0) { in vsyscall() 181 if (pid == 0) { in vsyscall() 206 waitpid(pid, &wstatus, 0); in vsyscall() 216 static int test_proc_pid_maps(pid_t pid) in test_proc_pid_maps() argument 219 snprintf(buf, sizeof(buf), "/proc/%u/maps", pid); in test_proc_pid_maps() 238 static int test_proc_pid_numa_maps(pid_t pid) in test_proc_pid_numa_maps() argument 241 snprintf(buf, sizeof(buf), "/proc/%u/numa_maps", pid); in test_proc_pid_numa_maps() 261 static int test_proc_pid_smaps(pid_t pid) in test_proc_pid_smaps() argument [all …]
|
| /tools/testing/selftests/pid_namespace/ |
| D | regression_enomem.c | 24 pid_t pid; in TEST() local 31 pid = fork(); in TEST() 32 ASSERT_GE(pid, 0); in TEST() 34 if (pid == 0) in TEST() 37 EXPECT_EQ(0, wait_for_pid(pid)); in TEST() 39 pid = fork(); in TEST() 40 ASSERT_LT(pid, 0); in TEST()
|
| /tools/testing/selftests/ptrace/ |
| D | vmaccess.c | 26 int f, pid = fork(); in TEST() local 29 if (!pid) { in TEST() 38 sprintf(mm, "/proc/%d/mem", pid); in TEST() 42 f = kill(pid, SIGCONT); in TEST() 48 int s, k, pid = fork(); in TEST() local 50 if (!pid) { in TEST() 59 k = ptrace(PTRACE_ATTACH, pid, 0L, 0L); in TEST() 65 ASSERT_NE(k, pid); in TEST() 69 k = ptrace(PTRACE_ATTACH, pid, 0L, 0L); in TEST() 72 ASSERT_EQ(k, pid); in TEST() [all …]
|
| D | get_syscall_info.c | 17 kill_tracee(pid_t pid) in kill_tracee() argument 19 if (!pid) in kill_tracee() 24 int rc = kill(pid, SIGKILL); in kill_tracee() 31 sys_ptrace(int request, pid_t pid, unsigned long addr, unsigned long data) in sys_ptrace() argument 33 return syscall(__NR_ptrace, request, pid, addr, data); in sys_ptrace() 38 kill_tracee(pid); \ 77 pid_t pid = fork(); in TEST() local 79 ASSERT_LE(0, pid) { in TEST() 83 if (pid == 0) { in TEST() 85 pid = getpid(); in TEST() [all …]
|
| /tools/bpf/runqslower/ |
| D | runqslower.bpf.c | 30 u32 pid = t->pid; in trace_enqueue() local 33 if (!pid || (targ_pid && targ_pid != pid)) in trace_enqueue() 74 u32 pid; in handle__sched_switch() local 80 pid = next->pid; in handle__sched_switch() 83 if (!pid || (targ_pid && targ_pid != pid)) in handle__sched_switch() 95 event.pid = pid; in handle__sched_switch()
|
| /tools/testing/selftests/powerpc/ |
| D | harness.c | 31 pid_t pid; in run_test() local 36 pid = fork(); in run_test() 37 if (pid == 0) { in run_test() 40 } else if (pid == -1) { in run_test() 45 setpgid(pid, pid); in run_test() 53 rc = waitpid(pid, &status, 0); in run_test() 62 kill(-pid, SIGKILL); in run_test() 66 kill(-pid, SIGTERM); in run_test() 74 kill(-pid, SIGTERM); in run_test()
|
| /tools/testing/selftests/cgroup/ |
| D | cgroup_util.c | 294 int pid = strtol(ptr, &ptr, 10); in cg_killall() local 296 if (pid == 0) in cg_killall() 302 if (kill(pid, SIGKILL)) in cg_killall() 329 int cg_enter(const char *cgroup, int pid) in cg_enter() argument 333 snprintf(pidbuf, sizeof(pidbuf), "%d", pid); in cg_enter() 351 int pid, retcode; in cg_run() local 353 pid = fork(); in cg_run() 354 if (pid < 0) { in cg_run() 355 return pid; in cg_run() 356 } else if (pid == 0) { in cg_run() [all …]
|
| D | test_freezer.c | 59 static int cg_enter_and_wait_for_frozen(const char *cgroup, int pid, in cg_enter_and_wait_for_frozen() argument 69 ret = cg_enter(cgroup, pid); in cg_enter_and_wait_for_frozen() 403 int pid; in test_cgfreezer_mkdir() local 422 pid = cg_run_nowait(child, child_fn, NULL); in test_cgfreezer_mkdir() 423 if (pid < 0) in test_cgfreezer_mkdir() 512 int pid; in test_cgfreezer_migrate() local 528 pid = cg_run_nowait(cgroup[0], child_fn, NULL); in test_cgfreezer_migrate() 529 if (pid < 0) in test_cgfreezer_migrate() 541 if (cg_enter_and_wait_for_frozen(cgroup[1], pid, true)) in test_cgfreezer_migrate() 550 if (cg_enter_and_wait_for_frozen(cgroup[0], pid, false)) in test_cgfreezer_migrate() [all …]
|
| /tools/testing/selftests/clone3/ |
| D | clone3_cap_checkpoint_restore.c | 41 pid_t pid = -1; in call_clone3_set_tid() local 49 pid = sys_clone3(&args, sizeof(args)); in call_clone3_set_tid() 50 if (pid < 0) { in call_clone3_set_tid() 55 if (pid == 0) { in call_clone3_set_tid() 66 TH_LOG("I am the parent (%d). My child's pid is %d", getpid(), pid); in call_clone3_set_tid() 68 if (waitpid(pid, &status, 0) < 0) { in call_clone3_set_tid() 136 pid_t pid; in TEST() local 149 pid = fork(); in TEST() 150 if (pid == 0) { in TEST() 154 ASSERT_GT(waitpid(pid, &status, 0), 0) in TEST() [all …]
|
| D | clone3_set_tid.c | 45 pid_t pid = -1; in call_clone3_set_tid() local 54 pid = sys_clone3(&args, sizeof(args)); in call_clone3_set_tid() 55 if (pid < 0) { in call_clone3_set_tid() 61 if (pid == 0) { in call_clone3_set_tid() 96 if (expected_pid == 0 || expected_pid == pid) { in call_clone3_set_tid() 98 getpid(), pid); in call_clone3_set_tid() 102 expected_pid, pid); in call_clone3_set_tid() 106 if (waitpid(pid, &status, 0) < 0) { in call_clone3_set_tid() 151 pid_t pid, ns1, ns2, ns3, ns_pid; in main() local 270 pid = fork(); in main() [all …]
|
| D | clone3_clear_sighand.c | 23 static int wait_for_pid(pid_t pid) in wait_for_pid() argument 28 ret = waitpid(pid, &status, 0); in wait_for_pid() 45 pid_t pid; in test_clone3_clear_sighand() local 55 pid = sys_clone3(&args, sizeof(args)); in test_clone3_clear_sighand() 56 if (pid > 0) in test_clone3_clear_sighand() 84 pid = sys_clone3(&args, sizeof(args)); in test_clone3_clear_sighand() 85 if (pid < 0) in test_clone3_clear_sighand() 89 if (pid == 0) { in test_clone3_clear_sighand() 107 ret = wait_for_pid(pid); in test_clone3_clear_sighand()
|
| /tools/testing/selftests/powerpc/benchmarks/ |
| D | fork.c | 48 int pid; in start_process_on() local 50 pid = fork(); in start_process_on() 51 if (pid == -1) { in start_process_on() 56 if (pid) in start_process_on() 88 pid_t pid = fork(); in bench_fork() local 89 if (pid == -1) { in bench_fork() 93 if (pid == 0) { in bench_fork() 98 pid = waitpid(pid, NULL, 0); in bench_fork() 99 if (pid == -1) { in bench_fork() 110 pid_t pid = vfork(); in bench_vfork() local [all …]
|
| /tools/testing/selftests/pidfd/ |
| D | pidfd_wait.c | 34 static int sys_waitid(int which, pid_t pid, siginfo_t *info, int options, in sys_waitid() argument 37 return syscall(__NR_waitid, which, pid, info, options, ru); in sys_waitid() 50 pid_t pid; in TEST() local 58 pid = sys_waitid(P_PIDFD, pidfd, &info, WEXITED, NULL); in TEST() 59 ASSERT_NE(pid, 0); in TEST() 66 pid = sys_waitid(P_PIDFD, pidfd, &info, WEXITED, NULL); in TEST() 67 ASSERT_NE(pid, 0); in TEST() 71 pid = sys_clone3(&args); in TEST() 72 ASSERT_GE(pid, 0); in TEST() 74 if (pid == 0) in TEST() [all …]
|
| /tools/testing/selftests/mm/ |
| D | mrelease_test.c | 82 pid_t pid; in main() local 110 pid = fork(); in main() 111 if (pid < 0) { in main() 117 if (pid == 0) { in main() 132 if (!kill(pid, SIGKILL)) in main() 133 waitpid(pid, NULL, 0); in main() 137 pidfd = syscall(__NR_pidfd_open, pid, 0); in main() 139 if (!kill(pid, SIGKILL)) in main() 140 waitpid(pid, NULL, 0); in main() 147 if (kill(pid, SIGKILL)) in main() [all …]
|
| /tools/testing/selftests/breakpoints/ |
| D | breakpoint_test_arm64.c | 81 static bool set_watchpoint(pid_t pid, int size, int wp) in set_watchpoint() argument 98 if (ptrace(PTRACE_SETREGSET, pid, NT_ARM_HW_WATCH, &iov) == 0) in set_watchpoint() 116 pid_t pid = fork(); in run_test() local 119 if (pid < 0) { in run_test() 124 if (pid == 0) in run_test() 127 wpid = waitpid(pid, &status, __WALL); in run_test() 128 if (wpid != pid) { in run_test() 143 if (!set_watchpoint(pid, wp_size, wp)) in run_test() 146 if (ptrace(PTRACE_CONT, pid, NULL, NULL) < 0) { in run_test() 154 wpid = waitpid(pid, &status, __WALL); in run_test() [all …]
|