Home
last modified time | relevance | path

Searched refs:pidfd (Results 1 – 25 of 32) sorted by relevance

12

/kernel/linux/linux-5.10/tools/testing/selftests/pidfd/
Dpidfd_wait.c42 int pidfd = -1; in TEST() local
46 .pidfd = ptr_to_u64(&pidfd), in TEST()
55 pidfd = open("/proc/self", O_DIRECTORY | O_RDONLY | O_CLOEXEC); in TEST()
56 ASSERT_GE(pidfd, 0); in TEST()
58 pid = sys_waitid(P_PIDFD, pidfd, &info, WEXITED, NULL); in TEST()
60 EXPECT_EQ(close(pidfd), 0); in TEST()
61 pidfd = -1; in TEST()
63 pidfd = open("/dev/null", O_RDONLY | O_CLOEXEC); in TEST()
64 ASSERT_GE(pidfd, 0); in TEST()
66 pid = sys_waitid(P_PIDFD, pidfd, &info, WEXITED, NULL); in TEST()
[all …]
Dpidfd_test.c33 static pid_t pidfd_clone(int flags, int *pidfd, int (*fn)(void *)) in pidfd_clone() argument
39 return __clone2(fn, stack, stack_size, flags | SIGCHLD, NULL, pidfd); in pidfd_clone()
41 return clone(fn, stack + stack_size, flags | SIGCHLD, NULL, pidfd); in pidfd_clone()
59 int pidfd, ret; in test_pidfd_send_signal_simple_success() local
69 pidfd = open("/proc/self", O_DIRECTORY | O_CLOEXEC); in test_pidfd_send_signal_simple_success()
70 if (pidfd < 0) in test_pidfd_send_signal_simple_success()
77 ret = sys_pidfd_send_signal(pidfd, SIGUSR1, NULL, 0); in test_pidfd_send_signal_simple_success()
78 close(pidfd); in test_pidfd_send_signal_simple_success()
94 int pidfd, ret, saved_errno; in test_pidfd_send_signal_exited_fail() local
116 pidfd = open(buf, O_DIRECTORY | O_CLOEXEC); in test_pidfd_send_signal_exited_fail()
[all …]
Dpidfd_open_test.c86 static pid_t get_pid_from_fdinfo_file(int pidfd, const char *key, size_t keylen) in get_pid_from_fdinfo_file() argument
95 snprintf(path, sizeof(path), "/proc/self/fdinfo/%d", pidfd); in get_pid_from_fdinfo_file()
123 int pidfd = -1, ret = 1; in main() local
128 pidfd = sys_pidfd_open(-1, 0); in main()
129 if (pidfd >= 0) { in main()
137 pidfd = sys_pidfd_open(getpid(), 1); in main()
138 if (pidfd >= 0) { in main()
146 pidfd = sys_pidfd_open(getpid(), 0); in main()
147 if (pidfd < 0) { in main()
153 pid = get_pid_from_fdinfo_file(pidfd, "Pid:", sizeof("Pid:") - 1); in main()
[all …]
Dpidfd_poll_test.c48 int pidfd; in main() local
68 pidfd = sys_pidfd_open(child_pid, 0); in main()
69 if (pidfd < 0) in main()
80 if (sys_pidfd_send_signal(pidfd, SIGKILL, NULL, 0)) in main()
85 fds.fd = pidfd; in main()
106 close(pidfd); in main()
Dpidfd_getfd_test.c126 int pidfd; in FIXTURE() local
155 self->pidfd = sys_pidfd_open(self->pid, 0); in FIXTURE_SETUP()
156 ASSERT_GE(self->pidfd, 0); in FIXTURE_SETUP()
168 EXPECT_EQ(0, close(self->pidfd)); in FIXTURE_TEARDOWN()
192 fd = sys_pidfd_getfd(self->pidfd, self->remote_fd, 0); in TEST_F()
204 fd = sys_pidfd_getfd(self->pidfd, self->remote_fd, 0); in TEST_F()
223 fd = sys_pidfd_getfd(self->pidfd, UNKNOWN_FD, 0); in TEST_F()
Dpidfd.h102 static inline int sys_pidfd_send_signal(int pidfd, int sig, siginfo_t *info, in sys_pidfd_send_signal() argument
105 return syscall(__NR_pidfd_send_signal, pidfd, sig, info, flags); in sys_pidfd_send_signal()
108 static inline int sys_pidfd_getfd(int pidfd, int fd, int flags) in sys_pidfd_getfd() argument
110 return syscall(__NR_pidfd_getfd, pidfd, fd, flags); in sys_pidfd_getfd()
Dpidfd_fdinfo_test.c163 static int verify_fdinfo(int pidfd, struct error *err, const char *prefix, in verify_fdinfo() argument
180 snprintf(path, sizeof(path), "/proc/self/fdinfo/%d", pidfd); in verify_fdinfo()
184 pidfd); in verify_fdinfo()
210 prefix, pidfd); in verify_fdinfo()
218 int pidfd; in child_fdinfo_nspid_test() local
242 pidfd = *(int *)args; in child_fdinfo_nspid_test()
243 r = verify_fdinfo(pidfd, &err, "NSpid:", 6, "\t0\n"); in child_fdinfo_nspid_test()
Dpidfd_setns_test.c55 int pidfd; in FIXTURE() local
75 pid_t create_child(int *pidfd, unsigned flags) in create_child() argument
80 .pidfd = ptr_to_u64(pidfd), in create_child()
153 self->pidfd = sys_pidfd_open(self->pid, 0); in FIXTURE_SETUP()
154 EXPECT_GT(self->pidfd, 0) { in FIXTURE_SETUP()
168 self->pidfd = sys_pidfd_open(self->pid, 0); in FIXTURE_SETUP()
169 EXPECT_GE(self->pidfd, 0) { in FIXTURE_SETUP()
345 ASSERT_NE(setns(self->pidfd, 0), 0); in TEST_F()
348 ASSERT_NE(setns(self->pidfd, -1), 0); in TEST_F()
351 ASSERT_NE(setns(self->pidfd, CLONE_VM), 0); in TEST_F()
[all …]
/kernel/linux/linux-5.10/samples/pidfd/
Dpidfd-metadata.c34 static pid_t pidfd_clone(int flags, int *pidfd) in pidfd_clone() argument
40 return __clone2(do_child, stack, stack_size, flags | SIGCHLD, NULL, pidfd); in pidfd_clone()
42 return clone(do_child, stack + stack_size, flags | SIGCHLD, NULL, pidfd); in pidfd_clone()
46 static inline int sys_pidfd_send_signal(int pidfd, int sig, siginfo_t *info, in sys_pidfd_send_signal() argument
49 return syscall(__NR_pidfd_send_signal, pidfd, sig, info, flags); in sys_pidfd_send_signal()
52 static int pidfd_metadata_fd(pid_t pid, int pidfd) in pidfd_metadata_fd() argument
68 ret = sys_pidfd_send_signal(pidfd, 0, NULL, 0); in pidfd_metadata_fd()
86 int pidfd = -1, ret = EXIT_FAILURE; in main() local
92 pid = pidfd_clone(CLONE_PIDFD, &pidfd); in main()
95 if (pidfd == -1) { in main()
[all …]
D.gitignore2 pidfd-metadata
DMakefile2 usertprogs-always-y += pidfd-metadata
/kernel/linux/linux-5.10/tools/testing/selftests/pid_namespace/
DMakefile8 $(OUTPUT)/regression_enomem: regression_enomem.c ../pidfd/pidfd.h
/kernel/linux/linux-5.10/arch/sparc/kernel/
Dprocess.c80 args.pidfd = compat_ptr(regs->u_regs[UREG_I2]); in sparc_clone()
86 args.pidfd = (int __user *)regs->u_regs[UREG_I2]; in sparc_clone()
/kernel/linux/linux-5.10/tools/testing/selftests/clone3/
Dclone3_selftests.h28 __aligned_u64 pidfd; member
/kernel/linux/patches/linux-5.10/prebuilts/usr/include/linux/
Dsched.h53 __aligned_u64 pidfd; member
/kernel/linux/linux-5.10/samples/
DMakefile15 subdir-$(CONFIG_SAMPLE_PIDFD) += pidfd
/kernel/linux/linux-5.10/include/uapi/linux/
Dsched.h94 __aligned_u64 pidfd; member
/kernel/linux/linux-5.10/tools/include/uapi/linux/
Dsched.h94 __aligned_u64 pidfd; member
/kernel/linux/linux-5.10/kernel/
Dfork.c1879 int pidfd = -1, retval; in copy_process() local
2174 pidfd = retval; in copy_process()
2179 put_unused_fd(pidfd); in copy_process()
2185 retval = put_user(pidfd, args->pidfd); in copy_process()
2345 fd_install(pidfd, pidfile); in copy_process()
2366 put_unused_fd(pidfd); in copy_process()
2503 (args->pidfd == args->parent_tid)) in kernel_clone()
2633 .pidfd = parent_tidptr, in SYSCALL_DEFINE5()
2695 .pidfd = u64_to_user_ptr(args.pidfd), in copy_clone_args_from_user()
Dpid.c682 SYSCALL_DEFINE3(pidfd_getfd, int, pidfd, int, fd, in SYSCALL_DEFINE3() argument
693 f = fdget(pidfd); in SYSCALL_DEFINE3()
/kernel/linux/linux-5.10/include/linux/sched/
Dtask.h23 int __user *pidfd; member
/kernel/linux/linux-5.10/arch/h8300/kernel/
Dprocess.c169 kargs.pidfd = (int __user *)parent_tidptr; in sys_clone()
/kernel/linux/linux-5.10/arch/m68k/kernel/
Dprocess.c120 .pidfd = (int __user *)regs->d3, in m68k_clone()
/kernel/linux/linux-5.10/arch/nios2/kernel/
Dprocess.c261 .pidfd = parent_tidptr, in nios2_clone()
/kernel/linux/linux-5.10/arch/x86/kernel/
Dsys_ia32.c246 .pidfd = parent_tidptr, in COMPAT_SYSCALL_DEFINE5()

12