- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- PID of a process
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2011 06:17 AM - edited 11-29-2011 06:30 AM
11-29-2011 06:17 AM - edited 11-29-2011 06:30 AM
How do I get the PID of a particular process using lib$getjpi using HP C ?
I'm able to get it for the current process but not for any other.
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2011 06:31 AM
11-29-2011 06:31 AM
Re: PID of a process
Guess: You need GROUP or WORLD privilege to poke around with information from other processes on the OpenVMS system.
Common related design errors: using process names to identify a target process is not a reliable means of differentiating processes; process names are (usually) unique within a UIC group, but are not unique across UIC groups.
Otherwise... Additional details, please? What process(es)? Some example source code? What programming language? What is the error code returned from the failed call? (It's also commonplace to include a reference to the OpenVMS version and platform associaed with questions, but this particular run-time library call is a very old call, and the PID stuff is little changed in probably the last twenty years or so.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2011 06:52 AM
11-29-2011 06:52 AM
Re: PID of a process
Nothing fancy but just trying to understand the library function ...just trying to get the process ID using lib$getjpi which i'm not getting through.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2011 07:09 AM
11-29-2011 07:09 AM
Re: PID of a process
cheers
Brian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2011 07:41 AM
11-29-2011 07:41 AM
Re: PID of a process
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2011 07:45 AM
11-29-2011 07:45 AM
SolutionYou're not performing a status check on the return. OpenVMS error conditions will often point you at the specific problem. The usual return status checls are for specific condition values and then more generally for odd or even values; successful condition returns are odd.
You'll really want to grok the return status values here, as well as the condition value structure definition, and you'll want to understand and specify and check the IOSB values where the IOSB argument is available on an OpenVMS system service or other OpenVMS-related call. These and other details are in the Programming Concepts manual.
I'd tend to use sys$getjpi and sys$getjpiw system service calls here, given that C supports pointers, and given that these system service calls are also far more flexible than lib$getjpi. The lib$ analogs of the OpenVMS system service calls are largely tailored for languages that don't support pointers. Either path does work, of course.
To get the PID of the SMHANDLER process, you'll need to have WORLD privilege, unless your process is in the same UIC group, then you'd need GROUP, unless you're in the same UIC, when you can get the PID without privilege. And process names aren't distinct across UIC groups - each group can have a SMHANDLER process - and thus the process name identifier is group-specific.
If you need to find a process with a particular process name system-wide, then you'll want to use a loop through all processes, and then match the process name and the UIC (and potentially other criteria) against your target process. (Or you can use the sys$process_scan call with either the sys$getjpi or the sys$getjpiw call looping, to narrow selection of processes that will be returned to you based on more specific target criteria.)
Here is example wildcard-loop code from the OpenVMS Programming Concepts manual.
Is there any particular reason you've chosen to look at the SMHANDER process here, or was that just a handy target for testing?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2011 08:32 AM
11-29-2011 08:32 AM
Re: PID of a process
Thanks All,
Hoff, SMHANDLER was chosen for no particular reason.... just a handy stuff.