SunOS 5.8 -- getting process info using it's pid in C/C++

  • Follow


Hi,

I am looking for a bit of help with Solaris with porting one of the
app. That app among other things needs to find few things about parent
and grandparent process:
- command line used to start it (I am not sure if it is possible for
process to change that -- it is another question... But if possible I
definitely need original cmd line). I tried to use /usr/bin/ps, but it
truncates cmd line to 80 symbols
- process's cwd (which could be taken from /proc/pid/cwd, I assume)
- path to the binary that was used to start that process (i.e.
equivalent of /proc/pid/exe link available in Linux)

How can I get this info? Is it possible to link some lib or I am
doomed using system/pipe calls to invoke some utility and then parsing
it's output?

Thank you!.

Sincerely yours,
Michael.
0
Reply crusader.mike (6) 10/22/2009 12:24:47 AM

On Oct 21, 8:24=A0pm, Michael Kilburn <crusader.m...@gmail.com> wrote:
> Hi,
>
> I am looking for a bit of help with Solaris with porting one of the
> app. That app among other things needs to find few things about parent
> and grandparent process:
> - command line used to start it (I am not sure if it is possible for
> process to change that -- it is another question... But if possible I
> definitely need original cmd line). I tried to use /usr/bin/ps, but it
> truncates cmd line to 80 symbols
> - process's cwd (which could be taken from /proc/pid/cwd, I assume)
> - path to the binary that was used to start that process (i.e.
> equivalent of /proc/pid/exe link available in Linux)
>
> How can I get this info? Is it possible to link some lib or I am
> doomed using system/pipe calls to invoke some utility and then parsing
> it's output?
>
> Thank you!.
>
> Sincerely yours,
> Michael.

The command "pargs" works great.  However, that command first showed
up in Solaris 9 so that might not be an option for you.  You might
want to try "/usr/ucb/ps -auxwwww".  For me, "pargs -l" on Solaris 9
or greater works great.

Juan
0
Reply webjuan 10/22/2009 2:14:51 AM


1 Replies
266 Views

(page loaded in 0.048 seconds)

Similiar Articles:













7/23/2012 4:46:35 PM


Reply: