atish bhowmick(deleted)
|
Get absolute fulll path of running process
|
atish bhowmick(deleted)
04/28/2014 6:43 AM
post110057
|
Get absolute fulll path of running process
I am trying to extract the absolute full path of executing processes from the proc file system by reading the file the
/proc/pid/as using devctl.
struct dinfo_s {
procfs_debuginfo info;
char pathbuffer[PATH_MAX];
};
struct dinfo_s dinfo;
sprintf( buffer, "/proc/%d/as", pid );
if ((fd = open( buffer, O_RDONLY )) != NULL)
{
status = devctl( fd, DCMD_PROC_MAPDEBUG_BASE, &dinfo, sizeof(dinfo), NULL );
printf("path %s \n", dinfo.info.path);
}
But the path info I get is the relative path which is dependent on the launchpoint of the process i.e if an exe is
launched as ./app1 , its full path shows as ./app1 instead of its absolute path .
How do I extract the absolute path of a running process ?
|
|
|