Lines Matching refs:pidfd
21 #include "pidfd.h"
86 static pid_t get_pid_from_fdinfo_file(int pidfd, const char *key, size_t keylen)
95 snprintf(path, sizeof(path), "/proc/self/fdinfo/%d", pidfd);
123 int pidfd = -1, ret = 1;
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 with invalid flag value specified\n",
146 pidfd = sys_pidfd_open(getpid(), 0);
147 if (pidfd < 0) {
148 ksft_print_msg("%s - failed to open pidfd\n", strerror(errno));
151 ksft_test_result_pass("open a new pidfd test: passed\n");
153 pid = get_pid_from_fdinfo_file(pidfd, "Pid:", sizeof("Pid:") - 1);
154 ksft_print_msg("pidfd %d refers to process with pid %d\n", pidfd, pid);
159 if (pidfd >= 0)
160 close(pidfd);