Skip to content

Commit 48014aa

Browse files
committed
refine the pidfd
Signed-off-by: Chen, Sheng S <sheng.s.chen@intel.com>
1 parent 5eff28e commit 48014aa

1 file changed

Lines changed: 6 additions & 12 deletions

File tree

clang/runtime/dpct-rt/include/dpct/ze_utils.hpp

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,19 @@ namespace dpct {
1919
namespace experimental {
2020

2121
namespace detail {
22-
/// System call number definitions for kernel compatibility.
23-
/// SYS_pidfd_open: Process file descriptor opener (requires kernel 5.6+).
24-
/// SYS_pidfd_getfd: Cross-process FD fetcher system call.
25-
#ifndef SYS_pidfd_open
26-
#define SYS_pidfd_open 434
27-
#endif
28-
29-
#ifndef SYS_pidfd_getfd
30-
#define SYS_pidfd_getfd 438
31-
#endif
3222

3323
/// Covert remote fd to the local fd through IPC handle extension.
3424
/// \param [in] ipc_ext_handle The extension of the IPC handle
3525
/// \returns Local process file descriptor
3626
template <class T> int convert_fd_from_handle(T ipc_ext_handle) {
37-
int pidfd = syscall(SYS_pidfd_open, ipc_ext_handle.pid, 0);
27+
int pidfd = syscall(434, ipc_ext_handle.pid,
28+
0); // obtain a file descriptor that refers to a
29+
// process(requires kernel 5.6+).
3830
if (pidfd < 0)
3931
return -1;
40-
return syscall(SYS_pidfd_getfd, pidfd, *(int *)ipc_ext_handle.handle.data, 0);
32+
return syscall(438, pidfd, *(int *)ipc_ext_handle.handle.data,
33+
0); // obtain a duplicate of another process's file
34+
// descriptor(requires kernel 5.6+).
4135
}
4236

4337
} // namespace detail

0 commit comments

Comments
 (0)