/external/linux-kselftest/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 | 102 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()
|
D | pidfd_fdinfo_test.c | 163 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()
|
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 …]
|
/external/ltp/testcases/kernel/syscalls/fanotify/ |
D | fanotify21.c | 65 static struct pidfd_fdinfo_t *read_pidfd_fdinfo(int pidfd) in read_pidfd_fdinfo() argument 72 SAFE_ASPRINTF(&fdinfo_path, "/proc/self/fdinfo/%d", pidfd); in read_pidfd_fdinfo() 113 int pidfd; in do_setup() local 128 pidfd = SAFE_PIDFD_OPEN(getpid(), 0); in do_setup() 130 self_pidfd_fdinfo = read_pidfd_fdinfo(pidfd); in do_setup() 134 pidfd); in do_setup() 195 if (info->pidfd < 0 && !tc->want_pidfd_err) { in do_test() 200 info->pidfd); in do_test() 203 info->pidfd != tc->want_pidfd_err) { in do_test() 206 info->pidfd, in do_test() [all …]
|
/external/ltp/testcases/kernel/syscalls/pidfd_getfd/ |
D | pidfd_getfd02.c | 28 static int valid_pidfd = -1, invalid_pidfd = -1, pidfd = -1; variable 33 int *pidfd; member 62 if (pidfd > -1) in cleanup() 63 SAFE_CLOSE(pidfd); in cleanup() 90 pidfd = SAFE_PIDFD_OPEN(pid, 0); in run() 93 TST_EXP_FAIL2(pidfd_getfd(pidfd, tc->targetfd, tc->flags), in run() 95 pidfd, tc->targetfd, tc->flags, tc->name); in run() 96 SAFE_CLOSE(pidfd); in run() 98 TST_EXP_FAIL2(pidfd_getfd(*tc->pidfd, tc->targetfd, tc->flags), in run() 100 *tc->pidfd, tc->targetfd, tc->flags, tc->name); in run()
|
D | pidfd_getfd01.c | 30 static int pidfd = -1; variable 57 pidfd = SAFE_PIDFD_OPEN(pid, 0); in run() 59 TST_EXP_FD_SILENT(pidfd_getfd(pidfd, targetfd, 0), in run() 60 "pidfd_getfd(%d, %d , 0)", pidfd, targetfd); in run() 69 tst_res(TPASS, "pidfd_getfd(%d, %d, 0) passed", pidfd, targetfd); in run() 73 SAFE_CLOSE(pidfd); in run() 90 if (pidfd > -1) in cleanup() 91 SAFE_CLOSE(pidfd); in cleanup()
|
/external/ltp/testcases/kernel/syscalls/pidfd_open/ |
D | pidfd_open04.c | 24 static int pidfd = -1; variable 40 pidfd = TST_RET; in run() 41 flag = SAFE_FCNTL(pidfd, F_GETFL); in run() 48 TST_EXP_FAIL(waitid(P_PIDFD, pidfd, &info, WEXITED), EAGAIN, in run() 53 ret = TST_RETRY_FUNC(waitid(P_PIDFD, pidfd, &info, WEXITED), TST_RETVAL_EQ0); in run() 61 SAFE_CLOSE(pidfd); in run() 82 if (pidfd > -1) in cleanup() 83 SAFE_CLOSE(pidfd); in cleanup()
|
D | pidfd_open01.c | 19 static int pidfd = -1; variable 27 pidfd = TST_RET; in run() 28 flag = SAFE_FCNTL(pidfd, F_GETFD); in run() 30 SAFE_CLOSE(pidfd); in run() 40 if (pidfd > -1) in cleanup() 41 SAFE_CLOSE(pidfd); in cleanup()
|
/external/ltp/testcases/kernel/syscalls/pidfd_send_signal/ |
D | pidfd_send_signal03.c | 34 static int pidfd, new_pidfd; variable 61 pidfd = SAFE_OPEN(pid_filename, O_DIRECTORY | O_CLOEXEC); in verify_pidfd_send_signal() 62 old_inode = get_inode_number(pidfd); in verify_pidfd_send_signal() 90 SAFE_CLOSE(pidfd); in verify_pidfd_send_signal() 103 TEST(pidfd_send_signal(pidfd, SIGUSR1, NULL, 0)); in verify_pidfd_send_signal() 115 SAFE_CLOSE(pidfd); in verify_pidfd_send_signal() 134 if (pidfd > 0) in cleanup() 135 SAFE_CLOSE(pidfd); in cleanup()
|
D | pidfd_send_signal02.c | 34 static int pidfd; variable 45 {&pidfd, &info, CORRECT_SIGNAL, 99999, EINVAL}, 47 {&pidfd, &info, DIFFERENT_SIGNAL, 0, EINVAL}, 73 pidfd = SAFE_OPEN("/proc/self", O_DIRECTORY | O_CLOEXEC); in setup() 95 if (pidfd > 0) in cleanup() 96 SAFE_CLOSE(pidfd); in cleanup()
|
D | pidfd_send_signal01.c | 28 static int pidfd; variable 59 TEST(pidfd_send_signal(pidfd, SIGNAL, uinfo, 0)); in verify_pidfd_send_signal() 78 pidfd = SAFE_OPEN("/proc/self", O_DIRECTORY | O_CLOEXEC); in setup() 100 if (pidfd > 0) in cleanup() 101 SAFE_CLOSE(pidfd); in cleanup()
|
/external/selinux/restorecond/ |
D | restorecond.c | 91 int pidfd, len; in write_pid_file() local 100 pidfd = open(pidfile, O_CREAT | O_TRUNC | O_NOFOLLOW | O_WRONLY, 0644); in write_pid_file() 101 if (pidfd < 0) { in write_pid_file() 106 if (write(pidfd, val, (unsigned int)len) != len) { in write_pid_file() 108 close(pidfd); in write_pid_file() 111 close(pidfd); in write_pid_file()
|
/external/ltp/include/lapi/ |
D | pidfd.h | 28 static inline int pidfd_send_signal(int pidfd, int sig, siginfo_t *info, in pidfd_send_signal() argument 31 return tst_syscall(__NR_pidfd_send_signal, pidfd, sig, info, flags); in pidfd_send_signal() 55 static inline int pidfd_getfd(int pidfd, int targetfd, unsigned int flags) in pidfd_getfd() argument 57 return tst_syscall(__NR_pidfd_getfd, pidfd, targetfd, flags); in pidfd_getfd()
|
/external/ltp/testcases/kernel/syscalls/clone3/ |
D | clone302.c | 28 int **pidfd; member 75 if (tc->pidfd) in run() 76 args->pidfd = (uint64_t)(*tc->pidfd); in run() 78 args->pidfd = 0; in run()
|
D | clone301.c | 24 static int pidfd, child_tid, parent_tid, parent_received_signal; variable 117 args->pidfd = (uint64_t)(&pidfd); in run() 141 TEST(pidfd_send_signal(pidfd, CHILD_SIGNAL, &uinfo, 0)); in run()
|
/external/linux-kselftest/tools/testing/selftests/pid_namespace/ |
D | Makefile | 8 $(OUTPUT)/regression_enomem: regression_enomem.c ../pidfd/pidfd.h
|
/external/linux-kselftest/tools/testing/selftests/cgroup/ |
D | Makefile | 14 LOCAL_HDRS += $(selfdir)/clone3/clone3_selftests.h $(selfdir)/pidfd/pidfd.h
|
/external/strace/tests/ |
D | qual_fault.c | 163 int pidfd = open_file(pid_prefix, proc); in main() local 168 assert(write(pidfd, pidstr, len) == len); in main() 170 close(pidfd); in main()
|
/external/strace/tests-mx32/ |
D | qual_fault.c | 163 int pidfd = open_file(pid_prefix, proc); in main() local 168 assert(write(pidfd, pidstr, len) == len); in main() 170 close(pidfd); in main()
|
/external/strace/tests-m32/ |
D | qual_fault.c | 163 int pidfd = open_file(pid_prefix, proc); in main() local 168 assert(write(pidfd, pidstr, len) == len); in main() 170 close(pidfd); in main()
|