FEX icon indicating copy to clipboard operation
FEX copied to clipboard

Tools/pidof: Fixes FEXpidof after #5097

Open Sonicadvance1 opened this issue 3 weeks ago • 6 comments

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.

Sonicadvance1 avatar Dec 04 '25 04:12 Sonicadvance1

Added support for FEXpidof FEX special case so that kill -9 $(FEXPidof FEX) still gives us equivalent behaviour as kill -9 $(pidof FEX).

Sonicadvance1 avatar Dec 04 '25 22:12 Sonicadvance1

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.

wcampbell-nv avatar Dec 04 '25 23:12 wcampbell-nv

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.

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.

Sonicadvance1 avatar Dec 04 '25 23:12 Sonicadvance1

I'll need to rethink how to determine if a process is FEX or not since it's tricky at this point.

Sonicadvance1 avatar Dec 05 '25 23:12 Sonicadvance1

/proc/pid/exe should always point to the original exe, maybe you can use that. readlink /proc/pid/exe outputs the original path.

wcampbell-nv avatar Dec 05 '25 23:12 wcampbell-nv

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.

Sonicadvance1 avatar Dec 05 '25 23:12 Sonicadvance1