|
Re: Get absolute fulll path of running process
|
04/28/2014 8:59 AM
post110059
|
Re: Get absolute fulll path of running process
Is this on 6.5?
The fullpath of the executable is stored on the auxv array on the
stack. Basically if you start with the initial_stack value from the
process info,
then you can scan through...
argc
argv0
...
argvn
NULL
envp1
...
envpn
NULL
auxv
Then look for auxv[AT_EXEFILE]
On 2014-04-28 6:43 AM, atish bhowmick wrote:
> 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 ?
>
>
>
>
>
> _______________________________________________
>
> Technology
> http://community.qnx.com/sf/go/post110057
> To cancel your subscription to this discussion, please e-mail technology-networking-unsubscribe@community.qnx.com
|
|
|