Lines Matching full:pid
6 * PID namespace.
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()
66 ksft_print_msg("I am the child, my PID is %d (expected %d)\n", in call_clone3_set_tid()
96 if (expected_pid == 0 || expected_pid == pid) { in call_clone3_set_tid()
97 ksft_print_msg("I am the parent (%d). My child's pid is %d\n", in call_clone3_set_tid()
98 getpid(), pid); in call_clone3_set_tid()
101 "Expected child pid %d does not match actual pid %d\n", 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
187 * nested PID namespace. in main()
208 * nested PID namespace. in main()
214 /* Try with an invalid PID */ in main()
227 /* Try it in a new PID namespace */ in main()
234 /* Try with a valid PID (1) this should return -EEXIST. */ in main()
237 test_clone3_set_tid("duplicate PID 1", in main()
242 /* Try it in a new PID namespace */ in main()
244 test_clone3_set_tid("duplicate PID 1", in main()
269 /* Find the current active PID */ in main()
270 pid = fork(); in main()
271 if (pid == 0) { in main()
272 ksft_print_msg("Child has PID %d\n", getpid()); in main()
275 if (waitpid(pid, &status, 0) < 0) in main()
276 ksft_exit_fail_msg("Waiting for child %d failed", pid); in main()
278 /* After the child has finished, its PID should be free. */ in main()
279 set_tid[0] = pid; in main()
283 /* This should fail as there is no PID 1 in that namespace */ in main()
288 * Creating a process with PID 1 in the newly created most nested in main()
289 * PID namespace and PID 'pid' in the parent PID namespace. This in main()
293 set_tid[1] = pid; in main()
294 test_clone3_set_tid("create PID 1 in new NS", in main()
295 set_tid, 2, CLONE_NEWPID, 0, pid, 0); in main()
297 ksft_print_msg("unshare PID namespace\n"); in main()
302 set_tid[0] = pid; in main()
304 /* This should fail as there is no PID 1 in that namespace */ in main()
305 test_clone3_set_tid("duplicate PID 1", in main()
308 /* Let's create a PID 1 */ in main()
312 * This and the next test cases check that all pid-s are in main()
321 set_tid[1] = pid; in main()
325 ksft_print_msg("Child in PID namespace has PID %d\n", getpid()); in main()
327 test_clone3_set_tid("create PID 2 in child NS", in main()
332 set_tid[2] = pid; in main()
333 /* This should fail as there is invalid PID at level '1'. */ in main()
339 set_tid[2] = pid; in main()
341 * This should fail as there are not enough active PID in main()
343 * PID namespace. Not yet nested. in main()
345 test_clone3_set_tid("fail due to too few active PID NSs", in main()
350 * something like 'NSpid: pid 42 1'. in main()
352 test_clone3_set_tid("verify that we have 3 PID NSs", in main()
365 snprintf(proc_path, sizeof(proc_path), "/proc/%d/status", pid); in main()
408 ksft_print_msg("Expecting PIDs %d, 42, 1\n", pid); in main()
410 ksft_test_result(ns3 == pid && ns2 == 42 && ns1 == 1, in main()