Languages and Scripting

Find the variables that store pid value

 
Sanjay Yugal Kishore Ha
Frequent Advisor

Find the variables that store pid value

Hi,

I have to find the list of variables that store pid value(s) from our legacy products' source code.
The easy part is-
1. Gather all variables that are of type pid_t.
2. Gather all variables that are named as *pid*.

Now the difficult part-
Those variables that are neither of the above types but store values returned syscalls/libraries like getpid(2), getppid(2), fork(2) and so on.
So the question would be-
Where is the best place or rather one-stop-shop to get the list of all hpux syscalls/libraries that either use pid as an input parameter or the return value is a pid value?

Thanks in advance,
Sanjay
Dying is the last thing that I will do.
3 REPLIES 3
Jeff_Traigle
Honored Contributor

Re: Find the variables that store pid value

You can go to http://docs.hp.com/ and search for PID. You'll want to use the "more options" link to narrow the search to the release you're interested in. For 11.00, I got 300+ hits... without narrowing the search to a release, you get 1100+ hits.
--
Jeff Traigle
Simon Hargrave
Honored Contributor

Re: Find the variables that store pid value

One crude way: -

In the man2.Z directory(s): -

for FILE in `ls`
do
cat $FILE | zcat | nroff | grep -i pid
done

This should unzip and format each man(2) page, and grep for the term "pid". Should give some idea?
Muthukumar_5
Honored Contributor

Re: Find the variables that store pid value

All system calls are defined on header files.

We can check the header files which contains the pattern "pid_t" as

find / -name "*.h" -exec grep -w pid_t {} \;

grep -w --> fixed pattern of pid_t

We can use nm to get into the library contents as,

nm /usr/lib/* | grep pid_t

Regards
Muthu
Easy to suggest when don't know about the problem!