Skip to content

Commit

Permalink
Processing (Haiku): support exe path detection
Browse files Browse the repository at this point in the history
  • Loading branch information
CarterLi committed Feb 13, 2025
1 parent 464e00d commit c585e09
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/common/processing_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <sys/sysctl.h>
#elif defined(__HAIKU__)
#include <OS.h>
#include <image.h>
#endif

enum { FF_PIPE_BUFSIZ = 8192 };
Expand Down Expand Up @@ -312,6 +313,21 @@ void ffProcessGetInfoLinux(pid_t pid, FFstrbuf* processName, FFstrbuf* exe, cons
}
kvm_close(kd);

#elif defined(__HAIKU__)

if (exePath)
{
image_info info;
int32 cookie = 0;

while (get_next_image_info(pid, &cookie, &info) == B_OK)
{
if (info.type != B_APP_IMAGE) continue;
ffStrbufSetS(exePath, info.name);
break;
}
}

#endif

if(exe->length == 0)
Expand Down Expand Up @@ -488,6 +504,8 @@ const char* ffProcessGetBasicInfoLinux(pid_t pid, FFstrbuf* name, pid_t* ppid, i
*ppid = info.parent;
}

FF_UNUSED(tty);

#else

return "Unsupported platform";
Expand Down

0 comments on commit c585e09

Please sign in to comment.