I am trying to find process type (32 bit/ 64bit) from process pid?
I get the process information and process list from using GetBSDProcessList method described here.
Okay so I did a lot of research and figured out a better solution. Although the sysctl approach works, the documentation states it should be avoided. The method below uses libproc.h's proc_pidinfo function and works similarly to sysctl. This is obviously for Apple's platforms.
bool Is64Bit (int pid)
{
proc_bsdshortinfo info;
if (proc_pidinfo (pid, PROC_PIDT_SHORTBSDINFO,
0, &info, PROC_PIDT_SHORTBSDINFO_SIZE))
return info.pbsi_flags & PROC_FLAG_LP64;
return false;
}