Skip to content

Commit

Permalink
Use __NR_pidfd_open and __NR_pidfd_getfd
Browse files Browse the repository at this point in the history
to avoid use of undeclared identifier 'SYS_pidfd_open'
  • Loading branch information
igchor committed Jul 29, 2024
1 parent eaa69f4 commit 2b9fa13
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions source/common/ur_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@ int ur_duplicate_fd(int pid, int fd_in) {
// pidfd_open(2) is supported since Linux 5.3
#if defined(__NR_pidfd_open) && defined(__NR_pidfd_getfd)
errno = 0;
int pid_fd = syscall(SYS_pidfd_open, pid, 0);
int pid_fd = syscall(__NR_pidfd_open, pid, 0);
if (pid_fd == -1) {
logger::error("SYS_pidfd_open");
logger::error("__NR_pidfd_open");
return -1;
}

int fd_dup = syscall(SYS_pidfd_getfd, pid_fd, fd_in, 0);
int fd_dup = syscall(__NR_pidfd_getfd, pid_fd, fd_in, 0);
close(pid_fd);
if (fd_dup == -1) {
logger::error("SYS_pidfd_getfd");
logger::error("__NR_pidfd_getfd");
return -1;
}

Expand Down

0 comments on commit 2b9fa13

Please sign in to comment.