Tools/pidof: Fixes FEXpidof after #5097
FEX argument will no longer exist in /proc/<pid>/cmdline after this PR. Ensure this tool still works.
After #5097 is merged, one can use regular pidof for Linux applications, but this is still useful as it finds Wine applications running with FEX as well.
Added support for FEXpidof FEX special case so that kill -9 $(FEXPidof FEX) still gives us equivalent behaviour as kill -9 $(pidof FEX).
but this is still useful as it finds Wine applications running with FEX as well.
I'm not sure this is necessary anymore, Wine similarly re-writes its argv[0] data so that /proc/pid/cmdline begins with the target .exe.
but this is still useful as it finds Wine applications running with FEX as well.
I'm not sure this is necessary anymore, Wine similarly re-writes its argv[0] data so that
/proc/pid/cmdlinebegins with the target .exe.
hm. I was going to say that it still did a bit more than pidof, but actually because we rename cmdline away, we actually can't reliably detect wine anymore. It does still provide use for FEXpidof FEX but it'll miss Wine things.
ryanh@orion-o6:/mnt/Work/Work/work/FEXNew/Build_Radxa$ FEXpidof SonicMania.exe
ryanh@orion-o6:/mnt/Work/Work/work/FEXNew/Build_Radxa$ pidof SonicMania.exe
12373
I don't think there would be a good way to actually resolve this now.
I'll need to rethink how to determine if a process is FEX or not since it's tricky at this point.
/proc/pid/exe should always point to the original exe, maybe you can use that. readlink /proc/pid/exe outputs the original path.
Mostly just need to ensure it works in the three main modalities of FEX which will take a bit of time.
- FEX - Running a linux app
- FEX - Running x86 Wine and extracting the .exe out of it
- Arm64ec/wow64 - Running inside of arm64 Wine and extracting the .exe file out of it.