/linux-master/tools/testing/selftests/pid_namespace/ |
H A D | Makefile | 6 LOCAL_HDRS += $(selfdir)/pidfd/pidfd.h
|
/linux-master/samples/pidfd/ |
H A D | Makefile | 2 usertprogs-always-y += pidfd-metadata
|
H A D | pidfd-metadata.c | 34 static pid_t pidfd_clone(int flags, int *pidfd) argument 40 return __clone2(do_child, stack, stack_size, flags | SIGCHLD, NULL, pidfd); 42 return clone(do_child, stack + stack_size, flags | SIGCHLD, NULL, pidfd); 46 static inline int sys_pidfd_send_signal(int pidfd, int sig, siginfo_t *info, argument 49 return syscall(__NR_pidfd_send_signal, pidfd, sig, info, flags); 52 static int pidfd_metadata_fd(pid_t pid, int pidfd) argument 68 ret = sys_pidfd_send_signal(pidfd, 0, NULL, 0); 86 int pidfd = -1, ret = EXIT_FAILURE; local 92 pid = pidfd_clone(CLONE_PIDFD, &pidfd); 95 if (pidfd [all...] |
/linux-master/tools/testing/selftests/pidfd/ |
H A D | pidfd_wait.c | 19 #include "pidfd.h" 42 int pidfd = -1; local 46 .pidfd = ptr_to_u64(&pidfd), 55 pidfd = open("/proc/self", O_DIRECTORY | O_RDONLY | O_CLOEXEC); 56 ASSERT_GE(pidfd, 0); 58 pid = sys_waitid(P_PIDFD, pidfd, &info, WEXITED, NULL); 60 EXPECT_EQ(close(pidfd), 0); 61 pidfd = -1; 63 pidfd 90 int pidfd = -1; local 151 int pidfd; local [all...] |
H A D | pidfd_open_test.c | 21 #include "pidfd.h" 86 static pid_t get_pid_from_fdinfo_file(int pidfd, const char *key, size_t keylen) argument 95 snprintf(path, sizeof(path), "/proc/self/fdinfo/%d", pidfd); 123 int pidfd = -1, ret = 1; local 128 pidfd = sys_pidfd_open(-1, 0); 129 if (pidfd >= 0) { 131 "%s - succeeded to open pidfd for invalid pid -1\n", 137 pidfd = sys_pidfd_open(getpid(), 1); 138 if (pidfd >= 0) { 140 "%s - succeeded to open pidfd wit [all...] |
H A D | pidfd_test.c | 22 #include "pidfd.h" 33 static pid_t pidfd_clone(int flags, int *pidfd, int (*fn)(void *)) argument 39 return __clone2(fn, stack, stack_size, flags | SIGCHLD, NULL, pidfd); 41 return clone(fn, stack + stack_size, flags | SIGCHLD, NULL, pidfd); 59 int pidfd, ret; local 69 pidfd = open("/proc/self", O_DIRECTORY | O_CLOEXEC); 70 if (pidfd < 0) 77 ret = sys_pidfd_send_signal(pidfd, SIGUSR1, NULL, 0); 78 close(pidfd); 94 int pidfd, re local 201 int pidfd = -1; local 353 int pidfd, ret; local 395 poll_pidfd(const char *test_name, int pidfd) argument 445 int pid, pidfd = 0; local 511 int pid, pidfd = 0; local [all...] |
H A D | pidfd_poll_test.c | 16 #include "pidfd.h" 44 ksft_print_msg("running pidfd poll test for %d iterations\n", 48 int pidfd; local 68 pidfd = sys_pidfd_open(child_pid, 0); 69 if (pidfd < 0) 80 if (sys_pidfd_send_signal(pidfd, SIGKILL, NULL, 0)) 85 fds.fd = pidfd; 106 close(pidfd); 114 ksft_test_result_pass("pidfd poll test: pass\n");
|
H A D | pidfd.h | 101 static inline int sys_pidfd_send_signal(int pidfd, int sig, siginfo_t *info, argument 104 return syscall(__NR_pidfd_send_signal, pidfd, sig, info, flags); 107 static inline int sys_pidfd_getfd(int pidfd, int fd, int flags) argument 109 return syscall(__NR_pidfd_getfd, pidfd, fd, flags);
|
H A D | pidfd_getfd_test.c | 21 #include "pidfd.h" 126 /* pidfd is the pidfd of the child */ 127 int pidfd; local 157 self->pidfd = sys_pidfd_open(self->pid, 0); 158 ASSERT_GE(self->pidfd, 0); 172 EXPECT_EQ(0, close(self->pidfd)); 198 fd = sys_pidfd_getfd(self->pidfd, self->remote_fd, 0); 210 fd = sys_pidfd_getfd(self->pidfd, self->remote_fd, 0); 229 fd = sys_pidfd_getfd(self->pidfd, UNKNOWN_F [all...] |
H A D | pidfd_fdinfo_test.c | 17 #include "pidfd.h" 164 static int verify_fdinfo(int pidfd, struct error *err, const char *prefix, argument 181 snprintf(path, sizeof(path), "/proc/self/fdinfo/%d", pidfd); 185 pidfd); 211 prefix, pidfd); 219 int pidfd; local 226 /* verify that we can not resolve the pidfd for a process 243 pidfd = *(int *)args; 244 r = verify_fdinfo(pidfd, &err, "NSpid:", 6, "\t0\n"); 256 const char *test_name = "pidfd chec [all...] |
H A D | pidfd_setns_test.c | 20 #include "pidfd.h" 55 int pidfd; local 75 pid_t create_child(int *pidfd, unsigned flags) argument 80 .pidfd = ptr_to_u64(pidfd), 153 self->pidfd = sys_pidfd_open(self->pid, 0); 154 EXPECT_GT(self->pidfd, 0) { 155 TH_LOG("%m - Failed to open pidfd for process %d", self->pid); 168 self->pidfd = sys_pidfd_open(self->pid, 0); 169 EXPECT_GE(self->pidfd, [all...] |
/linux-master/tools/testing/selftests/mm/ |
H A D | mrelease_test.c | 51 static void run_negative_tests(int pidfd) argument 54 if (!syscall(__NR_process_mrelease, pidfd, (unsigned int)-1) || 62 if (!syscall(__NR_process_mrelease, pidfd, 0) || errno != EINVAL) 79 int pipefd[2], pidfd; local 89 /* Test a wrong pidfd */ 95 ksft_exit_fail_msg("process_mrelease with wrong pidfd: %s", 137 pidfd = syscall(__NR_pidfd_open, pid, 0); 138 if (pidfd < 0) { 145 run_negative_tests(pidfd); 150 success = (syscall(__NR_process_mrelease, pidfd, [all...] |
/linux-master/tools/testing/selftests/cgroup/ |
H A D | Makefile | 19 LOCAL_HDRS += $(selfdir)/clone3/clone3_selftests.h $(selfdir)/pidfd/pidfd.h
|
/linux-master/tools/testing/selftests/net/af_unix/ |
H A D | scm_pidfd.c | 93 /* borrowed (with all helpers) from pidfd/pidfd_open_test.c */ 94 static pid_t get_pid_from_fdinfo_file(int pidfd, const char *key, size_t keylen) argument 103 snprintf(path, sizeof(path), "/proc/self/fdinfo/%d", pidfd); 138 int *pidfd = NULL; local 165 if (cmsg->cmsg_len < sizeof(*pidfd)) { 170 pidfd = (void *)CMSG_DATA(cmsg); 190 if (!pidfd) { 200 /* pidfd from SCM_PIDFD should point to the parent process PID */ 202 get_pid_from_fdinfo_file(*pidfd, "Pid:", sizeof("Pid:") - 1);
|
/linux-master/include/net/ |
H A D | scm.h | 129 int len, pidfd; local 147 pidfd = pidfd_prepare(scm->pid, 0, &pidfd_file); 149 if (put_cmsg(msg, SOL_SOCKET, SCM_PIDFD, sizeof(int), &pidfd)) { 151 put_unused_fd(pidfd); 159 fd_install(pidfd, pidfd_file);
|
/linux-master/arch/sparc/kernel/ |
H A D | process.c | 80 args.pidfd = compat_ptr(regs->u_regs[UREG_I2]); 86 args.pidfd = (int __user *)regs->u_regs[UREG_I2];
|
/linux-master/kernel/ |
H A D | pid.c | 47 #include <uapi/linux/pidfd.h> 557 * pidfd_get_task() - Get the task associated with a pidfd 559 * @pidfd: pidfd for which to get the task 560 * @flags: flags associated with this pidfd 562 * Return the task associated with @pidfd. The function takes a reference on 565 * Return: On success, the task_struct associated with the pidfd. 568 struct task_struct *pidfd_get_task(int pidfd, unsigned int *flags) argument 574 pid = pidfd_get_pid(pidfd, &f_flags); 590 * @pid: struct pid that the pidfd wil 605 int pidfd; local [all...] |
H A D | fork.c | 104 #include <uapi/linux/pidfd.h> 1993 * __pidfd_prepare - allocate a new pidfd_file and reserve a pidfd 1994 * @pid: the struct pid for which to create a pidfd 1995 * @flags: flags of the new @pidfd 1996 * @ret: Where to return the file for the pidfd. 1998 * Allocate a new file that stashes @pid and reserve a new pidfd number in the 1999 * caller's file descriptor table. The pidfd is reserved but not installed yet. 2002 * created via CLONE_PIDFD where @pid has no task attached when the pidfd and 2003 * pidfd file are prepared. 2006 * call fd_install() passing the returned pidfd an 2022 int pidfd; local 2140 int pidfd = -1, retval; local [all...] |
/linux-master/include/uapi/linux/ |
H A D | sched.h | 15 #define CLONE_PIDFD 0x00001000 /* set if a pidfd should be placed in parent */ 52 * @pidfd: If CLONE_PIDFD is set, a pidfd will be 94 __aligned_u64 pidfd; member in struct:clone_args
|
H A D | fanotify.h | 57 #define FAN_REPORT_PIDFD 0x00000080 /* Report pidfd for event->pid */ 178 * It holds a pidfd for the pid that was responsible for generating an event. 182 __s32 pidfd; member in struct:fanotify_event_info_pidfd
|
/linux-master/tools/include/uapi/linux/ |
H A D | sched.h | 15 #define CLONE_PIDFD 0x00001000 /* set if a pidfd should be placed in parent */ 52 * @pidfd: If CLONE_PIDFD is set, a pidfd will be 94 __aligned_u64 pidfd; member in struct:clone_args
|
/linux-master/tools/testing/selftests/clone3/ |
H A D | clone3_selftests.h | 24 __aligned_u64 pidfd; member in struct:__clone_args
|
/linux-master/samples/ |
H A D | Makefile | 18 subdir-$(CONFIG_SAMPLE_PIDFD) += pidfd
|
/linux-master/fs/notify/fanotify/ |
H A D | fanotify_user.c | 512 static int copy_pidfd_info_to_user(int pidfd, argument 524 info.pidfd = pidfd; 534 unsigned int info_mode, int pidfd, 635 ret = copy_pidfd_info_to_user(pidfd, buf, count); 666 int ret, pidfd = FAN_NOPIDFD, fd = FAN_NOFD; local 702 * exclusion is ever lifted. At the time of incoporating pidfd 703 * support within fanotify, the pidfd API only supported the 713 * in those cases, with all other pidfd creation errors being 718 pidfd 532 copy_info_records_to_user(struct fanotify_event *event, struct fanotify_info *info, unsigned int info_mode, int pidfd, char __user *buf, size_t count) argument [all...] |
/linux-master/include/linux/sched/ |
H A D | task.h | 25 int __user *pidfd; member in struct:kernel_clone_args
|