It is possible to check if an app bundle's binary process is running in 32 or 64 bit mode, as answered in this question, but I can verify that it only works with GUI processes.
However, I need to also check processes that don't have a GUI and is not part of a bundle.
So, programmatically, without calling system functions or other executables, how can I test if any process is running in 32 or 64 bit mode, given the process pid?