Home
last modified time | relevance | path

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

12

/linux/tools/testing/selftests/pidfd/
H A Dpidfd_wait.c42 int pidfd = -1; in TEST() local
46 .pidfd = ptr_to_u64(&pidfd), in TEST()
56 ASSERT_GE(pidfd, 0); in TEST()
61 pidfd = -1; in TEST()
64 ASSERT_GE(pidfd, 0); in TEST()
69 pidfd = -1; in TEST()
90 int pidfd = -1; in TEST() local
94 .pidfd = ptr_to_u64(&pidfd), in TEST()
151 int pidfd; in TEST() local
170 EXPECT_GE(pidfd, 0) { in TEST()
[all …]
H A Dpidfd_test.c59 int pidfd, ret; in test_pidfd_send_signal_simple_success() local
70 if (pidfd < 0) in test_pidfd_send_signal_simple_success()
78 close(pidfd); in test_pidfd_send_signal_simple_success()
121 if (pidfd < 0) in test_pidfd_send_signal_exited_fail()
128 close(pidfd); in test_pidfd_send_signal_exited_fail()
236 close(pidfd); in test_pidfd_send_signal_recycled_pid_fail()
240 if (pidfd < 0) in test_pidfd_send_signal_recycled_pid_fail()
357 if (pidfd < 0) in test_pidfd_send_signal_syscall_support()
375 close(pidfd); in test_pidfd_send_signal_syscall_support()
473 close(pidfd); in test_pidfd_poll_exec()
[all …]
H A Dpidfd_open_test.c95 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()
159 if (pidfd >= 0) in main()
[all …]
H A 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()
H A Dpidfd_getfd_test.c127 int pidfd; in FIXTURE() local
157 self->pidfd = sys_pidfd_open(self->pid, 0); in FIXTURE_SETUP()
158 ASSERT_GE(self->pidfd, 0); in FIXTURE_SETUP()
172 EXPECT_EQ(0, close(self->pidfd)); in FIXTURE_TEARDOWN()
198 fd = sys_pidfd_getfd(self->pidfd, self->remote_fd, 0); in TEST_F()
210 fd = sys_pidfd_getfd(self->pidfd, self->remote_fd, 0); in TEST_F()
229 fd = sys_pidfd_getfd(self->pidfd, UNKNOWN_FD, 0); in TEST_F()
250 fds.fd = self->pidfd; in TEST_F()
263 EXPECT_EQ(sys_pidfd_getfd(self->pidfd, self->remote_fd, 0), -1); in TEST_F()
H A Dpidfd.h101 static inline int sys_pidfd_send_signal(int pidfd, int sig, siginfo_t *info, in sys_pidfd_send_signal() argument
104 return syscall(__NR_pidfd_send_signal, pidfd, sig, info, flags); in sys_pidfd_send_signal()
107 static inline int sys_pidfd_getfd(int pidfd, int fd, int flags) in sys_pidfd_getfd() argument
109 return syscall(__NR_pidfd_getfd, pidfd, fd, flags); in sys_pidfd_getfd()
H A Dpidfd_fdinfo_test.c164 static int verify_fdinfo(int pidfd, struct error *err, const char *prefix, in verify_fdinfo() argument
181 snprintf(path, sizeof(path), "/proc/self/fdinfo/%d", pidfd); in verify_fdinfo()
185 pidfd); in verify_fdinfo()
211 prefix, pidfd); in verify_fdinfo()
219 int pidfd; in child_fdinfo_nspid_test() local
243 pidfd = *(int *)args; in child_fdinfo_nspid_test()
244 r = verify_fdinfo(pidfd, &err, "NSpid:", 6, "\t0\n"); in child_fdinfo_nspid_test()
H A 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 …]
/linux/samples/pidfd/
H A 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()
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()
100 procfd = pidfd_metadata_fd(pid, pidfd); in main()
[all …]
H A D.gitignore2 /pidfd-metadata
H A DMakefile2 usertprogs-always-y += pidfd-metadata
/linux/tools/testing/selftests/mm/
H A Dmrelease_test.c51 static void run_negative_tests(int pidfd) in run_negative_tests() argument
54 if (!syscall(__NR_process_mrelease, pidfd, (unsigned int)-1) || in run_negative_tests()
62 if (!syscall(__NR_process_mrelease, pidfd, 0) || errno != EINVAL) in run_negative_tests()
79 int pipefd[2], pidfd; in main() local
137 pidfd = syscall(__NR_pidfd_open, pid, 0); in main()
138 if (pidfd < 0) { in main()
145 run_negative_tests(pidfd); in main()
150 success = (syscall(__NR_process_mrelease, pidfd, 0) == 0); in main()
171 close(pidfd); in main()
/linux/include/net/
H A Dscm.h139 int len, pidfd; in scm_pidfd_recv() local
157 pidfd = pidfd_prepare(scm->pid, 0, &pidfd_file); in scm_pidfd_recv()
159 if (put_cmsg(msg, SOL_SOCKET, SCM_PIDFD, sizeof(int), &pidfd)) { in scm_pidfd_recv()
161 put_unused_fd(pidfd); in scm_pidfd_recv()
169 fd_install(pidfd, pidfd_file); in scm_pidfd_recv()
/linux/tools/testing/selftests/net/af_unix/
H A Dscm_pidfd.c94 static pid_t get_pid_from_fdinfo_file(int pidfd, const char *key, size_t keylen) in get_pid_from_fdinfo_file() argument
103 snprintf(path, sizeof(path), "/proc/self/fdinfo/%d", pidfd); in get_pid_from_fdinfo_file()
138 int *pidfd = NULL; in cmsg_check() local
165 if (cmsg->cmsg_len < sizeof(*pidfd)) { in cmsg_check()
170 pidfd = (void *)CMSG_DATA(cmsg); in cmsg_check()
190 if (!pidfd) { in cmsg_check()
202 get_pid_from_fdinfo_file(*pidfd, "Pid:", sizeof("Pid:") - 1); in cmsg_check()
/linux/tools/testing/selftests/pid_namespace/
H A DMakefile6 LOCAL_HDRS += $(selfdir)/pidfd/pidfd.h
/linux/kernel/
H A Dpid.c568 struct task_struct *pidfd_get_task(int pidfd, unsigned int *flags) in pidfd_get_task() argument
574 pid = pidfd_get_pid(pidfd, &f_flags); in pidfd_get_task()
605 int pidfd; in pidfd_create() local
608 pidfd = pidfd_prepare(pid, flags, &pidfd_file); in pidfd_create()
609 if (pidfd < 0) in pidfd_create()
610 return pidfd; in pidfd_create()
612 fd_install(pidfd, pidfd_file); in pidfd_create()
613 return pidfd; in pidfd_create()
746 SYSCALL_DEFINE3(pidfd_getfd, int, pidfd, int, fd, in SYSCALL_DEFINE3() argument
757 f = fdget(pidfd); in SYSCALL_DEFINE3()
H A Dfork.c2022 int pidfd; in __pidfd_prepare() local
2026 if (pidfd < 0) in __pidfd_prepare()
2027 return pidfd; in __pidfd_prepare()
2031 put_unused_fd(pidfd); in __pidfd_prepare()
2040 return pidfd; in __pidfd_prepare()
2140 int pidfd = -1, retval; in copy_process() local
2426 pidfd = retval; in copy_process()
2428 retval = put_user(pidfd, args->pidfd); in copy_process()
2633 put_unused_fd(pidfd); in copy_process()
2932 .pidfd = parent_tidptr, in SYSCALL_DEFINE5()
[all …]
/linux/tools/testing/selftests/cgroup/
H A DMakefile19 LOCAL_HDRS += $(selfdir)/clone3/clone3_selftests.h $(selfdir)/pidfd/pidfd.h
/linux/arch/sparc/kernel/
H A 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()
/linux/fs/notify/fanotify/
H A Dfanotify_user.c512 static int copy_pidfd_info_to_user(int pidfd, in copy_pidfd_info_to_user() argument
524 info.pidfd = pidfd; in copy_pidfd_info_to_user()
534 unsigned int info_mode, int pidfd, in copy_info_records_to_user() argument
635 ret = copy_pidfd_info_to_user(pidfd, buf, count); in copy_info_records_to_user()
666 int ret, pidfd = FAN_NOPIDFD, fd = FAN_NOFD; in copy_event_to_user() local
718 pidfd = FAN_NOPIDFD; in copy_event_to_user()
721 if (pidfd < 0) in copy_event_to_user()
722 pidfd = FAN_EPIDFD; in copy_event_to_user()
754 fd_install(pidfd, pidfd_file); in copy_event_to_user()
764 if (pidfd >= 0) { in copy_event_to_user()
[all …]
/linux/tools/testing/selftests/clone3/
H A Dclone3_selftests.h24 __aligned_u64 pidfd; member
/linux/include/uapi/linux/
H A Dsched.h94 __aligned_u64 pidfd; member
H A Dfanotify.h182 __s32 pidfd; member
/linux/tools/include/uapi/linux/
H A Dsched.h94 __aligned_u64 pidfd; member
/linux/samples/
H A DMakefile18 subdir-$(CONFIG_SAMPLE_PIDFD) += pidfd

12