- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Getting detailed process info in C program
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
Forums
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
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
03-25-2019 09:33 AM
03-25-2019 09:33 AM
Getting detailed process info in C program
Hello,
First post here, so if I'm in the wrong location, please redirect me to the correct one.
Our system is an older PA-RISC 9000/800 rp4440 running 64 bit HP-UX 11.31.
I am trying to locate the system calls that provide access to the detailed process information that 'ps' displays. I have found the getpid() and getppid() calls, but those only provide PID and parent PID. I'm wanting to see additional information such as the userid associated with the PID and/or PPID, as well as the extended command line that a process, or its parent, or its grandparent is executing.
I understand that some (all?) of these calls might require elevated privileges. That is not a problem, the C program that I'm writing will be able to do setresuid() to root if necessary prior to executing the calls to get this information.
I know the correct system calls must be out there somewhere, probably in section 2 or maybe section 3 of the man pages, but I haven't spotted them yet. Any help would be appreciated.
Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2019 09:46 AM
03-25-2019 09:46 AM
Re: Getting detailed process info in C program
I think the pstat(2) man page will help.
You can also use the "tusc" command to trace the system calls of a process.
E.g. "tusc -o /tmp/ps_tusc.txt ps"
This will run "ps" and trace the system-calls into /tmp/ps_tusc.txt".
Hope that helps.
I work at HPE
HPE Support Center offers support for your HPE services and products when and how you need it. Get started with HPE Support Center today.
[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2019 10:27 AM
03-25-2019 10:27 AM
Re: Getting detailed process info in C program
Thank you. I will look into the pstat() family of calls.
And thank you also for the tusc command. I was familiar with strace on Linux and was surprised that I couldn't find an equivalent in HP-UX. I tried to run 'man tusc' and got a 'No manual entry for tusc.' Can you tell me what section of man it would normally be in? Or where I might find it on the system?
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2019 10:38 AM
03-25-2019 10:38 AM
Re: Getting detailed process info in C program
I think the tusc-tool was never part of the official OS. Not sure.
You can download it from :
http://hpux.connect.org.uk/hppd/hpux/Sysadmin/tusc-8.1/
I work at HPE
HPE Support Center offers support for your HPE services and products when and how you need it. Get started with HPE Support Center today.
[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2019 03:29 PM
03-25-2019 03:29 PM
Re: Getting detailed process info in C program
I'll have to look into the tusc utility.
But the pstat_*() system calls is exactly what I was looking for. Thanks for the help.