Fixed wrong pid bug

The issue was that the thread ID wasn't factored in. A presumption was,
that FUSE already returned the PID, not TID. The issue was fixed by
implementing a function that translates the TID to PID.
This commit is contained in:
2025-05-14 20:37:32 +02:00
parent 33f55384bc
commit e4dbc5becc
5 changed files with 56 additions and 3 deletions

View File

@@ -10,7 +10,11 @@
#define PROCESS_INFO_H
#include "proc_operations.h"
#include <errno.h>
#include <limits.h>
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
struct process_info {
pid_t PID;
char *name;
@@ -18,7 +22,7 @@ struct process_info {
static inline struct process_info get_process_info(pid_t pid) {
struct process_info pi;
pi.PID = pid;
pi.PID = get_main_thread_pid(pid);
pi.name = get_process_name_by_pid(pi.PID);
if (pi.name == NULL) {
pi.PID = 0;