- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Problem with pstat_getproc
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
Forums
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
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
тАО06-28-2005 06:20 PM
тАО06-28-2005 06:20 PM
pstat_getproc failed: Value too large to be stored in data type
Source Code:
#define BURST ((size_t)10)
struct pst_status pst[BURST];
int i, count;
int idx = 0; /* index within the context */
while ((count=pstat_getproc(pst, sizeof(pst[0]),BURST,idx))>0) {
for (i = 0; i < count; i++) {
(void)printf("pid is %d, command is %s\n",pst[i].pst_pid, pst[i].pst_ucomm);
}
idx = pst[count-1].pst_idx + 1;
}
if (count == -1)
perror("pstat_getproc()");
#undef BURST
Solved! Go to Solution.
- Tags:
- pstat
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-28-2005 07:17 PM
тАО06-28-2005 07:17 PM
Re: Problem with pstat_getproc
Notes
A wide (64 bit) version of the pstat interfaces are available for
narrow (32 bit) applications to use. A narrow application could use
the flag -D_PSTAT64 at compile time to switch to the wide interfaces.
Using this compiler flag in a narrow application is equivalent to
using the default interfaces on a wide system.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-28-2005 07:20 PM
тАО06-28-2005 07:20 PM
Re: Problem with pstat_getproc
#include
#define BURST ((size_t)10)
main(){
struct pst_status pst[BURST];
int i, count;
int idx = 0; /* index within the context */
while ((count=pstat_getproc(pst, sizeof(pst[0]),BURST,idx))>0) {
for (i = 0; i < count; i++) {
(void)printf("pid is %d, command is %s\n",pst[i].pst_pid, pst[i].pst_ucomm);
}
idx = pst[count-1].pst_idx + 1;
}
if (count == -1)
perror("pstat_getproc()");
}
#undef BURST
I see no problem on my system. What is your system? do you have the error on compile or on exec?
How many process do you have?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-28-2005 07:49 PM
тАО06-28-2005 07:49 PM
Re: Problem with pstat_getproc
I'm working on an Itanium HPUX 11 v 2
I get the error when i execute the program.
This is the complete o/p:
I added some lines to o/p the pst size and no of processes.
bash-3.00# ./sysinf
Size of pst 776
pstat_getproc failed: Value too large to be stored in data type
*** 24 processes, 0 threads running
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-28-2005 08:20 PM
тАО06-28-2005 08:20 PM
Re: Problem with pstat_getproc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-28-2005 09:28 PM
тАО06-28-2005 09:28 PM
Solution$ cc -V
cc: HP aC++/ANSI C B3910B A.06.02 [Mar 24 2005]
$ cc -D_PSTAT64 pstat.c
$ ./a.out
pid is 0, command is swapper
pid is 1, command is init
pid is 8, command is ioconfigd
pid is 9, command is nfsktcpd
pid is 10, command is autofskd
pid is 11, command is lvmkd
pid is 12, command is lvmkd
pid is 13, command is lvmkd
pid is 14, command is lvmkd
pid is 15, command is lvmkd
pid is 16, command is lvmkd
...
If this still doesn't work for you try compiling 64-bit binary with +DD64 option to cc.
- Tags:
- +DD64
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-28-2005 09:47 PM
тАО06-28-2005 09:47 PM
Re: Problem with pstat_getproc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-28-2005 09:48 PM
тАО06-28-2005 09:48 PM
Re: Problem with pstat_getproc
This error "pstat_getproc failed: Value too large to be stored in data type" oocours when a 32 bit application running on a 64 bit booted machine...
Check If the machine is booted in 64-bit mode, getconf KERNEL_BITS
and it should return "64".
32-bit applications that will be deployed on 64-bit HP-UX must use the
pstat() wrappers turned on with -D_PSTAT64 in order to function correctly
and remain compatible on 64-bit HP-UX
Good Luck
Vinod K
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-19-2006 07:12 AM
тАО01-19-2006 07:12 AM
Re: Problem with pstat_getproc
After reading this thread, I tried the two solutions. The -D_PSTAT64 flag didn't work for me; all the process info for all the processes would report the same number. Like the pid would be the same for all the processes.
But the +DD64 flag made it work perfectly. Thanks for your help.