Closed gukejun1 closed 1 year ago
Depending on your distribution, you may need to install the kernel headers (e.g., linux-headers on debian/ubuntu). That's the only explanation I can come up with for the missing header really. What distribution are you using?
Installing kernel-devel
on CentOS 7.9 (kernel 3.10.0-1160.90.1.el7.x86_64) didn't work, but this patch did:
diff -Naur a/src/extract_processinfo_fdinfo.c b/src/extract_processinfo_fdinfo.c
--- a/src/extract_processinfo_fdinfo.c 2022-11-06 07:33:24.000000000 -0800
+++ b/src/extract_processinfo_fdinfo.c 2023-06-13 17:38:40.550066552 -0700
@@ -25,7 +25,6 @@
#include <ctype.h>
#include <dirent.h>
#include <fcntl.h>
-#include <linux/kcmp.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/syscall.h>
@@ -140,10 +139,14 @@
fd_num = atoi(fdinfo_dent->d_name);
+ #ifndef KCMP_FILE
+ #define KCMP_FILE 0
+ #endif
+
// check if this fd refers to the same open file as any seen ones.
// we only care about unique opens
for (unsigned i = 0; i < seen_fds_len; i++) {
- if (syscall(SYS_kcmp, client_pid, client_pid, KCMP_FILE, fd_num, seen_fds[i]) <= 0)
+ if (syscall(SYS_kcmp, client_pid, client_pid, 0, fd_num, seen_fds[i]) <= 0)
goto next_fd;
}
Inspired by this.
Thank you @Lacedaemon, I applied a similar patch in 9a8458b541a195a0c5cadafb66e240962c852b39
@Syllo
The same error is reported,in accordance with this practice #152 . How to solve this problem