Project Home
Project Home
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
BroadcastCommunity.qnx.com will be offline from May 31 6:00pm until June 2 12:00AM for upcoming system upgrades. For more information please go to https://community.qnx.com/sf/discussion/do/listPosts/projects.bazaar/discussion.bazaar.topc28418
Forum Topic - Get absolute fulll path of running process: Page 1 of 8 (8 Items)
   
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 ?