Operating System - HP-UX
1748235 Members
3311 Online
108759 Solutions
New Discussion юеВ

/proc/pid/stat file in HP-UX

 
SOLVED
Go to solution
murugesan_2
Advisor

/proc/pid/stat file in HP-UX

Hello all,

In Linux we have /proc/pid/stat file for a process information..
Similarly where can I find the file in HP-UX ?

Thanks in advance,
Murugesan
7 REPLIES 7
Dave Olker
HPE Pro

Re: /proc/pid/stat file in HP-UX

I don't know of a similar file in HP-UX. Some of the information maintained in the /proc/pid/stat file is returned by the ps command, other information you can get from top or glance.

Is there some specific piece of information that are you trying to find out about a running process?

Regards,

Dave
I work for HPE

[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]
Accept or Kudo
Muthukumar_5
Honored Contributor
Solution

Re: /proc/pid/stat file in HP-UX

There is not a such file system for storing the process informations.

If you want to get the process informations then use ps -efl and pstat_getproc() call ( programming is needed )

http://h21007.www2.hp.com/cmdspp/QuestionAnswer/1,1764,CC81A71B-B5C4-4101-91CF-F1F635999BD1,00.html

- muthu
Easy to suggest when don't know about the problem!
Con O'Kelly
Honored Contributor

Re: /proc/pid/stat file in HP-UX

HP-UX does not have the concept of /proc directory unlike Linux or even Solaris.

To get information on a process you need to use variations of the ├в ps├в command or othe tools (eg glance)
One useful ├в ps├в command which gives you CPU usage and Memory usage for a process is as follows:
# UNIX95= ps -eo "pid ruser stime state vsz pcpu args"
Con O'Kelly
Honored Contributor

Re: /proc/pid/stat file in HP-UX

HP-UX does not have the concept of /proc/pid file unlike Linux or even Solaris.

To get information on a process you need to use variations of the 'ps' command or other tools (eg glance).

One useful 'ps' command which gives you CPU usage and Memory usage for a process is as follows:
# UNIX95= ps -eo "pid ruser stime state vsz pcpu args"

Cheers
Con
murugesan_2
Advisor

Re: /proc/pid/stat file in HP-UX

Thanks for the replies...
I need to write a C program to get the parent process ids of a particular process given the child process id...
This I can do it with /proc/pid/stat in Linux...

How can I achieve it in HP-UX.
Mike Stroyan
Honored Contributor

Re: /proc/pid/stat file in HP-UX

Call pstat_getproc and look at the pst_ppid field of the returned struct.

#include
#include
#include
#include
int main(int argc, char *argv[])
{
struct pst_status pst;
int i, pid;
for (i=1; i pid = atoi(argv[i]);
if (pstat_getproc(&pst, sizeof(pst), 0, pid) > 0) {
printf("pid %d, ppid %d\n", pid, pst.pst_ppid);
} else {
printf("pid %d doesn't exist\n", pid);
}
}
return 0;
}

Bill Hassell
Honored Contributor

Re: /proc/pid/stat file in HP-UX

The ps command has a *lot* of features and one is the -H option to show the entire process hierarchy. Another is the -C option to show exact process name matches (no grep needed) and then famous -o option for a do-it-yourself listing. I put this alias in my .profile to make it easier to turn on these features:

alias ps="UNIX95= ps"

Now type ps -f or ps -f -u myuser and you can view the process hiearchy.


Bill Hassell, sysadmin