![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| script to monitor process running on server and posting a mail if any process is dead | pradeepmacha | Shell Programming and Scripting | 12 | 10-17-2008 12:08 AM |
| Can a child process return a specific value to a parent process ? | Ametis1970 | High Level Programming | 8 | 04-09-2008 08:22 PM |
| Killing of a process and send a mail if the process doesnot come up within 2 minutes | Prince89 | Shell Programming and Scripting | 1 | 02-15-2008 04:10 PM |
| how to start a process and make it sleep for 5 mins and then kill that process | shrao | Shell Programming and Scripting | 6 | 03-27-2007 09:54 AM |
| my process is going to sleep mode after 12 hours but i need my process in in firsy pr | mukesh_rakesh1 | UNIX for Advanced & Expert Users | 0 | 09-04-2006 11:43 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
||||
|
||||
|
get process name from pid - getcommandline
All,
I have a requirement to get the process name of the newly execv'd process. After getting the complete process name, I need to carry out further operations on that. Problem so far is how do I retrieve the name of the process ? There is an API in windows called GetCommandLine. I need something similiar to that in Linux. I tried this forum and a whole lot of other google results. Nothing helped. The best I have come up is Linux maintains a struct for each process, and a struct member supoosedly hold the process name. But I cant figure out which/what struct that is. Any pointers will be appreciated. Thanks, Vino |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
There is not any general way to do this unix. Each OS has different ways to handle it and some are very hard. You mention Linux though. With Linux, the info is in the /proc filesystem. To get the command line for process id 9999, read the file "/proc/9999/cmdline".
|
|
#3
|
||||
|
||||
|
Perfect. This is what I was looking for !!
Thanks Perderabo ! Vino |
||||
| Google The UNIX and Linux Forums |