The only complete list of running processes is provided by 2 above, asking the kernel. Getting the actual name of the process is not straight forward. In a nutshell, you look up the pid in any other source you can find until you get a match.
For some processes, the following will work:
ProcessSerialNumber psn;
CFStringRef name = NULL;
status = GetProcessForPID( inPID , &psn );
if ( noErr == status ) CopyProcessName( &psn , &name );
For some processes, you can look up the pid in the results of [[NSWorkspace sharedWorkspace] launchedApplications]
by NSApplicationProcessIdentifier
. Available with 10.2 and later. Most, but maybe not all, items in this list will be the same as CopyProcessName above.
For some processes, you can look up the process arguments and get the full path from the first argument. Similar to getting the original list, but using KERN_PROCARGS or KERN_PROCARGS2 as the second mib value. This is what ps
is doing.
For some processes, you are stuck with the 16 character p_comm.