/linux-6.6.21/tools/testing/selftests/pidfd/ |
D | pidfd_wait.c | 42 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 …]
|
D | pidfd_test.c | 33 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 …]
|
D | pidfd_open_test.c | 86 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 …]
|
D | pidfd_poll_test.c | 48 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()
|
D | pidfd_getfd_test.c | 126 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()
|
D | pidfd.h | 101 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()
|
D | pidfd_fdinfo_test.c | 164 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()
|
D | pidfd_setns_test.c | 55 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-6.6.21/samples/pidfd/ |
D | pidfd-metadata.c | 34 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 | .gitignore | 2 /pidfd-metadata
|
D | Makefile | 2 usertprogs-always-y += pidfd-metadata
|
/linux-6.6.21/tools/testing/selftests/mm/ |
D | mrelease_test.c | 55 static void run_negative_tests(int pidfd) in run_negative_tests() argument 59 if (!syscall(__NR_process_mrelease, pidfd, (unsigned int)-1) || in run_negative_tests() 69 if (!syscall(__NR_process_mrelease, pidfd, 0) || errno != EINVAL) { in run_negative_tests() 89 int pipefd[2], pidfd; in main() local 143 pidfd = syscall(__NR_pidfd_open, pid, 0); in main() 144 if (pidfd < 0) { in main() 152 run_negative_tests(pidfd); in main() 160 success = (syscall(__NR_process_mrelease, pidfd, 0) == 0); in main() 184 close(pidfd); in main()
|
/linux-6.6.21/include/net/ |
D | scm.h | 127 int len, pidfd; in scm_pidfd_recv() local 145 pidfd = pidfd_prepare(scm->pid, 0, &pidfd_file); in scm_pidfd_recv() 147 if (put_cmsg(msg, SOL_SOCKET, SCM_PIDFD, sizeof(int), &pidfd)) { in scm_pidfd_recv() 149 put_unused_fd(pidfd); in scm_pidfd_recv() 157 fd_install(pidfd, pidfd_file); in scm_pidfd_recv()
|
/linux-6.6.21/kernel/ |
D | pid.c | 563 struct task_struct *pidfd_get_task(int pidfd, unsigned int *flags) in pidfd_get_task() argument 569 pid = pidfd_get_pid(pidfd, &f_flags); in pidfd_get_task() 600 int pidfd; in pidfd_create() local 603 pidfd = pidfd_prepare(pid, flags, &pidfd_file); in pidfd_create() 604 if (pidfd < 0) in pidfd_create() 605 return pidfd; in pidfd_create() 607 fd_install(pidfd, pidfd_file); in pidfd_create() 608 return pidfd; in pidfd_create() 725 SYSCALL_DEFINE3(pidfd_getfd, int, pidfd, int, fd, in SYSCALL_DEFINE3() argument 736 f = fdget(pidfd); in SYSCALL_DEFINE3()
|
D | fork.c | 2131 int pidfd; in __pidfd_prepare() local 2137 pidfd = get_unused_fd_flags(O_RDWR | O_CLOEXEC); in __pidfd_prepare() 2138 if (pidfd < 0) in __pidfd_prepare() 2139 return pidfd; in __pidfd_prepare() 2144 put_unused_fd(pidfd); in __pidfd_prepare() 2149 return pidfd; in __pidfd_prepare() 2246 int pidfd = -1, retval; in copy_process() local 2535 pidfd = retval; in copy_process() 2537 retval = put_user(pidfd, args->pidfd); in copy_process() 2722 fd_install(pidfd, pidfile); in copy_process() [all …]
|
/linux-6.6.21/tools/testing/selftests/net/af_unix/ |
D | scm_pidfd.c | 94 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-6.6.21/tools/testing/selftests/pid_namespace/ |
D | Makefile | 6 LOCAL_HDRS += $(selfdir)/pidfd/pidfd.h
|
/linux-6.6.21/tools/testing/selftests/cgroup/ |
D | Makefile | 18 LOCAL_HDRS += $(selfdir)/clone3/clone3_selftests.h $(selfdir)/pidfd/pidfd.h
|
/linux-6.6.21/arch/sparc/kernel/ |
D | process.c | 80 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-6.6.21/fs/notify/fanotify/ |
D | fanotify_user.c | 513 static int copy_pidfd_info_to_user(int pidfd, in copy_pidfd_info_to_user() argument 525 info.pidfd = pidfd; in copy_pidfd_info_to_user() 535 unsigned int info_mode, int pidfd, in copy_info_records_to_user() argument 636 ret = copy_pidfd_info_to_user(pidfd, buf, count); in copy_info_records_to_user() 667 int ret, pidfd = FAN_NOPIDFD, fd = FAN_NOFD; in copy_event_to_user() local 719 pidfd = FAN_NOPIDFD; in copy_event_to_user() 721 pidfd = pidfd_prepare(event->pid, 0, &pidfd_file); in copy_event_to_user() 722 if (pidfd < 0) in copy_event_to_user() 723 pidfd = FAN_EPIDFD; in copy_event_to_user() 745 ret = copy_info_records_to_user(event, info, info_mode, pidfd, in copy_event_to_user() [all …]
|
/linux-6.6.21/tools/testing/selftests/clone3/ |
D | clone3_selftests.h | 28 __aligned_u64 pidfd; member
|
/linux-6.6.21/include/uapi/linux/ |
D | sched.h | 94 __aligned_u64 pidfd; member
|
D | fanotify.h | 182 __s32 pidfd; member
|
/linux-6.6.21/tools/include/uapi/linux/ |
D | sched.h | 94 __aligned_u64 pidfd; member
|
/linux-6.6.21/samples/ |
D | Makefile | 17 subdir-$(CONFIG_SAMPLE_PIDFD) += pidfd
|