get program name give a process id


 
Thread Tools Search this Thread
Operating Systems HP-UX get program name give a process id
# 1  
Old 09-01-2006
get program name give a process id

Hi ,

I have query regarding to get a program name given a pid in HP-Ux .


give procees id ( PID) i would like to retrieve the process/program through a C program ?

my input to c program will be will be pid and i would like to know what is process name /program name .


Many Thanks
Naren
# 2  
Old 09-01-2006
In other words, you want to implement a combo of ps and grep... not easy. Use the pstat(2) family of syscalls. Check the man page of pstat(2) for details.
A better way would be to use system and run the "ps |grep" combo.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Tweak python program to give result in json

Hi , Below is the script which prints result in json but when i validate it has some tab or extra space issues. JSON result { "data": } This is the line I tweaked. Please advise. print "\t{", "\"{#NAME}\":\""+container+hn+"\"}" #!/usr/bin/env python # (2 Replies)
Discussion started by: ashokvpp
2 Replies

2. Shell Programming and Scripting

Nohup not give expected output. Non-stop running process

Hello, I am trying to make a bash script, I tested nohup but it did not help me. My code is: ffmpeg -i $input_url -c:v copy -c:a copy -listen 1 -f mpegts http://localhost:port/live/test When I open it in VLC, it starts feeding my screen and I see bitrate values. When I stop watching it,... (4 Replies)
Discussion started by: baris35
4 Replies

3. Shell Programming and Scripting

How to give a text file as input while running a program?

Hi Friends, I am running a program /path/to/program -i 1 100 -o /path/to/output/op_1_100.txt In the above command, I have to try various number of combinations at the -i parameter and the output file name varies with each combination. Now, I have my -i parameter text file, which is like... (4 Replies)
Discussion started by: jacobs.smith
4 Replies

4. Shell Programming and Scripting

How can I get parent process program name?

Hi: I have 2 script on AIX server. The child script is called by parent script. For example: The parent script full name is /home/op/def/parent.spt, which calls /home/op/abc/child.spt I want to get the parent program name with full path name (i.e. /home/op/def/parent.spt), in... (3 Replies)
Discussion started by: cstsang
3 Replies

5. Shell Programming and Scripting

How to give runtime arguments to different program

I have a shell script that is attempting to call a c program. I call the c program with ./dictool dictool accepts arguments at runtime. It works by prompting the user for various commands, acting on those commands, spitting out an output, and then prompting for more commands. My question is,... (1 Reply)
Discussion started by: aarongoldfein
1 Replies

6. UNIX for Dummies Questions & Answers

defunct process occuring in a particular program

All, I am getting a wired scenario, Not all times but some times i am getting the defunct process for a program. If i rerun the same program it is working fine.This defunct scenario is not occuring often. And this is happening only for the one program in my system that to sometimes Can you... (1 Reply)
Discussion started by: arunkumar_mca
1 Replies

7. Programming

Please give me some advise to program for unix/linux using c/c++?

I have a good foundation of c++.I want to learn to program for linux/unix,can you give me some advises,for example classic books ,which operating system is used better(freebsd,solaris,federal linux.etc),and which aspects uses mostly in job.Can you give me clear direction for working or learning. (1 Reply)
Discussion started by: fengshuiyue
1 Replies

8. UNIX for Advanced & Expert Users

can some one give me some link about process and job control commands

can some one give me some link about process and job control commands (2 Replies)
Discussion started by: alokjyotibal
2 Replies

9. Programming

Getting process info in a program

Hi, I am wondering if there is a way to find out in a C software program if a particular process is running without having to write a file. In the past, I have been using the system command to execute a pgrep and output the info to a file. Then the C program reads the file to make the... (1 Reply)
Discussion started by: herbmiller
1 Replies

10. HP-UX

IO by Process/program

HI there, I'm trying to find a way of showing the IO's performed by individual programs. Number of reads/writes IO time that kind of thing. Anybody know of any way to show this information. Free little downloads that kind of thing? Cheers Phil (2 Replies)
Discussion started by: cpiuk
2 Replies
Login or Register to Ask a Question