Operating System - HP-UX
1753394 Members
7214 Online
108792 Solutions
New Discussion юеВ

Re: Using pstat_getpathname

 
rakeshcs123
Advisor

Using pstat_getpathname

Hi All,
Can anybody tell me how to use pstat_getpathname function to get the pathname of the running process.
man page of pstat_getpathname states that we can use pstat_getproc method to get the fid which in turn will be used in pstat_getpathname method
int pstat_getpathname(
char *buf,
size_t elemcount,
struct pst_fid *fid
);

but i could not find a way to use pstat_getproc to get the fid, although i am able to do so using call to pstat_getfile2 method, but here i need to open file and get the file id of that to pass to pstat_getfile2 function and not directly using the pid of the process.

can any one provide me an example of using pstat_getpathname using pstat_getproc method.

Thanks for your help in advance.
8 REPLIES 8
Don Morris_1
Honored Contributor

Re: Using pstat_getpathname

You want the pst_text field of the pst_status structure returned by pstat_getproc() -- that's the "File ID of the process' executable", after all.
Dennis Handly
Acclaimed Contributor

Re: Using pstat_getpathname

>Don: You want the pst_text field

This is a psfileid, 16 bytes (or 32). pst_fid is a 64 byte struct.
Is there a special way to convert them?
Don Morris_1
Honored Contributor

Re: Using pstat_getpathname

Argh, good catch. pst_fid_text then. That's there all the way back to 11.11LR, so it isn't a recent field thing.
Dennis Handly
Acclaimed Contributor

Re: Using pstat_getpathname

>Don: good catch.

Not really, the compiler and the kernel told me it wasn't working. :-)
rakeshcs123
Advisor

Re: Using pstat_getpathname

I solved my problem with some different technique
Peter Nikitka
Honored Contributor

Re: Using pstat_getpathname

What a pity, that you won't tell us this technique...

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
Dennis Handly
Acclaimed Contributor

Re: Using pstat_getpathname

>Peter: What a pity, that you won't tell us this technique.

There are two solutions in rakeshcs123's other thread.
Dennis Handly
Acclaimed Contributor

Re: Using pstat_getpathname