Unix Programming - how to get process status

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > January 2004 > how to get process status





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author how to get process status
Jaguk Ku

2004-01-23, 5:07 pm

Hi there,

I need to get process status, such as process memory usage, cpu usage in
unix programming

Machine : sun E450, solaris 8
Compiler : gcc

Thanks in advance

Jaguk Ku


David Schwartz

2004-01-23, 5:07 pm


"Jaguk Ku" <jkku@kynax.com> wrote in message
news:br130q$45v$1@news1.kornet.net...
quote:

> Hi there,
>
> I need to get process status, such as process memory usage, cpu usage in
> unix programming
>
> Machine : sun E450, solaris 8
> Compiler : gcc
>
> Thanks in advance
>
> Jaguk Ku



The 'ps' program is what you want.

DS


Jaguk Ku

2004-01-23, 5:07 pm


"David Schwartz" <davids@webmaster.com> wrote in message
news:br1eni$6hg$1@nntp.webmaster.com...
quote:

>
> "Jaguk Ku" <jkku@kynax.com> wrote in message
> news:br130q$45v$1@news1.kornet.net...
>
> The 'ps' program is what you want.
>
> DS
>
>



thanks for your reply
i need a function for my application rather than shell command


David Schwartz

2004-01-23, 5:07 pm


"Jaguk Ku" <jkku@kynax.com> wrote in message
news:br1dj7$cv2$1@news1.kornet.net...
quote:

[QUOTE][color=darkred]
> thanks for your reply
> i need a function for my application rather than shell command



Then use 'popen' to launch the 'ps' program. Otherwise, get the source
code to 'ps' and modify/borrow it.

DS


Terry Sanders

2004-01-23, 5:07 pm

"David Schwartz" <davids@webmaster.com> wrote in message
news:br1hc2$841$1@nntp.webmaster.com...
quote:

>
> "Jaguk Ku" <jkku@kynax.com> wrote in message
> news:br1dj7$cv2$1@news1.kornet.net...
>
>
>
> Then use 'popen' to launch the 'ps' program. Otherwise, get the source
> code to 'ps' and modify/borrow it.
>



Have a look in /usr/include/sys/proc.h or get the source for
utilities such as top or yamm and see how they do it.



Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com